mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: dynamic requirements
This commit is contained in:
parent
4ee0d93abf
commit
7d1283492b
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
matplotlib==3.0.2
|
@ -691,7 +691,7 @@ class runbot_build(models.Model):
|
|||||||
|
|
||||||
def _get_available_modules(self, commit):
|
def _get_available_modules(self, commit):
|
||||||
for manifest_file_name in commit.repo.manifest_files.split(','): # '__manifest__.py' '__openerp__.py'
|
for manifest_file_name in commit.repo.manifest_files.split(','): # '__manifest__.py' '__openerp__.py'
|
||||||
for addons_path in commit.repo.addons_paths.split(','): # '' 'addons' 'odoo/addons'
|
for addons_path in (commit.repo.addons_paths or '').split(','): # '' 'addons' 'odoo/addons'
|
||||||
sep = os.path.join(addons_path, '*')
|
sep = os.path.join(addons_path, '*')
|
||||||
for manifest_path in glob.glob(commit._source_path(sep, manifest_file_name)):
|
for manifest_path in glob.glob(commit._source_path(sep, manifest_file_name)):
|
||||||
module = os.path.basename(os.path.dirname(manifest_path))
|
module = os.path.basename(os.path.dirname(manifest_path))
|
||||||
@ -866,7 +866,7 @@ class runbot_build(models.Model):
|
|||||||
def _get_addons_path(self, commits=None):
|
def _get_addons_path(self, commits=None):
|
||||||
for commit in (commits or self._get_all_commit()):
|
for commit in (commits or self._get_all_commit()):
|
||||||
source_path = self._docker_source_folder(commit)
|
source_path = self._docker_source_folder(commit)
|
||||||
for addons_path in commit.repo.addons_paths.split(','):
|
for addons_path in (commit.repo.addons_paths or '').split(','):
|
||||||
if os.path.isdir(commit._source_path(addons_path)):
|
if os.path.isdir(commit._source_path(addons_path)):
|
||||||
yield os.path.join(source_path, addons_path).strip(os.sep)
|
yield os.path.join(source_path, addons_path).strip(os.sep)
|
||||||
|
|
||||||
@ -887,11 +887,16 @@ class runbot_build(models.Model):
|
|||||||
build = self
|
build = self
|
||||||
python_params = python_params or []
|
python_params = python_params or []
|
||||||
py_version = py_version if py_version is not None else build._get_py_version()
|
py_version = py_version if py_version is not None else build._get_py_version()
|
||||||
|
pres = []
|
||||||
|
for commit in self._get_all_commit():
|
||||||
|
if os.path.isfile(commit._source_path('requirements.txt')):
|
||||||
|
repo_dir = self._docker_source_folder(commit)
|
||||||
|
requirement_path = os.path.join(repo_dir, 'requirements.txt')
|
||||||
|
pres.append(['sudo', 'pip%s' % py_version, 'install', '-r', '%s' % requirement_path])
|
||||||
|
|
||||||
|
addons_paths = self._get_addons_path()
|
||||||
(server_commit, server_file) = self._get_server_info()
|
(server_commit, server_file) = self._get_server_info()
|
||||||
server_dir = self._docker_source_folder(server_commit)
|
server_dir = self._docker_source_folder(server_commit)
|
||||||
addons_paths = self._get_addons_path()
|
|
||||||
requirement_path = os.path.join(server_dir, 'requirements.txt')
|
|
||||||
pres = [['sudo', 'pip%s' % py_version, 'install', '-r', '%s' % requirement_path]]
|
|
||||||
|
|
||||||
# commandline
|
# commandline
|
||||||
cmd = ['python%s' % py_version] + python_params + [os.path.join(server_dir, server_file), '--addons-path', ",".join(addons_paths)]
|
cmd = ['python%s' % py_version] + python_params + [os.path.join(server_dir, server_file), '--addons-path', ",".join(addons_paths)]
|
||||||
|
@ -144,7 +144,13 @@ class Test_Build(common.TransactionCase):
|
|||||||
""" test that the server path and addons path """
|
""" test that the server path and addons path """
|
||||||
|
|
||||||
def is_file(file):
|
def is_file(file):
|
||||||
self.assertIn('sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/server.py', file)
|
self.assertIn(file, [
|
||||||
|
'/tmp/runbot_test/static/sources/bar-ent/d0d0caca0000ffffffffffffffffffffffffffff/requirements.txt',
|
||||||
|
'/tmp/runbot_test/static/sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/requirements.txt',
|
||||||
|
'/tmp/runbot_test/static/sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/server.py'
|
||||||
|
])
|
||||||
|
if file == '/tmp/runbot_test/static/sources/bar-ent/d0d0caca0000ffffffffffffffffffffffffffff/requirements.txt':
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_dir(file):
|
def is_dir(file):
|
||||||
@ -196,7 +202,12 @@ class Test_Build(common.TransactionCase):
|
|||||||
""" test that the server path and addons path """
|
""" test that the server path and addons path """
|
||||||
|
|
||||||
def is_file(file):
|
def is_file(file):
|
||||||
self.assertIn('sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/server.py', file)
|
self.assertIn(file, [
|
||||||
|
'/tmp/runbot_test/static/sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/requirements.txt',
|
||||||
|
'/tmp/runbot_test/static/sources/bar/d0d0caca0000ffffffffffffffffffffffffffff/requirements.txt',
|
||||||
|
'/tmp/runbot_test/static/sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/server.py'])
|
||||||
|
if file == '/tmp/runbot_test/static/sources/bar/dfdfcfcf0000ffffffffffffffffffffffffffff/requirements.txt':
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
mock_is_file.side_effect = is_file
|
mock_is_file.side_effect = is_file
|
||||||
|
Loading…
Reference in New Issue
Block a user