Skip to content

Commit

Permalink
Merge pull request #1195 from dnicolodi/rm-egg-wininst
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw authored Dec 5, 2024
2 parents 2319d1c + f3a0a1f commit 55854b7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 82 deletions.
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.

0 comments on commit 55854b7

Please sign in to comment.