Skip to content

Commit f8d79df

Browse files
Don't directly instantiate ParseResult [integration]
1 parent 525a9b0 commit f8d79df

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

micropip/wheelinfo.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ def from_url(cls, url: str) -> "WheelInfo":
6969
See https://www.python.org/dev/peps/pep-0427/#file-name-convention
7070
"""
7171
parsed_url = urlparse(url)
72+
73+
# If parsed_url has no scheme, then add file:// to
74+
# the URL and parse it again
7275
if not parsed_url.scheme:
73-
parsed_url = ParseResult(
74-
scheme="file",
75-
netloc=parsed_url.netloc,
76-
path=parsed_url.path,
77-
params=parsed_url.params,
78-
query=parsed_url.query,
79-
fragment=parsed_url.fragment,
80-
)
76+
url = "file:///" + url
77+
parsed_url = urlparse(url)
78+
8179
file_name = Path(parsed_url.path).name
8280
name, version, build, tags = parse_wheel_filename(file_name)
8381
return WheelInfo(

0 commit comments

Comments
 (0)