diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2018-10-04 22:48:17 +0300 |
|---|---|---|
| committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2018-10-04 22:48:17 +0300 |
| commit | fbf3e3ada64d36ca7bb9c1422f5a1ccdba7e4dcf (patch) | |
| tree | d51e11fd44fec9f4d3fd47ce9775d005dfcf44e1 | |
| parent | e284ddf676adffa22f6d6a7b02be7328acfe23c4 (diff) | |
| download | wheel-git-fbf3e3ada64d36ca7bb9c1422f5a1ccdba7e4dcf.tar.gz | |
Fixed build number appearing in the .dist-info directory name
Adding a build number caused two different .dist-info directories to be added to the wheel, making pip (rightfully) reject it.
We now construct the dist-info directory name without the build number in all cases.
Fixes #263.
| -rw-r--r-- | docs/news.rst | 4 | ||||
| -rw-r--r-- | tests/test_bdist_wheel.py | 11 | ||||
| -rw-r--r-- | wheel/bdist_wheel.py | 5 |
3 files changed, 19 insertions, 1 deletions
diff --git a/docs/news.rst b/docs/news.rst index b9eeaba..69db33b 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,10 @@ Release Notes ============= +**UNRELEASED** + +- Fixed build number appearing in the ``.dist-info`` directory name + **0.32.1** - Fixed ``AttributeError: 'Requirement' object has no attribute 'url'`` on diff --git a/tests/test_bdist_wheel.py b/tests/test_bdist_wheel.py index 2e87bb3..1ad34af 100644 --- a/tests/test_bdist_wheel.py +++ b/tests/test_bdist_wheel.py @@ -88,3 +88,14 @@ def test_licenses_disabled(dummy_dist, monkeypatch, tmpdir): '--universal']) with WheelFile('dist/dummy_dist-1.0-py2.py3-none-any.whl') as wf: assert set(wf.namelist()) == DEFAULT_FILES + + +def test_build_number(dummy_dist, monkeypatch, tmpdir): + monkeypatch.chdir(dummy_dist) + subprocess.check_call([sys.executable, 'setup.py', 'bdist_wheel', '-b', str(tmpdir), + '--universal', '--build-number=2']) + with WheelFile('dist/dummy_dist-1.0-2-py2.py3-none-any.whl') as wf: + filenames = set(wf.namelist()) + assert 'dummy_dist-1.0.dist-info/RECORD' in filenames + assert 'dummy_dist-1.0.dist-info/METADATA' in filenames + diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py index d6cfa2f..5796970 100644 --- a/wheel/bdist_wheel.py +++ b/wheel/bdist_wheel.py @@ -233,7 +233,10 @@ class bdist_wheel(Command): self._ensure_relative(install.install_base)) self.set_undefined_options('install_egg_info', ('target', 'egginfo_dir')) - distinfo_dir = os.path.join(self.bdist_dir, '%s.dist-info' % self.wheel_dist_name) + distinfo_dirname = '{}-{}.dist-info'.format( + safer_name(self.distribution.get_name()), + safer_version(self.distribution.get_version())) + distinfo_dir = os.path.join(self.bdist_dir, distinfo_dirname) self.egg2dist(self.egginfo_dir, distinfo_dir) self.write_wheelfile(distinfo_dir) |
