summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachi King <nakato@nakato.io>2015-09-11 17:57:23 +1000
committerSachi King <nakato@nakato.io>2015-09-14 18:26:11 +1000
commitdaa905cad45ea89b557b6468af021270980b9c24 (patch)
tree86672612a9d721c50a258eef01aba8c8ddd4dfe7
parentbcc9b304b8db32bcfa32e52dc3918a95f9f581ab (diff)
downloadpbr-daa905cad45ea89b557b6468af021270980b9c24.tar.gz
Strip comments present in setup.cfg1.8.0
When processing setup.cfg strip trailing comments from lines as this is unsupported by setuptools. Change-Id: I7712c07552b50830549644a6ff4167b90d897125 Closes-bug: 1494330
-rw-r--r--pbr/tests/test_packaging.py5
-rw-r--r--pbr/util.py4
2 files changed, 5 insertions, 4 deletions
diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py
index 607d63a..9e56fd8 100644
--- a/pbr/tests/test_packaging.py
+++ b/pbr/tests/test_packaging.py
@@ -479,7 +479,8 @@ class TestRequirementParsing(base.BaseTestCase):
[extras]
test =
foo
- baz>3.2 :python_version=='2.7'
+ baz>3.2 :python_version=='2.7' # MIT
+ bar>3.3 :python_version=='2.7' # MIT # Apache
""")))
# pkg_resources.split_sections uses None as the title of an
# anonymous section instead of the empty string. Weird.
@@ -489,7 +490,7 @@ class TestRequirementParsing(base.BaseTestCase):
":(python_version=='2.7')": ['Routes>=1.12.3,!=2.0,!=2.1',
'requests-kerberos>=0.6'],
'test': ['foo'],
- "test:(python_version=='2.7')": ['baz>3.2']
+ "test:(python_version=='2.7')": ['baz>3.2', 'bar>3.3']
}
setup_py = os.path.join(tempdir, 'setup.py')
diff --git a/pbr/util.py b/pbr/util.py
index 644bcd8..fffd733 100644
--- a/pbr/util.py
+++ b/pbr/util.py
@@ -334,7 +334,7 @@ def setup_cfg_to_setup_kwargs(config):
# Split install_requires into package,env_marker tuples
# These will be re-assembled later
install_requires = []
- requirement_pattern = '(?P<package>[^;]*);?(?P<env_marker>.*)$'
+ requirement_pattern = '(?P<package>[^;]*);?(?P<env_marker>[^#]*?)(?:\s*#.*)?$'
for requirement in in_cfg_value:
m = re.match(requirement_pattern, requirement)
requirement_package = m.group('package').strip()
@@ -394,7 +394,7 @@ def setup_cfg_to_setup_kwargs(config):
# -> {'fred': ['bar'], 'fred:marker':['foo']}
if 'extras' in config:
- requirement_pattern = '(?P<package>[^:]*):?(?P<env_marker>.*)$'
+ requirement_pattern = '(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$'
extras = config['extras']
for extra in extras:
extra_requirements = []