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 <doug.hellmann@dreamhost.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Julien Danjou <julien@danjou.info>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Mark McLoughlin 2013-07-08 21:45:39 +01:00 committed by Jenkins
parent 3d55fe4303
commit 4d8ed16c24

View File

@ -37,7 +37,9 @@ class RequirementsList(object):
self.reqs = {} self.reqs = {}
self.failed = False 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): for line in open(fn):
line = line[:line.find('#')] line = line[:line.find('#')]
line = line.strip() line = line.strip()
@ -47,21 +49,22 @@ class RequirementsList(object):
line.startswith('-f')): line.startswith('-f')):
continue continue
req = pkg_resources.Requirement.parse(line) 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" % print("Duplicate requirement in %s: %s" %
(self.name, str(req))) (self.name, str(req)))
self.failed = True self.failed = True
self.reqs[req.project_name.lower()] = req 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', for fn in ['tools/pip-requires',
'tools/test-requires', 'tools/test-requires',
'requirements.txt', 'requirements.txt',
'test-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(): def main():
branch = sys.argv[1] branch = sys.argv[1]
@ -85,7 +88,7 @@ def main():
print "requirements git sha: %s" % run_command( print "requirements git sha: %s" % run_command(
"git rev-parse HEAD").strip() "git rev-parse HEAD").strip()
os_reqs = RequirementsList('openstack/requirements') os_reqs = RequirementsList('openstack/requirements')
os_reqs.read_all_requirements() os_reqs.read_all_requirements(include_dev=(branch=='master'))
failed = False failed = False
for req in head_reqs.reqs.values(): for req in head_reqs.reqs.values():