Skip to content

Commit

Permalink
Avoid failing to parse requirements due to invalid entry points confi…
Browse files Browse the repository at this point in the history
…g. (#536)
  • Loading branch information
UebelAndre authored Sep 17, 2021
1 parent e1646c4 commit ea1bb2b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions python/pip_install/extract_wheels/lib/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ def entry_points(self) -> Dict[str, str]:

# Parse the avaialble entry points
config = configparser.ConfigParser()
config.read_string(whl.read(entry_points_path).decode("utf-8"))
if "console_scripts" in config.sections():
return dict(config["console_scripts"])
try:
config.read_string(whl.read(entry_points_path).decode("utf-8"))
if "console_scripts" in config.sections():
return dict(config["console_scripts"])

# TODO: It's unclear what to do in a situation with duplicate sections or options.
# For now, we treat the config file as though it contains no scripts. For more
# details on the config parser, see:
# https://docs.python.org/3.7/library/configparser.html#configparser.ConfigParser
# https://docs.python.org/3.7/library/configparser.html#configparser.Error
except configparser.Error:
pass

return dict()

Expand Down

0 comments on commit ea1bb2b

Please sign in to comment.