aboutsummaryrefslogtreecommitdiffstats
path: root/env/lib/python3.10/site-packages/pip/_internal/distributions
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-11-14 16:43:12 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-11-14 16:43:12 +0530
commitd47f8b48935d258f4c5c3e2267911753bebd5214 (patch)
tree3ed04e75bc3fc7c8e4ce618f527565da1df630a1 /env/lib/python3.10/site-packages/pip/_internal/distributions
parent9468226a9e2e2ab8cdd599f1d8538e860ca86120 (diff)
downloadidcard-d47f8b48935d258f4c5c3e2267911753bebd5214.tar.gz
idcard-d47f8b48935d258f4c5c3e2267911753bebd5214.tar.bz2
idcard-d47f8b48935d258f4c5c3e2267911753bebd5214.zip
id card
Diffstat (limited to 'env/lib/python3.10/site-packages/pip/_internal/distributions')
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/__init__.py21
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-310.pycbin784 -> 0 bytes
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/base.cpython-310.pycbin1872 -> 0 bytes
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-310.pycbin1249 -> 0 bytes
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-310.pycbin4980 -> 0 bytes
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-310.pycbin1616 -> 0 bytes
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/base.py39
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/installed.py23
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py150
-rw-r--r--env/lib/python3.10/site-packages/pip/_internal/distributions/wheel.py34
10 files changed, 0 insertions, 267 deletions
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/__init__.py b/env/lib/python3.10/site-packages/pip/_internal/distributions/__init__.py
deleted file mode 100644
index 9a89a83..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.distributions.sdist import SourceDistribution
-from pip._internal.distributions.wheel import WheelDistribution
-from pip._internal.req.req_install import InstallRequirement
-
-
-def make_distribution_for_install_requirement(
- install_req: InstallRequirement,
-) -> AbstractDistribution:
- """Returns a Distribution for the given InstallRequirement"""
- # Editable requirements will always be source distributions. They use the
- # legacy logic until we create a modern standard for them.
- if install_req.editable:
- return SourceDistribution(install_req)
-
- # If it's a wheel, it's a WheelDistribution
- if install_req.is_wheel:
- return WheelDistribution(install_req)
-
- # Otherwise, a SourceDistribution
- return SourceDistribution(install_req)
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-310.pyc b/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-310.pyc
deleted file mode 100644
index fe30f79..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-310.pyc
+++ /dev/null
Binary files differ
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/base.cpython-310.pyc b/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/base.cpython-310.pyc
deleted file mode 100644
index 599107d..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/base.cpython-310.pyc
+++ /dev/null
Binary files differ
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-310.pyc b/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-310.pyc
deleted file mode 100644
index b941408..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-310.pyc
+++ /dev/null
Binary files differ
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-310.pyc b/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-310.pyc
deleted file mode 100644
index 65df2d8..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-310.pyc
+++ /dev/null
Binary files differ
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-310.pyc b/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-310.pyc
deleted file mode 100644
index 6f56fd2..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-310.pyc
+++ /dev/null
Binary files differ
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/base.py b/env/lib/python3.10/site-packages/pip/_internal/distributions/base.py
deleted file mode 100644
index 75ce2dc..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/base.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import abc
-
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.metadata.base import BaseDistribution
-from pip._internal.req import InstallRequirement
-
-
-class AbstractDistribution(metaclass=abc.ABCMeta):
- """A base class for handling installable artifacts.
-
- The requirements for anything installable are as follows:
-
- - we must be able to determine the requirement name
- (or we can't correctly handle the non-upgrade case).
-
- - for packages with setup requirements, we must also be able
- to determine their requirements without installing additional
- packages (for the same reason as run-time dependencies)
-
- - we must be able to create a Distribution object exposing the
- above metadata.
- """
-
- def __init__(self, req: InstallRequirement) -> None:
- super().__init__()
- self.req = req
-
- @abc.abstractmethod
- def get_metadata_distribution(self) -> BaseDistribution:
- raise NotImplementedError()
-
- @abc.abstractmethod
- def prepare_distribution_metadata(
- self,
- finder: PackageFinder,
- build_isolation: bool,
- check_build_deps: bool,
- ) -> None:
- raise NotImplementedError()
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/installed.py b/env/lib/python3.10/site-packages/pip/_internal/distributions/installed.py
deleted file mode 100644
index edb38aa..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/installed.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.metadata import BaseDistribution
-
-
-class InstalledDistribution(AbstractDistribution):
- """Represents an installed package.
-
- This does not need any preparation as the required information has already
- been computed.
- """
-
- def get_metadata_distribution(self) -> BaseDistribution:
- assert self.req.satisfied_by is not None, "not actually installed"
- return self.req.satisfied_by
-
- def prepare_distribution_metadata(
- self,
- finder: PackageFinder,
- build_isolation: bool,
- check_build_deps: bool,
- ) -> None:
- pass
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py b/env/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py
deleted file mode 100644
index 4c25647..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py
+++ /dev/null
@@ -1,150 +0,0 @@
-import logging
-from typing import Iterable, Set, Tuple
-
-from pip._internal.build_env import BuildEnvironment
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.exceptions import InstallationError
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.metadata import BaseDistribution
-from pip._internal.utils.subprocess import runner_with_spinner_message
-
-logger = logging.getLogger(__name__)
-
-
-class SourceDistribution(AbstractDistribution):
- """Represents a source distribution.
-
- The preparation step for these needs metadata for the packages to be
- generated, either using PEP 517 or using the legacy `setup.py egg_info`.
- """
-
- def get_metadata_distribution(self) -> BaseDistribution:
- return self.req.get_dist()
-
- def prepare_distribution_metadata(
- self,
- finder: PackageFinder,
- build_isolation: bool,
- check_build_deps: bool,
- ) -> None:
- # Load pyproject.toml, to determine whether PEP 517 is to be used
- self.req.load_pyproject_toml()
-
- # Set up the build isolation, if this requirement should be isolated
- should_isolate = self.req.use_pep517 and build_isolation
- if should_isolate:
- # Setup an isolated environment and install the build backend static
- # requirements in it.
- self._prepare_build_backend(finder)
- # Check that if the requirement is editable, it either supports PEP 660 or
- # has a setup.py or a setup.cfg. This cannot be done earlier because we need
- # to setup the build backend to verify it supports build_editable, nor can
- # it be done later, because we want to avoid installing build requirements
- # needlessly. Doing it here also works around setuptools generating
- # UNKNOWN.egg-info when running get_requires_for_build_wheel on a directory
- # without setup.py nor setup.cfg.
- self.req.isolated_editable_sanity_check()
- # Install the dynamic build requirements.
- self._install_build_reqs(finder)
- # Check if the current environment provides build dependencies
- should_check_deps = self.req.use_pep517 and check_build_deps
- if should_check_deps:
- pyproject_requires = self.req.pyproject_requires
- assert pyproject_requires is not None
- conflicting, missing = self.req.build_env.check_requirements(
- pyproject_requires
- )
- if conflicting:
- self._raise_conflicts("the backend dependencies", conflicting)
- if missing:
- self._raise_missing_reqs(missing)
- self.req.prepare_metadata()
-
- def _prepare_build_backend(self, finder: PackageFinder) -> None:
- # Isolate in a BuildEnvironment and install the build-time
- # requirements.
- pyproject_requires = self.req.pyproject_requires
- assert pyproject_requires is not None
-
- self.req.build_env = BuildEnvironment()
- self.req.build_env.install_requirements(
- finder, pyproject_requires, "overlay", kind="build dependencies"
- )
- conflicting, missing = self.req.build_env.check_requirements(
- self.req.requirements_to_check
- )
- if conflicting:
- self._raise_conflicts("PEP 517/518 supported requirements", conflicting)
- if missing:
- logger.warning(
- "Missing build requirements in pyproject.toml for %s.",
- self.req,
- )
- logger.warning(
- "The project does not specify a build backend, and "
- "pip cannot fall back to setuptools without %s.",
- " and ".join(map(repr, sorted(missing))),
- )
-
- def _get_build_requires_wheel(self) -> Iterable[str]:
- with self.req.build_env:
- runner = runner_with_spinner_message("Getting requirements to build wheel")
- backend = self.req.pep517_backend
- assert backend is not None
- with backend.subprocess_runner(runner):
- return backend.get_requires_for_build_wheel()
-
- def _get_build_requires_editable(self) -> Iterable[str]:
- with self.req.build_env:
- runner = runner_with_spinner_message(
- "Getting requirements to build editable"
- )
- backend = self.req.pep517_backend
- assert backend is not None
- with backend.subprocess_runner(runner):
- return backend.get_requires_for_build_editable()
-
- def _install_build_reqs(self, finder: PackageFinder) -> None:
- # Install any extra build dependencies that the backend requests.
- # This must be done in a second pass, as the pyproject.toml
- # dependencies must be installed before we can call the backend.
- if (
- self.req.editable
- and self.req.permit_editable_wheels
- and self.req.supports_pyproject_editable()
- ):
- build_reqs = self._get_build_requires_editable()
- else:
- build_reqs = self._get_build_requires_wheel()
- conflicting, missing = self.req.build_env.check_requirements(build_reqs)
- if conflicting:
- self._raise_conflicts("the backend dependencies", conflicting)
- self.req.build_env.install_requirements(
- finder, missing, "normal", kind="backend dependencies"
- )
-
- def _raise_conflicts(
- self, conflicting_with: str, conflicting_reqs: Set[Tuple[str, str]]
- ) -> None:
- format_string = (
- "Some build dependencies for {requirement} "
- "conflict with {conflicting_with}: {description}."
- )
- error_message = format_string.format(
- requirement=self.req,
- conflicting_with=conflicting_with,
- description=", ".join(
- f"{installed} is incompatible with {wanted}"
- for installed, wanted in sorted(conflicting_reqs)
- ),
- )
- raise InstallationError(error_message)
-
- def _raise_missing_reqs(self, missing: Set[str]) -> None:
- format_string = (
- "Some build dependencies for {requirement} are missing: {missing}."
- )
- error_message = format_string.format(
- requirement=self.req, missing=", ".join(map(repr, sorted(missing)))
- )
- raise InstallationError(error_message)
diff --git a/env/lib/python3.10/site-packages/pip/_internal/distributions/wheel.py b/env/lib/python3.10/site-packages/pip/_internal/distributions/wheel.py
deleted file mode 100644
index 03aac77..0000000
--- a/env/lib/python3.10/site-packages/pip/_internal/distributions/wheel.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from pip._vendor.packaging.utils import canonicalize_name
-
-from pip._internal.distributions.base import AbstractDistribution
-from pip._internal.index.package_finder import PackageFinder
-from pip._internal.metadata import (
- BaseDistribution,
- FilesystemWheel,
- get_wheel_distribution,
-)
-
-
-class WheelDistribution(AbstractDistribution):
- """Represents a wheel distribution.
-
- This does not need any preparation as wheels can be directly unpacked.
- """
-
- def get_metadata_distribution(self) -> BaseDistribution:
- """Loads the metadata from the wheel file into memory and returns a
- Distribution that uses it, not relying on the wheel file or
- requirement.
- """
- assert self.req.local_file_path, "Set as part of preparation during download"
- assert self.req.name, "Wheels are never unnamed"
- wheel = FilesystemWheel(self.req.local_file_path)
- return get_wheel_distribution(wheel, canonicalize_name(self.req.name))
-
- def prepare_distribution_metadata(
- self,
- finder: PackageFinder,
- build_isolation: bool,
- check_build_deps: bool,
- ) -> None:
- pass