Fix project requirements check to work with "extras"

Process "extras" defined in a project setup.cfg properly by looping over
the dictionary's member items and not the dictionary itself.

Do not compare comments associated with requirements, since those are
always collected as a set of unnamed requirements and many of the
comments from global-requirements.txt are not needed in the local
project file (especially when the dependencies for which the comments
are relevant are not used).

Change-Id: I78838dcd4da43b3c1d2610ac87a3ec55b9535646
This commit is contained in:
Doug Hellmann 2015-07-10 18:16:48 +00:00
parent 460a1c7dbd
commit c469a09998

View File

@ -80,7 +80,7 @@ class RequirementsList(object):
% {'name': self.name, 'fname': fname})
reqs[name].update(r for (r, line) in entries)
for name, content in project.extras(self.project):
for name, content in project.extras(self.project).items():
print("Processing .[%(extra)s]" % {'extra': name})
parsed = requirement.parse(content)
for name, entries in parsed.items():
@ -196,6 +196,12 @@ def main():
# equivalents we want enforced
failed = False
for name, reqs in head_reqs.reqs.items():
if not name:
# Comments show up as unnamed requirements. There's no
# point in copying comments related to packages that
# aren't in the destination, so ignore the comments
# entirely.
continue
if name in branch_reqs.reqs and reqs == branch_reqs.reqs[name]:
# Unchanged [or a change that preserves a current value]
continue