Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ce19337

Browse filesBrowse files
author
Jonathon Belotti
authored
pip_install: avoid assuming 'Root-Is-Purelib' is provided in all WHEEL files. bazel-contrib#435 (bazel-contrib#485)
1 parent d95e89f commit ce19337
Copy full SHA for ce19337

File tree

1 file changed

+3
-7
lines changed
Filter options

1 file changed

+3
-7
lines changed

‎python/pip_install/extract_wheels/lib/purelib.py

Copy file name to clipboardExpand all lines: python/pip_install/extract_wheels/lib/purelib.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ def spread_purelib_into_root(wheel_dir: str) -> None:
1515
wheel_metadata_file_path = pathlib.Path(dist_info, "WHEEL")
1616
wheel_metadata_dict = wheel.parse_wheel_meta_file(str(wheel_metadata_file_path))
1717

18-
if "Root-Is-Purelib" not in wheel_metadata_dict:
19-
raise ValueError(
20-
"Invalid WHEEL file '%s'. Expected key 'Root-Is-Purelib'."
21-
% wheel_metadata_file_path
22-
)
23-
root_is_purelib = wheel_metadata_dict["Root-Is-Purelib"]
24-
18+
# It is not guaranteed that a WHEEL file author populates 'Root-Is-Purelib'.
19+
# See: https://github.com/bazelbuild/rules_python/issues/435
20+
root_is_purelib: str = wheel_metadata_dict.get("Root-Is-Purelib", "")
2521
if root_is_purelib.lower() == "true":
2622
# The Python package code is in the root of the Wheel, so no need to 'spread' anything.
2723
return

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.