mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +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):
|
||||
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, '*')
|
||||
for manifest_path in glob.glob(commit._source_path(sep, manifest_file_name)):
|
||||
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):
|
||||
for commit in (commits or self._get_all_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)):
|
||||
yield os.path.join(source_path, addons_path).strip(os.sep)
|
||||
|
||||
@ -887,11 +887,16 @@ class runbot_build(models.Model):
|
||||
build = self
|
||||
python_params = python_params or []
|
||||
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_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
|
||||
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 """
|
||||
|
||||
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
|
||||
|
||||
def is_dir(file):
|
||||
@ -196,7 +202,12 @@ class Test_Build(common.TransactionCase):
|
||||
""" test that the server path and addons path """
|
||||
|
||||
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
|
||||
|
||||
mock_is_file.side_effect = is_file
|
||||
|
Loading…
Reference in New Issue
Block a user