mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Move file type info to utils.filetypes.
This commit is contained in:
parent
6a5bd723ec
commit
6a8b47d20b
|
@ -15,11 +15,8 @@ from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||||
from pip._vendor.six.moves.urllib import request as urllib_request
|
from pip._vendor.six.moves.urllib import request as urllib_request
|
||||||
|
|
||||||
from pip._internal.models.link import Link
|
from pip._internal.models.link import Link
|
||||||
from pip._internal.utils.misc import (
|
from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS
|
||||||
ARCHIVE_EXTENSIONS,
|
from pip._internal.utils.misc import path_to_url, redact_auth_from_url
|
||||||
path_to_url,
|
|
||||||
redact_auth_from_url,
|
|
||||||
)
|
|
||||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||||
from pip._internal.utils.urls import url_to_path
|
from pip._internal.utils.urls import url_to_path
|
||||||
from pip._internal.vcs import is_url, vcs
|
from pip._internal.vcs import is_url, vcs
|
||||||
|
|
|
@ -24,12 +24,9 @@ from pip._internal.models.format_control import FormatControl
|
||||||
from pip._internal.models.link import Link
|
from pip._internal.models.link import Link
|
||||||
from pip._internal.models.selection_prefs import SelectionPreferences
|
from pip._internal.models.selection_prefs import SelectionPreferences
|
||||||
from pip._internal.models.target_python import TargetPython
|
from pip._internal.models.target_python import TargetPython
|
||||||
|
from pip._internal.utils.filetypes import WHEEL_EXTENSION
|
||||||
from pip._internal.utils.logging import indent_log
|
from pip._internal.utils.logging import indent_log
|
||||||
from pip._internal.utils.misc import (
|
from pip._internal.utils.misc import SUPPORTED_EXTENSIONS, build_netloc
|
||||||
SUPPORTED_EXTENSIONS,
|
|
||||||
WHEEL_EXTENSION,
|
|
||||||
build_netloc,
|
|
||||||
)
|
|
||||||
from pip._internal.utils.packaging import check_requires_python
|
from pip._internal.utils.packaging import check_requires_python
|
||||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||||
from pip._internal.utils.urls import url_to_path
|
from pip._internal.utils.urls import url_to_path
|
||||||
|
|
|
@ -3,8 +3,8 @@ import re
|
||||||
|
|
||||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||||
|
|
||||||
|
from pip._internal.utils.filetypes import WHEEL_EXTENSION
|
||||||
from pip._internal.utils.misc import (
|
from pip._internal.utils.misc import (
|
||||||
WHEEL_EXTENSION,
|
|
||||||
path_to_url,
|
path_to_url,
|
||||||
redact_auth_from_url,
|
redact_auth_from_url,
|
||||||
split_auth_from_netloc,
|
split_auth_from_netloc,
|
||||||
|
|
|
@ -25,12 +25,8 @@ from pip._internal.models.index import PyPI, TestPyPI
|
||||||
from pip._internal.models.link import Link
|
from pip._internal.models.link import Link
|
||||||
from pip._internal.pyproject import make_pyproject_path
|
from pip._internal.pyproject import make_pyproject_path
|
||||||
from pip._internal.req.req_install import InstallRequirement
|
from pip._internal.req.req_install import InstallRequirement
|
||||||
from pip._internal.utils.misc import (
|
from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS
|
||||||
ARCHIVE_EXTENSIONS,
|
from pip._internal.utils.misc import is_installable_dir, path_to_url, splitext
|
||||||
is_installable_dir,
|
|
||||||
path_to_url,
|
|
||||||
splitext,
|
|
||||||
)
|
|
||||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||||
from pip._internal.utils.urls import url_to_path
|
from pip._internal.utils.urls import url_to_path
|
||||||
from pip._internal.vcs import is_url, vcs
|
from pip._internal.vcs import is_url, vcs
|
||||||
|
|
11
src/pip/_internal/utils/filetypes.py
Normal file
11
src/pip/_internal/utils/filetypes.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
"""Filetype information.
|
||||||
|
"""
|
||||||
|
|
||||||
|
WHEEL_EXTENSION = '.whl'
|
||||||
|
BZ2_EXTENSIONS = ('.tar.bz2', '.tbz')
|
||||||
|
XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz', '.tar.lz', '.tar.lzma')
|
||||||
|
ZIP_EXTENSIONS = ('.zip', WHEEL_EXTENSION)
|
||||||
|
TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar')
|
||||||
|
ARCHIVE_EXTENSIONS = (
|
||||||
|
ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS
|
||||||
|
)
|
|
@ -41,6 +41,12 @@ from pip._internal.utils.compat import (
|
||||||
stdlib_pkgs,
|
stdlib_pkgs,
|
||||||
str_to_display,
|
str_to_display,
|
||||||
)
|
)
|
||||||
|
from pip._internal.utils.filetypes import (
|
||||||
|
BZ2_EXTENSIONS,
|
||||||
|
TAR_EXTENSIONS,
|
||||||
|
XZ_EXTENSIONS,
|
||||||
|
ZIP_EXTENSIONS,
|
||||||
|
)
|
||||||
from pip._internal.utils.marker_files import write_delete_marker_file
|
from pip._internal.utils.marker_files import write_delete_marker_file
|
||||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||||
from pip._internal.utils.virtualenv import (
|
from pip._internal.utils.virtualenv import (
|
||||||
|
@ -79,7 +85,7 @@ __all__ = ['rmtree', 'display_path', 'backup_dir',
|
||||||
'renames', 'get_prog',
|
'renames', 'get_prog',
|
||||||
'call_subprocess',
|
'call_subprocess',
|
||||||
'captured_stdout', 'ensure_dir',
|
'captured_stdout', 'ensure_dir',
|
||||||
'ARCHIVE_EXTENSIONS', 'SUPPORTED_EXTENSIONS', 'WHEEL_EXTENSION',
|
'SUPPORTED_EXTENSIONS',
|
||||||
'get_installed_version', 'remove_auth_from_url']
|
'get_installed_version', 'remove_auth_from_url']
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,13 +94,6 @@ subprocess_logger = logging.getLogger('pip.subprocessor')
|
||||||
|
|
||||||
LOG_DIVIDER = '----------------------------------------'
|
LOG_DIVIDER = '----------------------------------------'
|
||||||
|
|
||||||
WHEEL_EXTENSION = '.whl'
|
|
||||||
BZ2_EXTENSIONS = ('.tar.bz2', '.tbz')
|
|
||||||
XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz', '.tar.lz', '.tar.lzma')
|
|
||||||
ZIP_EXTENSIONS = ('.zip', WHEEL_EXTENSION)
|
|
||||||
TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar')
|
|
||||||
ARCHIVE_EXTENSIONS = (
|
|
||||||
ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS)
|
|
||||||
SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS
|
SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -14,11 +14,13 @@ import tarfile
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from pip._internal.exceptions import InstallationError
|
from pip._internal.exceptions import InstallationError
|
||||||
from pip._internal.utils.misc import (
|
from pip._internal.utils.filetypes import (
|
||||||
BZ2_EXTENSIONS,
|
BZ2_EXTENSIONS,
|
||||||
TAR_EXTENSIONS,
|
TAR_EXTENSIONS,
|
||||||
XZ_EXTENSIONS,
|
XZ_EXTENSIONS,
|
||||||
ZIP_EXTENSIONS,
|
ZIP_EXTENSIONS,
|
||||||
|
)
|
||||||
|
from pip._internal.utils.misc import (
|
||||||
current_umask,
|
current_umask,
|
||||||
ensure_dir,
|
ensure_dir,
|
||||||
file_contents,
|
file_contents,
|
||||||
|
|
Loading…
Reference in a new issue