Skip to content

Commit

Permalink
Merge pull request #133 from aboutcode-org/update-pip-import
Browse files Browse the repository at this point in the history
Fix the import for the vendored pip and prepare for the v0.6.0 release
  • Loading branch information
keshav-space authored Sep 25, 2024
2 parents a9ad33c + 19c123f commit 8d0bfc7
Show file tree
Hide file tree
Showing 220 changed files with 1,080 additions and 1,071 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

v0.6.0
------
- Add package metadata support for CocoaPods.
- Report all PyPI package versions even if the corresponding distributions are unavailable
- Support Python ``3.11`` and ``3.12``, drop ``3.6`` and ``3.7`` support
- Upgrade vendored pip to 24.2 (This removes the support for pseudo vcs URLs like ``git://``,
``hg://``, ``svn://`` and ``bzr://`` see https://github.com/pypa/pip/pull/9436)


v0.5.2
------
- Update link references of ownership from nexB to aboutcode-org
Expand Down
2 changes: 1 addition & 1 deletion src/fetchcode/vcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ def fetch_via_vcs(url):
vcs_type = vcs_name

backend = vcs.get_backend_for_scheme(scheme)
backend.obtain(dest=dest_dir, url=misc.hide_url(url))
backend.obtain(dest=dest_dir, url=misc.hide_url(url), verbosity=1)

return VCSResponse(dest_dir=dest_dir, vcs_type=vcs_type, domain=domain)
2 changes: 1 addition & 1 deletion src/fetchcode/vcs/pip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ def main(args: Optional[List[str]] = None) -> int:
For additional details, see https://github.com/pypa/pip/issues/7498.
"""
from pip._internal.utils.entrypoints import _wrapper
from fetchcode.vcs.pip._internal.utils.entrypoints import _wrapper

return _wrapper(args)
2 changes: 1 addition & 1 deletion src/fetchcode/vcs/pip/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
sys.path.insert(0, path)

if __name__ == "__main__":
from pip._internal.cli.main import main as _main
from fetchcode.vcs.pip._internal.cli.main import main as _main

sys.exit(_main())
4 changes: 2 additions & 2 deletions src/fetchcode/vcs/pip/_internal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from pip._internal.utils import _log
from fetchcode.vcs.pip._internal.utils import _log

# init_logging() must be called before any call to logging.getLogger()
# which happens at import of most modules.
Expand All @@ -13,6 +13,6 @@ def main(args: Optional[List[str]] = None) -> int:
For additional details, see https://github.com/pypa/pip/issues/7498.
"""
from pip._internal.utils.entrypoints import _wrapper
from fetchcode.vcs.pip._internal.utils.entrypoints import _wrapper

return _wrapper(args)
20 changes: 10 additions & 10 deletions src/fetchcode/vcs/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
from types import TracebackType
from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type, Union

from pip._vendor.certifi import where
from pip._vendor.packaging.version import Version
from fetchcode.vcs.pip._vendor.certifi import where
from fetchcode.vcs.pip._vendor.packaging.version import Version

from pip import __file__ as pip_location
from pip._internal.cli.spinners import open_spinner
from pip._internal.locations import get_platlib, get_purelib, get_scheme
from pip._internal.metadata import get_default_environment, get_environment
from pip._internal.utils.logging import VERBOSE
from pip._internal.utils.packaging import get_requirement
from pip._internal.utils.subprocess import call_subprocess
from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
from fetchcode.vcs.pip._internal.cli.spinners import open_spinner
from fetchcode.vcs.pip._internal.locations import get_platlib, get_purelib, get_scheme
from fetchcode.vcs.pip._internal.metadata import get_default_environment, get_environment
from fetchcode.vcs.pip._internal.utils.logging import VERBOSE
from fetchcode.vcs.pip._internal.utils.packaging import get_requirement
from fetchcode.vcs.pip._internal.utils.subprocess import call_subprocess
from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds

if TYPE_CHECKING:
from pip._internal.index.package_finder import PackageFinder
from fetchcode.vcs.pip._internal.index.package_finder import PackageFinder

logger = logging.getLogger(__name__)

Expand Down
18 changes: 9 additions & 9 deletions src/fetchcode/vcs/pip/_internal/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from pathlib import Path
from typing import Any, Dict, List, Optional

from pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version
from pip._vendor.packaging.utils import canonicalize_name

from pip._internal.exceptions import InvalidWheelFilename
from pip._internal.models.direct_url import DirectUrl
from pip._internal.models.link import Link
from pip._internal.models.wheel import Wheel
from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
from pip._internal.utils.urls import path_to_url
from fetchcode.vcs.pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version
from fetchcode.vcs.pip._vendor.packaging.utils import canonicalize_name

from fetchcode.vcs.pip._internal.exceptions import InvalidWheelFilename
from fetchcode.vcs.pip._internal.models.direct_url import DirectUrl
from fetchcode.vcs.pip._internal.models.link import Link
from fetchcode.vcs.pip._internal.models.wheel import Wheel
from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
from fetchcode.vcs.pip._internal.utils.urls import path_to_url

logger = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions src/fetchcode/vcs/pip/_internal/cli/autocompletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from itertools import chain
from typing import Any, Iterable, List, Optional

from pip._internal.cli.main_parser import create_main_parser
from pip._internal.commands import commands_dict, create_command
from pip._internal.metadata import get_default_environment
from fetchcode.vcs.pip._internal.cli.main_parser import create_main_parser
from fetchcode.vcs.pip._internal.commands import commands_dict, create_command
from fetchcode.vcs.pip._internal.metadata import get_default_environment


def autocomplete() -> None:
Expand Down
26 changes: 13 additions & 13 deletions src/fetchcode/vcs/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
from optparse import Values
from typing import List, Optional, Tuple

from pip._vendor.rich import reconfigure
from pip._vendor.rich import traceback as rich_traceback
from fetchcode.vcs.pip._vendor.rich import reconfigure
from fetchcode.vcs.pip._vendor.rich import traceback as rich_traceback

from pip._internal.cli import cmdoptions
from pip._internal.cli.command_context import CommandContextMixIn
from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip._internal.cli.status_codes import (
from fetchcode.vcs.pip._internal.cli import cmdoptions
from fetchcode.vcs.pip._internal.cli.command_context import CommandContextMixIn
from fetchcode.vcs.pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from fetchcode.vcs.pip._internal.cli.status_codes import (
ERROR,
PREVIOUS_BUILD_DIR_ERROR,
UNKNOWN_ERROR,
VIRTUALENV_NOT_FOUND,
)
from pip._internal.exceptions import (
from fetchcode.vcs.pip._internal.exceptions import (
BadCommand,
CommandError,
DiagnosticPipError,
InstallationError,
NetworkConnectionError,
PreviousBuildDirError,
)
from pip._internal.utils.filesystem import check_path_owner
from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging
from pip._internal.utils.misc import get_prog, normalize_path
from pip._internal.utils.temp_dir import TempDirectoryTypeRegistry as TempDirRegistry
from pip._internal.utils.temp_dir import global_tempdir_manager, tempdir_registry
from pip._internal.utils.virtualenv import running_under_virtualenv
from fetchcode.vcs.pip._internal.utils.filesystem import check_path_owner
from fetchcode.vcs.pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging
from fetchcode.vcs.pip._internal.utils.misc import get_prog, normalize_path
from fetchcode.vcs.pip._internal.utils.temp_dir import TempDirectoryTypeRegistry as TempDirRegistry
from fetchcode.vcs.pip._internal.utils.temp_dir import global_tempdir_manager, tempdir_registry
from fetchcode.vcs.pip._internal.utils.virtualenv import running_under_virtualenv

__all__ = ["Command"]

Expand Down
20 changes: 10 additions & 10 deletions src/fetchcode/vcs/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
from textwrap import dedent
from typing import Any, Callable, Dict, Optional, Tuple

from pip._vendor.packaging.utils import canonicalize_name

from pip._internal.cli.parser import ConfigOptionParser
from pip._internal.exceptions import CommandError
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
from pip._internal.models.format_control import FormatControl
from pip._internal.models.index import PyPI
from pip._internal.models.target_python import TargetPython
from pip._internal.utils.hashes import STRONG_HASHES
from pip._internal.utils.misc import strtobool
from fetchcode.vcs.pip._vendor.packaging.utils import canonicalize_name

from fetchcode.vcs.pip._internal.cli.parser import ConfigOptionParser
from fetchcode.vcs.pip._internal.exceptions import CommandError
from fetchcode.vcs.pip._internal.locations import USER_CACHE_DIR, get_src_prefix
from fetchcode.vcs.pip._internal.models.format_control import FormatControl
from fetchcode.vcs.pip._internal.models.index import PyPI
from fetchcode.vcs.pip._internal.models.target_python import TargetPython
from fetchcode.vcs.pip._internal.utils.hashes import STRONG_HASHES
from fetchcode.vcs.pip._internal.utils.misc import strtobool

logger = logging.getLogger(__name__)

Expand Down
14 changes: 7 additions & 7 deletions src/fetchcode/vcs/pip/_internal/cli/index_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
from optparse import Values
from typing import TYPE_CHECKING, List, Optional

from pip._vendor import certifi
from fetchcode.vcs.pip._vendor import certifi

from pip._internal.cli.base_command import Command
from pip._internal.cli.command_context import CommandContextMixIn
from fetchcode.vcs.pip._internal.cli.base_command import Command
from fetchcode.vcs.pip._internal.cli.command_context import CommandContextMixIn

if TYPE_CHECKING:
from ssl import SSLContext

from pip._internal.network.session import PipSession
from fetchcode.vcs.pip._internal.network.session import PipSession

logger = logging.getLogger(__name__)

Expand All @@ -37,7 +37,7 @@ def _create_truststore_ssl_context() -> Optional["SSLContext"]:
return None

try:
from pip._vendor import truststore
from fetchcode.vcs.pip._vendor import truststore
except ImportError:
logger.warning("Disabling truststore because platform isn't supported")
return None
Expand Down Expand Up @@ -86,7 +86,7 @@ def _build_session(
retries: Optional[int] = None,
timeout: Optional[int] = None,
) -> "PipSession":
from pip._internal.network.session import PipSession
from fetchcode.vcs.pip._internal.network.session import PipSession

cache_dir = options.cache_dir
assert not cache_dir or os.path.isabs(cache_dir)
Expand Down Expand Up @@ -132,7 +132,7 @@ def _build_session(


def _pip_self_version_check(session: "PipSession", options: Values) -> None:
from pip._internal.self_outdated_check import pip_self_version_check as check
from fetchcode.vcs.pip._internal.self_outdated_check import pip_self_version_check as check

check(session, options)

Expand Down
10 changes: 5 additions & 5 deletions src/fetchcode/vcs/pip/_internal/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import warnings
from typing import List, Optional

from pip._internal.cli.autocompletion import autocomplete
from pip._internal.cli.main_parser import parse_command
from pip._internal.commands import create_command
from pip._internal.exceptions import PipError
from pip._internal.utils import deprecation
from fetchcode.vcs.pip._internal.cli.autocompletion import autocomplete
from fetchcode.vcs.pip._internal.cli.main_parser import parse_command
from fetchcode.vcs.pip._internal.commands import create_command
from fetchcode.vcs.pip._internal.exceptions import PipError
from fetchcode.vcs.pip._internal.utils import deprecation

logger = logging.getLogger(__name__)

Expand Down
12 changes: 6 additions & 6 deletions src/fetchcode/vcs/pip/_internal/cli/main_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import sys
from typing import List, Optional, Tuple

from pip._internal.build_env import get_runnable_pip
from pip._internal.cli import cmdoptions
from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip._internal.commands import commands_dict, get_similar_commands
from pip._internal.exceptions import CommandError
from pip._internal.utils.misc import get_pip_version, get_prog
from fetchcode.vcs.pip._internal.build_env import get_runnable_pip
from fetchcode.vcs.pip._internal.cli import cmdoptions
from fetchcode.vcs.pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from fetchcode.vcs.pip._internal.commands import commands_dict, get_similar_commands
from fetchcode.vcs.pip._internal.exceptions import CommandError
from fetchcode.vcs.pip._internal.utils.misc import get_pip_version, get_prog

__all__ = ["create_main_parser", "parse_command"]

Expand Down
6 changes: 3 additions & 3 deletions src/fetchcode/vcs/pip/_internal/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from contextlib import suppress
from typing import Any, Dict, Generator, List, Optional, Tuple

from pip._internal.cli.status_codes import UNKNOWN_ERROR
from pip._internal.configuration import Configuration, ConfigurationError
from pip._internal.utils.misc import redact_auth_from_url, strtobool
from fetchcode.vcs.pip._internal.cli.status_codes import UNKNOWN_ERROR
from fetchcode.vcs.pip._internal.configuration import Configuration, ConfigurationError
from fetchcode.vcs.pip._internal.utils.misc import redact_auth_from_url, strtobool

logger = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions src/fetchcode/vcs/pip/_internal/cli/progress_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from typing import Callable, Generator, Iterable, Iterator, Optional, Tuple

from pip._vendor.rich.progress import (
from fetchcode.vcs.pip._vendor.rich.progress import (
BarColumn,
DownloadColumn,
FileSizeColumn,
Expand All @@ -15,8 +15,8 @@
TransferSpeedColumn,
)

from pip._internal.cli.spinners import RateLimiter
from pip._internal.utils.logging import get_indentation
from fetchcode.vcs.pip._internal.cli.spinners import RateLimiter
from fetchcode.vcs.pip._internal.utils.logging import get_indentation

DownloadProgressRenderer = Callable[[Iterable[bytes]], Iterator[bytes]]

Expand Down
34 changes: 17 additions & 17 deletions src/fetchcode/vcs/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
from optparse import Values
from typing import Any, List, Optional, Tuple

from pip._internal.cache import WheelCache
from pip._internal.cli import cmdoptions
from pip._internal.cli.index_command import IndexGroupCommand
from pip._internal.cli.index_command import SessionCommandMixin as SessionCommandMixin
from pip._internal.exceptions import CommandError, PreviousBuildDirError
from pip._internal.index.collector import LinkCollector
from pip._internal.index.package_finder import PackageFinder
from pip._internal.models.selection_prefs import SelectionPreferences
from pip._internal.models.target_python import TargetPython
from pip._internal.network.session import PipSession
from pip._internal.operations.build.build_tracker import BuildTracker
from pip._internal.operations.prepare import RequirementPreparer
from pip._internal.req.constructors import (
from fetchcode.vcs.pip._internal.cache import WheelCache
from fetchcode.vcs.pip._internal.cli import cmdoptions
from fetchcode.vcs.pip._internal.cli.index_command import IndexGroupCommand
from fetchcode.vcs.pip._internal.cli.index_command import SessionCommandMixin as SessionCommandMixin
from fetchcode.vcs.pip._internal.exceptions import CommandError, PreviousBuildDirError
from fetchcode.vcs.pip._internal.index.collector import LinkCollector
from fetchcode.vcs.pip._internal.index.package_finder import PackageFinder
from fetchcode.vcs.pip._internal.models.selection_prefs import SelectionPreferences
from fetchcode.vcs.pip._internal.models.target_python import TargetPython
from fetchcode.vcs.pip._internal.network.session import PipSession
from fetchcode.vcs.pip._internal.operations.build.build_tracker import BuildTracker
from fetchcode.vcs.pip._internal.operations.prepare import RequirementPreparer
from fetchcode.vcs.pip._internal.req.constructors import (
install_req_from_editable,
install_req_from_line,
install_req_from_parsed_requirement,
install_req_from_req_string,
)
from pip._internal.req.req_file import parse_requirements
from pip._internal.req.req_install import InstallRequirement
from pip._internal.resolution.base import BaseResolver
from pip._internal.utils.temp_dir import (
from fetchcode.vcs.pip._internal.req.req_file import parse_requirements
from fetchcode.vcs.pip._internal.req.req_install import InstallRequirement
from fetchcode.vcs.pip._internal.resolution.base import BaseResolver
from fetchcode.vcs.pip._internal.utils.temp_dir import (
TempDirectory,
TempDirectoryTypeRegistry,
tempdir_kinds,
Expand Down
4 changes: 2 additions & 2 deletions src/fetchcode/vcs/pip/_internal/cli/spinners.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time
from typing import IO, Generator, Optional

from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.logging import get_indentation
from fetchcode.vcs.pip._internal.utils.compat import WINDOWS
from fetchcode.vcs.pip._internal.utils.logging import get_indentation

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/fetchcode/vcs/pip/_internal/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import namedtuple
from typing import Any, Dict, Optional

from pip._internal.cli.base_command import Command
from fetchcode.vcs.pip._internal.cli.base_command import Command

CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary")

Expand Down
10 changes: 5 additions & 5 deletions src/fetchcode/vcs/pip/_internal/commands/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from optparse import Values
from typing import Any, List

from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.exceptions import CommandError, PipError
from pip._internal.utils import filesystem
from pip._internal.utils.logging import getLogger
from fetchcode.vcs.pip._internal.cli.base_command import Command
from fetchcode.vcs.pip._internal.cli.status_codes import ERROR, SUCCESS
from fetchcode.vcs.pip._internal.exceptions import CommandError, PipError
from fetchcode.vcs.pip._internal.utils import filesystem
from fetchcode.vcs.pip._internal.utils.logging import getLogger

logger = getLogger(__name__)

Expand Down
Loading

0 comments on commit 8d0bfc7

Please sign in to comment.