mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 08:41:42 -05:00
Allow legacy package indices to return absolute paths (#719)
This commit is contained in:
parent
420107e7e7
commit
283b30a5c4
2 changed files with 14 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,3 +4,5 @@ artifacts
|
||||||
poetry2nix-flamegraph.svg
|
poetry2nix-flamegraph.svg
|
||||||
.direnv
|
.direnv
|
||||||
flake.lock
|
flake.lock
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
|
|
@ -80,14 +80,23 @@ if package_filename not in parser.sources:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
package_file = open(package_filename, "wb")
|
package_file = open(package_filename, "wb")
|
||||||
# Sometimes the href is a relative path
|
# Sometimes the href is a relative or absolute path within the index's domain.
|
||||||
if urlparse(parser.sources[package_filename]).netloc == "":
|
indicated_url = urlparse(parser.sources[package_filename])
|
||||||
|
if indicated_url.netloc == "":
|
||||||
parsed_url = urlparse(index_url)
|
parsed_url = urlparse(index_url)
|
||||||
|
|
||||||
|
if indicated_url.path.startswith("/"):
|
||||||
|
# An absolute path within the index's domain.
|
||||||
|
path = parser.sources[package_filename]
|
||||||
|
else:
|
||||||
|
# A relative path.
|
||||||
|
path = parsed_url.path + "/" + parser.sources[package_filename]
|
||||||
|
|
||||||
package_url = urlunparse(
|
package_url = urlunparse(
|
||||||
(
|
(
|
||||||
parsed_url.scheme,
|
parsed_url.scheme,
|
||||||
parsed_url.netloc,
|
parsed_url.netloc,
|
||||||
parsed_url.path + "/" + parser.sources[package_filename],
|
path,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
|
Loading…
Add table
Reference in a new issue