Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #309 from dephell/fix-entrypoint-lookup
Browse files Browse the repository at this point in the history
Improve entry point lookup for egg-info packages
  • Loading branch information
orsinium committed Nov 19, 2019
2 parents ec3a87a + 9e20ea5 commit 65aa3bd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dephell/actions/_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,20 @@ def get_entrypoints(*, venv: VEnv, name: str) -> Optional[Tuple[EntryPoint, ...]
if not paths:
logger.critical('cannot locate dist-info for installed package')
return None

path = paths[0] / 'entry_points.txt'
if not path.exists():
# entry_points.txt can be missed for egg-info.
# In that case let's try to find a binary with the same name as package.
if venv.bin_path:
paths = (
venv.bin_path / name,
venv.bin_path / name.replace('-', '_'),
venv.bin_path / name.replace('_', '-'),
)
for path in paths:
if path.exists:
return [EntryPoint(path=path, name=name)]
logger.error('cannot find any entrypoints for package')
return None
return EggInfoConverter().parse_entrypoints(content=path.read_text()).entrypoints

0 comments on commit 65aa3bd

Please sign in to comment.