Deprecate git+git@ form of VCS url

This commit is contained in:
Stéphane Bidoul (ACSONE) 2020-01-02 15:42:10 +01:00
parent 68e49b9613
commit cf071dee55
No known key found for this signature in database
GPG Key ID: BCAB2555446B5B92
3 changed files with 17 additions and 1 deletions

View File

@ -409,7 +409,6 @@ Here are the supported forms::
[-e] git+ssh://git.example.com/MyProject#egg=MyProject
[-e] git+git://git.example.com/MyProject#egg=MyProject
[-e] git+file:///home/user/projects/MyProject#egg=MyProject
-e git+git@git.example.com:MyProject#egg=MyProject
Passing a branch name, a commit hash, a tag name or a git ref is possible like so::

4
news/7543.removal Normal file
View File

@ -0,0 +1,4 @@
Support for the ``git+git@`` form of VCS requirement is being deprecated and
will be removed in pip 21.0. Switch to ``git+https://`` or
``git+ssh://``. ``git+git://`` also works but its use is discouraged as it is
insecure.

View File

@ -30,6 +30,7 @@ from pip._internal.operations.install.legacy import install as install_legacy
from pip._internal.operations.install.wheel import install_wheel
from pip._internal.pyproject import load_pyproject_toml, make_pyproject_path
from pip._internal.req.req_uninstall import UninstallPathSet
from pip._internal.utils.deprecation import deprecated
from pip._internal.utils.hashes import Hashes
from pip._internal.utils.logging import indent_log
from pip._internal.utils.marker_files import (
@ -633,6 +634,18 @@ class InstallRequirement(object):
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:// or git+ssh://"
)
deprecated(reason, replacement, gone_in="21.0")
hidden_url = hide_url(self.link.url)
if obtain:
vcs_backend.obtain(self.source_dir, url=hidden_url)