Improve terminology in the requirements tree
There is no real reason we should be using some of the terms we do, they're outdated, and we're behind other open-source projects in this respect. Let's switch to using more inclusive terms in all possible places. Change-Id: I90ac679c1745a31474c6f24ec7953624ad056d79
This commit is contained in:
parent
091035a031
commit
ea345875cd
@ -20,7 +20,7 @@ pycodestyle
|
|||||||
pylint
|
pylint
|
||||||
yamllint
|
yamllint
|
||||||
|
|
||||||
# The following Neutron libraries need to be blacklisted
|
# The following Neutron libraries need to be denylisted
|
||||||
# as they do not use cycle-with-intermediary. The only time they
|
# as they do not use cycle-with-intermediary. The only time they
|
||||||
# would be updated is at release time.
|
# would be updated is at release time.
|
||||||
networking-bagpipe
|
networking-bagpipe
|
@ -242,7 +242,7 @@ keyring # MIT/PSF
|
|||||||
ldappool # MPL
|
ldappool # MPL
|
||||||
# Do not make mock conditional on Python version: we depend on newer code than
|
# Do not make mock conditional on Python version: we depend on newer code than
|
||||||
# in [most] releases of the Python std library.
|
# in [most] releases of the Python std library.
|
||||||
# https://github.com/testing-cabal/mock/issues/487 for 4.0.[0-1] blacklist
|
# https://github.com/testing-cabal/mock/issues/487 for 4.0.[0-1] denylist
|
||||||
mock!=4.0.0,!=4.0.1 # BSD
|
mock!=4.0.0,!=4.0.1 # BSD
|
||||||
moto # Apache-2.0
|
moto # Apache-2.0
|
||||||
mypy # MIT
|
mypy # MIT
|
||||||
@ -486,16 +486,16 @@ storpool.spopenstack # Apache-2.0
|
|||||||
|
|
||||||
## section:internal
|
## section:internal
|
||||||
##
|
##
|
||||||
## Tooling-related caps and blacklists.
|
## Tooling-related caps and denylists.
|
||||||
|
|
||||||
pip # MIT
|
pip # MIT
|
||||||
# While setuptools cannot deal with pre-installed incompatible versions,
|
# While setuptools cannot deal with pre-installed incompatible versions,
|
||||||
# setting a lower bound is not harmful - it makes error messages cleaner. DO
|
# setting a lower bound is not harmful - it makes error messages cleaner. DO
|
||||||
# NOT set an upper bound on setuptools, as that will lead to uninstallable
|
# NOT set an upper bound on setuptools, as that will lead to uninstallable
|
||||||
# situations as progressive releases of projects are done.
|
# situations as progressive releases of projects are done.
|
||||||
# Blacklist setuptools 34.0.0-34.3.2 due to https://github.com/pypa/setuptools/issues/951
|
# Denylist setuptools 34.0.0-34.3.2 due to https://github.com/pypa/setuptools/issues/951
|
||||||
# Blacklist setuptools 36.2.0 due to https://github.com/pypa/setuptools/issues/1086
|
# Denylist setuptools 36.2.0 due to https://github.com/pypa/setuptools/issues/1086
|
||||||
# Blacklist setuptools 48.0.0, 49.0.0 due to https://github.com/pypa/setuptools/issues/2232
|
# Denylist setuptools 48.0.0, 49.0.0 due to https://github.com/pypa/setuptools/issues/2232
|
||||||
setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,!=48.0.0,!=49.0.0 # PSF/ZPL
|
setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,!=48.0.0,!=49.0.0 # PSF/ZPL
|
||||||
wheel # MIT
|
wheel # MIT
|
||||||
|
|
||||||
|
@ -215,15 +215,15 @@ def _get_python3_reqs(reqs):
|
|||||||
def _validate_one(
|
def _validate_one(
|
||||||
name,
|
name,
|
||||||
reqs,
|
reqs,
|
||||||
blacklist,
|
denylist,
|
||||||
global_reqs,
|
global_reqs,
|
||||||
backports,
|
backports,
|
||||||
allow_3_only=False,
|
allow_3_only=False,
|
||||||
):
|
):
|
||||||
"""Returns True if there is a failure."""
|
"""Returns True if there is a failure."""
|
||||||
|
|
||||||
if name in blacklist:
|
if name in denylist:
|
||||||
# Blacklisted items are not synced and are managed
|
# Denylisted items are not synced and are managed
|
||||||
# by project teams as they see fit, so no further
|
# by project teams as they see fit, so no further
|
||||||
# testing is needed.
|
# testing is needed.
|
||||||
return False
|
return False
|
||||||
@ -279,7 +279,7 @@ def _validate_one(
|
|||||||
|
|
||||||
def validate(
|
def validate(
|
||||||
head_reqs,
|
head_reqs,
|
||||||
blacklist,
|
denylist,
|
||||||
global_reqs,
|
global_reqs,
|
||||||
backports,
|
backports,
|
||||||
allow_3_only=False,
|
allow_3_only=False,
|
||||||
@ -294,7 +294,7 @@ def validate(
|
|||||||
_validate_one(
|
_validate_one(
|
||||||
name,
|
name,
|
||||||
reqs,
|
reqs,
|
||||||
blacklist,
|
denylist,
|
||||||
global_reqs,
|
global_reqs,
|
||||||
backports,
|
backports,
|
||||||
allow_3_only,
|
allow_3_only,
|
||||||
@ -344,7 +344,7 @@ def _find_constraint(req, constraints):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def validate_lower_constraints(req_list, constraints, blacklist):
|
def validate_lower_constraints(req_list, constraints, denylist):
|
||||||
"""Return True if there is an error.
|
"""Return True if there is an error.
|
||||||
|
|
||||||
:param reqs: RequirementsList for the head of the branch
|
:param reqs: RequirementsList for the head of the branch
|
||||||
@ -369,7 +369,7 @@ def validate_lower_constraints(req_list, constraints, blacklist):
|
|||||||
|
|
||||||
for name, reqs in freqs.items():
|
for name, reqs in freqs.items():
|
||||||
|
|
||||||
if name in blacklist:
|
if name in denylist:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if name not in parsed_constraints:
|
if name not in parsed_constraints:
|
||||||
|
@ -52,12 +52,12 @@ def main():
|
|||||||
except pkg_resources.ContextualVersionConflict as e:
|
except pkg_resources.ContextualVersionConflict as e:
|
||||||
if e.dist.key in xfails:
|
if e.dist.key in xfails:
|
||||||
xfail_requirement = xfails[e.dist.key][0][0]
|
xfail_requirement = xfails[e.dist.key][0][0]
|
||||||
xfail_blacklists = set(xfail_requirement.markers.split(','))
|
xfail_denylists = set(xfail_requirement.markers.split(','))
|
||||||
conflict = e.dist.as_requirement()
|
conflict = e.dist.as_requirement()
|
||||||
conflict_specifiers = ''.join(conflict.specs[0])
|
conflict_specifiers = ''.join(conflict.specs[0])
|
||||||
conflict_name = conflict.name.lower()
|
conflict_name = conflict.name.lower()
|
||||||
|
|
||||||
if (e.required_by.issubset(xfail_blacklists) and
|
if (e.required_by.issubset(xfail_denylists) and
|
||||||
xfail_requirement.package == conflict_name and
|
xfail_requirement.package == conflict_name and
|
||||||
conflict_specifiers == xfail_requirement.specifiers):
|
conflict_specifiers == xfail_requirement.specifiers):
|
||||||
|
|
||||||
|
@ -40,9 +40,9 @@ def main(args=None):
|
|||||||
default='global-requirements.txt',
|
default='global-requirements.txt',
|
||||||
help='Path to the global-requirements.txt file')
|
help='Path to the global-requirements.txt file')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-b', '--blacklist',
|
'-b', '-d', '--denylist',
|
||||||
default='blacklist.txt',
|
default='denylist.txt',
|
||||||
help='Path to the blacklist.txt file')
|
help='Path to the denylist.txt file')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-G', '--gr-check', action='store_true',
|
'-G', '--gr-check', action='store_true',
|
||||||
help='Do a specifier check of global-requirements')
|
help='Do a specifier check of global-requirements')
|
||||||
@ -50,7 +50,7 @@ def main(args=None):
|
|||||||
|
|
||||||
upper_constraints = read_requirements_file(args.upper_constraints)
|
upper_constraints = read_requirements_file(args.upper_constraints)
|
||||||
global_requirements = read_requirements_file(args.global_requirements)
|
global_requirements = read_requirements_file(args.global_requirements)
|
||||||
blacklist = read_requirements_file(args.blacklist)
|
denylist = read_requirements_file(args.denylist)
|
||||||
project_data = project.read(args.project)
|
project_data = project.read(args.project)
|
||||||
error_count = 0
|
error_count = 0
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ def main(args=None):
|
|||||||
% require_file)
|
% require_file)
|
||||||
requirements = requirement.parse(data)
|
requirements = requirement.parse(data)
|
||||||
for name, spec_list in requirements.items():
|
for name, spec_list in requirements.items():
|
||||||
if not name or name in blacklist:
|
if not name or name in denylist:
|
||||||
continue
|
continue
|
||||||
if name not in global_requirements:
|
if name not in global_requirements:
|
||||||
print(u'%s from %s not found in global-requirements' % (
|
print(u'%s from %s not found in global-requirements' % (
|
||||||
|
@ -108,7 +108,7 @@ def _freeze(requirements, python):
|
|||||||
fh.write(b'\n'.join(output))
|
fh.write(b'\n'.join(output))
|
||||||
|
|
||||||
|
|
||||||
def _combine_freezes(freezes, blacklist=None):
|
def _combine_freezes(freezes, denylist=None):
|
||||||
"""Combine multiple freezes into a single structure.
|
"""Combine multiple freezes into a single structure.
|
||||||
|
|
||||||
This deals with the variation between different python versions by
|
This deals with the variation between different python versions by
|
||||||
@ -116,13 +116,13 @@ def _combine_freezes(freezes, blacklist=None):
|
|||||||
versions of a dependency.
|
versions of a dependency.
|
||||||
|
|
||||||
:param freezes: A list of (python_version, frozen_requirements) tuples.
|
:param freezes: A list of (python_version, frozen_requirements) tuples.
|
||||||
:param blacklist: An iterable of package names to exclude. These packages
|
:param denylist: An iterable of package names to exclude. These packages
|
||||||
won't be included in the output.
|
won't be included in the output.
|
||||||
:return: A list of '\n' terminated lines for a requirements file.
|
:return: A list of '\n' terminated lines for a requirements file.
|
||||||
"""
|
"""
|
||||||
packages = {} # {package : {version : [py_version]}}
|
packages = {} # {package : {version : [py_version]}}
|
||||||
excludes = frozenset((requirement.canonical_name(s)
|
excludes = frozenset((requirement.canonical_name(s)
|
||||||
for s in blacklist) if blacklist else ())
|
for s in denylist) if denylist else ())
|
||||||
reference_versions = []
|
reference_versions = []
|
||||||
for py_version, freeze in freezes:
|
for py_version, freeze in freezes:
|
||||||
if py_version in reference_versions:
|
if py_version in reference_versions:
|
||||||
@ -180,10 +180,10 @@ def _validate_options(options):
|
|||||||
raise Exception(
|
raise Exception(
|
||||||
"Requirements file %(req)s not found."
|
"Requirements file %(req)s not found."
|
||||||
% dict(req=options.requirements))
|
% dict(req=options.requirements))
|
||||||
if options.blacklist and not os.path.exists(options.blacklist):
|
if options.denylist and not os.path.exists(options.denylist):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Blacklist file %(path)s not found."
|
"Denylist file %(path)s not found."
|
||||||
% dict(path=options.blacklist))
|
% dict(path=options.denylist))
|
||||||
version_map = {}
|
version_map = {}
|
||||||
for map_entry in options.version_map:
|
for map_entry in options.version_map:
|
||||||
if ':' not in map_entry:
|
if ':' not in map_entry:
|
||||||
@ -196,7 +196,7 @@ def _validate_options(options):
|
|||||||
options.version_map = version_map
|
options.version_map = version_map
|
||||||
|
|
||||||
|
|
||||||
def _parse_blacklist(path):
|
def _parse_denylist(path):
|
||||||
"""Return the strings from path if it is not None."""
|
"""Return the strings from path if it is not None."""
|
||||||
if path is None:
|
if path is None:
|
||||||
return []
|
return []
|
||||||
@ -226,7 +226,7 @@ def main(argv=None, stdout=None):
|
|||||||
parser.add_option(
|
parser.add_option(
|
||||||
"-r", dest="requirements", help="Requirements file to process.")
|
"-r", dest="requirements", help="Requirements file to process.")
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"-b", dest="blacklist",
|
"-b", "-d", dest="denylist",
|
||||||
help="Filename of a list of package names to exclude.")
|
help="Filename of a list of package names to exclude.")
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"--version-map", dest='version_map', default=[], action='append',
|
"--version-map", dest='version_map', default=[], action='append',
|
||||||
@ -242,8 +242,8 @@ def main(argv=None, stdout=None):
|
|||||||
freezes = [
|
freezes = [
|
||||||
_freeze(options.requirements, python) for python in options.pythons]
|
_freeze(options.requirements, python) for python in options.pythons]
|
||||||
_clone_versions(freezes, options)
|
_clone_versions(freezes, options)
|
||||||
blacklist = _parse_blacklist(options.blacklist)
|
denylist = _parse_denylist(options.denylist)
|
||||||
frozen = [
|
frozen = [
|
||||||
*sorted(_combine_freezes(freezes, blacklist), key=_make_sort_key)]
|
*sorted(_combine_freezes(freezes, denylist), key=_make_sort_key)]
|
||||||
stdout.writelines(frozen)
|
stdout.writelines(frozen)
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
|
@ -35,9 +35,9 @@ def main():
|
|||||||
help='path to the upper-constraints.txt file',
|
help='path to the upper-constraints.txt file',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'blacklist',
|
'denylist',
|
||||||
default='blacklist.txt',
|
default='denylist.txt',
|
||||||
help='path to the blacklist.txt file',
|
help='path to the denylist.txt file',
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -76,11 +76,11 @@ def main():
|
|||||||
error_count += 1
|
error_count += 1
|
||||||
|
|
||||||
# Check that all of the items in the global-requirements list
|
# Check that all of the items in the global-requirements list
|
||||||
# appear in exactly one of the constraints file or the blacklist.
|
# appear in exactly one of the constraints file or the denylist.
|
||||||
print('\nChecking %s' % args.blacklist)
|
print('\nChecking %s' % args.denylist)
|
||||||
blacklist = read_requirements_file(args.blacklist)
|
denylist = read_requirements_file(args.denylist)
|
||||||
for msg in constraints.check_blacklist_coverage(
|
for msg in constraints.check_denylist_coverage(
|
||||||
global_reqs, constraints_txt, blacklist,
|
global_reqs, constraints_txt, denylist,
|
||||||
os.path.basename(args.upper_constraints)):
|
os.path.basename(args.upper_constraints)):
|
||||||
print(msg)
|
print(msg)
|
||||||
error_count += 1
|
error_count += 1
|
||||||
|
@ -14,7 +14,7 @@ from packaging import specifiers
|
|||||||
|
|
||||||
|
|
||||||
# FIXME(dhellmann): These items were not in the constraints list but
|
# FIXME(dhellmann): These items were not in the constraints list but
|
||||||
# should not be blacklisted. We don't know yet what versions they
|
# should not be denylisted. We don't know yet what versions they
|
||||||
# should have, so just ignore them for a little while until we have
|
# should have, so just ignore them for a little while until we have
|
||||||
# time to figure that out.
|
# time to figure that out.
|
||||||
UNCONSTRAINABLE = set([
|
UNCONSTRAINABLE = set([
|
||||||
@ -29,28 +29,28 @@ UNCONSTRAINABLE = set([
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def check_blacklist_coverage(global_reqs, constraints, blacklist,
|
def check_denylist_coverage(global_reqs, constraints, denylist,
|
||||||
constraints_list_name):
|
constraints_list_name):
|
||||||
"""Report any items that are not properly constrained.
|
"""Report any items that are not properly constrained.
|
||||||
|
|
||||||
Check that all of the items in the global-requirements list
|
Check that all of the items in the global-requirements list
|
||||||
appear either in the constraints file or the blacklist.
|
appear either in the constraints file or the denylist.
|
||||||
"""
|
"""
|
||||||
to_be_constrained = (
|
to_be_constrained = (
|
||||||
set(global_reqs.keys()) - set(blacklist.keys())
|
set(global_reqs.keys()) - set(denylist.keys())
|
||||||
- UNCONSTRAINABLE
|
- UNCONSTRAINABLE
|
||||||
)
|
)
|
||||||
constrained = set(constraints.keys()) - set([''])
|
constrained = set(constraints.keys()) - set([''])
|
||||||
unconstrained = to_be_constrained - constrained
|
unconstrained = to_be_constrained - constrained
|
||||||
for u in sorted(unconstrained):
|
for u in sorted(unconstrained):
|
||||||
yield ('%r appears in global-requirements.txt '
|
yield ('%r appears in global-requirements.txt '
|
||||||
'but not %s or blacklist.txt' % (u, constraints_list_name))
|
'but not %s or denylist.txt' % (u, constraints_list_name))
|
||||||
|
|
||||||
# Verify that the blacklist packages are not also listed in
|
# Verify that the denylist packages are not also listed in
|
||||||
# the constraints file.
|
# the constraints file.
|
||||||
dupes = constrained.intersection(set(blacklist.keys()))
|
dupes = constrained.intersection(set(denylist.keys()))
|
||||||
for d in dupes:
|
for d in dupes:
|
||||||
yield ('%r appears in both blacklist.txt and %s'
|
yield ('%r appears in both denylist.txt and %s'
|
||||||
% (d, constraints_list_name))
|
% (d, constraints_list_name))
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,10 +78,10 @@ class GlobalRequirements(fixtures.Fixture):
|
|||||||
self.req_file = os.path.join(self.root, "global-requirements.txt")
|
self.req_file = os.path.join(self.root, "global-requirements.txt")
|
||||||
shutil.copy(
|
shutil.copy(
|
||||||
"openstack_requirements/tests/files/gr-base.txt", self.req_file)
|
"openstack_requirements/tests/files/gr-base.txt", self.req_file)
|
||||||
self.blacklist_file = os.path.join(self.root, "blacklist.txt")
|
self.denylist_file = os.path.join(self.root, "denylist.txt")
|
||||||
shutil.copy(
|
shutil.copy(
|
||||||
"openstack_requirements/tests/files/blacklist.txt",
|
"openstack_requirements/tests/files/denylist.txt",
|
||||||
self.blacklist_file)
|
self.denylist_file)
|
||||||
|
|
||||||
|
|
||||||
# Static data for unit testing.
|
# Static data for unit testing.
|
||||||
@ -95,8 +95,8 @@ global_reqs = requirement.parse(
|
|||||||
upper_constraints = requirement.parse(
|
upper_constraints = requirement.parse(
|
||||||
open("openstack_requirements/tests/files/upper-constraints.txt",
|
open("openstack_requirements/tests/files/upper-constraints.txt",
|
||||||
"rt").read())
|
"rt").read())
|
||||||
blacklist = requirement.parse(
|
denylist = requirement.parse(
|
||||||
open("openstack_requirements/tests/files/blacklist.txt", "rt").read())
|
open("openstack_requirements/tests/files/denylist.txt", "rt").read())
|
||||||
pbr_project = make_project(pbr_fixture)
|
pbr_project = make_project(pbr_fixture)
|
||||||
project_project = make_project(project_fixture)
|
project_project = make_project(project_fixture)
|
||||||
bad_project = make_project(bad_project_fixture)
|
bad_project = make_project(bad_project_fixture)
|
||||||
|
@ -226,14 +226,14 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_blacklisted(self):
|
def test_denylisted(self):
|
||||||
# If the package is blacklisted, everything is OK.
|
# If the package is denylisted, everything is OK.
|
||||||
reqs = [
|
reqs = [
|
||||||
r
|
r
|
||||||
for r, line in requirement.parse('name>=1.2,!=1.4')['name']
|
for r, line in requirement.parse('name>=1.2,!=1.4')['name']
|
||||||
@ -243,14 +243,14 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse('name'),
|
denylist=requirement.parse('name'),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_blacklisted_mismatch(self):
|
def test_denylisted_mismatch(self):
|
||||||
# If the package is blacklisted, it doesn't matter if the
|
# If the package is denylisted, it doesn't matter if the
|
||||||
# version matches.
|
# version matches.
|
||||||
reqs = [
|
reqs = [
|
||||||
r
|
r
|
||||||
@ -261,7 +261,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse('name'),
|
denylist=requirement.parse('name'),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -278,7 +278,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -295,7 +295,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -313,7 +313,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -331,7 +331,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -349,7 +349,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -375,7 +375,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -400,7 +400,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -426,7 +426,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
)
|
)
|
||||||
@ -453,7 +453,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
allow_3_only=True,
|
allow_3_only=True,
|
||||||
@ -481,7 +481,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
allow_3_only=True,
|
allow_3_only=True,
|
||||||
@ -508,7 +508,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
allow_3_only=True,
|
allow_3_only=True,
|
||||||
@ -533,7 +533,7 @@ class TestValidateOne(testtools.TestCase):
|
|||||||
check._validate_one(
|
check._validate_one(
|
||||||
'name',
|
'name',
|
||||||
reqs=reqs,
|
reqs=reqs,
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
backports=self.backports,
|
backports=self.backports,
|
||||||
global_reqs=global_reqs,
|
global_reqs=global_reqs,
|
||||||
allow_3_only=True,
|
allow_3_only=True,
|
||||||
@ -561,7 +561,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -579,7 +579,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -597,7 +597,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -614,11 +614,11 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_mismatch_blacklisted(self):
|
def test_mismatch_denylisted(self):
|
||||||
constraints_content = textwrap.dedent("""
|
constraints_content = textwrap.dedent("""
|
||||||
name==1.2
|
name==1.2
|
||||||
""")
|
""")
|
||||||
@ -632,7 +632,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse('name'),
|
denylist=requirement.parse('name'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -650,7 +650,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -668,7 +668,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -712,7 +712,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -737,7 +737,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -762,7 +762,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ class TestValidateLowerConstraints(testtools.TestCase):
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
req_list=head_reqs,
|
req_list=head_reqs,
|
||||||
constraints=project_data['lower-constraints.txt'],
|
constraints=project_data['lower-constraints.txt'],
|
||||||
blacklist=requirement.parse(''),
|
denylist=requirement.parse(''),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ def mock_read_requirements_file(filename):
|
|||||||
return common.upper_constraints
|
return common.upper_constraints
|
||||||
elif os.path.basename(filename) == 'global-requirements.txt':
|
elif os.path.basename(filename) == 'global-requirements.txt':
|
||||||
return common.global_reqs
|
return common.global_reqs
|
||||||
elif os.path.basename(filename) == 'blacklist.txt':
|
elif os.path.basename(filename) == 'denylist.txt':
|
||||||
return common.blacklist
|
return common.denylist
|
||||||
else:
|
else:
|
||||||
raise IOError('No such file or directory: %s' % filename)
|
raise IOError('No such file or directory: %s' % filename)
|
||||||
|
|
||||||
|
@ -64,42 +64,42 @@ class TestCheckFormat(testtools.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestBlacklistCoverage(testtools.TestCase):
|
class TestDenylistCoverage(testtools.TestCase):
|
||||||
|
|
||||||
def test_constrained(self):
|
def test_constrained(self):
|
||||||
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
||||||
good_constraints = requirement.parse("foo===1.2.5\nbar==2.1")
|
good_constraints = requirement.parse("foo===1.2.5\nbar==2.1")
|
||||||
blacklist = requirement.parse('flake8\nhacking')
|
denylist = requirement.parse('flake8\nhacking')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[],
|
[],
|
||||||
list(constraints.check_blacklist_coverage(
|
list(constraints.check_denylist_coverage(
|
||||||
global_reqs, good_constraints, blacklist, 'test'))
|
global_reqs, good_constraints, denylist, 'test'))
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_blacklisted(self):
|
def test_denylisted(self):
|
||||||
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
||||||
good_constraints = requirement.parse("foo===1.2.5\n")
|
good_constraints = requirement.parse("foo===1.2.5\n")
|
||||||
blacklist = requirement.parse('flake8\nhacking\nbar')
|
denylist = requirement.parse('flake8\nhacking\nbar')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[],
|
[],
|
||||||
list(constraints.check_blacklist_coverage(
|
list(constraints.check_denylist_coverage(
|
||||||
global_reqs, good_constraints, blacklist, 'test'))
|
global_reqs, good_constraints, denylist, 'test'))
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_both(self):
|
def test_both(self):
|
||||||
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
||||||
good_constraints = requirement.parse("foo===1.2.5\nbar>2.0")
|
good_constraints = requirement.parse("foo===1.2.5\nbar>2.0")
|
||||||
blacklist = requirement.parse('flake8\nhacking\nbar')
|
denylist = requirement.parse('flake8\nhacking\nbar')
|
||||||
results = list(constraints.check_blacklist_coverage(
|
results = list(constraints.check_denylist_coverage(
|
||||||
global_reqs, good_constraints, blacklist, 'test'))
|
global_reqs, good_constraints, denylist, 'test'))
|
||||||
self.assertEqual(1, len(results))
|
self.assertEqual(1, len(results))
|
||||||
self.assertIn("'bar' appears in both", results[0])
|
self.assertIn("'bar' appears in both", results[0])
|
||||||
|
|
||||||
def test_neither(self):
|
def test_neither(self):
|
||||||
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
global_reqs = requirement.parse("foo>=1.2\nbar>2.0\n")
|
||||||
good_constraints = requirement.parse("foo===1.2.5\n")
|
good_constraints = requirement.parse("foo===1.2.5\n")
|
||||||
blacklist = requirement.parse('flake8\nhacking')
|
denylist = requirement.parse('flake8\nhacking')
|
||||||
results = list(constraints.check_blacklist_coverage(
|
results = list(constraints.check_denylist_coverage(
|
||||||
global_reqs, good_constraints, blacklist, 'test'))
|
global_reqs, good_constraints, denylist, 'test'))
|
||||||
self.assertEqual(1, len(results))
|
self.assertEqual(1, len(results))
|
||||||
self.assertIn("'bar' appears in global-requirements.txt", results[0])
|
self.assertIn("'bar' appears in global-requirements.txt", results[0])
|
||||||
|
@ -97,23 +97,23 @@ class TestCombine(testtools.TestCase):
|
|||||||
with testtools.ExpectedException(Exception):
|
with testtools.ExpectedException(Exception):
|
||||||
list(generate._combine_freezes([('2.7', []), ('2.7', [])]))
|
list(generate._combine_freezes([('2.7', []), ('2.7', [])]))
|
||||||
|
|
||||||
def test_blacklist(self):
|
def test_denylist(self):
|
||||||
blacklist = ['Fixtures']
|
denylist = ['Fixtures']
|
||||||
freeze_27 = ('2.7', [('fixtures', '1.2.0')])
|
freeze_27 = ('2.7', [('fixtures', '1.2.0')])
|
||||||
freeze_34 = ('3.4', [('fixtures', '1.2.0'), ('enum', '1.5.0')])
|
freeze_34 = ('3.4', [('fixtures', '1.2.0'), ('enum', '1.5.0')])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
["enum===1.5.0;python_version=='3.4'\n"],
|
["enum===1.5.0;python_version=='3.4'\n"],
|
||||||
list(generate._combine_freezes(
|
list(generate._combine_freezes(
|
||||||
[freeze_27, freeze_34], blacklist=blacklist)))
|
[freeze_27, freeze_34], denylist=denylist)))
|
||||||
|
|
||||||
def test_blacklist_with_safe_name(self):
|
def test_denylist_with_safe_name(self):
|
||||||
blacklist = ['flake8_docstrings']
|
denylist = ['flake8_docstrings']
|
||||||
freeze_27 = ('2.7', [('flake8-docstrings', '0.2.1.post1'),
|
freeze_27 = ('2.7', [('flake8-docstrings', '0.2.1.post1'),
|
||||||
('enum', '1.5.0')])
|
('enum', '1.5.0')])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
['enum===1.5.0\n'],
|
['enum===1.5.0\n'],
|
||||||
list(generate._combine_freezes(
|
list(generate._combine_freezes(
|
||||||
[freeze_27], blacklist=blacklist)))
|
[freeze_27], denylist=denylist)))
|
||||||
|
|
||||||
|
|
||||||
class Namespace(object):
|
class Namespace(object):
|
||||||
|
@ -111,8 +111,8 @@ def main():
|
|||||||
with tempdir():
|
with tempdir():
|
||||||
with open(reqdir + '/global-requirements.txt', 'rt') as f:
|
with open(reqdir + '/global-requirements.txt', 'rt') as f:
|
||||||
global_reqs = check.get_global_reqs(f.read())
|
global_reqs = check.get_global_reqs(f.read())
|
||||||
blacklist = requirement.parse(
|
denylist = requirement.parse(
|
||||||
open(reqdir + '/blacklist.txt', 'rt').read())
|
open(reqdir + '/denylist.txt', 'rt').read())
|
||||||
backports_file = reqdir + '/backports.txt'
|
backports_file = reqdir + '/backports.txt'
|
||||||
if os.path.exists(backports_file):
|
if os.path.exists(backports_file):
|
||||||
backports = requirement.parse(open(backports_file, 'rt').read())
|
backports = requirement.parse(open(backports_file, 'rt').read())
|
||||||
@ -139,7 +139,7 @@ def main():
|
|||||||
|
|
||||||
failed = check.validate(
|
failed = check.validate(
|
||||||
head_reqs,
|
head_reqs,
|
||||||
blacklist,
|
denylist,
|
||||||
global_reqs,
|
global_reqs,
|
||||||
list(backports.keys()),
|
list(backports.keys()),
|
||||||
allow_3_only=python_3_branch,
|
allow_3_only=python_3_branch,
|
||||||
@ -149,7 +149,7 @@ def main():
|
|||||||
check.validate_lower_constraints(
|
check.validate_lower_constraints(
|
||||||
head_reqs,
|
head_reqs,
|
||||||
head_proj['lower-constraints.txt'],
|
head_proj['lower-constraints.txt'],
|
||||||
blacklist,
|
denylist,
|
||||||
)
|
)
|
||||||
or failed
|
or failed
|
||||||
)
|
)
|
||||||
|
4
tox.ini
4
tox.ini
@ -51,13 +51,13 @@ description = Regenerates upper-constraints.txt
|
|||||||
# Generate needs an unconstrained install to get new dependencies
|
# Generate needs an unconstrained install to get new dependencies
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
commands = generate-constraints {posargs: -b blacklist.txt -r global-requirements.txt -p python3.8 -p python3.9 -p python3.10 -p python3.11 > upper-constraints.txt}
|
commands = generate-constraints {posargs: -d denylist.txt -r global-requirements.txt -p python3.8 -p python3.9 -p python3.10 -p python3.11 > upper-constraints.txt}
|
||||||
|
|
||||||
[testenv:validate]
|
[testenv:validate]
|
||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
validate-constraints
|
validate-constraints
|
||||||
commands =
|
commands =
|
||||||
validate-constraints {toxinidir}/global-requirements.txt {toxinidir}/upper-constraints.txt {toxinidir}/blacklist.txt
|
validate-constraints {toxinidir}/global-requirements.txt {toxinidir}/upper-constraints.txt {toxinidir}/denylist.txt
|
||||||
|
|
||||||
[testenv:validate-projects]
|
[testenv:validate-projects]
|
||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user