Skip to content

Commit ce46f85

Browse files
authored
Merge pull request #6545 from cjerdonek/vcs-imports
Remove from pip/_internal/__init__.py the vcs module imports
2 parents dd72011 + 5c89643 commit ce46f85

File tree

14 files changed

+660
-649
lines changed

14 files changed

+660
-649
lines changed

src/pip/_internal/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from pip._internal.commands import commands_dict
4343
from pip._internal.exceptions import PipError
4444
from pip._internal.utils import deprecation
45-
from pip._internal.vcs import git, mercurial, subversion, bazaar # noqa
4645
from pip._vendor.urllib3.exceptions import InsecureRequestWarning
4746

4847
logger = logging.getLogger(__name__)

src/pip/_internal/download.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
from pip._internal.utils.misc import (
3838
ARCHIVE_EXTENSIONS, ask, ask_input, ask_password, ask_path_exists,
3939
backup_dir, consume, display_path, format_size, get_installed_version,
40-
remove_auth_from_url, rmtree, split_auth_netloc_from_url, splitext,
41-
unpack_file,
40+
path_to_url, remove_auth_from_url, rmtree, split_auth_netloc_from_url,
41+
splitext, unpack_file,
4242
)
4343
from pip._internal.utils.temp_dir import TempDirectory
4444
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
@@ -52,7 +52,7 @@
5252
from optparse import Values
5353
from pip._internal.models.link import Link
5454
from pip._internal.utils.hashes import Hashes
55-
from pip._internal.vcs import AuthInfo, VersionControl
55+
from pip._internal.vcs.versioncontrol import AuthInfo, VersionControl
5656

5757
try:
5858
import ssl # noqa
@@ -693,17 +693,6 @@ def url_to_path(url):
693693
return path
694694

695695

696-
def path_to_url(path):
697-
# type: (Union[str, Text]) -> str
698-
"""
699-
Convert a path to a file: URL. The path will be made absolute and have
700-
quoted path parts.
701-
"""
702-
path = os.path.normpath(os.path.abspath(path))
703-
url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path))
704-
return url
705-
706-
707696
def is_archive_file(name):
708697
# type: (str) -> bool
709698
"""Return True if `name` is a considered as an archive file."""

src/pip/_internal/index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def _match_vcs_scheme(url):
8282
8383
Returns the matched VCS scheme, or None if there's no match.
8484
"""
85-
from pip._internal.vcs import VcsSupport
86-
for scheme in VcsSupport.schemes:
85+
from pip._internal.vcs import vcs
86+
for scheme in vcs.schemes:
8787
if url.lower().startswith(scheme) and url[len(scheme)] in '+:':
8888
return scheme
8989
return None

src/pip/_internal/utils/misc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from pip._vendor.six import PY2
2626
from pip._vendor.six.moves import input, shlex_quote
2727
from pip._vendor.six.moves.urllib import parse as urllib_parse
28+
from pip._vendor.six.moves.urllib import request as urllib_request
2829
from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
2930

3031
from pip._internal.exceptions import CommandError, InstallationError
@@ -941,6 +942,17 @@ def enum(*sequential, **named):
941942
return type('Enum', (), enums)
942943

943944

945+
def path_to_url(path):
946+
# type: (Union[str, Text]) -> str
947+
"""
948+
Convert a path to a file: URL. The path will be made absolute and have
949+
quoted path parts.
950+
"""
951+
path = os.path.normpath(os.path.abspath(path))
952+
url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path))
953+
return url
954+
955+
944956
def split_auth_from_netloc(netloc):
945957
"""
946958
Parse out and remove the auth information from a netloc.

0 commit comments

Comments
 (0)