Skip to content

Commit f3a0a1f

Browse files
committed
Remove egg and wininst support
PyPI does not accept these distribution types since August 2023 and there are no modern build backends that produce these, thus they are most likely not used anymore. egg support has only very minimal test coverage and had a fairly obvious although likely inconsequential bug in reporting the target Python version. wininst support has no tests.
1 parent 2319d1c commit f3a0a1f

File tree

7 files changed

+12
-82
lines changed

7 files changed

+12
-82
lines changed

changelog/1195.removal.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Remove support for ``egg`` and ``wininst` distribution types. These are not
2+
accepted by PyPI and not produced by any modern build-backeds.

docs/internal/twine.rst

-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ twine package
1515
twine.settings
1616
twine.utils
1717
twine.wheel
18-
twine.wininst

docs/internal/twine.wininst.rst

-4
This file was deleted.

tests/fixtures/twine-3.3.0-py3.9.egg

-64.4 KB
Binary file not shown.

tests/test_package.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,14 @@ def test_malformed_from_file(monkeypatch):
463463
assert "Invalid distribution file" in err.value.args[0]
464464

465465

466-
def test_package_from_egg():
467-
filename = "tests/fixtures/twine-3.3.0-py3.9.egg"
468-
package_file.PackageFile.from_filename(filename, comment=None)
469-
470-
471466
def test_package_from_sdist():
472467
filename = "tests/fixtures/twine-1.5.0.tar.gz"
473468
p = package_file.PackageFile.from_filename(filename, comment=None)
474469
assert p.python_version == "source"
470+
471+
472+
def test_package_from_unrecognized_file_error():
473+
filename = "twine/package.py"
474+
with pytest.raises(exceptions.InvalidDistribution) as err:
475+
package_file.PackageFile.from_filename(filename, comment=None)
476+
assert "Unknown distribution format" in err.value.args[0]

twine/package.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,14 @@
4444

4545
from twine import exceptions
4646
from twine import wheel
47-
from twine import wininst
4847

4948
DIST_TYPES = {
50-
"bdist_wheel": wheel.Wheel,
51-
"bdist_wininst": wininst.WinInst,
52-
"bdist_egg": pkginfo.BDist,
49+
"wheel": wheel.Wheel,
5350
"sdist": pkginfo.SDist,
5451
}
5552

5653
DIST_EXTENSIONS = {
57-
".whl": "bdist_wheel",
58-
".exe": "bdist_wininst",
59-
".egg": "bdist_egg",
54+
".whl": "wheel",
6055
".tar.bz2": "sdist",
6156
".tar.gz": "sdist",
6257
".zip": "sdist",
@@ -157,13 +152,8 @@ def from_filename(cls, filename: str, comment: Optional[str]) -> "PackageFile":
157152
)
158153
raise exceptions.InvalidDistribution(msg)
159154

160-
if dtype == "bdist_egg":
161-
(dist,) = importlib_metadata.Distribution.discover(path=[filename])
162-
py_version = dist.metadata["Version"]
163-
elif dtype == "bdist_wheel":
155+
if dtype == "wheel":
164156
py_version = cast(wheel.Wheel, meta).py_version
165-
elif dtype == "bdist_wininst":
166-
py_version = cast(wininst.WinInst, meta).py_version
167157
elif dtype == "sdist":
168158
py_version = "source"
169159
else:

twine/wininst.py

-59
This file was deleted.

0 commit comments

Comments
 (0)