Deal with underscores in blacklist during generate-constraints
In change id I60adf0dca4aa32f4ef6bca61250b375c8a3703c6, we added flake8_docstrings to the black list. However as seen in I8bfff1b2e65541959e7f2ae0fa6ca6c17889eb54, the generate-constraints job ends up proposing adding "flake8-docstrings===0.2.1.post1" to the upper-constraints.txt. This is because of the '-' vs '_' difference. So just like in Ibaa22657a2cf2c0ad96dbd0b9bc43cdafe6a1d56, we need to convert the items in black list to the correct safe name before trying to check if the item is in the black list. Change-Id: Ieb1cd44e908b80d58a20bf0d0e1e6b10f17ae95e
This commit is contained in:
parent
5b7ab7e69d
commit
47fdbc1391
@ -18,6 +18,8 @@ import sys
|
||||
|
||||
import fixtures
|
||||
|
||||
from openstack_requirements import requirement
|
||||
|
||||
|
||||
def _parse_freeze(text):
|
||||
"""Parse a freeze into structured data.
|
||||
@ -100,7 +102,8 @@ def _combine_freezes(freezes, blacklist=None):
|
||||
:return: A list of '\n' terminated lines for a requirements file.
|
||||
"""
|
||||
packages = {} # {package : {version : [py_version]}}
|
||||
excludes = frozenset((s.lower() for s in blacklist) if blacklist else ())
|
||||
excludes = frozenset((requirement.canonical_name(s)
|
||||
for s in blacklist) if blacklist else ())
|
||||
reference_versions = []
|
||||
for py_version, freeze in freezes:
|
||||
if py_version in reference_versions:
|
||||
|
@ -89,3 +89,12 @@ class TestCombine(testtools.TestCase):
|
||||
["enum===1.5.0;python_version=='3.4'\n"],
|
||||
list(generate._combine_freezes(
|
||||
[freeze_27, freeze_34], blacklist=blacklist)))
|
||||
|
||||
def test_blacklist_with_safe_name(self):
|
||||
blacklist = ['flake8_docstrings']
|
||||
freeze_27 = ('2.7', [('flake8-docstrings', '0.2.1.post1'),
|
||||
('enum', '1.5.0')])
|
||||
self.assertEqual(
|
||||
['enum===1.5.0\n'],
|
||||
list(generate._combine_freezes(
|
||||
[freeze_27], blacklist=blacklist)))
|
||||
|
Loading…
Reference in New Issue
Block a user