Skip to content

Commit

Permalink
Restore expectation that egg-link files will be named with dashes and…
Browse files Browse the repository at this point in the history
… not underscores for compatibility with older pips.
  • Loading branch information
jaraco committed Feb 11, 2024
1 parent 9cbe157 commit f291ee0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions setuptools/_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ def filename_component(value: str) -> str:
return value.replace("-", "_").strip("_")


def filename_component_broken(value: str) -> str:
"""
Produce the incorrect filename component for compatibility.
See pypa/setuptools#4167 for detailed analysis.
TODO: replace this with filename_component after pip 24 is
nearly-ubiquitous.
>>> filename_component_broken('foo_bar-baz')
'foo-bar-baz'
"""
return value.replace('_', '-')


def safer_name(value: str) -> str:
"""Like ``safe_name`` but can be used as filename component for wheel"""
# See bdist_wheel.safer_name
Expand Down
5 changes: 4 additions & 1 deletion setuptools/command/develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import glob

from setuptools.command.easy_install import easy_install
from setuptools import _normalization
from setuptools import _path
from setuptools import namespaces
import setuptools
Expand Down Expand Up @@ -52,7 +53,9 @@ def finalize_options(self):
# pick up setup-dir .egg files only: no .egg-info
self.package_index.scan(glob.glob('*.egg'))

egg_link_fn = ei.egg_name + '.egg-link'
egg_link_fn = (
_normalization.filename_component_broken(ei.egg_name) + '.egg-link'
)
self.egg_link = os.path.join(self.install_dir, egg_link_fn)
self.egg_base = ei.egg_base
if self.egg_path is None:
Expand Down

0 comments on commit f291ee0

Please sign in to comment.