Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in parsing requirements due to invalid entry points config. #536

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we could do something more in this case. We could warn, but developers are warnings-blind (for good reasons) plus this would be printed during repository rule execution which will scroll off the screen before you actually try to use the generated entry point scripts.


return dict()

Expand Down