Skip to content

Remove egg and wininst support #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog/1195.removal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Remove support for ``egg`` and ``wininst` distribution types. These are not
accepted by PyPI and not produced by any modern build-backeds.
1 change: 0 additions & 1 deletion docs/internal/twine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ twine package
twine.settings
twine.utils
twine.wheel
twine.wininst
4 changes: 0 additions & 4 deletions docs/internal/twine.wininst.rst

This file was deleted.

Binary file removed tests/fixtures/twine-3.3.0-py3.9.egg
Binary file not shown.
12 changes: 7 additions & 5 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,14 @@ def test_malformed_from_file(monkeypatch):
assert "Invalid distribution file" in err.value.args[0]


def test_package_from_egg():
filename = "tests/fixtures/twine-3.3.0-py3.9.egg"
package_file.PackageFile.from_filename(filename, comment=None)


def test_package_from_sdist():
filename = "tests/fixtures/twine-1.5.0.tar.gz"
p = package_file.PackageFile.from_filename(filename, comment=None)
assert p.python_version == "source"


def test_package_from_unrecognized_file_error():
filename = "twine/package.py"
with pytest.raises(exceptions.InvalidDistribution) as err:
package_file.PackageFile.from_filename(filename, comment=None)
assert "Unknown distribution format" in err.value.args[0]
16 changes: 3 additions & 13 deletions twine/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@

from twine import exceptions
from twine import wheel
from twine import wininst

DIST_TYPES = {
"bdist_wheel": wheel.Wheel,
"bdist_wininst": wininst.WinInst,
"bdist_egg": pkginfo.BDist,
"wheel": wheel.Wheel,
"sdist": pkginfo.SDist,
}

DIST_EXTENSIONS = {
".whl": "bdist_wheel",
".exe": "bdist_wininst",
".egg": "bdist_egg",
".whl": "wheel",
".tar.bz2": "sdist",
".tar.gz": "sdist",
".zip": "sdist",
Expand Down Expand Up @@ -157,13 +152,8 @@ def from_filename(cls, filename: str, comment: Optional[str]) -> "PackageFile":
)
raise exceptions.InvalidDistribution(msg)

if dtype == "bdist_egg":
(dist,) = importlib_metadata.Distribution.discover(path=[filename])
py_version = dist.metadata["Version"]
elif dtype == "bdist_wheel":
if dtype == "wheel":
py_version = cast(wheel.Wheel, meta).py_version
elif dtype == "bdist_wininst":
py_version = cast(wininst.WinInst, meta).py_version
elif dtype == "sdist":
py_version = "source"
else:
Expand Down
59 changes: 0 additions & 59 deletions twine/wininst.py

This file was deleted.

Loading