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. 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 62b196668f6..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 @@ -21,13 +20,11 @@ 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: - from typing import Iterable, List, Optional, Match, Text, Union - - from pip._internal.models.link import Link + from typing import Iterable, List, Optional, Text, Union logger = logging.getLogger(__name__) @@ -56,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('\\') @@ -231,7 +211,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) @@ -253,14 +232,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? 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'),