Support stable requirements

project-requirements-change.py master runs against stable branches
with the stable version of requirements. requirements provides the
Requirement class that's used by project-requirements-change.py. The
stable version of the Requirement class doesn't have the `extras`
attribute, which was added in commit 33636c1d.

The workaround is to check if the Requirements object has extras and
only use extras if present.

Change-Id: I90839386dff7f28e6fa8ca7c4c56b547eaa7a541
This commit is contained in:
Brant Knudson 2016-02-08 13:47:54 -06:00
parent 6c7a038292
commit c01b96e6da

View File

@ -228,7 +228,7 @@ def main():
if reqs == global_reqs[name]:
continue
for req in reqs:
if req.extras:
if hasattr(req, 'extras') and req.extras:
for extra in req.extras:
counts[extra] = counts.get(extra, 0) + 1
else: