diff --git a/news/7554.removal.rst b/news/7554.removal.rst new file mode 100644 index 0000000000000000000000000000000000000000..d5037d5fdb9aadb5f89ac502e8eddac76e3b0cbc --- /dev/null +++ b/news/7554.removal.rst @@ -0,0 +1,2 @@ +Remove support for VCS pseudo URLs editable requirements. It was emitting +deprecation warning since version 20.0. diff --git a/src/pip/_internal/req/constructors.py b/src/pip/_internal/req/constructors.py index 5a8f0666ca2b24b90c64b253674c97d58a9d5dcd..6c223cd79947db45129e57ca6e96120753777a9c 100644 --- a/src/pip/_internal/req/constructors.py +++ b/src/pip/_internal/req/constructors.py @@ -115,7 +115,9 @@ def parse_editable(editable_req): url = f'{version_control}+{url}' break - if '+' not in url: + link = Link(url) + + if not link.is_vcs: backends = ", ".join([backend.name + '+' for backend in vcs.backends]) raise InstallationError( f'{editable_req} is not a valid editable requirement. ' @@ -123,16 +125,7 @@ def parse_editable(editable_req): f'(beginning with {backends}).' ) - vc_type = url.split('+', 1)[0].lower() - - if not vcs.get_backend(vc_type): - backends = ", ".join([bends.name + '+URL' for bends in vcs.backends]) - error_message = "For --editable={}, " \ - "only {} are currently supported".format( - editable_req, backends) - raise InstallationError(error_message) - - package_name = Link(url).egg_fragment + package_name = link.egg_fragment if not package_name: raise InstallationError( "Could not detect requirement name for '{}', please specify one " diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index 11d000df503575765a4892888d698153e6eb04f3..6d0aa30b418b0753909b9d1129347a8fe9bff820 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -625,31 +625,12 @@ class InstallRequirement: if self.link.scheme == 'file': # Static paths don't get updated return - assert '+' in self.link.url, \ - "bad url: {self.link.url!r}".format(**locals()) - vc_type, url = self.link.url.split('+', 1) - vcs_backend = vcs.get_backend(vc_type) - if vcs_backend: - if not self.link.is_vcs: - reason = ( - "This form of VCS requirement is being deprecated: {}." - ).format( - self.link.url - ) - replacement = None - if self.link.url.startswith("git+git@"): - replacement = ( - "git+https://git@example.com/..., " - "git+ssh://git@example.com/..., " - "or the insecure git+git://git@example.com/..." - ) - deprecated(reason, replacement, gone_in="21.0", issue=7554) - hidden_url = hide_url(self.link.url) - vcs_backend.obtain(self.source_dir, url=hidden_url) - else: - assert 0, ( - 'Unexpected version control type (in {}): {}'.format( - self.link, vc_type)) + vcs_backend = vcs.get_backend_for_scheme(self.link.scheme) + # Editable requirements are validated in Requirement constructors. + # So here, if it's neither a path nor a valid VCS URL, it's a bug. + assert vcs_backend, f"Unsupported VCS URL {self.link.url}" + hidden_url = hide_url(self.link.url) + vcs_backend.obtain(self.source_dir, url=hidden_url) # Top-level Actions def uninstall(self, auto_confirm=False, verbose=False): diff --git a/src/pip/_internal/vcs/bazaar.py b/src/pip/_internal/vcs/bazaar.py index 3c9c8a47930b78bd3d701317a88766e0298ccff9..2e82134992ec28b82310e05af8a82c0089e697f2 100644 --- a/src/pip/_internal/vcs/bazaar.py +++ b/src/pip/_internal/vcs/bazaar.py @@ -26,7 +26,7 @@ class Bazaar(VersionControl): repo_name = 'branch' schemes = ( 'bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp', - 'bzr+lp', + 'bzr+lp', 'bzr+file' ) @staticmethod diff --git a/src/pip/_internal/vcs/subversion.py b/src/pip/_internal/vcs/subversion.py index f397c427e67ee0ffdc4e272be55bc5c4667d916d..54d616485a6f26cf078db9d299ac488cebacfa08 100644 --- a/src/pip/_internal/vcs/subversion.py +++ b/src/pip/_internal/vcs/subversion.py @@ -37,7 +37,9 @@ class Subversion(VersionControl): name = 'svn' dirname = '.svn' repo_name = 'checkout' - schemes = ('svn', 'svn+ssh', 'svn+http', 'svn+https', 'svn+svn') + schemes = ( + 'svn', 'svn+ssh', 'svn+http', 'svn+https', 'svn+svn', 'svn+file' + ) @classmethod def should_add_vcs_url_prefix(cls, remote_url): diff --git a/tests/functional/test_install_vcs_git.py b/tests/functional/test_install_vcs_git.py index 4c26d8e88ac7d6c08448831f33b63aacda273b2c..afd6ffae0554bd415312144dd27073a2cb9f8d22 100644 --- a/tests/functional/test_install_vcs_git.py +++ b/tests/functional/test_install_vcs_git.py @@ -1,5 +1,6 @@ import pytest +from pip._internal.utils.urls import path_to_url from tests.lib import pyversion # noqa: F401 from tests.lib import ( _change_test_package_version, @@ -454,7 +455,7 @@ def test_check_submodule_addition(script): ) install_result = script.pip( - 'install', '-e', 'git+' + module_path + '#egg=version_pkg' + 'install', '-e', 'git+' + path_to_url(module_path) + '#egg=version_pkg' ) install_result.did_create( script.venv / 'src/version-pkg/testpkg/static/testfile' @@ -467,7 +468,7 @@ def test_check_submodule_addition(script): # expect error because git may write to stderr update_result = script.pip( - 'install', '-e', 'git+' + module_path + '#egg=version_pkg', + 'install', '-e', 'git+' + path_to_url(module_path) + '#egg=version_pkg', '--upgrade', )