Commit f3f71ea2 by Riccardo Albertazzi Committed by GitHub

fix: revert #7916 to fix caching issue resulting in missing dependencies (#7995)

parent 92179755
...@@ -76,10 +76,6 @@ class HTTPRepository(CachedRepository): ...@@ -76,10 +76,6 @@ class HTTPRepository(CachedRepository):
@contextmanager @contextmanager
def _cached_or_downloaded_file(self, link: Link) -> Iterator[Path]: def _cached_or_downloaded_file(self, link: Link) -> Iterator[Path]:
filepath = self._authenticator.get_cached_file_for_url(link.url)
if filepath:
yield filepath
else:
self._log(f"Downloading: {link.url}", level="debug") self._log(f"Downloading: {link.url}", level="debug")
with temporary_directory() as temp_dir: with temporary_directory() as temp_dir:
filepath = Path(temp_dir) / link.filename filepath = Path(temp_dir) / link.filename
......
...@@ -19,7 +19,6 @@ import requests.exceptions ...@@ -19,7 +19,6 @@ import requests.exceptions
from cachecontrol import CacheControlAdapter from cachecontrol import CacheControlAdapter
from cachecontrol.caches import FileCache from cachecontrol.caches import FileCache
from cachecontrol.caches.file_cache import url_to_file_path
from filelock import FileLock from filelock import FileLock
from poetry.config.config import Config from poetry.config.config import Config
...@@ -464,13 +463,6 @@ class Authenticator: ...@@ -464,13 +463,6 @@ class Authenticator:
return selected.certs(config=self._config) return selected.certs(config=self._config)
return RepositoryCertificateConfig() return RepositoryCertificateConfig()
def get_cached_file_for_url(self, url: str) -> Path | None:
if self._cache_control is None:
return None
path = Path(url_to_file_path(url, self._cache_control))
return path if path.exists() else None
_authenticator: Authenticator | None = None _authenticator: Authenticator | None = None
......
...@@ -627,22 +627,6 @@ def test_authenticator_git_repositories( ...@@ -627,22 +627,6 @@ def test_authenticator_git_repositories(
assert not three.password assert not three.password
def test_authenticator_get_cached_file_for_url__cache_miss(config: Config) -> None:
authenticator = Authenticator(config, NullIO())
assert (
authenticator.get_cached_file_for_url("https://foo.bar/cache/miss.whl") is None
)
def test_authenticator_get_cached_file_for_url__cache_hit(config: Config) -> None:
authenticator = Authenticator(config, NullIO())
url = "https://foo.bar/files/foo-0.1.0.tar.gz"
authenticator._cache_control.set(url, b"hello")
assert authenticator.get_cached_file_for_url(url)
@pytest.mark.parametrize( @pytest.mark.parametrize(
("ca_cert", "client_cert", "result"), ("ca_cert", "client_cert", "result"),
[ [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment