summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-03-17 10:24:23 -0400
committerGitHub <noreply@github.com>2018-03-17 10:24:23 -0400
commitb14a39a8479dcad08d6301caee45cab8156f61dd (patch)
tree77e9188ea1963228801bb878ba73fb679cc9a56f
parent16187afb3f532199f4951801d4e39939c560facc (diff)
parent1fffc0eff9892c7c9bc3b177dd3483a41e85e40e (diff)
downloadpython-setuptools-git-b14a39a8479dcad08d6301caee45cab8156f61dd.tar.gz
Merge pull request #1293 from wimglenn/no_empty_string_extra
Don't claim to provide the extra ''
-rw-r--r--setuptools/dist.py4
-rw-r--r--setuptools/tests/test_egg_info.py17
2 files changed, 20 insertions, 1 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 33ceb404..d24958da 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -389,7 +389,9 @@ class Distribution(Distribution_parse_config_files, _Distribution):
# Since this gets called multiple times at points where the
# keys have become 'converted' extras, ensure that we are only
# truly adding extras we haven't seen before here.
- self.metadata.provides_extras.add(extra.split(':')[0])
+ extra = extra.split(':')[0]
+ if extra:
+ self.metadata.provides_extras.add(extra)
self._convert_extras_requirements()
self._move_install_requirements_markers()
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index ff5fa0a3..d2211671 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -438,6 +438,23 @@ class TestEggInfo(object):
assert 'Provides-Extra: foobar' in pkg_info_lines
assert 'Metadata-Version: 2.1' in pkg_info_lines
+ def test_doesnt_provides_extra(self, tmpdir_cwd, env):
+ self._setup_script_with_requires(
+ '''install_requires=["spam ; python_version<'3.3'"]''')
+ environ = os.environ.copy().update(
+ HOME=env.paths['home'],
+ )
+ environment.run_setup_py(
+ cmd=['egg_info'],
+ pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
+ data_stream=1,
+ env=environ,
+ )
+ egg_info_dir = os.path.join('.', 'foo.egg-info')
+ with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
+ pkg_info_text = pkginfo_file.read()
+ assert 'Provides-Extra:' not in pkg_info_text
+
def test_long_description_content_type(self, tmpdir_cwd, env):
# Test that specifying a `long_description_content_type` keyword arg to
# the `setup` function results in writing a `Description-Content-Type`