Skip to content

Commit

Permalink
Don't provide dist-info-metadata attribute
Browse files Browse the repository at this point in the history
Fixes issue when pip tries to get unprovided metadata
  • Loading branch information
EpicWink committed Aug 16, 2024
1 parent 981267e commit 6865570
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/proxpi/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,14 @@ def _list_files(self, package_name: str):
if child.tag == "a":
name = child.text
url = urllib.parse.urljoin(response.request.url, child.attrib["href"])
attributes = {k: v for k, v in child.attrib.items() if k != "href"}
attributes = {
k: v
for k, v in child.attrib.items()
# Specifically ignore dist-info-metadat attribute: this version of
# proxpi doesn't support serving the file. See GitHub issue
# EpicWink/proxpi#23
if k not in ("href", "data-dist-info-metadata")
}
fragment = urllib.parse.urlsplit(url).fragment
package.files[name] = File(name, url, fragment, attributes)
self._packages[package_name] = package
Expand Down
4 changes: 4 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_pip_download(server, tmp_path):
"download",
"--index-url",
"http://127.0.0.1:5042/index/",
"--no-deps",
]
p = subprocess.run(
[*args, "--dest", str(tmp_path / "dest1"), "Jinja2", "marshmallow"]
Expand All @@ -62,6 +63,9 @@ def test_pip_download(server, tmp_path):
contents = list((tmp_path / "dest2").iterdir())
print(contents)
assert any("jinja2" in p.name.lower() for p in contents)
subprocess.run(
[*args, "--dest", str(tmp_path / "dest3"), "sphinx == 7.0.1"], check=True
)


def test_list(server):
Expand Down

0 comments on commit 6865570

Please sign in to comment.