From 4d8ed16c244bc89cd96d244eecf6064ff6e39375 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 8 Jul 2013 21:45:39 +0100 Subject: [PATCH] Use dev-requirements.txt in openstack/requirements We wish to be able to use pre-release versions of some libraries during the development cycle. The principle is that we don't want to expose users of the stable release of those libraries to the churn that happens during a development cycle. More background on this is described here: https://wiki.openstack.org/wiki/Oslo The requirements.txt files in this repository are used for two purposes. Firstly to describe what libraries projects are allowed to use and, secondly, what libraries to populate our PyPI mirror with. In the case of these development versions of libraries, they aren't released to PyPI so we don't want them to be appear in our PyPI mirror. So, we need to add a file which is only used for the first purpose and ignored by the mirror-building job. We allow dev-requirements.txt to list newer versions of libraries which are already listed in requirements.txt so that we still get the stable version in our mirror. Change-Id: I176d40404adac6f7dcb2a255b9c42eb3d2c9321e Reviewed-on: https://review.openstack.org/36128 Reviewed-by: Doug Hellmann Reviewed-by: James E. Blair Reviewed-by: Julien Danjou Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- .../project-requirements-change.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/files/slave_scripts/project-requirements-change.py b/files/slave_scripts/project-requirements-change.py index 45c2f59..473bff3 100755 --- a/files/slave_scripts/project-requirements-change.py +++ b/files/slave_scripts/project-requirements-change.py @@ -37,7 +37,9 @@ class RequirementsList(object): self.reqs = {} self.failed = False - def read_requirements(self, fn): + def read_requirements(self, fn, ignore_dups=False): + if not os.path.exists(fn): + return for line in open(fn): line = line[:line.find('#')] line = line.strip() @@ -47,21 +49,22 @@ class RequirementsList(object): line.startswith('-f')): continue req = pkg_resources.Requirement.parse(line) - if req.project_name.lower() in self.reqs: + if not ignore_dups and req.project_name.lower() in self.reqs: print("Duplicate requirement in %s: %s" % (self.name, str(req))) self.failed = True self.reqs[req.project_name.lower()] = req - def read_all_requirements(self): + def read_all_requirements(self, include_dev=False): for fn in ['tools/pip-requires', 'tools/test-requires', 'requirements.txt', 'test-requirements.txt', ]: - if os.path.exists(fn): - self.read_requirements(fn) - + self.read_requirements(fn) + if include_dev: + self.read_requirements('dev-requirements.txt', + ignore_dups=True) def main(): branch = sys.argv[1] @@ -85,7 +88,7 @@ def main(): print "requirements git sha: %s" % run_command( "git rev-parse HEAD").strip() os_reqs = RequirementsList('openstack/requirements') - os_reqs.read_all_requirements() + os_reqs.read_all_requirements(include_dev=(branch=='master')) failed = False for req in head_reqs.reqs.values():