Strip markers from test requirements.
Setuptools doesn't [yet] support markeres in tests_require parameters to setup(). While we need to get that fixed, we also need to support syncing marker constrained requirements from global-requirements. Since version constraints are needed to successfully port to Python3 this won't be a long term viable solution: but few of our test-only dependencies require version constraints, so we can do this in the interim. The ones that do - such as python-mysql - we're either moving away from, or centralising them into optional dependencies on other packages where the tests_require limitation shouldn't apply. Change-Id: I31adaf35c8d7b72fe3f8c9242cc356fe34d537e8
This commit is contained in:
parent
e41a9180ed
commit
4b1503849c
|
@ -29,4 +29,5 @@ class BackwardsCompatConfig(base.BaseConfig):
|
|||
packaging.append_text_list(
|
||||
self.config, 'tests_require',
|
||||
packaging.parse_requirements(
|
||||
packaging.TEST_REQUIREMENTS_FILES))
|
||||
packaging.TEST_REQUIREMENTS_FILES,
|
||||
strip_markers=True))
|
||||
|
|
|
@ -81,7 +81,7 @@ def get_reqs_from_files(requirements_files):
|
|||
return []
|
||||
|
||||
|
||||
def parse_requirements(requirements_files=None):
|
||||
def parse_requirements(requirements_files=None, strip_markers=False):
|
||||
|
||||
if requirements_files is None:
|
||||
requirements_files = get_requirements_files()
|
||||
|
@ -104,7 +104,8 @@ def parse_requirements(requirements_files=None):
|
|||
# -r other-requirements.txt
|
||||
if line.startswith('-r'):
|
||||
req_file = line.partition(' ')[2]
|
||||
requirements += parse_requirements([req_file])
|
||||
requirements += parse_requirements(
|
||||
[req_file], strip_markers=strip_markers)
|
||||
continue
|
||||
|
||||
try:
|
||||
|
@ -130,6 +131,11 @@ def parse_requirements(requirements_files=None):
|
|||
reason = 'Index Location'
|
||||
|
||||
if line is not None:
|
||||
if strip_markers:
|
||||
semi_pos = line.find(';')
|
||||
if semi_pos < 0:
|
||||
semi_pos = None
|
||||
line = line[:semi_pos]
|
||||
requirements.append(line)
|
||||
else:
|
||||
log.info(
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ordereddict;python_version=='2.6'
|
Loading…
Reference in New Issue