Skip to content

Commit ea1bb2b

Browse files
authored
Avoid failing to parse requirements due to invalid entry points config. (#536)
1 parent e1646c4 commit ea1bb2b

File tree

1 file changed

+12
-3
lines changed
  • python/pip_install/extract_wheels/lib

1 file changed

+12
-3
lines changed

python/pip_install/extract_wheels/lib/wheel.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,18 @@ def entry_points(self) -> Dict[str, str]:
6363

6464
# Parse the avaialble entry points
6565
config = configparser.ConfigParser()
66-
config.read_string(whl.read(entry_points_path).decode("utf-8"))
67-
if "console_scripts" in config.sections():
68-
return dict(config["console_scripts"])
66+
try:
67+
config.read_string(whl.read(entry_points_path).decode("utf-8"))
68+
if "console_scripts" in config.sections():
69+
return dict(config["console_scripts"])
70+
71+
# TODO: It's unclear what to do in a situation with duplicate sections or options.
72+
# For now, we treat the config file as though it contains no scripts. For more
73+
# details on the config parser, see:
74+
# https://docs.python.org/3.7/library/configparser.html#configparser.ConfigParser
75+
# https://docs.python.org/3.7/library/configparser.html#configparser.Error
76+
except configparser.Error:
77+
pass
6978

7079
return dict()
7180

0 commit comments

Comments
 (0)