From 6727972508ac2056bf53620ea85e13d4c29e6e61 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Tue, 15 Oct 2019 21:44:58 +0530 Subject: [PATCH 1/3] Do not show full URLs when downloading from PyPI --- src/pip/_internal/download.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pip/_internal/download.py b/src/pip/_internal/download.py index 2799e38812c..9845b79c0c6 100644 --- a/src/pip/_internal/download.py +++ b/src/pip/_internal/download.py @@ -224,7 +224,7 @@ def written_chunks(chunks): progress_indicator = _progress_indicator - if link.netloc == PyPI.netloc: + if link.netloc == PyPI.file_storage_domain: url = link.show_url else: url = link.url_without_fragment From 33d7d65da19389c489cc8f1ed91d83fe72a7508c Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Tue, 15 Oct 2019 23:21:45 +0530 Subject: [PATCH 2/3] Update test to verify that full URL is not printed --- tests/functional/test_install.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index f8f814a092d..823b2c1a1e9 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -226,7 +226,7 @@ def test_basic_install_from_pypi(script): """ Test installing a package from PyPI. """ - result = script.pip('install', '-vvv', 'INITools==0.2') + result = script.pip('install', 'INITools==0.2') egg_info_folder = ( script.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion ) @@ -238,6 +238,13 @@ def test_basic_install_from_pypi(script): assert "Looking in indexes: " not in result.stdout assert "Looking in links: " not in result.stdout + # Ensure that we don't print the full URL. + # The URL should be trimmed to only the last part of the path in it, + # when installing from PyPI. The assertion here only checks for + # `https://` since that's likely to show up if we're not trimming in + # the correct circumstances. + assert "https://" not in result.stdout + def test_basic_editable_install(script): """ From af0c5b5b7b9dc6d59b3b055d155faef163eca90c Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Wed, 16 Oct 2019 12:40:51 +0530 Subject: [PATCH 3/3] :newspaper: --- news/7225.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/7225.feature diff --git a/news/7225.feature b/news/7225.feature new file mode 100644 index 00000000000..1678a80f4fd --- /dev/null +++ b/news/7225.feature @@ -0,0 +1 @@ +Show only the filename (instead of full URL), when downloading from PyPI.