From 8648ff568f50d1a80c3f9236b2605b7ac4a7b4bb Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Thu, 19 Sep 2019 00:58:47 -0400 Subject: [PATCH 1/4] Removed unused Subversion().unpack in unpack_file `download.unpack_url` already calls `unpack_vcs_link`, it looks like this was leftover from before that change. --- src/pip/_internal/utils/unpacking.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/pip/_internal/utils/unpacking.py b/src/pip/_internal/utils/unpacking.py index 62b196668f6..c0379b6bf8e 100644 --- a/src/pip/_internal/utils/unpacking.py +++ b/src/pip/_internal/utils/unpacking.py @@ -21,7 +21,7 @@ XZ_EXTENSIONS, ZIP_EXTENSIONS, ) -from pip._internal.utils.misc import ensure_dir, hide_url +from pip._internal.utils.misc import ensure_dir from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: @@ -253,14 +253,6 @@ def unpack_file( ) ): untar_file(filename, location) - elif ( - content_type and content_type.startswith('text/html') and - is_svn_page(file_contents(filename)) - ): - # We don't really care about this - from pip._internal.vcs.subversion import Subversion - hidden_url = hide_url('svn+' + link.url) - Subversion().unpack(location, url=hidden_url) else: # FIXME: handle? # FIXME: magic signatures? From 89bbe7349831bedeb860435b9e8bfb00c58fd942 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Thu, 19 Sep 2019 01:03:28 -0400 Subject: [PATCH 2/4] Remove unused argument in unpacking.unpack_file --- src/pip/_internal/download.py | 4 ++-- src/pip/_internal/utils/unpacking.py | 3 --- tests/unit/test_wheel.py | 8 ++++---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/pip/_internal/download.py b/src/pip/_internal/download.py index eaf9e2e12ab..14dbb1d815f 100644 --- a/src/pip/_internal/download.py +++ b/src/pip/_internal/download.py @@ -1024,7 +1024,7 @@ def unpack_http_url( # unpack the archive to the build dir location. even when only # downloading archives, they have to be unpacked to parse dependencies - unpack_file(from_path, location, content_type, link) + unpack_file(from_path, location, content_type) # a download dir is specified; let's copy the archive there if download_dir and not already_downloaded_path: @@ -1120,7 +1120,7 @@ def unpack_file_url( # unpack the archive to the build dir location. even when only downloading # archives, they have to be unpacked to parse dependencies - unpack_file(from_path, location, content_type, link) + unpack_file(from_path, location, content_type) # a download dir is specified and not already downloaded if download_dir and not already_downloaded_path: diff --git a/src/pip/_internal/utils/unpacking.py b/src/pip/_internal/utils/unpacking.py index c0379b6bf8e..bcc6832fa39 100644 --- a/src/pip/_internal/utils/unpacking.py +++ b/src/pip/_internal/utils/unpacking.py @@ -27,8 +27,6 @@ if MYPY_CHECK_RUNNING: from typing import Iterable, List, Optional, Match, Text, Union - from pip._internal.models.link import Link - logger = logging.getLogger(__name__) @@ -231,7 +229,6 @@ def unpack_file( filename, # type: str location, # type: str content_type, # type: Optional[str] - link # type: Optional[Link] ): # type: (...) -> None filename = os.path.realpath(filename) diff --git a/tests/unit/test_wheel.py b/tests/unit/test_wheel.py index f7b2e123b02..3cf47d51de4 100644 --- a/tests/unit/test_wheel.py +++ b/tests/unit/test_wheel.py @@ -370,9 +370,9 @@ def test_wheel_version(tmpdir, data): future_version = (1, 9) unpack_file(data.packages.joinpath(future_wheel), - tmpdir + 'future', None, None) + tmpdir + 'future', None) unpack_file(data.packages.joinpath(broken_wheel), - tmpdir + 'broken', None, None) + tmpdir + 'broken', None) assert wheel.wheel_version(tmpdir + 'future') == future_version assert not wheel.wheel_version(tmpdir + 'broken') @@ -593,7 +593,7 @@ def test_support_index_min__none_supported(self): def test_unpack_wheel_no_flatten(self, tmpdir): filepath = os.path.join(DATA_DIR, 'packages', 'meta-1.0-py2.py3-none-any.whl') - unpack_file(filepath, tmpdir, 'application/zip', None) + unpack_file(filepath, tmpdir, 'application/zip') assert os.path.isdir(os.path.join(tmpdir, 'meta-1.0.dist-info')) def test_purelib_platlib(self, data): @@ -633,7 +633,7 @@ def prep(self, data, tmpdir): self.req = Requirement('sample') self.src = os.path.join(tmpdir, 'src') self.dest = os.path.join(tmpdir, 'dest') - unpack_file(self.wheelpath, self.src, None, None) + unpack_file(self.wheelpath, self.src, None) self.scheme = { 'scripts': os.path.join(self.dest, 'bin'), 'purelib': os.path.join(self.dest, 'lib'), From ea6eb1f898e27b0fff9a3b5fc9f7036054dfbacf Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Thu, 19 Sep 2019 01:38:05 -0400 Subject: [PATCH 3/4] Remove unused functions --- src/pip/_internal/utils/unpacking.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/pip/_internal/utils/unpacking.py b/src/pip/_internal/utils/unpacking.py index bcc6832fa39..92424da5ad3 100644 --- a/src/pip/_internal/utils/unpacking.py +++ b/src/pip/_internal/utils/unpacking.py @@ -8,7 +8,6 @@ import logging import os -import re import shutil import stat import tarfile @@ -25,7 +24,7 @@ from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: - from typing import Iterable, List, Optional, Match, Text, Union + from typing import Iterable, List, Optional, Text, Union logger = logging.getLogger(__name__) @@ -54,23 +53,6 @@ def current_umask(): return mask -def file_contents(filename): - # type: (str) -> Text - with open(filename, 'rb') as fp: - return fp.read().decode('utf-8') - - -def is_svn_page(html): - # type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]] - """ - Returns true if the page appears to be the index page of an svn repository - """ - return ( - re.search(r'[^<]*Revision \d+:', html) and - re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I) - ) - - def split_leading_dir(path): # type: (Union[str, Text]) -> List[Union[str, Text]] path = path.lstrip('/').lstrip('\\') From b6f7470185ab84453f4d847d98ba30f75678ed2a Mon Sep 17 00:00:00 2001 From: Chris Hunt <chrahunt@gmail.com> Date: Thu, 19 Sep 2019 01:47:01 -0400 Subject: [PATCH 4/4] Add news --- news/7037.removal | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/7037.removal diff --git a/news/7037.removal b/news/7037.removal new file mode 100644 index 00000000000..577a02f5e46 --- /dev/null +++ b/news/7037.removal @@ -0,0 +1,2 @@ +Remove undocumented support for http:// requirements pointing to SVN +repositories.