Skip to content

Commit 791068a

Browse files
committed
Improve presentation of non-verbose downloads with non-PyPI indexes
1 parent 7f76f2b commit 791068a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/pip/_internal/network/download.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from pip._internal.cli.progress_bars import BarType, get_download_progress_renderer
2121
from pip._internal.exceptions import IncompleteDownloadError, NetworkConnectionError
22-
from pip._internal.models.index import PyPI
2322
from pip._internal.models.link import Link
2423
from pip._internal.network.cache import SafeFileCache, is_from_cache
2524
from pip._internal.network.session import CacheControlAdapter, PipSession
@@ -51,10 +50,10 @@ def _log_download(
5150
total_length: int | None,
5251
range_start: int | None = 0,
5352
) -> Iterable[bytes]:
54-
if link.netloc == PyPI.file_storage_domain:
55-
url = link.show_url
56-
else:
53+
if logger.getEffectiveLevel() > logging.INFO:
5754
url = link.url_without_fragment
55+
else:
56+
url = link.show_url
5857

5958
logged_url = redact_auth_from_url(url)
6059

tests/unit/test_network_download.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
{},
3131
False,
3232
None,
33-
"Downloading http://example.com/foo.tgz",
33+
"Downloading foo.tgz",
3434
),
3535
(
3636
"http://example.com/foo.tgz",
3737
{"content-length": "2"},
3838
False,
3939
None,
40-
"Downloading http://example.com/foo.tgz (2 bytes)",
40+
"Downloading foo.tgz (2 bytes)",
4141
),
4242
(
4343
"http://example.com/foo.tgz",
4444
{"content-length": "2"},
4545
True,
4646
None,
47-
"Using cached http://example.com/foo.tgz (2 bytes)",
47+
"Using cached foo.tgz (2 bytes)",
4848
),
4949
(
5050
"https://files.pythonhosted.org/foo.tgz",
@@ -72,7 +72,7 @@
7272
{"content-length": "200"},
7373
False,
7474
100,
75-
"Resuming download http://example.com/foo.tgz (100 bytes/200 bytes)",
75+
"Resuming download foo.tgz (100 bytes/200 bytes)",
7676
),
7777
],
7878
)

0 commit comments

Comments
 (0)