mirror of https://github.com/pypa/pip
Refactor away VcsSupport.get_backend_from_location().
This commit is contained in:
parent
47b94f19bb
commit
2f16b88fb3
|
@ -173,12 +173,18 @@ class FrozenRequirement(object):
|
|||
"""
|
||||
location = os.path.normcase(os.path.abspath(dist.location))
|
||||
from pip._internal.vcs import vcs, get_src_requirement
|
||||
if not dist_is_editable(dist) or not vcs.get_backend_name(location):
|
||||
if not dist_is_editable(dist):
|
||||
req = dist.as_requirement()
|
||||
return (req, False, [])
|
||||
|
||||
vc_name = vcs.get_backend_name(location)
|
||||
|
||||
if not vc_name:
|
||||
req = dist.as_requirement()
|
||||
return (req, False, [])
|
||||
|
||||
try:
|
||||
req = get_src_requirement(dist, location)
|
||||
req = get_src_requirement(vc_name, dist, location)
|
||||
except InstallationError as exc:
|
||||
logger.warning(
|
||||
"Error when trying to get requirement for VCS system %s, "
|
||||
|
|
|
@ -150,12 +150,6 @@ class VcsSupport(object):
|
|||
if name in self._registry:
|
||||
return self._registry[name]
|
||||
|
||||
def get_backend_from_location(self, location):
|
||||
vc_type = self.get_backend_name(location)
|
||||
if vc_type:
|
||||
return self.get_backend(vc_type)
|
||||
return None
|
||||
|
||||
|
||||
vcs = VcsSupport()
|
||||
|
||||
|
@ -487,8 +481,8 @@ class VersionControl(object):
|
|||
return cls.is_repository_directory(location)
|
||||
|
||||
|
||||
def get_src_requirement(dist, location):
|
||||
version_control = vcs.get_backend_from_location(location)
|
||||
def get_src_requirement(vc_name, dist, location):
|
||||
version_control = vcs.get_backend(vc_name)
|
||||
if version_control:
|
||||
try:
|
||||
return version_control().get_src_requirement(dist,
|
||||
|
|
Loading…
Reference in New Issue