From b69c8174c4ba84d41b55819ba0c908f6797817a3 Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Sun, 3 Sep 2023 05:31:47 -0400 Subject: [PATCH] add NEWS --- news/12257.feature.rst | 1 + src/pip/_internal/cli/req_command.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 news/12257.feature.rst diff --git a/news/12257.feature.rst b/news/12257.feature.rst new file mode 100644 index 00000000000..21ea8cf5942 --- /dev/null +++ b/news/12257.feature.rst @@ -0,0 +1 @@ +Store HTTP caching headers in ``~/.cache/pip/fetch-resolve`` to reduce bandwidth usage when ``--use-feature=metadata-cache`` is enabled. diff --git a/src/pip/_internal/cli/req_command.py b/src/pip/_internal/cli/req_command.py index dc63e4aaef1..e63af8b616d 100644 --- a/src/pip/_internal/cli/req_command.py +++ b/src/pip/_internal/cli/req_command.py @@ -506,7 +506,7 @@ def _build_package_finder( ignore_requires_python=ignore_requires_python, ) - if options.cache_dir: + if bool(options.cache_dir) and ("metadata-cache" in options.features_enabled): fetch_resolve_cache = FetchResolveCache(options.cache_dir) else: fetch_resolve_cache = None