ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PK]̩[index.pynu["""Routines related to PyPI, indexes""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False # mypy: disallow-untyped-defs=False from __future__ import absolute_import import logging import re from pip._vendor.packaging import specifiers from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import parse as parse_version from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, InvalidWheelFilename, UnsupportedWheel, ) from pip._internal.models.candidate import InstallationCandidate from pip._internal.models.format_control import FormatControl from pip._internal.models.link import Link from pip._internal.models.selection_prefs import SelectionPreferences 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.misc import build_netloc from pip._internal.utils.packaging import check_requires_python from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.utils.unpacking import SUPPORTED_EXTENSIONS from pip._internal.utils.urls import url_to_path from pip._internal.wheel import Wheel if MYPY_CHECK_RUNNING: from typing import ( FrozenSet, Iterable, List, Optional, Set, Text, Tuple, Union, ) from pip._vendor.packaging.version import _BaseVersion from pip._internal.collector import LinkCollector from pip._internal.models.search_scope import SearchScope from pip._internal.req import InstallRequirement from pip._internal.pep425tags import Pep425Tag from pip._internal.utils.hashes import Hashes BuildTag = Union[Tuple[()], Tuple[int, str]] CandidateSortingKey = ( Tuple[int, int, int, _BaseVersion, BuildTag, Optional[int]] ) __all__ = ['FormatControl', 'BestCandidateResult', 'PackageFinder'] logger = logging.getLogger(__name__) def _check_link_requires_python( link, # type: Link version_info, # type: Tuple[int, int, int] ignore_requires_python=False, # type: bool ): # type: (...) -> bool """ Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. """ try: is_compatible = check_requires_python( link.requires_python, version_info=version_info, ) except specifiers.InvalidSpecifier: logger.debug( "Ignoring invalid Requires-Python (%r) for link: %s", link.requires_python, link, ) else: if not is_compatible: version = '.'.join(map(str, version_info)) if not ignore_requires_python: logger.debug( 'Link requires a different Python (%s not in: %r): %s', version, link.requires_python, link, ) return False logger.debug( 'Ignoring failed Requires-Python check (%s not in: %r) ' 'for link: %s', version, link.requires_python, link, ) return True class LinkEvaluator(object): """ Responsible for evaluating links for a particular project. """ _py_version_re = re.compile(r'-py([123]\.?[0-9]?)$') # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. def __init__( self, project_name, # type: str canonical_name, # type: str formats, # type: FrozenSet target_python, # type: TargetPython allow_yanked, # type: bool ignore_requires_python=None, # type: Optional[bool] ): # type: (...) -> None """ :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. """ if ignore_requires_python is None: ignore_requires_python = False self._allow_yanked = allow_yanked self._canonical_name = canonical_name self._ignore_requires_python = ignore_requires_python self._formats = formats self._target_python = target_python self.project_name = project_name def evaluate_link(self, link): # type: (Link) -> Tuple[bool, Optional[Text]] """ Determine whether a link is a candidate for installation. :return: A tuple (is_candidate, result), where `result` is (1) a version string if `is_candidate` is True, and (2) if `is_candidate` is False, an optional string to log the reason the link fails to qualify. """ version = None if link.is_yanked and not self._allow_yanked: reason = link.yanked_reason or '' # Mark this as a unicode string to prevent "UnicodeEncodeError: # 'ascii' codec can't encode character" in Python 2 when # the reason contains non-ascii characters. return (False, u'yanked for reason: {}'.format(reason)) if link.egg_fragment: egg_info = link.egg_fragment ext = link.ext else: egg_info, ext = link.splitext() if not ext: return (False, 'not a file') if ext not in SUPPORTED_EXTENSIONS: return (False, 'unsupported archive format: %s' % ext) if "binary" not in self._formats and ext == WHEEL_EXTENSION: reason = 'No binaries permitted for %s' % self.project_name return (False, reason) if "macosx10" in link.path and ext == '.zip': return (False, 'macosx10 one') if ext == WHEEL_EXTENSION: try: wheel = Wheel(link.filename) except InvalidWheelFilename: return (False, 'invalid wheel filename') if canonicalize_name(wheel.name) != self._canonical_name: reason = 'wrong project name (not %s)' % self.project_name return (False, reason) supported_tags = self._target_python.get_tags() if not wheel.supported(supported_tags): # Include the wheel's tags in the reason string to # simplify troubleshooting compatibility issues. file_tags = wheel.get_formatted_file_tags() reason = ( "none of the wheel's tags match: {}".format( ', '.join(file_tags) ) ) return (False, reason) version = wheel.version # This should be up by the self.ok_binary check, but see issue 2700. if "source" not in self._formats and ext != WHEEL_EXTENSION: return (False, 'No sources permitted for %s' % self.project_name) if not version: version = _extract_version_from_fragment( egg_info, self._canonical_name, ) if not version: return ( False, 'Missing project version for %s' % self.project_name, ) match = self._py_version_re.search(version) if match: version = version[:match.start()] py_version = match.group(1) if py_version != self._target_python.py_version: return (False, 'Python version is incorrect') supports_python = _check_link_requires_python( link, version_info=self._target_python.py_version_info, ignore_requires_python=self._ignore_requires_python, ) if not supports_python: # Return None for the reason text to suppress calling # _log_skipped_link(). return (False, None) logger.debug('Found link %s, version: %s', link, version) return (True, version) def filter_unallowed_hashes( candidates, # type: List[InstallationCandidate] hashes, # type: Hashes project_name, # type: str ): # type: (...) -> List[InstallationCandidate] """ Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). """ if not hashes: logger.debug( 'Given no hashes to check %s links for project %r: ' 'discarding no candidates', len(candidates), project_name, ) # Make sure we're not returning back the given value. return list(candidates) matches_or_no_digest = [] # Collect the non-matches for logging purposes. non_matches = [] match_count = 0 for candidate in candidates: link = candidate.link if not link.has_hash: pass elif link.is_hash_allowed(hashes=hashes): match_count += 1 else: non_matches.append(candidate) continue matches_or_no_digest.append(candidate) if match_count: filtered = matches_or_no_digest else: # Make sure we're not returning back the given value. filtered = list(candidates) if len(filtered) == len(candidates): discard_message = 'discarding no candidates' else: discard_message = 'discarding {} non-matches:\n {}'.format( len(non_matches), '\n '.join(str(candidate.link) for candidate in non_matches) ) logger.debug( 'Checked %s links for project %r against %s hashes ' '(%s matches, %s no digest): %s', len(candidates), project_name, hashes.digest_count, match_count, len(matches_or_no_digest) - match_count, discard_message ) return filtered class CandidatePreferences(object): """ Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. """ def __init__( self, prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool ): # type: (...) -> None """ :param allow_all_prereleases: Whether to allow all pre-releases. """ self.allow_all_prereleases = allow_all_prereleases self.prefer_binary = prefer_binary class BestCandidateResult(object): """A collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. """ def __init__( self, candidates, # type: List[InstallationCandidate] applicable_candidates, # type: List[InstallationCandidate] best_candidate, # type: Optional[InstallationCandidate] ): # type: (...) -> None """ :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. """ assert set(applicable_candidates) <= set(candidates) if best_candidate is None: assert not applicable_candidates else: assert best_candidate in applicable_candidates self._applicable_candidates = applicable_candidates self._candidates = candidates self.best_candidate = best_candidate def iter_all(self): # type: () -> Iterable[InstallationCandidate] """Iterate through all candidates. """ return iter(self._candidates) def iter_applicable(self): # type: () -> Iterable[InstallationCandidate] """Iterate through the applicable candidates. """ return iter(self._applicable_candidates) class CandidateEvaluator(object): """ Responsible for filtering and sorting candidates for installation based on what tags are valid. """ @classmethod def create( cls, project_name, # type: str target_python=None, # type: Optional[TargetPython] prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool specifier=None, # type: Optional[specifiers.BaseSpecifier] hashes=None, # type: Optional[Hashes] ): # type: (...) -> CandidateEvaluator """Create a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. """ if target_python is None: target_python = TargetPython() if specifier is None: specifier = specifiers.SpecifierSet() supported_tags = target_python.get_tags() return cls( project_name=project_name, supported_tags=supported_tags, specifier=specifier, prefer_binary=prefer_binary, allow_all_prereleases=allow_all_prereleases, hashes=hashes, ) def __init__( self, project_name, # type: str supported_tags, # type: List[Pep425Tag] specifier, # type: specifiers.BaseSpecifier prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool hashes=None, # type: Optional[Hashes] ): # type: (...) -> None """ :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). """ self._allow_all_prereleases = allow_all_prereleases self._hashes = hashes self._prefer_binary = prefer_binary self._project_name = project_name self._specifier = specifier self._supported_tags = supported_tags def get_applicable_candidates( self, candidates, # type: List[InstallationCandidate] ): # type: (...) -> List[InstallationCandidate] """ Return the applicable candidates from a list of candidates. """ # Using None infers from the specifier instead. allow_prereleases = self._allow_all_prereleases or None specifier = self._specifier versions = { str(v) for v in specifier.filter( # We turn the version object into a str here because otherwise # when we're debundled but setuptools isn't, Python will see # packaging.version.Version and # pkg_resources._vendor.packaging.version.Version as different # types. This way we'll use a str as a common data interchange # format. If we stop using the pkg_resources provided specifier # and start using our own, we can drop the cast to str(). (str(c.version) for c in candidates), prereleases=allow_prereleases, ) } # Again, converting version to str to deal with debundling. applicable_candidates = [ c for c in candidates if str(c.version) in versions ] return filter_unallowed_hashes( candidates=applicable_candidates, hashes=self._hashes, project_name=self._project_name, ) def _sort_key(self, candidate): # type: (InstallationCandidate) -> CandidateSortingKey """ Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal """ valid_tags = self._supported_tags support_num = len(valid_tags) build_tag = () # type: BuildTag binary_preference = 0 link = candidate.link if link.is_wheel: # can raise InvalidWheelFilename wheel = Wheel(link.filename) if not wheel.supported(valid_tags): raise UnsupportedWheel( "%s is not a supported wheel for this platform. It " "can't be sorted." % wheel.filename ) if self._prefer_binary: binary_preference = 1 pri = -(wheel.support_index_min(valid_tags)) if wheel.build_tag is not None: match = re.match(r'^(\d+)(.*)$', wheel.build_tag) build_tag_groups = match.groups() build_tag = (int(build_tag_groups[0]), build_tag_groups[1]) else: # sdist pri = -(support_num) has_allowed_hash = int(link.is_hash_allowed(self._hashes)) yank_value = -1 * int(link.is_yanked) # -1 for yanked. return ( has_allowed_hash, yank_value, binary_preference, candidate.version, build_tag, pri, ) def sort_best_candidate( self, candidates, # type: List[InstallationCandidate] ): # type: (...) -> Optional[InstallationCandidate] """ Return the best candidate per the instance's sort order, or None if no candidate is acceptable. """ if not candidates: return None best_candidate = max(candidates, key=self._sort_key) # Log a warning per PEP 592 if necessary before returning. link = best_candidate.link if link.is_yanked: reason = link.yanked_reason or '' msg = ( # Mark this as a unicode string to prevent # "UnicodeEncodeError: 'ascii' codec can't encode character" # in Python 2 when the reason contains non-ascii characters. u'The candidate selected for download or install is a ' 'yanked version: {candidate}\n' 'Reason for being yanked: {reason}' ).format(candidate=best_candidate, reason=reason) logger.warning(msg) return best_candidate def compute_best_candidate( self, candidates, # type: List[InstallationCandidate] ): # type: (...) -> BestCandidateResult """ Compute and return a `BestCandidateResult` instance. """ applicable_candidates = self.get_applicable_candidates(candidates) best_candidate = self.sort_best_candidate(applicable_candidates) return BestCandidateResult( candidates, applicable_candidates=applicable_candidates, best_candidate=best_candidate, ) class PackageFinder(object): """This finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. """ def __init__( self, link_collector, # type: LinkCollector target_python, # type: TargetPython allow_yanked, # type: bool format_control=None, # type: Optional[FormatControl] candidate_prefs=None, # type: CandidatePreferences ignore_requires_python=None, # type: Optional[bool] ): # type: (...) -> None """ This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. """ if candidate_prefs is None: candidate_prefs = CandidatePreferences() format_control = format_control or FormatControl(set(), set()) self._allow_yanked = allow_yanked self._candidate_prefs = candidate_prefs self._ignore_requires_python = ignore_requires_python self._link_collector = link_collector self._target_python = target_python self.format_control = format_control # These are boring links that have already been logged somehow. self._logged_links = set() # type: Set[Link] # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. @classmethod def create( cls, link_collector, # type: LinkCollector selection_prefs, # type: SelectionPreferences target_python=None, # type: Optional[TargetPython] ): # type: (...) -> PackageFinder """Create a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. """ if target_python is None: target_python = TargetPython() candidate_prefs = CandidatePreferences( prefer_binary=selection_prefs.prefer_binary, allow_all_prereleases=selection_prefs.allow_all_prereleases, ) return cls( candidate_prefs=candidate_prefs, link_collector=link_collector, target_python=target_python, allow_yanked=selection_prefs.allow_yanked, format_control=selection_prefs.format_control, ignore_requires_python=selection_prefs.ignore_requires_python, ) @property def search_scope(self): # type: () -> SearchScope return self._link_collector.search_scope @search_scope.setter def search_scope(self, search_scope): # type: (SearchScope) -> None self._link_collector.search_scope = search_scope @property def find_links(self): # type: () -> List[str] return self._link_collector.find_links @property def index_urls(self): # type: () -> List[str] return self.search_scope.index_urls @property def trusted_hosts(self): # type: () -> Iterable[str] for host_port in self._link_collector.session.pip_trusted_origins: yield build_netloc(*host_port) @property def allow_all_prereleases(self): # type: () -> bool return self._candidate_prefs.allow_all_prereleases def set_allow_all_prereleases(self): # type: () -> None self._candidate_prefs.allow_all_prereleases = True def make_link_evaluator(self, project_name): # type: (str) -> LinkEvaluator canonical_name = canonicalize_name(project_name) formats = self.format_control.get_allowed_formats(canonical_name) return LinkEvaluator( project_name=project_name, canonical_name=canonical_name, formats=formats, target_python=self._target_python, allow_yanked=self._allow_yanked, ignore_requires_python=self._ignore_requires_python, ) def _sort_links(self, links): # type: (Iterable[Link]) -> List[Link] """ Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates """ eggs, no_eggs = [], [] seen = set() # type: Set[Link] for link in links: if link not in seen: seen.add(link) if link.egg_fragment: eggs.append(link) else: no_eggs.append(link) return no_eggs + eggs def _log_skipped_link(self, link, reason): # type: (Link, Text) -> None if link not in self._logged_links: # Mark this as a unicode string to prevent "UnicodeEncodeError: # 'ascii' codec can't encode character" in Python 2 when # the reason contains non-ascii characters. # Also, put the link at the end so the reason is more visible # and because the link string is usually very long. logger.debug(u'Skipping link: %s: %s', reason, link) self._logged_links.add(link) def get_install_candidate(self, link_evaluator, link): # type: (LinkEvaluator, Link) -> Optional[InstallationCandidate] """ If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. """ is_candidate, result = link_evaluator.evaluate_link(link) if not is_candidate: if result: self._log_skipped_link(link, reason=result) return None return InstallationCandidate( project=link_evaluator.project_name, link=link, # Convert the Text result to str since InstallationCandidate # accepts str. version=str(result), ) def evaluate_links(self, link_evaluator, links): # type: (LinkEvaluator, Iterable[Link]) -> List[InstallationCandidate] """ Convert links that are candidates to InstallationCandidate objects. """ candidates = [] for link in self._sort_links(links): candidate = self.get_install_candidate(link_evaluator, link) if candidate is not None: candidates.append(candidate) return candidates def find_all_candidates(self, project_name): # type: (str) -> List[InstallationCandidate] """Find all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. """ collected_links = self._link_collector.collect_links(project_name) link_evaluator = self.make_link_evaluator(project_name) find_links_versions = self.evaluate_links( link_evaluator, links=collected_links.find_links, ) page_versions = [] for page_url, page_links in collected_links.pages.items(): logger.debug('Analyzing links from page %s', page_url) with indent_log(): new_versions = self.evaluate_links( link_evaluator, links=page_links, ) page_versions.extend(new_versions) file_versions = self.evaluate_links( link_evaluator, links=collected_links.files, ) if file_versions: file_versions.sort(reverse=True) logger.debug( 'Local files found: %s', ', '.join([ url_to_path(candidate.link.url) for candidate in file_versions ]) ) # This is an intentional priority ordering return file_versions + find_links_versions + page_versions def make_candidate_evaluator( self, project_name, # type: str specifier=None, # type: Optional[specifiers.BaseSpecifier] hashes=None, # type: Optional[Hashes] ): # type: (...) -> CandidateEvaluator """Create a CandidateEvaluator object to use. """ candidate_prefs = self._candidate_prefs return CandidateEvaluator.create( project_name=project_name, target_python=self._target_python, prefer_binary=candidate_prefs.prefer_binary, allow_all_prereleases=candidate_prefs.allow_all_prereleases, specifier=specifier, hashes=hashes, ) def find_best_candidate( self, project_name, # type: str specifier=None, # type: Optional[specifiers.BaseSpecifier] hashes=None, # type: Optional[Hashes] ): # type: (...) -> BestCandidateResult """Find matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. """ candidates = self.find_all_candidates(project_name) candidate_evaluator = self.make_candidate_evaluator( project_name=project_name, specifier=specifier, hashes=hashes, ) return candidate_evaluator.compute_best_candidate(candidates) def find_requirement(self, req, upgrade): # type: (InstallRequirement, bool) -> Optional[Link] """Try to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a Link if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise """ hashes = req.hashes(trust_internet=False) best_candidate_result = self.find_best_candidate( req.name, specifier=req.specifier, hashes=hashes, ) best_candidate = best_candidate_result.best_candidate installed_version = None # type: Optional[_BaseVersion] if req.satisfied_by is not None: installed_version = parse_version(req.satisfied_by.version) def _format_versions(cand_iter): # This repeated parse_version and str() conversion is needed to # handle different vendoring sources from pip and pkg_resources. # If we stop using the pkg_resources provided specifier and start # using our own, we can drop the cast to str(). return ", ".join(sorted( {str(c.version) for c in cand_iter}, key=parse_version, )) or "none" if installed_version is None and best_candidate is None: logger.critical( 'Could not find a version that satisfies the requirement %s ' '(from versions: %s)', req, _format_versions(best_candidate_result.iter_all()), ) raise DistributionNotFound( 'No matching distribution found for %s' % req ) best_installed = False if installed_version and ( best_candidate is None or best_candidate.version <= installed_version): best_installed = True if not upgrade and installed_version is not None: if best_installed: logger.debug( 'Existing installed version (%s) is most up-to-date and ' 'satisfies requirement', installed_version, ) else: logger.debug( 'Existing installed version (%s) satisfies requirement ' '(most up-to-date version is %s)', installed_version, best_candidate.version, ) return None if best_installed: # We have an existing version, and its the best version logger.debug( 'Installed version (%s) is most up-to-date (past versions: ' '%s)', installed_version, _format_versions(best_candidate_result.iter_applicable()), ) raise BestVersionAlreadyInstalled logger.debug( 'Using version %s (newest of versions: %s)', best_candidate.version, _format_versions(best_candidate_result.iter_applicable()), ) return best_candidate.link def _find_name_version_sep(fragment, canonical_name): # type: (str, str) -> int """Find the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 """ # Project name and version must be separated by one single dash. Find all # occurrences of dashes; if the string in front of it matches the canonical # name, this is the one separating the name and version parts. for i, c in enumerate(fragment): if c != "-": continue if canonicalize_name(fragment[:i]) == canonical_name: return i raise ValueError("{} does not match {}".format(fragment, canonical_name)) def _extract_version_from_fragment(fragment, canonical_name): # type: (str, str) -> Optional[str] """Parse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. """ try: version_start = _find_name_version_sep(fragment, canonical_name) + 1 except ValueError: return None version = fragment[version_start:] if not version: return None return version PK]WFWF collector.pynu[""" The main purpose of this module is to expose LinkCollector.collect_links(). """ # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False import cgi import itertools import logging import mimetypes import os from collections import OrderedDict from pip._vendor import html5lib, requests from pip._vendor.distlib.compat import unescape from pip._vendor.requests.exceptions import HTTPError, RetryError, SSLError from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request from pip._internal.models.link import Link from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS from pip._internal.utils.misc import redact_auth_from_url from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.utils.urls import path_to_url, url_to_path from pip._internal.vcs import is_url, vcs if MYPY_CHECK_RUNNING: from typing import ( Callable, Dict, Iterable, List, MutableMapping, Optional, Sequence, Tuple, Union, ) import xml.etree.ElementTree from pip._vendor.requests import Response from pip._internal.models.search_scope import SearchScope from pip._internal.network.session import PipSession HTMLElement = xml.etree.ElementTree.Element ResponseHeaders = MutableMapping[str, str] logger = logging.getLogger(__name__) def _match_vcs_scheme(url): # type: (str) -> Optional[str] """Look for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. """ for scheme in vcs.schemes: if url.lower().startswith(scheme) and url[len(scheme)] in '+:': return scheme return None def _is_url_like_archive(url): # type: (str) -> bool """Return whether the URL looks like an archive. """ filename = Link(url).filename for bad_ext in ARCHIVE_EXTENSIONS: if filename.endswith(bad_ext): return True return False class _NotHTML(Exception): def __init__(self, content_type, request_desc): # type: (str, str) -> None super(_NotHTML, self).__init__(content_type, request_desc) self.content_type = content_type self.request_desc = request_desc def _ensure_html_header(response): # type: (Response) -> None """Check the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html. """ content_type = response.headers.get("Content-Type", "") if not content_type.lower().startswith("text/html"): raise _NotHTML(content_type, response.request.method) class _NotHTTP(Exception): pass def _ensure_html_response(url, session): # type: (str, PipSession) -> None """Send a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. """ scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url) if scheme not in {'http', 'https'}: raise _NotHTTP() resp = session.head(url, allow_redirects=True) resp.raise_for_status() _ensure_html_header(resp) def _get_html_response(url, session): # type: (str, PipSession) -> Response """Access an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotHTML` if it is not HTML. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got HTML, and raise `_NotHTML` otherwise. """ if _is_url_like_archive(url): _ensure_html_response(url, session=session) logger.debug('Getting page %s', redact_auth_from_url(url)) resp = session.get( url, headers={ "Accept": "text/html", # We don't want to blindly returned cached data for # /simple/, because authors generally expecting that # twine upload && pip install will function, but if # they've done a pip install in the last ~10 minutes # it won't. Thus by setting this to zero we will not # blindly use any cached data, however the benefit of # using max-age=0 instead of no-cache, is that we will # still support conditional requests, so we will still # minimize traffic sent in cases where the page hasn't # changed at all, we will just always incur the round # trip for the conditional GET now instead of only # once per 10 minutes. # For more information, please see pypa/pip#5670. "Cache-Control": "max-age=0", }, ) resp.raise_for_status() # The check for archives above only works if the url ends with # something that looks like an archive. However that is not a # requirement of an url. Unless we issue a HEAD request on every # url we cannot know ahead of time for sure if something is HTML # or not. However we can check after we've downloaded it. _ensure_html_header(resp) return resp def _get_encoding_from_headers(headers): # type: (ResponseHeaders) -> Optional[str] """Determine if we have any encoding information in our headers. """ if headers and "Content-Type" in headers: content_type, params = cgi.parse_header(headers["Content-Type"]) if "charset" in params: return params['charset'] return None def _determine_base_url(document, page_url): # type: (HTMLElement, str) -> str """Determine the HTML document's base URL. This looks for a ```` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the HTML file's URL is used as the base URL. :param document: An HTML document representation. The current implementation expects the result of ``html5lib.parse()``. :param page_url: The URL of the HTML document. """ for base in document.findall(".//base"): href = base.get("href") if href is not None: return href return page_url def _clean_link(url): # type: (str) -> str """Makes sure a link is fully encoded. That is, if a ' ' shows up in the link, it will be rewritten to %20 (while not over-quoting % or other characters).""" # Split the URL into parts according to the general structure # `scheme://netloc/path;parameters?query#fragment`. Note that the # `netloc` can be empty and the URI will then refer to a local # filesystem path. result = urllib_parse.urlparse(url) # In both cases below we unquote prior to quoting to make sure # nothing is double quoted. if result.netloc == "": # On Windows the path part might contain a drive letter which # should not be quoted. On Linux where drive letters do not # exist, the colon should be quoted. We rely on urllib.request # to do the right thing here. path = urllib_request.pathname2url( urllib_request.url2pathname(result.path)) else: # In addition to the `/` character we protect `@` so that # revision strings in VCS URLs are properly parsed. path = urllib_parse.quote(urllib_parse.unquote(result.path), safe="/@") return urllib_parse.urlunparse(result._replace(path=path)) def _create_link_from_element( anchor, # type: HTMLElement page_url, # type: str base_url, # type: str ): # type: (...) -> Optional[Link] """ Convert an anchor element in a simple repository page to a Link. """ href = anchor.get("href") if not href: return None url = _clean_link(urllib_parse.urljoin(base_url, href)) pyrequire = anchor.get('data-requires-python') pyrequire = unescape(pyrequire) if pyrequire else None yanked_reason = anchor.get('data-yanked') if yanked_reason: # This is a unicode string in Python 2 (and 3). yanked_reason = unescape(yanked_reason) link = Link( url, comes_from=page_url, requires_python=pyrequire, yanked_reason=yanked_reason, ) return link def parse_links(page): # type: (HTMLPage) -> Iterable[Link] """ Parse an HTML document, and yield its anchor elements as Link objects. """ document = html5lib.parse( page.content, transport_encoding=page.encoding, namespaceHTMLElements=False, ) url = page.url base_url = _determine_base_url(document, url) for anchor in document.findall(".//a"): link = _create_link_from_element( anchor, page_url=url, base_url=base_url, ) if link is None: continue yield link class HTMLPage(object): """Represents one page, along with its URL""" def __init__( self, content, # type: bytes encoding, # type: Optional[str] url, # type: str ): # type: (...) -> None """ :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. """ self.content = content self.encoding = encoding self.url = url def __str__(self): return redact_auth_from_url(self.url) def _handle_get_page_fail( link, # type: Link reason, # type: Union[str, Exception] meth=None # type: Optional[Callable[..., None]] ): # type: (...) -> None if meth is None: meth = logger.debug meth("Could not fetch URL %s: %s - skipping", link, reason) def _make_html_page(response): # type: (Response) -> HTMLPage encoding = _get_encoding_from_headers(response.headers) return HTMLPage(response.content, encoding=encoding, url=response.url) def _get_html_page(link, session=None): # type: (Link, Optional[PipSession]) -> Optional[HTMLPage] if session is None: raise TypeError( "_get_html_page() missing 1 required keyword argument: 'session'" ) url = link.url.split('#', 1)[0] # Check for VCS schemes that do not support lookup as web pages. vcs_scheme = _match_vcs_scheme(url) if vcs_scheme: logger.debug('Cannot look at %s URL %s', vcs_scheme, link) return None # Tack index.html onto file:// URLs that point to directories scheme, _, path, _, _, _ = urllib_parse.urlparse(url) if (scheme == 'file' and os.path.isdir(urllib_request.url2pathname(path))): # add trailing slash if not present so urljoin doesn't trim # final segment if not url.endswith('/'): url += '/' url = urllib_parse.urljoin(url, 'index.html') logger.debug(' file: URL is directory, getting %s', url) try: resp = _get_html_response(url, session=session) except _NotHTTP: logger.debug( 'Skipping page %s because it looks like an archive, and cannot ' 'be checked by HEAD.', link, ) except _NotHTML as exc: logger.debug( 'Skipping page %s because the %s request got Content-Type: %s', link, exc.request_desc, exc.content_type, ) except HTTPError as exc: _handle_get_page_fail(link, exc) except RetryError as exc: _handle_get_page_fail(link, exc) except SSLError as exc: reason = "There was a problem confirming the ssl certificate: " reason += str(exc) _handle_get_page_fail(link, reason, meth=logger.info) except requests.ConnectionError as exc: _handle_get_page_fail(link, "connection error: %s" % exc) except requests.Timeout: _handle_get_page_fail(link, "timed out") else: return _make_html_page(resp) return None def _remove_duplicate_links(links): # type: (Iterable[Link]) -> List[Link] """ Return a list of links, with duplicates removed and ordering preserved. """ # We preserve the ordering when removing duplicates because we can. return list(OrderedDict.fromkeys(links)) def group_locations(locations, expand_dir=False): # type: (Sequence[str], bool) -> Tuple[List[str], List[str]] """ Divide a list of locations into two groups: "files" (archives) and "urls." :return: A pair of lists (files, urls). """ files = [] urls = [] # puts the url for the given file path into the appropriate list def sort_path(path): url = path_to_url(path) if mimetypes.guess_type(url, strict=False)[0] == 'text/html': urls.append(url) else: files.append(url) for url in locations: is_local_path = os.path.exists(url) is_file_url = url.startswith('file:') if is_local_path or is_file_url: if is_local_path: path = url else: path = url_to_path(url) if os.path.isdir(path): if expand_dir: path = os.path.realpath(path) for item in os.listdir(path): sort_path(os.path.join(path, item)) elif is_file_url: urls.append(url) else: logger.warning( "Path '{0}' is ignored: " "it is a directory.".format(path), ) elif os.path.isfile(path): sort_path(path) else: logger.warning( "Url '%s' is ignored: it is neither a file " "nor a directory.", url, ) elif is_url(url): # Only add url with clear scheme urls.append(url) else: logger.warning( "Url '%s' is ignored. It is either a non-existing " "path or lacks a specific scheme.", url, ) return files, urls class CollectedLinks(object): """ Encapsulates all the Link objects collected by a call to LinkCollector.collect_links(), stored separately as-- (1) links from the configured file locations, (2) links from the configured find_links, and (3) a dict mapping HTML page url to links from that page. """ def __init__( self, files, # type: List[Link] find_links, # type: List[Link] pages, # type: Dict[str, List[Link]] ): # type: (...) -> None """ :param files: Links from file locations. :param find_links: Links from find_links. :param pages: A dict mapping HTML page url to links from that page. """ self.files = files self.find_links = find_links self.pages = pages class LinkCollector(object): """ Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_links() method. """ def __init__( self, session, # type: PipSession search_scope, # type: SearchScope ): # type: (...) -> None self.search_scope = search_scope self.session = session @property def find_links(self): # type: () -> List[str] return self.search_scope.find_links def _get_pages(self, locations): # type: (Iterable[Link]) -> Iterable[HTMLPage] """ Yields (page, page_url) from the given locations, skipping locations that have errors. """ for location in locations: page = _get_html_page(location, session=self.session) if page is None: continue yield page def collect_links(self, project_name): # type: (str) -> CollectedLinks """Find all available links for the given project name. :return: All the Link objects (unfiltered), as a CollectedLinks object. """ search_scope = self.search_scope index_locations = search_scope.get_index_urls_locations(project_name) index_file_loc, index_url_loc = group_locations(index_locations) fl_file_loc, fl_url_loc = group_locations( self.find_links, expand_dir=True, ) file_links = [ Link(url) for url in itertools.chain(index_file_loc, fl_file_loc) ] # We trust every directly linked archive in find_links find_link_links = [Link(url, '-f') for url in self.find_links] # We trust every url that the user has given us whether it was given # via --index-url or --find-links. # We want to filter out anything that does not have a secure origin. url_locations = [ link for link in itertools.chain( (Link(url) for url in index_url_loc), (Link(url) for url in fl_url_loc), ) if self.session.is_secure_origin(link) ] url_locations = _remove_duplicate_links(url_locations) lines = [ '{} location(s) to search for versions of {}:'.format( len(url_locations), project_name, ), ] for link in url_locations: lines.append('* {}'.format(link)) logger.debug('\n'.join(lines)) pages_links = {} for page in self._get_pages(url_locations): pages_links[page.url] = list(parse_links(page)) return CollectedLinks( files=file_links, find_links=find_link_links, pages=pages_links, ) PK] )))__pycache__/legacy_resolve.cpython-38.pycnu[U .eRC@sFdZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z m Z mZddlmZddlmZmZmZmZdd lmZmZdd lmZerdd lmZmZmZmZm Z m!Z!dd l"m#Z#dd l$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ee0e-ge-fZ1e2e3Z4dddZ5Gddde6Z7dS)ayDependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) N) defaultdict)chain) specifiers)BestVersionAlreadyInstalledDistributionNotFound HashError HashErrorsUnsupportedPythonVersion) indent_log)dist_in_install_pathdist_in_usersite ensure_dirnormalize_version_info)check_requires_pythonget_requires_python)MYPY_CHECK_RUNNING)Callable DefaultDictListOptionalSetTuple) pkg_resources)AbstractDistribution) PipSession) PackageFinder)RequirementPreparer)InstallRequirement)RequirementSetFc Cst|}zt||d}Wn:tjk rR}ztd|j|WYdSd}~XYnX|r\dSdtt |}|rt d|j||dSt d |j||dS)a Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. ) version_infoz-Package %r has an invalid Requires-Python: %sN.zBIgnoring failed Requires-Python check for package %r: %s not in %rz8Package {!r} requires a different Python: {} not in {!r}) rrrZInvalidSpecifierloggerwarningZ project_namejoinmapstrdebugr format)distrignore_requires_pythonZrequires_pythonZ is_compatibleexcversionr,@/usr/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py_check_dist_requires_python>s> r.csdeZdZdZdddhZdfdd Zdd Zd d Zd d ZddZ ddZ ddZ ddZ Z S)ResolverzResolves which packages need to be installed/uninstalled to perform the requested operation without breaking the requirements of any package. eageronly-if-neededto-satisfy-onlyNc stt|| |jkst| dkr4tjdd} nt| } | |_||_ ||_ ||_ d|_ | |_ | |_||_||_||_||_||_tt|_dS)N)superr/__init___allowed_strategiesAssertionErrorsysrr_py_version_infopreparerfindersessionrequire_hashesupgrade_strategyforce_reinstallignore_dependenciesignore_installedr) use_user_site_make_install_reqrlist_discovered_dependencies) selfr:r<r;Zmake_install_reqrBr@rAr)r?r>Zpy_version_info __class__r,r-r5us&zResolver.__init__c Cs|jjrt|jj|jt|j}|jp>tdd|D|_|j j }| }|r`t |g}t}t||D]N}z||||Wqttk r}z||_||W5d}~XYqtXqt|r|dS)aResolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. css|] }|jVqdSN)Zhas_hash_options).0reqr,r,r- sz#Resolver.resolve..N)r:Zwheel_download_dirr Zunnamed_requirementsrD requirementsvaluesr=anyr; search_scopeZget_formatted_locationsr!inforrextend _resolve_onerrKappend) rFrequirement_setZ root_reqsrPZ locationsZdiscovered_reqsZ hash_errorsrKr*r,r,r-resolves2     zResolver.resolvecCs4|jdkrdS|jdkrdS|jdks*t|jSdS)Nr2Fr0Tr1)r>r7 is_directrFrKr,r,r-_is_upgrade_alloweds   zResolver._is_upgrade_allowedcCs,|jrt|jr"t|jr"|j|_d|_dS)z4 Set a requirement to be installed. N)rBr satisfied_byr Zconflicts_withrXr,r,r-_set_req_to_reinstallszResolver._set_req_to_reinstallcCs|jr dS||j|js dS|jr4||dS||sP|jdkrLdSdS|jsz|j j |ddWn(t k rYdSt k rYnX||dS)aCheck if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. Nr1z#already satisfied, skipping upgradezalready satisfiedT)Zupgradezalready up-to-date) rAcheck_if_existsrBrZr?r[rYr>linkr;Zfind_requirementrr)rFreq_to_installr,r,r-_check_skip_installeds*     zResolver._check_skip_installedcCs|jdk std|jr0|j||j|j|jS|jdks>t||}|jr`|j ||j|S| |}| |j||j|j ||j |j|j}|js||j|jr|jdkp|jp|jp|jjdk}|r||n td||S)zzTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. Nz9require_hashes should have been set in Resolver.resolve()r2filezr?r]Zschemer[r!rQ)rFrKZ skip_reasonZupgrade_allowed abstract_distZ should_modifyr,r,r-_get_abstract_dist_forsV        zResolver._get_abstract_dist_forc s4js jrgSd_j}|}t|jjdgfdd}t  j sd_ j ddjs jrtddjttjt|j}|D]}td ||qtt|jtj@}||D]} || |d qjs&js&jW5QRXS) zxPrepare a single requirements file. :return: A list of additional InstallRequirements to also install. T)rr)csPt|}j}j|||d\}}|rB|rBj|||dS)N)parent_req_nameextras_requested)rCr%nameadd_requirementrErTrR)subreqreZsub_install_reqrdZ to_scan_againZ add_to_parentZ more_reqsr^rUrFr,r-add_req}s  z&Resolver._resolve_one..add_reqN)rdz!Installing extra requirements: %r,z"%s does not provide the extra '%s')re) constraintZpreparedZreqs_to_cleanuprTrcZget_pkg_resources_distributionr.r9r)r Zhas_requirementrfrWrgr@Zextrasr!r&r#sortedsetr"ZrequiresrarZZsuccessfully_downloaded) rFrUr^rbr(rjZmissing_requestedZmissingZavailable_requestedrhr,rir-rS[sV     zResolver._resolve_onecs8gtfdd|jD] }|q&S)zCreate the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. csN|js|krdS|jrdS|j|jD] }|q2|dSrI)rZrladdrErfrT)rKZdeporderZ ordered_reqsschedulerFr,r-rrs  z1Resolver.get_installation_order..schedule)rnrMrN)rFZreq_setZ install_reqr,rpr-get_installation_orders   zResolver.get_installation_order)N)__name__ __module__ __qualname____doc__r6r5rVrYr[r_rcrSrs __classcell__r,r,rGr-r/ns +3  5<Zr/)F)8rwZloggingr8 collectionsr itertoolsrZpip._vendor.packagingrZpip._internal.exceptionsrrrrr Zpip._internal.utils.loggingr Zpip._internal.utils.miscr r r rZpip._internal.utils.packagingrrZpip._internal.utils.typingrtypingrrrrrrZ pip._vendorrZpip._internal.distributionsrZpip._internal.network.sessionrZpip._internal.indexrZ pip._internal.operations.preparerZpip._internal.req.req_installrZpip._internal.req.req_setrr%ZInstallRequirementProviderZ getLoggerrtr!r.objectr/r,r,r,r-s4                0PK]h,7bb __pycache__/index.cpython-38.pycnu[U .e@s(dZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z mZmZmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*e$rddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ddl m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>e3e2de2e?e@ffZAe2e?e?e?e4eAe/e?fZBdddgZCeDeEZFd1d!d"ZGGd#d$d$eHZId%d&ZJGd'd(d(eHZKGd)ddeHZLGd*d+d+eHZMGd,ddeHZNd-d.ZOd/d0ZPdS)2z!Routines related to PyPI, indexes)absolute_importN) specifiers)canonicalize_name)parse)BestVersionAlreadyInstalledDistributionNotFoundInvalidWheelFilenameUnsupportedWheel)InstallationCandidate) FormatControl)Link)SelectionPreferences) TargetPython)WHEEL_EXTENSION) indent_log) build_netloc)check_requires_python)MYPY_CHECK_RUNNING)SUPPORTED_EXTENSIONS) url_to_path)Wheel) FrozenSetIterableListOptionalSetTextTupleUnion) _BaseVersion) LinkCollector) SearchScope)InstallRequirement) Pep425Tag)Hashesr BestCandidateResult PackageFinderFcCs~zt|j|d}Wn&tjk r8td|j|YnBX|szdtt|}|shtd||j|dStd||j|dS)aa Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. ) version_infoz2Ignoring invalid Requires-Python (%r) for link: %s.z4Link requires a different Python (%s not in: %r): %sFzBIgnoring failed Requires-Python check (%s not in: %r) for link: %sT) rZrequires_pythonrZInvalidSpecifierloggerdebugjoinmapstr)linkr(ignore_requires_pythonZ is_compatibleversionr%r%7/usr/lib/python3.8/site-packages/pip/_internal/index.py_check_link_requires_python;s8  r3c@s,eZdZdZedZdddZddZdS) LinkEvaluatorzD Responsible for evaluating links for a particular project. z-py([123]\.?[0-9]?)$NcCs4|dkr d}||_||_||_||_||_||_dS)a :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. NF) _allow_yanked_canonical_name_ignore_requires_python_formats_target_python project_name)selfr:canonical_nameformats target_python allow_yankedr0r%r%r2__init__rszLinkEvaluator.__init__c Csd}|jr(|js(|jpd}dd|fS|jr<|j}|j}n|\}}|sPdS|tkrddd|fSd|jkr|t krd|j }d|fSd |j kr|d krd S|t kr,zt |j }Wntk rYd SXt|j|jkrd |j }d|fS|j}||s&|}dd|}d|fS|j}d|jkrP|t krPdd|j fS|sbt||j}|svdd|j fS|j|} | r|d| }| d} | |jjkrdSt||jj|j d} | sdSt!"d||d|fS)aG Determine whether a link is a candidate for installation. :return: A tuple (is_candidate, result), where `result` is (1) a version string if `is_candidate` is True, and (2) if `is_candidate` is False, an optional string to log the reason the link fails to qualify. N Fzyanked for reason: {})Fz not a filezunsupported archive format: %sZbinaryzNo binaries permitted for %sZmacosx10z.zip)Fz macosx10 one)Fzinvalid wheel filenamezwrong project name (not %s)z"none of the wheel's tags match: {}, sourcezNo sources permitted for %szMissing project version for %s)FzPython version is incorrect)r(r0)FNzFound link %s, version: %sT)# is_yankedr5 yanked_reasonformat egg_fragmentextsplitextrr8rr:pathrfilenamerrnamer6r9get_tags supportedZget_formatted_file_tagsr,r1_extract_version_from_fragment_py_version_researchstartgroup py_versionr3Zpy_version_infor7r*r+) r;r/r1reasonZegg_inforIwheelsupported_tagsZ file_tagsmatchrUZsupports_pythonr%r%r2 evaluate_linksx            zLinkEvaluator.evaluate_link)N) __name__ __module__ __qualname____doc__recompilerQr@rZr%r%r%r2r4fs  &r4c Cs|stdt||t|Sg}g}d}|D]>}|j}|js@n"|j|drV|d7}n ||q.||q.|rx|}nt|}t|t|krd} n dt|d dd |D} td t|||j |t||| |S) a Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). zJGiven no hashes to check %s links for project %r: discarding no candidatesr)hashesrDzdiscarding no candidateszdiscarding {} non-matches: {}z css|]}t|jVqdSN)r.r/.0 candidater%r%r2 +sz*filter_unallowed_hashes..zPChecked %s links for project %r against %s hashes (%s matches, %s no digest): %s) r*r+lenlistr/Zhas_hashis_hash_allowedappendrGr,Z digest_count) candidatesrar:Zmatches_or_no_digestZ non_matchesZ match_countrer/ZfilteredZdiscard_messager%r%r2filter_unallowed_hashessL      rlc@seZdZdZdddZdS)CandidatePreferenceszk Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. FcCs||_||_dS)zR :param allow_all_prereleases: Whether to allow all pre-releases. N)allow_all_prereleases prefer_binary)r;rornr%r%r2r@Cs zCandidatePreferences.__init__N)FF)r[r\r]r^r@r%r%r%r2rm<srmc@s(eZdZdZddZddZddZdS) r&zA collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. cCsHt|t|kst|dkr&|r2tn ||ks2t||_||_||_dS)a :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. N)setAssertionError_applicable_candidates _candidatesbest_candidater;rkapplicable_candidatesrtr%r%r2r@Ws   zBestCandidateResult.__init__cCs t|jS)z(Iterate through all candidates. )iterrsr;r%r%r2iter_allpszBestCandidateResult.iter_allcCs t|jS)z3Iterate through the applicable candidates. )rwrrrxr%r%r2iter_applicablevsz#BestCandidateResult.iter_applicableN)r[r\r]r^r@ryrzr%r%r%r2r&Psc@sHeZdZdZedddZdddZdd Zd d Zd d Z ddZ dS)CandidateEvaluatorzm Responsible for filtering and sorting candidates for installation based on what tags are valid. NFcCs:|dkrt}|dkrt}|}|||||||dS)aCreate a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. N)r:rX specifierrornra)rrZ SpecifierSetrN)clsr:r>rornr|rarXr%r%r2createszCandidateEvaluator.createcCs(||_||_||_||_||_||_dS)z :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). N)_allow_all_prereleases_hashes_prefer_binary _project_name _specifier_supported_tags)r;r:rXr|rornrar%r%r2r@s zCandidateEvaluator.__init__csV|jpd}|j}dd|jdd|D|dDfdd|D}t||j|jd S) zM Return the applicable candidates from a list of candidates. NcSsh|] }t|qSr%)r.)rdvr%r%r2 sz?CandidateEvaluator.get_applicable_candidates..css|]}t|jVqdSrbr.r1rdcr%r%r2rfsz?CandidateEvaluator.get_applicable_candidates..)Z prereleasescsg|]}t|jkr|qSr%rrZversionsr%r2 sz@CandidateEvaluator.get_applicable_candidates..)rkrar:)rrfilterrlrr)r;rkZallow_prereleasesr|rvr%rr2get_applicable_candidatess   z,CandidateEvaluator.get_applicable_candidatesc Cs|j}t|}d}d}|j}|jrt|j}||sDtd|j|jrNd}| | }|j dk rt d|j } | } t| d| df}n| }t||j} dt|j} | | ||j||fS)a) Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal r%rzB%s is not a supported wheel for this platform. It can't be sorted.rDNz ^(\d+)(.*)$)rrgr/Zis_wheelrrLrOr rZsupport_index_min build_tagr_rYgroupsintrirrEr1) r;reZ valid_tagsZ support_numrZbinary_preferencer/rWZprirYZbuild_tag_groupsZhas_allowed_hashZ yank_valuer%r%r2 _sort_keys<    zCandidateEvaluator._sort_keycCsH|sdSt||jd}|j}|jrD|jp*d}dj||d}t||S)zy Return the best candidate per the instance's sort order, or None if no candidate is acceptable. NkeyrAzqThe candidate selected for download or install is a yanked version: {candidate} Reason for being yanked: {reason})rerV)maxrr/rErFrGr*Zwarning)r;rkrtr/rVmsgr%r%r2sort_best_candidates   z&CandidateEvaluator.sort_best_candidatecCs"||}||}t|||dS)zF Compute and return a `BestCandidateResult` instance. )rvrt)rrr&rur%r%r2compute_best_candidate<s  z)CandidateEvaluator.compute_best_candidate)NFFNN)FFN) r[r\r]r^ classmethodr~r@rrrrr%r%r%r2r{}s  ) $<r{c@seZdZdZd&ddZed'ddZeddZej d dZed d Z ed d Z eddZ eddZ ddZddZddZddZddZddZddZd(d d!Zd)d"d#Zd$d%ZdS)*r'zThis finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. NcCsP|dkrt}|pttt}||_||_||_||_||_||_t|_ dS)a This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. N) rmr rpr5_candidate_prefsr7_link_collectorr9format_control _logged_links)r;link_collectorr>r?rcandidate_prefsr0r%r%r2r@VszPackageFinder.__init__cCs8|dkrt}t|j|jd}|||||j|j|jdS)afCreate a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. N)rorn)rrr>r?rr0)rrmrornr?rr0)r}rZselection_prefsr>rr%r%r2r~~szPackageFinder.createcCs|jjSrbr search_scoperxr%r%r2rszPackageFinder.search_scopecCs ||j_dSrbr)r;rr%r%r2rscCs|jjSrb)r find_linksrxr%r%r2rszPackageFinder.find_linkscCs|jjSrb)r index_urlsrxr%r%r2rszPackageFinder.index_urlsccs|jjjD]}t|Vq dSrb)rZsessionZpip_trusted_originsr)r;Z host_portr%r%r2 trusted_hostsszPackageFinder.trusted_hostscCs|jjSrbrrnrxr%r%r2rnsz#PackageFinder.allow_all_prereleasescCs d|j_dS)NTrrxr%r%r2set_allow_all_prereleasessz'PackageFinder.set_allow_all_prereleasescCs.t|}|j|}t||||j|j|jdS)N)r:r<r=r>r?r0)rrZget_allowed_formatsr4r9r5r7)r;r:r<r=r%r%r2make_link_evaluators z!PackageFinder.make_link_evaluatorcCsPgg}}t}|D]2}||kr|||jr<||q||q||S)z Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates )rpaddrHrj)r;linksZeggsZno_eggsseenr/r%r%r2 _sort_linkss    zPackageFinder._sort_linkscCs(||jkr$td|||j|dS)NzSkipping link: %s: %s)rr*r+r)r;r/rVr%r%r2_log_skipped_links zPackageFinder._log_skipped_linkcCs<||\}}|s(|r$|j||ddSt|j|t|dS)z If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. )rVN)Zprojectr/r1)rZrr r:r.)r;link_evaluatorr/Z is_candidateresultr%r%r2get_install_candidatesz#PackageFinder.get_install_candidatecCs6g}||D]"}|||}|dk r||q|S)zU Convert links that are candidates to InstallationCandidate objects. N)rrrj)r;rrrkr/rer%r%r2evaluate_linkss   zPackageFinder.evaluate_linksc Cs|j|}||}|j||jd}g}|jD]>\}}td|t |j||d}| |W5QRXq4|j||j d} | r| j ddtdd dd| D| ||S) aFind all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. )rzAnalyzing links from page %sT)reversezLocal files found: %srBcSsg|]}t|jjqSr%)rr/Zurlrcr%r%r2r2sz5PackageFinder.find_all_candidates..)rZ collect_linksrrrZpagesitemsr*r+rextendfilessortr,) r;r:Zcollected_linksrZfind_links_versionsZ page_versionsZpage_urlZ page_linksZ new_versionsZ file_versionsr%r%r2find_all_candidates s8      z!PackageFinder.find_all_candidatescCs"|j}tj||j|j|j||dS)z3Create a CandidateEvaluator object to use. )r:r>rornr|ra)rr{r~r9rorn)r;r:r|rarr%r%r2make_candidate_evaluator;s z&PackageFinder.make_candidate_evaluatorcCs$||}|j|||d}||S)aFind matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. )r:r|ra)rrr)r;r:r|rarkZcandidate_evaluatorr%r%r2find_best_candidateNs z!PackageFinder.find_best_candidatec Cs|jdd}|j|j|j|d}|j}d}|jdk r@t|jj}dd}|dkrz|dkrzt d||| t d|d}|r|dks|j|krd }|s|dk r|rt d |nt d ||jdS|rt d ||| tt d |j|| |jS)zTry to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a Link if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise F)Ztrust_internet)r|raNcSs dtdd|DtdpdS)NrBcSsh|]}t|jqSr%rrr%r%r2r}szKPackageFinder.find_requirement.._format_versions..rZnone)r,sorted parse_version)Z cand_iterr%r%r2_format_versionsws  z8PackageFinder.find_requirement.._format_versionszNCould not find a version that satisfies the requirement %s (from versions: %s)z%No matching distribution found for %sTzLExisting installed version (%s) is most up-to-date and satisfies requirementzUExisting installed version (%s) satisfies requirement (most up-to-date version is %s)z=Installed version (%s) is most up-to-date (past versions: %s)z)Using version %s (newest of versions: %s))rarrMr|rtZ satisfied_byrr1r*Zcriticalryrr+rzrr/) r;ZreqZupgraderaZbest_candidate_resultrtZinstalled_versionrZbest_installedr%r%r2find_requirementesh        zPackageFinder.find_requirement)NNN)N)NN)NN)r[r\r]r^r@rr~propertyrsetterrrrrnrrrrrrrrrrr%r%r%r2r'OsD  (         1  cCsLt|D].\}}|dkrqt|d||kr|Sqtd||dS)aFind the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 -Nz{} does not match {}) enumerater ValueErrorrG)fragmentr<irr%r%r2_find_name_version_seps  rcCsBzt||d}Wntk r(YdSX||d}|s>dS|S)zParse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. rDN)rr)rr<Z version_startr1r%r%r2rPs  rP)F)Qr^Z __future__rZloggingr_Zpip._vendor.packagingrZpip._vendor.packaging.utilsrZpip._vendor.packaging.versionrrZpip._internal.exceptionsrrrr Zpip._internal.models.candidater Z#pip._internal.models.format_controlr Zpip._internal.models.linkr Z$pip._internal.models.selection_prefsr Z"pip._internal.models.target_pythonrZpip._internal.utils.filetypesrZpip._internal.utils.loggingrZpip._internal.utils.miscrZpip._internal.utils.packagingrZpip._internal.utils.typingrZpip._internal.utils.unpackingrZpip._internal.utils.urlsrZpip._internal.wheelrtypingrrrrrrrrrZpip._internal.collectorr Z!pip._internal.models.search_scoper!Zpip._internal.reqr"Zpip._internal.pep425tagsr#Zpip._internal.utils.hashesr$rr.ZBuildTagZCandidateSortingKey__all__Z getLoggerr[r*r3objectr4rlrmr&r{r'rrPr%r%r%r2s^                 (         + K-ShPK]2g *__pycache__/locations.cpython-38.opt-1.pycnu[U .e&@sdZddlmZddlZddlZddlZddlZddlZddlZddl mZ ddl m Z ddl mZddlmZddlmZdd lmZerdd lmZmZmZmZmZed Zd d ZddZedZ e!"dkre #Z z e$Z%Wne&k r ej'Z%YnXer`ej()ej*dZ+ej()e%dZ,ej(-e+sej()ej*dZ+ej()e%dZ,nJej()ej*dZ+ej()e%dZ,ejdddkrej*dddkrdZ+dddZ.dS)z7Locations where we look for configs, install stuff, etc)absolute_importN) sysconfig) SCHEME_KEYS)appdirs)WINDOWS)MYPY_CHECK_RUNNING)running_under_virtualenv)AnyUnionDictListOptionalZpipcCs djtjS)ze Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". z{}.{})formatsys version_inforr;/usr/lib/python3.8/site-packages/pip/_internal/locations.pyget_major_minor_versionsrcCsZtrtjtjd}n6ztjtd}Wntk rLtdYnXtj |S)Nsrcz=The folder you are executing pip from can no longer be found.) rospathjoinrprefixgetcwdOSErrorexitabspath)Z src_prefixrrrget_src_prefix(s rpurelibZpypyZScriptsbindarwinz/System/Library/z/usr/local/binFcCsHddlm}i}|r ddgi}ni}d|i} | ||| } | | jddd} |p\| j| _|sh|rnd | _|pv| j| _|p| j| _|p| j| _| t D]} t | d | || <qd | dkr|t | j| jd trDtjtjd ddt||d<|dk rDtjtj|dd} tj|| dd|d<|S)z+ Return a distutils install scheme r) DistributionZ script_argsz --no-user-cfgnameZinstallT)ZcreateZinstall_ install_lib)rZplatlibZincludesitezpython{}ZheadersN)Zdistutils.distr#updateZparse_config_filesZget_command_objuserrhomerootZfinalize_optionsrgetattrZget_option_dictdictr&rrrrrrr splitdriver)Z dist_namer*r+r,isolatedrr#ZschemeZextra_dist_argsZ dist_argsdikeyZ path_no_driverrrdistutils_scheme[sP           r4)FNNFN)/__doc__Z __future__rrZos.pathplatformr'rrZ distutilsZdistutils_sysconfigZdistutils.command.installrZpip._internal.utilsrZpip._internal.utils.compatrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrtypingr r r r r Zuser_cache_dirZUSER_CACHE_DIRrrZget_pathZ site_packagesZpython_implementationlowerZget_python_libgetusersitepackages user_siteAttributeError USER_SITErrrZbin_pyZbin_userexistsr4rrrrsN            (PK]$0Umm __pycache__/wheel.cpython-38.pycnu[U .eH@s4dZddlmZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lm Z m!Z!m"Z"dd l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-m.Z.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>ddl?m@Z@e:rddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMddlNmOZOddlPmQZQddlRmSZSddlTmUZUddlVmWZWeGeXdfZYeLeQgeZfZ[d Z\e]e^Z_d!d"Z`dXd$d%ZadYd&d'Zbd(d)Zcd*d+Zdd,d-Zee fd.e jgZhd/d0Zid1d2Zjd3d4Zkd5d6Zld7d8ZmGd9d:d:enZod;d<ZpGd=d>d>eZqdZdAdBZrdCdDZsdEdFZtdGdHZuGdIdJdJevZwe fdKe jxfdLdMZydNdOZzdPdQZ{dRdSZ|dTdUZ}GdVdWdWevZ~dS)[zH Support for installing and building the "wheel" binary package format. )absolute_importN)urlsafe_b64encode)Parser) pkg_resources) ScriptMaker)get_export_entry)canonicalize_name)StringIO) pep425tags)InstallationErrorInvalidWheelFilenameUnsupportedWheel)distutils_schemeget_major_minor_version)Link) indent_log)has_delete_marker_file)captured_stdout ensure_dir read_chunks)make_setuptools_shim_args) LOG_DIVIDERcall_subprocessformat_command_argsrunner_with_spinner_message) TempDirectory)MYPY_CHECK_RUNNING) open_spinner) unpack_file) path_to_url) DictListOptionalSequenceMappingTupleIOTextAnyIterableCallableSet) Requirement)InstallRequirement)RequirementPreparer) WheelCache) Pep425Tag.)rcCstj||tjjdS)N/)ospathrelpathreplacesep)srcpr:7/usr/lib/python3.8/site-packages/pip/_internal/wheel.pynormpathOsr<c CsRt}d}t|d.}t||dD]}|t|7}||q$W5QRX||fS)z5Return (hash, length) for path using hashlib.sha256()rrb)size)hashlibZsha256openrlenupdate)r4 blocksizehlengthfblockr:r:r; hash_fileSs  rIcCs6t||\}}dt|dd}|t|fS)z?Return (encoded_digest, length) for path using hashlib.sha256()zsha256=latin1=)rIrdigestdecoderstripstr)r4rDrErFrLr:r:r;rehash_srPcCs6tjddkri}d}n ddi}d}t|||f|S)Nrbnewline)sys version_inforA)namemodenlbinr:r:r; open_for_csvjs r[cCs|d}||d<d|S)zBReplace the Python tag in a wheel file name with a new value. -)splitjoin)Z wheelnameZnew_tagpartsr:r:r;replace_python_tagus rac Cstj|rt|dR}|}|ds8W5QRdStjt }d|tj d}| }W5QRXt|d}| || |W5QRXdSdS) zLReplace #!python with #!/path/to/python Return True if file was changed.r>s#!pythonFs#!asciiwbTN) r3r4isfilerAreadline startswithrU executableencodegetfilesystemencodinglinesepreadwrite)r4Zscript firstlineZexenamerestr:r:r; fix_script~s     rozX^(?P(?P.+?)(-(?P.+?))?) \.dist-info$c Cs|dd}t|D]p}t|}|r|d|krttj||d6}|D]*}| }|dkrPW5QRdSqPW5QRXqdS)zP Return True if the extracted wheel in wheeldir should go into purelib. r\_rWWHEELzroot-is-purelib: trueTF) r6r3listdir dist_info_rematchgrouprAr4r_lowerrN)rWwheeldirZ name_foldeditemrtwheelliner:r:r;root_is_purelibs    r{c stj|siifSt|8}t}|D]}|||dq(|dW5QRXtj |}| di}| di}ddt fdd| D}t fd d| D}||fS) N rZconsole_scriptsZ gui_scriptscSst|dddS)zRget the string representation of EntryPoint, remove space and split on '=' rTrK)rOr6r^)sr:r:r; _split_epsz"get_entrypoints.._split_epc3s|]}|VqdSNr:.0vrr:r; sz"get_entrypoints..c3s|]}|VqdSrr:rrr:r;rs)r3r4existsrAr rlstripseekrZ EntryPointZ parse_mapgetdictvalues)filenamefpdatarzZ entry_pointsconsoleguir:rr;get_entrypointss      rc sJ|sdStt}|D]*}tj|}tj|}|||qddtj dd tj D tj tjtjfdd|D}|sdSg}|D]b\}}t|}t|dkrd |d } n$d d |dd d|d } | d| |qd} t|dkr0| | dn| | dd|S)zDetermine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. NcSs g|]}tj|tjqSr:)r3r4normcaserNr7)rir:r:r; sz5message_about_scripts_not_on_PATH..PATHrTcs&i|]\}}tj|kr||qSr:)r3r4r)r parent_dirscriptsZ not_warn_dirsr:r; sz5message_about_scripts_not_on_PATH..r1z script {} isrzscripts {} are, z and z.The {} installed in '{}' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriesr|) collections defaultdictsetr3r4dirnamebasenameaddenvironrr^pathsepappendrrUrgitemssortedrBformatr_) rZgrouped_by_dirdestfilerZ script_nameZwarn_for msg_linesZ dir_scriptsZsorted_scriptsZ start_textZ last_line_fmtr:rr;!message_about_scripts_not_on_PATHsH     rcCst|dddS)a; Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. cSstdd|DS)Ncss|]}t|VqdSr)rO)rxr:r:r;rsz3sorted_outrows....)tuple)rowr:r:r;z sorted_outrows..)key)r)outrowsr:r:r;sorted_outrowssrc Csg}|D]v}t|dkr(td|t|}|d}|||}||d<||krpt|\} } | |d<| |d<|t|q|D]*} t| \} } |t | || t | fq|D]} ||| ddfq|S)z_ :param installed: A map from archive RECORD path to installation RECORD path. rQz,RECORD line has more than three elements: {}rr1rT) rBloggerwarningrlistpoprPrrr<rO) Z old_csv_rows installedchanged generatedlib_dirZinstalled_rowsrZold_pathnew_pathrLrFrGr:r:r;get_csv_rows_for_installeds*     rc@s eZdZdS)MissingCallableSuffixN)__name__ __module__ __qualname__r:r:r:r;r=srcCs*t|}|dk r&|jdkr&tt|dSr)rsuffixrrO) specificationentryr:r:r;_raise_for_invalid_entrypointAsrcseZdZdfdd ZZS)PipScriptMakerNcst|tt|||Sr)rsuperrmake)selfrZoptions __class__r:r;rHszPipScriptMaker.make)N)rrrr __classcell__r:r:rr;rGsrFTc - s\|st|||||| d}t| r,|dn|dgg tjjtjj} itg} |rt4} t t dt j | dddW5QRXW5QRXt | d. fdd d/fd d }|| dstd tjdd}t|\fdd}D]j}d }d }ttj |D]F}d }|dkr`t}|}tj ||} ||}|| |d||dqFq&td |d}d|_dh|_d|_g}dd }|rDdtjkr|d|tjdddkr|dtjd|f|dt|fddD}|D] }|=q6dd }|rdtjkrp|d||dt|fddD}|D] }|=q| d d!!Dd"d!D}g}z.|"|}| || |"|d#diWn>t#k r>}z|j$d} t%d$&| W5d }~XYnX| rbt'|}!|!d k rbt (|!tjdd%}"tjdd&}#t)|#d'}$|$*d(W5QRXt+,|#|"| |"tjdd)}%tjdd*}&t-|%d+\}'t-|&d,F}(t./|'})t0|)| d-}*t.1|(}+t2|*D]},|+3|,q&W5QRXW5QRXt+,|&|%d S)0zInstall a wheel)userhomerootisolatedprefixZpurelibZplatlibignoreT)forcequietFcs.t|}t|}||<|r*|dS)z6Map archive RECORD paths to installation RECORD paths.N)r<r)srcfilerZmodifiedZoldpathnewpath)rrrrwr:r;record_installeds   z*move_wheel_files..record_installedNcst|t|D]\}}}|t|dtjj}tj||} |rf|tjjdd drfq|D]} tj||| } |r|dkr| dr | qjqj|rj| drjt |  t j rjrtd| dd | qj|D]} |r|| rqtj|| } tj||| }t| tj|rFt|t| |t| }ttdr|t||j|jft| tjrt| }|jtjBtjBtjB}t||d }|r||}| ||qqdS) Nr1rz.datarTz .dist-infoz!Multiple .dist-info directories: rutimeF)rr3walkrBlstripr4r7r_r^endswithrrrfrWAssertionErrorrunlinkshutilZcopyfilestathasattrrst_atimest_mtimeaccessX_OKst_modeS_IXUSRS_IXGRPS_IXOTHchmod)sourcedestZis_basefixerfilterdirZsubdirsfilesZbasedirZdestdirr~Z destsubdirrGrrstZ permissionsr) data_dirsinfo_dirrreqr:r;clobbers^         z!move_wheel_files..clobberz!%s .dist-info directory not foundrzentry_points.txtcsh|dr|dd}n<|dr8|dd}n |drT|dd}n|}|kpf|kS)Nz.exez -script.pyiz.pya)rvr)rWZ matchname)rrr:r;is_entrypoint_wrappersz/move_wheel_files..is_entrypoint_wrapperr)rrrTZpipZENSUREPIP_OPTIONSzpip = Z altinstallz pip%s = %scSsg|]}td|r|qS)zpip(\d(\.\d)?)?$rertrkr:r:r;r0s z$move_wheel_files..Z easy_installzeasy_install = zeasy_install-%s = %scSsg|]}td|r|qS)zeasy_install(-\d\.\d)?$rrr:r:r;r@s css|]}d|VqdS)%s = %sNr:rZkvr:r:r;rGsz#move_wheel_files..cSsg|] }d|qS)rr:rr:r:r;rKsrzInvalid script entry point: {} for req: {} - A callable suffix is required. Cf https://packaging.python.org/en/latest/distributing.html#console-scripts for more information.Z INSTALLERz INSTALLER.piprcspip ZRECORDz RECORD.piprzw+)rrrr)F)NN)4rr{rNr3r4r7rrwarningscatch_warningsfilterwarnings compileall compile_dirrdebuggetvaluerr_rrrrorrZvariantsZset_moderrrrrUrVrextendrZ make_multiplerargsr rrrrArlrmover[csvreaderrwriterrZwriterow)-rWrrwrrrZ pycompileZschemerrZwarn_script_locationrrstdoutrZep_filerZdatadirrrZsubdirrZmakerZscripts_to_generateZ pip_scriptZpip_eprZeasy_install_scriptZeasy_install_epZgui_scripts_to_generateZgenerated_console_scriptsermsgZ installerZtemp_installerZinstaller_filerecordZ temp_recordZ record_inZ record_outr rr rr:) rrrrrrrrrrwr;move_wheel_filesMs    $F   #                     "rcCsrzVddtd|Dd}|d}t|}|d}ttt| d}|WSt k rlYdSXdS)z Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it. cSsg|]}|qSr:r:)rdr:r:r;rsz!wheel_version..Nrrqz Wheel-Version.) rZ find_on_pathZ get_metadatarZparsestrrrmapintr^ Exception) source_dirZdistZ wheel_dataversionr:r:r; wheel_versions   rcCsb|std||dtdkr>td|dtt|fn |tkr^tddtt|dS)a Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given z(%s is in an unsupported or invalid wheelrzB%s's Wheel-Version (%s) is not compatible with this version of piprz*Installing from a newer Wheel-Version (%s)N)r VERSION_COMPATIBLEr_rrOrr)rrWr:r:r;check_compatibilitysrcCs d|S)z Format three tags in the form "--". :param file_tag: A 3-tuple of tags (python_tag, abi_tag, platform_tag). r\)r_)Zfile_tagr:r:r; format_tagsrc@s>eZdZdZedejZddZddZ ddZ d d Z d S) Wheelz A wheel filez^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$csj|}|std||_|ddd_|ddd_|d_|d d_ |d  d_ |d  d_ fd d j D_ d S)zX :raises InvalidWheelFilename: when the filename is invalid for a wheel z!%s is not a valid wheel filename.rWrpr\ZverbuildZpyverrZabiZplatcs.h|]&}jD]}jD]}|||fqqqSr:)abisplats)rryzrr:r; s z!Wheel.__init__..N) wheel_file_rertr rrur6rWrZ build_tagr^Z pyversionsrr file_tags)rrZ wheel_infor:r!r;__init__s   zWheel.__init__cCstdd|jDS)zF Return the wheel's tags as a sorted list of strings. css|]}t|VqdSr)rrtagr:r:r;rsz0Wheel.get_formatted_file_tags..)rr$r!r:r:r;get_formatted_file_tagsszWheel.get_formatted_file_tagscstfdd|jDS)a Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. c3s |]}|kr|VqdSr)indexr&tagsr:r;rsz*Wheel.support_index_min..)minr$rr+r:r*r;support_index_minszWheel.support_index_mincCs|j| S)z Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. )r$ isdisjointr-r:r:r; supportedszWheel.supportedN) rrr__doc__rcompileVERBOSEr#r%r(r.r0r:r:r:r;rsrz([a-z0-9_.]+)-([a-z0-9_.!+-]+)cCst||S)zjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 )boolsearch)r~Z _egg_info_rer:r:r;_contains_egg_infosr6cCs|jr dS|jr&|s"td|jdS|s.dS|js:|js>dS||sXtd|jdS|jrj|jjrjdS|j}| \}}|rt |rdSdS)a[ Return whether to build an InstallRequirement object using the ephemeral cache. :param cache_available: whether a cache directory is available for the should_unpack=True case. :return: True or False to build the requirement with ephem_cache=True or False, respectively; or None not to build the requirement. Nz(Skipping %s, due to already being wheel.FzCSkipping wheel build for %s, due to binaries being disabled for it.T) Z constraintis_wheelrinforWZeditablerlinkZis_vcssplitextr6)r should_unpackcache_availablecheck_binary_allowedr9baseZextr:r:r;should_use_ephemeral_cache s4   r?cCs^t|}d|}|s |d7}n:ttjkr8|d7}n"|dsJ|d7}|d|t7}|S)z1 Format command information for logging. zCommand arguments: {} zCommand output: Nonez'Command output: [use --verbose to show]r|zCommand output: {}{})rrrZgetEffectiveLevelloggingDEBUGrr) command_argscommand_outputZ command_desctextr:r:r;format_command_resultGs    rEcCsxt|}|s4d|j}|t||7}t|dSt|dkrfd|j|}|t||7}t|tj ||dS)zH Return the path to the wheel in the temporary build directory. z1Legacy build of wheel for {!r} created no files. Nr1zZLegacy build of wheel for {!r} created more than one file. Filenames (choosing first): {} r) rrrWrErrrBr3r4r_)namestemp_dirrrBrCr r:r:r;get_legacy_build_wheel_path^s$    rHcCsdS)NTr:)rpr:r:r; _always_true~srIc@s\eZdZdZdddZdddZddd Zd d Zdd d ZdddZ ddZ dddZ dS) WheelBuilderz#Build wheels from a RequirementSet.NFcCsD|dkr t}||_||_|j|_|p&g|_|p0g|_||_||_dSr) rIpreparer wheel_cacheZwheel_download_dir _wheel_dir build_optionsglobal_optionsr=no_clean)rrKrLrNrOr=rPr:r:r;r%s   zWheelBuilder.__init__c Cs.|j|j|||dW5QRSQRXdS)ziBuild one wheel. :return: The filename of the built wheel, or None if the build failed.  python_tagN)Z build_env_build_one_inside_env)rr output_dirrRr:r:r; _build_oneszWheelBuilder._build_onec Cstdd}|jr|j}n|j}|||j|d}|dk rtj|}tj||}zNt|\} } t ||t d|j || | t d||WW5QRStk rYnX||W5QRdSQRXdS)Nry)ZkindrQz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %s)rZ use_pep517_build_one_pep517_build_one_legacyr4r3rr_rIrrrr8rWZ hexdigestr _clean_one) rrrTrRrGZbuilder wheel_path wheel_nameZ dest_pathZ wheel_hashrFr:r:r;rSs.      z"WheelBuilder._build_one_inside_envcCst|j|jddS)NT)rOZunbuffered_output)rZ setup_py_pathrO)rrr:r:r;_base_setup_argss zWheelBuilder._base_setup_argsc Cs|jdk st|jr*td|jfdSz~td|td|j}|j }| ||j ||jd}W5QRX|rt ||}t t j||t j|||}Wn$tk rtd|jYdSXt j||S)zBuild one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. NzGCannot build wheel for %s using PEP 517 when --build-options is presentDestination directory: %szBuilding wheel for {} (PEP 517))metadata_directoryFailed building wheel for %s)r]rrNrerrorrWrrrZpep517_backendZsubprocess_runnerZ build_wheelrar3renamer4r_r)rrtempdrRZrunnerZbackendrZnew_namer:r:r;rVs8      zWheelBuilder._build_one_pep517c Cs||}d|jf}t|}td||dd|g|j}|dk rT|d|g7}zt||j|d}Wn8tk r| dt d |jYW5QRdSXt |} t | ||||d } | W5QRSQRXdS) zBuild one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. z Building wheel for %s (setup.py)r\Z bdist_wheelz-dNz --python-tag)cwdspinnerr_r^)rFrGrrBrC)r[rWrrrrNrZunpacked_source_directoryrZfinishr_r3rrrH) rrrarR base_argsZ spin_messagerdZ wheel_argsoutputrFrYr:r:r;rWs8         zWheelBuilder._build_one_legacycCsb||}td|j|ddg}zt||jdWdStk r\td|jYdSXdS)NzRunning setup.py clean for %sZcleanz--all)rcTz Failed cleaning build dir for %sF)r[rr8rWrrrr_)rrreZ clean_argsr:r:r;rXs  zWheelBuilder._clean_onec Cs|r |jr|s|jstg}t|jj}|D]\}t||||jd}|dkrLq,|rt|rd|j|j}qz|j |j}n|j}| ||fq,|sgSt dd dd|Dd}|rtj}tgg} } |D]\}}z t|WnFtk r.} z&t d|j| | |WYqW5d} ~ XYnX|j|||d} | r| ||r|jrrt|jsrtd |||jj|_tt| |_|jjstt|jj |jq| |qW5QRX| rt d d d d| D| rt d d dd| D| S)aBuild wheels. :param should_unpack: If True, after building the wheel, unpack it and replace the sdist with the unpacked version in preparation for installation. :return: True if all the wheels built correctly. )r;r<r=Nz*Building wheels for collected packages: %srcSsg|]\}}|jqSr:rW)rrrpr:r:r;r\sz&WheelBuilder.build..z Building wheel for %s failed: %srQzbad source dir - missing markerzSuccessfully built %sr}cSsg|] }|jqSr:rgrrr:r:r;rszFailed to build %scSsg|] }|jqSr:rgrhr:r:r;rs)!rMrr4rL cache_dirr?r=Zget_ephem_path_for_linkr9Zget_path_for_linkrrr8r_r Zimplementation_tagrrOSErrorrrWrUrrZremove_temporary_sourceZensure_build_locationrKZ build_dirrrr7rZ file_path) rZ requirementsr;Zbuildsetr<rZ ephem_cacherTrRZ build_successZ build_failurer Z wheel_filer:r:r;r#s       zWheelBuilder.build)NNNF)N)N)N)N)F) rrrr1r%rUrSr[rVrWrXrr:r:r:r;rJs   ' %rJ)r=)r=)FNNTNFNT)r1Z __future__rrrrr@r@Zos.pathr3rrrrUrbase64rZ email.parserrZ pip._vendorrZpip._vendor.distlib.scriptsrZpip._vendor.distlib.utilrZpip._vendor.packaging.utilsrZpip._vendor.sixr Z pip._internalr Zpip._internal.exceptionsr r r Zpip._internal.locationsrrZpip._internal.models.linkrZpip._internal.utils.loggingrZ pip._internal.utils.marker_filesrZpip._internal.utils.miscrrrZ$pip._internal.utils.setuptools_buildrZpip._internal.utils.subprocessrrrrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.uirZpip._internal.utils.unpackingrZpip._internal.utils.urlsrtypingr r!r"r#r$r%r&r'r(r)r*r+Z"pip._vendor.packaging.requirementsr,Zpip._internal.req.req_installr-Z pip._internal.operations.preparer.Zpip._internal.cacher/Zpip._internal.pep425tagsr0rOZInstalledCSVRowr4ZBinaryAllowedPredicaterZ getLoggerrrr<rIrPr[raror2r3rsr{rrrrrrrrrrrrobjectrIr6r?rErHrIrJr:r:r:r;s                  8           =$  4 J : PK] 4_\(\(/__pycache__/legacy_resolve.cpython-38.opt-1.pycnu[U .eRC@sFdZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z m Z mZddlmZddlmZmZmZmZdd lmZmZdd lmZerdd lmZmZmZmZm Z m!Z!dd l"m#Z#dd l$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ee0e-ge-fZ1e2e3Z4dddZ5Gddde6Z7dS)ayDependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) N) defaultdict)chain) specifiers)BestVersionAlreadyInstalledDistributionNotFound HashError HashErrorsUnsupportedPythonVersion) indent_log)dist_in_install_pathdist_in_usersite ensure_dirnormalize_version_info)check_requires_pythonget_requires_python)MYPY_CHECK_RUNNING)Callable DefaultDictListOptionalSetTuple) pkg_resources)AbstractDistribution) PipSession) PackageFinder)RequirementPreparer)InstallRequirement)RequirementSetFc Cst|}zt||d}Wn:tjk rR}ztd|j|WYdSd}~XYnX|r\dSdtt |}|rt d|j||dSt d |j||dS)a Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. ) version_infoz-Package %r has an invalid Requires-Python: %sN.zBIgnoring failed Requires-Python check for package %r: %s not in %rz8Package {!r} requires a different Python: {} not in {!r}) rrrZInvalidSpecifierloggerwarningZ project_namejoinmapstrdebugr format)distrignore_requires_pythonZrequires_pythonZ is_compatibleexcversionr,@/usr/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py_check_dist_requires_python>s> r.csdeZdZdZdddhZdfdd Zdd Zd d Zd d ZddZ ddZ ddZ ddZ Z S)ResolverzResolves which packages need to be installed/uninstalled to perform the requested operation without breaking the requirements of any package. eageronly-if-neededto-satisfy-onlyNc stt|| dkr&tjdd} nt| } | |_||_||_||_ d|_ | |_ | |_ ||_ ||_||_||_||_tt|_dS)N)superr/__init__sysrr_py_version_infopreparerfindersessionrequire_hashesupgrade_strategyforce_reinstallignore_dependenciesignore_installedr) use_user_site_make_install_reqrlist_discovered_dependencies) selfr8r:r9Zmake_install_reqr@r>r?r)r=r<Zpy_version_info __class__r,r-r5us$zResolver.__init__c Cs|jjrt|jj|jt|j}|jp>tdd|D|_|j j }| }|r`t |g}t}t||D]N}z||||Wqttk r}z||_||W5d}~XYqtXqt|r|dS)aResolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. css|] }|jVqdSN)Zhas_hash_options).0reqr,r,r- sz#Resolver.resolve..N)r8Zwheel_download_dirr Zunnamed_requirementsrB requirementsvaluesr;anyr9 search_scopeZget_formatted_locationsr!inforrextend _resolve_onerrIappend) rDrequirement_setZ root_reqsrNZ locationsZdiscovered_reqsZ hash_errorsrIr*r,r,r-resolves2     zResolver.resolvecCs&|jdkrdS|jdkrdS|jSdS)Nr2Fr0T)r< is_directrDrIr,r,r-_is_upgrade_alloweds   zResolver._is_upgrade_allowedcCs,|jrt|jr"t|jr"|j|_d|_dS)z4 Set a requirement to be installed. N)r@r satisfied_byr Zconflicts_withrVr,r,r-_set_req_to_reinstallszResolver._set_req_to_reinstallcCs|jr dS||j|js dS|jr4||dS||sP|jdkrLdSdS|jsz|j j |ddWn(t k rYdSt k rYnX||dS)aCheck if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. Nr1z#already satisfied, skipping upgradezalready satisfiedT)Zupgradezalready up-to-date) r?check_if_existsr@rXr=rYrWr<linkr9Zfind_requirementrr)rDreq_to_installr,r,r-_check_skip_installeds*     zResolver._check_skip_installedcCs|jr|j||j|j|jS||}|jr@|j||j|S| |}| |j||j|j ||j |j|j}|j s||j|jr|jdkp|jp|j p|jjdk}|r||n td||S)zzTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. r2filez.add_reqN)rbz!Installing extra requirements: %r,z"%s does not provide the extra '%s')rc) constraintZpreparedZreqs_to_cleanuprRraZget_pkg_resources_distributionr.r7r)r Zhas_requirementrdrUrer>Zextrasr!r&r#sortedsetr"Zrequiresr_rXZsuccessfully_downloaded) rDrSr\r`r(rhZmissing_requestedZmissingZavailable_requestedrfr,rgr-rQ[sV     zResolver._resolve_onecs8gtfdd|jD] }|q&S)zCreate the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. csN|js|krdS|jrdS|j|jD] }|q2|dSrG)rXrjaddrCrdrR)rIZdeporderZ ordered_reqsschedulerDr,r-rps  z1Resolver.get_installation_order..schedule)rlrKrL)rDZreq_setZ install_reqr,rnr-get_installation_orders   zResolver.get_installation_order)N)__name__ __module__ __qualname____doc__Z_allowed_strategiesr5rTrWrYr]rarQrq __classcell__r,r,rEr-r/ns +3  5<Zr/)F)8ruZloggingr6 collectionsr itertoolsrZpip._vendor.packagingrZpip._internal.exceptionsrrrrr Zpip._internal.utils.loggingr Zpip._internal.utils.miscr r r rZpip._internal.utils.packagingrrZpip._internal.utils.typingrtypingrrrrrrZ pip._vendorrZpip._internal.distributionsrZpip._internal.network.sessionrZpip._internal.indexrZ pip._internal.operations.preparerZpip._internal.req.req_installrZpip._internal.req.req_setrr%ZInstallRequirementProviderZ getLoggerrrr!r.objectr/r,r,r,r-s4                0PK]ll&__pycache__/wheel.cpython-38.opt-1.pycnu[U .eH@s4dZddlmZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lm Z m!Z!m"Z"dd l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-m.Z.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>ddl?m@Z@e:rddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMddlNmOZOddlPmQZQddlRmSZSddlTmUZUddlVmWZWeGeXdfZYeLeQgeZfZ[d Z\e]e^Z_d!d"Z`dXd$d%ZadYd&d'Zbd(d)Zcd*d+Zdd,d-Zee fd.e jgZhd/d0Zid1d2Zjd3d4Zkd5d6Zld7d8ZmGd9d:d:enZod;d<ZpGd=d>d>eZqdZdAdBZrdCdDZsdEdFZtdGdHZuGdIdJdJevZwe fdKe jxfdLdMZydNdOZzdPdQZ{dRdSZ|dTdUZ}GdVdWdWevZ~dS)[zH Support for installing and building the "wheel" binary package format. )absolute_importN)urlsafe_b64encode)Parser) pkg_resources) ScriptMaker)get_export_entry)canonicalize_name)StringIO) pep425tags)InstallationErrorInvalidWheelFilenameUnsupportedWheel)distutils_schemeget_major_minor_version)Link) indent_log)has_delete_marker_file)captured_stdout ensure_dir read_chunks)make_setuptools_shim_args) LOG_DIVIDERcall_subprocessformat_command_argsrunner_with_spinner_message) TempDirectory)MYPY_CHECK_RUNNING) open_spinner) unpack_file) path_to_url) DictListOptionalSequenceMappingTupleIOTextAnyIterableCallableSet) Requirement)InstallRequirement)RequirementPreparer) WheelCache) Pep425Tag.)rcCstj||tjjdS)N/)ospathrelpathreplacesep)srcpr:7/usr/lib/python3.8/site-packages/pip/_internal/wheel.pynormpathOsr<c CsRt}d}t|d.}t||dD]}|t|7}||q$W5QRX||fS)z5Return (hash, length) for path using hashlib.sha256()rrb)size)hashlibZsha256openrlenupdate)r4 blocksizehlengthfblockr:r:r; hash_fileSs  rIcCs6t||\}}dt|dd}|t|fS)z?Return (encoded_digest, length) for path using hashlib.sha256()zsha256=latin1=)rIrdigestdecoderstripstr)r4rDrErFrLr:r:r;rehash_srPcCs6tjddkri}d}n ddi}d}t|||f|S)Nrbnewline)sys version_inforA)namemodenlbinr:r:r; open_for_csvjs r[cCs|d}||d<d|S)zBReplace the Python tag in a wheel file name with a new value. -)splitjoin)Z wheelnameZnew_tagpartsr:r:r;replace_python_tagus rac Cstj|rt|dR}|}|ds8W5QRdStjt }d|tj d}| }W5QRXt|d}| || |W5QRXdSdS) zLReplace #!python with #!/path/to/python Return True if file was changed.r>s#!pythonFs#!asciiwbTN) r3r4isfilerAreadline startswithrU executableencodegetfilesystemencodinglinesepreadwrite)r4Zscript firstlineZexenamerestr:r:r; fix_script~s     rozX^(?P(?P.+?)(-(?P.+?))?) \.dist-info$c Cs|dd}t|D]p}t|}|r|d|krttj||d6}|D]*}| }|dkrPW5QRdSqPW5QRXqdS)zP Return True if the extracted wheel in wheeldir should go into purelib. r\_rWWHEELzroot-is-purelib: trueTF) r6r3listdir dist_info_rematchgrouprAr4r_lowerrN)rWwheeldirZ name_foldeditemrtwheelliner:r:r;root_is_purelibs    r{c stj|siifSt|8}t}|D]}|||dq(|dW5QRXtj |}| di}| di}ddt fdd| D}t fd d| D}||fS) N rZconsole_scriptsZ gui_scriptscSst|dddS)zRget the string representation of EntryPoint, remove space and split on '=' rTrK)rOr6r^)sr:r:r; _split_epsz"get_entrypoints.._split_epc3s|]}|VqdSNr:.0vrr:r; sz"get_entrypoints..c3s|]}|VqdSrr:rrr:r;rs)r3r4existsrAr rlstripseekrZ EntryPointZ parse_mapgetdictvalues)filenamefpdatarzZ entry_pointsconsoleguir:rr;get_entrypointss      rc sJ|sdStt}|D]*}tj|}tj|}|||qddtj dd tj D tj tjtjfdd|D}|sdSg}|D]b\}}t|}t|dkrd |d } n$d d |dd d|d } | d| |qd} t|dkr0| | dn| | dd|S)zDetermine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. NcSs g|]}tj|tjqSr:)r3r4normcaserNr7)rir:r:r; sz5message_about_scripts_not_on_PATH..PATHrTcs&i|]\}}tj|kr||qSr:)r3r4r)r parent_dirscriptsZ not_warn_dirsr:r; sz5message_about_scripts_not_on_PATH..r1z script {} isrzscripts {} are, z and z.The {} installed in '{}' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriesr|) collections defaultdictsetr3r4dirnamebasenameaddenvironrr^pathsepappendrrUrgitemssortedrBformatr_) rZgrouped_by_dirdestfilerZ script_nameZwarn_for msg_linesZ dir_scriptsZsorted_scriptsZ start_textZ last_line_fmtr:rr;!message_about_scripts_not_on_PATHsH     rcCst|dddS)a; Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. cSstdd|DS)Ncss|]}t|VqdSr)rO)rxr:r:r;rsz3sorted_outrows....)tuple)rowr:r:r;z sorted_outrows..)key)r)outrowsr:r:r;sorted_outrowssrc Csg}|D]v}t|dkr(td|t|}|d}|||}||d<||krpt|\} } | |d<| |d<|t|q|D]*} t| \} } |t | || t | fq|D]} ||| ddfq|S)z_ :param installed: A map from archive RECORD path to installation RECORD path. rQz,RECORD line has more than three elements: {}rr1rT) rBloggerwarningrlistpoprPrrr<rO) Z old_csv_rows installedchanged generatedlib_dirZinstalled_rowsrZold_pathnew_pathrLrFrGr:r:r;get_csv_rows_for_installeds*     rc@s eZdZdS)MissingCallableSuffixN)__name__ __module__ __qualname__r:r:r:r;r=srcCs*t|}|dk r&|jdkr&tt|dSr)rsuffixrrO) specificationentryr:r:r;_raise_for_invalid_entrypointAsrcseZdZdfdd ZZS)PipScriptMakerNcst|tt|||Sr)rsuperrmake)selfrZoptions __class__r:r;rHszPipScriptMaker.make)N)rrrr __classcell__r:r:rr;rGsrFTc - sL|st|||||| d}t| r,|dn|dgg tjjtjj} itg} |rt4} t t dt j | dddW5QRXW5QRXt | d- fdd d.fd d }|| dtjd d}t|\fdd}D]j}d }d }ttj |D]F}d }|dkrPt}|}tj ||} ||}|| |d||dq6qtd |d}d|_dh|_d|_g}dd }|r4dtjkr|d|tjdddkr|dtjd |f|dt|fddD}|D] }|=q&dd }|rdtjkr`|d||dt|fddD}|D] }|=q|dd  Dd!d D}g}z.|!|}| || |!|d"diWn>t"k r.}z|j#d } t$d#%| W5d }~XYnX| rRt&|}!|!d k rRt '|!tjd d$}"tjd d%}#t(|#d&}$|$)d'W5QRXt*+|#|"| |"tjd d(}%tjd d)}&t,|%d*\}'t,|&d+F}(t-.|'})t/|)| d,}*t-0|(}+t1|*D]},|+2|,qW5QRXW5QRXt*+|&|%d S)/zInstall a wheel)userhomerootisolatedprefixZpurelibZplatlibignoreT)forcequietFcs.t|}t|}||<|r*|dS)z6Map archive RECORD paths to installation RECORD paths.N)r<r)srcfilerZmodifiedZoldpathnewpath)rrrrwr:r;record_installeds   z*move_wheel_files..record_installedNcst|t|D]\}}}|t|dtjj}tj||} |rf|tjjdd drfq|D]d} tj||| } |r|dkr| dr | qjqj|rj| drjt |  t j rj | qj|D]} |r|| rqtj|| } tj||| }t| tj|r$t|t| |t| }ttdrZt||j|jft| tjrt| }|jtjBtjBtjB}t||d}|r||}| ||qqdS)Nr1rz.datarTz .dist-infoutimeF)rr3walkrBlstripr4r7r_r^endswithrrrfrWrunlinkshutilZcopyfilestathasattrrst_atimest_mtimeaccessX_OKst_modeS_IXUSRS_IXGRPS_IXOTHchmod)sourcedestZis_basefixerfilterdirZsubdirsfilesZbasedirZdestdirr~Z destsubdirrGrrstZ permissionsr) data_dirsinfo_dirrreqr:r;clobbersP          z!move_wheel_files..clobberrzentry_points.txtcsh|dr|dd}n<|dr8|dd}n |drT|dd}n|}|kpf|kS)Nz.exez -script.pyiz.pya)rvr)rWZ matchname)rrr:r;is_entrypoint_wrappersz/move_wheel_files..is_entrypoint_wrapperr)rrrTZpipZENSUREPIP_OPTIONSzpip = Z altinstallz pip%s = %scSsg|]}td|r|qS)zpip(\d(\.\d)?)?$rertrkr:r:r;r0s z$move_wheel_files..Z easy_installzeasy_install = zeasy_install-%s = %scSsg|]}td|r|qS)zeasy_install(-\d\.\d)?$rrr:r:r;r@s css|]}d|VqdS)%s = %sNr:rZkvr:r:r;rGsz#move_wheel_files..cSsg|] }d|qS)rr:rr:r:r;rKsrzInvalid script entry point: {} for req: {} - A callable suffix is required. Cf https://packaging.python.org/en/latest/distributing.html#console-scripts for more information.Z INSTALLERz INSTALLER.piprcspip ZRECORDz RECORD.piprzw+)rrrr)F)NN)3rr{rNr3r4r7rrwarningscatch_warningsfilterwarnings compileall compile_dirrdebuggetvaluer_rrrrorrZvariantsZset_moderrrrrUrVrextendrZ make_multiplerargsr rrrrArlrmover[csvreaderrwriterrZwriterow)-rWrrwrrrZ pycompileZschemerrZwarn_script_locationrrstdoutrZep_filerZdatadirrrZsubdirrZmakerZscripts_to_generateZ pip_scriptZpip_eprZeasy_install_scriptZeasy_install_epZgui_scripts_to_generateZgenerated_console_scriptsermsgZ installerZtemp_installerZinstaller_filerecordZ temp_recordZ record_inZ record_outrrr rr:) rrrrrrrrrrwr;move_wheel_filesMs    $F   #                     "rcCsrzVddtd|Dd}|d}t|}|d}ttt| d}|WSt k rlYdSXdS)z Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it. cSsg|]}|qSr:r:)rdr:r:r;rsz!wheel_version..Nrrqz Wheel-Version.) rZ find_on_pathZ get_metadatarZparsestrrrmapintr^ Exception) source_dirZdistZ wheel_dataversionr:r:r; wheel_versions   rcCsb|std||dtdkr>td|dtt|fn |tkr^tddtt|dS)a Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given z(%s is in an unsupported or invalid wheelrzB%s's Wheel-Version (%s) is not compatible with this version of piprz*Installing from a newer Wheel-Version (%s)N)r VERSION_COMPATIBLEr_rrOrr)rrWr:r:r;check_compatibilitysrcCs d|S)z Format three tags in the form "--". :param file_tag: A 3-tuple of tags (python_tag, abi_tag, platform_tag). r\)r_)Zfile_tagr:r:r; format_tagsrc@s>eZdZdZedejZddZddZ ddZ d d Z d S) Wheelz A wheel filez^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$csj|}|std||_|ddd_|ddd_|d_|d d_ |d  d_ |d  d_ fd d j D_ d S)zX :raises InvalidWheelFilename: when the filename is invalid for a wheel z!%s is not a valid wheel filename.rWrpr\ZverbuildZpyverrZabiZplatcs.h|]&}jD]}jD]}|||fqqqSr:)abisplats)rryzrr:r; s z!Wheel.__init__..N) wheel_file_rertr rrur6rWrZ build_tagr^Z pyversionsrr file_tags)rrZ wheel_infor:r r;__init__s   zWheel.__init__cCstdd|jDS)zF Return the wheel's tags as a sorted list of strings. css|]}t|VqdSr)rrtagr:r:r;rsz0Wheel.get_formatted_file_tags..)rr#r r:r:r;get_formatted_file_tagsszWheel.get_formatted_file_tagscstfdd|jDS)a Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. c3s |]}|kr|VqdSr)indexr%tagsr:r;rsz*Wheel.support_index_min..)minr#rr*r:r)r;support_index_minszWheel.support_index_mincCs|j| S)z Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. )r# isdisjointr,r:r:r; supportedszWheel.supportedN) rrr__doc__rcompileVERBOSEr"r$r'r-r/r:r:r:r;rsrz([a-z0-9_.]+)-([a-z0-9_.!+-]+)cCst||S)zjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 )boolsearch)r~Z _egg_info_rer:r:r;_contains_egg_infosr5cCs|jr dS|jr&|s"td|jdS|s.dS|js:|js>dS||sXtd|jdS|jrj|jjrjdS|j}| \}}|rt |rdSdS)a[ Return whether to build an InstallRequirement object using the ephemeral cache. :param cache_available: whether a cache directory is available for the should_unpack=True case. :return: True or False to build the requirement with ephem_cache=True or False, respectively; or None not to build the requirement. Nz(Skipping %s, due to already being wheel.FzCSkipping wheel build for %s, due to binaries being disabled for it.T) Z constraintZis_wheelrinforWZeditablerlinkZis_vcssplitextr5)r should_unpackcache_availablecheck_binary_allowedr7baseZextr:r:r;should_use_ephemeral_cache s4   r=cCs^t|}d|}|s |d7}n:ttjkr8|d7}n"|dsJ|d7}|d|t7}|S)z1 Format command information for logging. zCommand arguments: {} zCommand output: Nonez'Command output: [use --verbose to show]r|zCommand output: {}{})rrrZgetEffectiveLevelloggingDEBUGrr) command_argscommand_outputZ command_desctextr:r:r;format_command_resultGs    rCcCsxt|}|s4d|j}|t||7}t|dSt|dkrfd|j|}|t||7}t|tj ||dS)zH Return the path to the wheel in the temporary build directory. z1Legacy build of wheel for {!r} created no files. Nr1zZLegacy build of wheel for {!r} created more than one file. Filenames (choosing first): {} r) rrrWrCrrrBr3r4r_)namestemp_dirrr@rAr r:r:r;get_legacy_build_wheel_path^s$    rFcCsdS)NTr:)rpr:r:r; _always_true~srGc@s\eZdZdZdddZdddZddd Zd d Zdd d ZdddZ ddZ dddZ dS) WheelBuilderz#Build wheels from a RequirementSet.NFcCsD|dkr t}||_||_|j|_|p&g|_|p0g|_||_||_dSr) rGpreparer wheel_cacheZwheel_download_dir _wheel_dir build_optionsglobal_optionsr;no_clean)rrIrJrLrMr;rNr:r:r;r$s   zWheelBuilder.__init__c Cs.|j|j|||dW5QRSQRXdS)ziBuild one wheel. :return: The filename of the built wheel, or None if the build failed.  python_tagN)Z build_env_build_one_inside_env)rr output_dirrPr:r:r; _build_oneszWheelBuilder._build_onec Cstdd}|jr|j}n|j}|||j|d}|dk rtj|}tj||}zNt|\} } t ||t d|j || | t d||WW5QRStk rYnX||W5QRdSQRXdS)Nry)ZkindrOz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %s)rZ use_pep517_build_one_pep517_build_one_legacyr4r3rr_rIrrrr6rWZ hexdigestr _clean_one) rrrRrPrEZbuilder wheel_path wheel_nameZ dest_pathZ wheel_hashrFr:r:r;rQs.      z"WheelBuilder._build_one_inside_envcCst|j|jddS)NT)rMZunbuffered_output)rZ setup_py_pathrM)rrr:r:r;_base_setup_argss zWheelBuilder._base_setup_argsc Cs|jrtd|jfdSz~td|td|j}|j}|||j ||j d}W5QRX|rt ||}t t j||t j|||}Wn$tk rtd|jYdSXt j||S)zBuild one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. zGCannot build wheel for %s using PEP 517 when --build-options is presentNDestination directory: %szBuilding wheel for {} (PEP 517))metadata_directoryFailed building wheel for %s)rLrerrorrWrrrZpep517_backendZsubprocess_runnerZ build_wheelr[rar3renamer4r_r)rrtempdrPZrunnerZbackendrXnew_namer:r:r;rTs6      zWheelBuilder._build_one_pep517c Cs||}d|jf}t|}td||dd|g|j}|dk rT|d|g7}zt||j|d}Wn8tk r| dt d |jYW5QRdSXt |} t | ||||d } | W5QRSQRXdS) zBuild one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. z Building wheel for %s (setup.py)rZZ bdist_wheelz-dNz --python-tag)cwdspinnerr]r\)rDrErr@rA)rYrWrrrrLrZunpacked_source_directoryrZfinishr]r3rrrF) rrr_rP base_argsZ spin_messagerbZ wheel_argsoutputrDrWr:r:r;rUs8         zWheelBuilder._build_one_legacycCsb||}td|j|ddg}zt||jdWdStk r\td|jYdSXdS)NzRunning setup.py clean for %sZcleanz--all)raTz Failed cleaning build dir for %sF)rYrr6rWrrrr])rrrcZ clean_argsr:r:r;rVs  zWheelBuilder._clean_onec Csg}t|jj}|D]\}t||||jd}|dkr4q|r\|rL|j|j}qb|j|j}n|j}| ||fq|szgSt dd dd|Dd}|rt j}tgg} } |D]\}}z t|WnFtk r} z&t d|j| | |WYqW5d} ~ XYnX|j|||d} | r| ||r|jrXt|jsXtd |||jj|_tt| |_t|jj|jq| |qW5QRX| rt d d d d| D| rt d d dd| D| S)aBuild wheels. :param should_unpack: If True, after building the wheel, unpack it and replace the sdist with the unpacked version in preparation for installation. :return: True if all the wheels built correctly. )r9r:r;Nz*Building wheels for collected packages: %srcSsg|]\}}|jqSr:rW)rrrpr:r:r;r\sz&WheelBuilder.build..z Building wheel for %s failed: %srOzbad source dir - missing markerzSuccessfully built %sr}cSsg|] }|jqSr:rerrr:r:r;rszFailed to build %scSsg|] }|jqSr:rerfr:r:r;rs) r3rJ cache_dirr=r;Zget_ephem_path_for_linkr7Zget_path_for_linkrKrrr6r_r Zimplementation_tagrrOSErrorrrWrSrrAssertionErrorZremove_temporary_sourceZensure_build_locationrIZ build_dirrrrZ file_path) rZ requirementsr9Zbuildsetr:rZ ephem_cacherRrPZ build_successZ build_failurer Z wheel_filer:r:r;r#s      zWheelBuilder.build)NNNF)N)N)N)N)F) rrrr0r$rSrQrYrTrUrVrr:r:r:r;rHs   ' %rH)r=)r=)FNNTNFNT)r0Z __future__rrrrr@r>Zos.pathr3rrrrUrbase64rZ email.parserrZ pip._vendorrZpip._vendor.distlib.scriptsrZpip._vendor.distlib.utilrZpip._vendor.packaging.utilsrZpip._vendor.sixr Z pip._internalr Zpip._internal.exceptionsr r r Zpip._internal.locationsrrZpip._internal.models.linkrZpip._internal.utils.loggingrZ pip._internal.utils.marker_filesrZpip._internal.utils.miscrrrZ$pip._internal.utils.setuptools_buildrZpip._internal.utils.subprocessrrrrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.uirZpip._internal.utils.unpackingrZpip._internal.utils.urlsrtypingr r!r"r#r$r%r&r'r(r)r*r+Z"pip._vendor.packaging.requirementsr,Zpip._internal.req.req_installr-Z pip._internal.operations.preparer.Zpip._internal.cacher/Zpip._internal.pep425tagsr0rOZInstalledCSVRowr3ZBinaryAllowedPredicaterZ getLoggerrrr<rIrPr[raror1r2rsr{rrrrrrrrrrrrobjectrIr5r=rCrFrGrHr:r:r:r;s                  8           =$  4 J : PK]$$ __pycache__/cache.cpython-38.pycnu[U ʗRe)@s:dZddlZddlZddlZddlZddlmZddlmZm Z m Z m Z m Z ddl mZmZmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd l m!Z!e"e#Z$dZ%e e&e&fe&dddZ'GdddZ(Gddde(Z)Gddde)Z*GdddZ+Gddde(Z,dS)zCache Management N)Path)AnyDictListOptionalSet)Taginterpreter_nameinterpreter_version)canonicalize_name)InvalidWheelFilename) DirectUrl) FormatControl)Link)Wheel) TempDirectory tempdir_kinds) path_to_urlz origin.json)dreturncCs&tj|dddd}t|dS)z'Return a stable sha224 of a dictionary.T),:) sort_keys separators ensure_asciiascii)jsondumpshashlibsha224encode hexdigest)rsr#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cache.py _hash_dictsr%cseZdZdZeeeeddfdd Zee edddZ eee e d d d Z eedd d Z eeee eedddZZS)CacheanAn abstract class - provides cache directories for data from links :param cache_dir: The root of the cache. :param format_control: An object of FormatControl class to limit binaries being read from the cache. :param allowed_formats: which formats of files the cache should store. ('binary' and 'source' are the only allowed values) N) cache_dirformat_controlallowed_formatsrcsTt|rtj|st|p$d|_||_||_ddh}|j ||ksPtdS)Nsourcebinary) super__init__ospathisabsAssertionErrorr'r(r)union)selfr'r(r)_valid_formats __class__r#r$r-,s  zCache.__init__linkrcCsd|ji}|jdk r*|jdk r*|j||j<|jr:|j|d<t|d<t|d<t|}|dd|dd|dd|ddg}|S) zs.         XF PK] Q,,)__pycache__/download.cpython-38.opt-1.pycnu[U .eEQ@sddlmZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z ddlmZddlmZddlmZmZddlmZdd lmZdd lmZdd lmZdd lmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'dd l(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3e+rddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:ddl;mZ>ddl?m@Z@ddlAmBZBered0d ZSd1d2ZTd3d4ZUd?d5dZVd@d6d!ZWd7d#ZXd8d"ZYd9d:ZZd;d<Z[dS)A)absolute_importN)requests)CONTENT_CHUNK_SIZEResponse)PY2)parse) HashMismatchInstallationError)PyPI) PipSession) auto_decode) copy2_fixed) ask_path_exists backup_dirconsume display_path format_sizehide_urlpath_to_displayrmtreesplitext) TempDirectory)MYPY_CHECK_RUNNING)DownloadProgressProvider) unpack_file)get_url_scheme)vcs)IOCallableListOptionalTextTuple) TypedDict)Link)Hashes)VersionControlCopytreeKwargsignoresymlinksF)Ztotal) copy_functionr)Zignore_dangling_symlinksr*get_file_contentunpack_vcs_linkunpack_file_urlunpack_http_url unpack_urlparse_content_dispositionsanitize_content_filenamec Cs6|dkrtdt|}|dkr>||}||j|jfS|dkr|rd|drdtd||f|ddd}| d d }t |}|r| dd|d dd}t |}|d rd |d }|}z&t|d }t|}W5QRXWn4tk r,} ztd t| W5d} ~ XYnX||fS)a*Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. :param url: File path or url. :param comes_from: Origin description of requirements. :param session: Instance of pip.download.PipSession. NzAget_file_content() missing 1 required keyword argument: 'session')httpZhttpsfiler3z6Requirements file %s references URL %s, which is local:\/|rbz$Could not open requirements file: %s) TypeErrorrgetraise_for_statusurltext startswithr splitreplace_url_slash_drive_rematchgroup urllib_parseZunquotelstripopenr readIOErrorstr) r>Z comes_fromsessionschemeresppathrDfZcontentexcrR:/usr/lib/python3.8/site-packages/pip/_internal/download.pyr,UsB         z /*([a-z])\|cCs t|}|j|t|jddS)N)r>)_get_used_vcs_backendunpackrr>)linklocation vcs_backendrRrRrSr-scCs$tjD]}|j|jkr|SqdS)z1 Return a VersionControl object or None. N)rZbackendsrMZschemes)rVrXrRrRrSrTs   rTcOs|SNrR)iterableargskwargsrRrRrS_progress_indicatorsr]c s6ztjd}Wntttfk r0d}YnXtdd}ttj krRd}n&|r\d}n|dkrjd}n|std}nd}|j }fdd} fd d } t } |j t j kr|} n|j} |rt||d } |rtd | t|n td | n|rtd| n td | | | | tt} |r*|| nt| dS)Nzcontent-lengthrZ from_cacheFi@Tc3sTz jj|ddD] }|VqWn.tk rNj|}|sBqJ|Vq0YnXdS)NF)Zdecode_content)rawstreamAttributeErrorrI)Z chunk_sizechunk)rNrRrS resp_reads   z _download_url..resp_readc3s|D]}||VqdSrY)write)Zchunksra) content_filerRrSwritten_chunkss z%_download_url..written_chunks)maxzDownloading %s (%s)zDownloading %szUsing cached %s)intheaders ValueErrorKeyErrorr;getattrloggerZgetEffectiveLevelloggingINFOshow_urlr]Znetlocr Zurl_without_fragmentrinforrZcheck_against_chunksr)rNrVrdhashes progress_barZ total_lengthZ cached_respZ show_progressrorbreZprogress_indicatorr>Zdownloaded_chunksrR)rdrNrS _download_urlsP   %    rscCsd}tj||j}tj|rtdt|d}|dkr@d}nj|dkrdtdt|t |nF|dkrt |}td t|t|t ||n|d krt d |rt ||td t|dS) NTz8The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abort)iwbartFruz Deleting %srvzBacking up %s to %srwzSaved %s)osrOjoinfilenameexistsrrrlwarningremovershutilZmovesysexitcopyrp)r{rWrVrZdownload_locationresponseZ dest_filerRrRrS _copy_files6    ronc Cs|dkrtdtddv}d}|r0t|||}|rH|}t|d} nt|||j||\}} t||| |r~|s~t||||st |W5QRXdS)Nz@unpack_http_url() missing 1 required keyword argument: 'session'rU)Zkindr) r;r_check_download_dir mimetypes guess_type_download_http_urlrOrrryunlink) rVrW download_dirrLrqrrtemp_diralready_downloaded_path from_path content_typerRrRrSr/s2    c CsTzt||Wn@tjk rN}z tdt|t|t|W5d}~XYnXdS)zCopying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. z>Ignoring special file error '%s' encountered copying %s to %s.N)r rZSpecialFileErrorrlr}rKr)srcdesterRrRrS_copy2_ignoring_special_filesJsrcs`tj|}tj|tj|fdd}t|dd}tsLt|d<tj |f|dS)Ncs6g}|kr|ddg7}tj|kr2|g7}|S)Nz.toxz.nox)ryrOabspath)dnamesZskippedsourceZtarget_basenameZtarget_dirnamerRrSr)es   z!_copy_source_tree..ignoreTr(r+) ryrOrbasenamedirnamedictrrrZcopytree)rtargetZtarget_abspathr)r\rRrrS_copy_source_tree_s    rcCs|j}|r>tj|r"t|t|||r:tddS|rL| |d}|r`t |||}|rj|}n|}t |d}t ||||r|st|||dS)zUnpack link into location. If download_dir is provided and link points to a file, make a copy of the link file inside download_dir. z*Link is a directory, ignoring download_dirNr) file_pathZis_existing_dirryrOisdirrrrlrpcheck_against_pathrrrrr)rVrWrrqZ link_pathrrrrRrRrSr.~s.      cCsP|jrt||n:|jr*t||||dn"|dkr8t}t||||||ddS)avUnpack link. If link is a VCS link: if only_download, export into download_dir and ignore location else unpack into location for other types of link: - unpack into location - if download_dir, copy the file into download_dir - if only_download, mark location for deletion :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. )rqN)rqrr)Zis_vcsr-is_filer.r r/)rVrWrrLrqrrrRrRrSr0s cCs tj|S)zJ Sanitize the "filename" value from a Content-Disposition header. )ryrOr)r{rRrRrSr2scCs,t|\}}|d}|r$t|}|p*|S)z Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. r{)cgiZ parse_headerr<r2)content_dispositionZdefault_filenameZ_typeZparamsr{rRrRrSr1s  c Cs*|jddd}z |j|ddidd}|Wn8tjk rj}ztd|jj |W5d }~XYnX|j d d }|j } |j d } | rt | | } t | d} | st|} | r| | 7} | s|j|jkrtj |jd} | r| | 7} tj|| } t| d } t||| ||W5QRX| |fS)z6Download link url into temp_dir using provided session#r6rzAccept-EncodingZidentityT)rhr_zHTTP error %s while getting %sNz content-typezcontent-dispositionwb)r>rAr<r=rZ HTTPErrorrlZcriticalrZ status_coderhr{r1rrZguess_extensionryrOrzrHrs)rVrLrrqrrZ target_urlrNrQrr{rZextrrdrRrRrSrsB       rcCsptj||j}tj|s dStd||rlz||Wn,tk rjt d|t |YdSX|S)z Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.) ryrOrzr{r|rlrprrr}r)rVrrqZ download_pathrRrRrSr7s   r)NN)NNNr)NN)NNNr)\Z __future__rrrmrryrerrZ pip._vendorrZpip._vendor.requests.modelsrrZpip._vendor.sixrZpip._vendor.six.moves.urllibrrFZpip._internal.exceptionsrr Zpip._internal.models.indexr Zpip._internal.network.sessionr Zpip._internal.utils.encodingr Zpip._internal.utils.filesystemr Zpip._internal.utils.miscrrrrrrrrrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.uirZpip._internal.utils.unpackingrZpip._internal.utils.urlsrZpip._internal.vcsrtypingrrrr r!r"Zmypy_extensionsr#Zpip._internal.models.linkr$Zpip._internal.utils.hashesr%Z pip._internal.vcs.versioncontrolr&rKboolr'__all__Z getLogger__name__rlr,compileIrCr-rTr]rsrr/rrr.r0r2r1rrrRrRrRrSs        ,               0 d -" 8 .?PK]:p p $__pycache__/locations.cpython-38.pycnu[U .e&@sdZddlmZddlZddlZddlZddlZddlZddlZddl mZ ddl m Z ddl mZddlmZddlmZdd lmZerdd lmZmZmZmZmZed Zd d ZddZedZ e!"dkre #Z z e$Z%Wne&k r ej'Z%YnXer`ej()ej*dZ+ej()e%dZ,ej(-e+sej()ej*dZ+ej()e%dZ,nJej()ej*dZ+ej()e%dZ,ejdddkrej*dddkrdZ+dddZ.dS)z7Locations where we look for configs, install stuff, etc)absolute_importN) sysconfig) SCHEME_KEYS)appdirs)WINDOWS)MYPY_CHECK_RUNNING)running_under_virtualenv)AnyUnionDictListOptionalZpipcCs djtjS)ze Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". z{}.{})formatsys version_inforr;/usr/lib/python3.8/site-packages/pip/_internal/locations.pyget_major_minor_versionsrcCsZtrtjtjd}n6ztjtd}Wntk rLtdYnXtj |S)Nsrcz=The folder you are executing pip from can no longer be found.) rospathjoinrprefixgetcwdOSErrorexitabspath)Z src_prefixrrrget_src_prefix(s rpurelibZpypyZScriptsbindarwinz/System/Library/z/usr/local/binFcCsddlm}i}|r ddgi}ni}d|i} | ||| } | | jddd} | d k s`t|rx|rxtd |||r|rtd |||p| j| _|s|rd | _|p| j| _|p| j | _ |p| j | _ | t D]} t | d | || <qd| dkr|t| j| jdtrtjtjdddt||d<|d k rtjtj|dd} tj|| dd |d<|S)z+ Return a distutils install scheme r) DistributionZ script_argsz --no-user-cfgnameZinstallT)ZcreateNzuser={} prefix={}zhome={} prefix={}Zinstall_ install_lib)rZplatlibZincludesitezpython{}Zheaders)Zdistutils.distr#updateZparse_config_filesZget_command_objAssertionErrorruserrhomerootZfinalize_optionsrgetattrZget_option_dictdictr&rrrrrr splitdriver)Z dist_namer+r,r-isolatedrr#ZschemeZextra_dist_argsZ dist_argsdikeyZ path_no_driverrrdistutils_scheme[sV            r5)FNNFN)/__doc__Z __future__rrZos.pathplatformr'rrZ distutilsZdistutils_sysconfigZdistutils.command.installrZpip._internal.utilsrZpip._internal.utils.compatrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrtypingr r r r r Zuser_cache_dirZUSER_CACHE_DIRrrZget_pathZ site_packagesZpython_implementationlowerZget_python_libgetusersitepackages user_siteAttributeError USER_SITErrrZbin_pyZbin_userexistsr5rrrrsN            (PK]^=2&__pycache__/cache.cpython-38.opt-1.pycnu[U .e @sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZmZerdd lmZmZmZmZdd lmZdd lmZeeZGd dde Z!Gddde!Z"Gddde"Z#Gddde!Z$dS)zCache Management N)canonicalize_name)Link) expanduser) TempDirectory)MYPY_CHECK_RUNNING) path_to_url)InvalidWheelFilenameWheel)OptionalSetListAny) FormatControl) Pep425TagcsPeZdZdZfddZddZddZdd Zd d Zd d Z ddZ Z S)CacheaAn abstract class - provides cache directories for data from links :param cache_dir: The root of the cache. :param format_control: An object of FormatControl class to limit binaries being read from the cache. :param allowed_formats: which formats of files the cache should store. ('binary' and 'source' are the only allowed values) cs8tt||rt|nd|_||_||_ddh}dS)Nsourcebinary)superr__init__r cache_dirformat_controlallowed_formats)selfrrrZ_valid_formats __class__7/usr/lib/python3.8/site-packages/pip/_internal/cache.pyr(s zCache.__init__cCs|jg}|jdk r4|jdk r4|d|j|jgd|}t|}|dd|dd|dd|ddg}|S)zEGet parts of part that must be os.path.joined with cache_dir N=#) Zurl_without_fragmentZ hash_namehashappendjoinhashlibZsha224encodeZ hexdigest)rlinkZ key_partsZkey_urlZhashedpartsrrr_get_cache_path_parts2s ,zCache._get_cache_path_partsc Cs|j p| p| }|rgSt|}|j|}|j|s@gS||}z t|WSt k r}z$|j t j t j hkrgWYSW5d}~XYnXdSN) rrrZget_allowed_formatsr intersectionget_path_for_linkoslistdirOSErrorerrnoZENOENTZENOTDIR)rr' package_nameZ can_not_cacheZcanonical_nameZformatsrooterrrrr_get_candidatesLs(    zCache._get_candidatescCs tdS)z>Return a directory to store cached items in for link. NNotImplementedErrorrr'rrrr,eszCache.get_path_for_linkcCs tdS)zaReturns a link to a cached item if it exists, otherwise returns the passed link. Nr5)rr'r1supported_tagsrrrgetks z Cache.getcCs$||}tj||}tt|Sr*)r,r-pathr$rr)rr' candidater2r:rrr_link_for_candidatews zCache._link_for_candidatecCsdSr*rrrrrcleanup~sz Cache.cleanup) __name__ __module__ __qualname____doc__rr)r4r,r9r<r> __classcell__rrrrrs  rcs0eZdZdZfddZddZddZZS)SimpleWheelCachez+A cache of wheels for future installs. cstt|||dhdSNr)rrDrrrrrrrrs  zSimpleWheelCache.__init__cCs ||}tjj|jdf|S)aReturn a directory to store cached wheels for link Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have plausible version numbers, so that we don't contaminate the cache with things that were not unique. E.g. ./package might have dozens of installs done for it and build a version of 0.0...and if we built and cached a wheel, we'd end up using the same wheel even if the source has been edited. :param link: The link of the sdist for which this will cache wheels. Zwheels)r)r-r:r$r)rr'r(rrrr,s z"SimpleWheelCache.get_path_for_linkc Csxg}|||D]J}z t|}Wntk r8YqYnX||sFq||||fq|sd|S||t|dS)N)r4r rZ supportedr#Zsupport_index_minr<min)rr'r1r8Z candidatesZ wheel_nameZwheelrrrr9s    zSimpleWheelCache.get)r?r@rArBrr,r9rCrrrrrDs rDcs(eZdZdZfddZddZZS)EphemWheelCachezGA SimpleWheelCache that creates it's own temporary cache directory cs&tdd|_tt||jj|dS)Nzephem-wheel-cache)Zkind)r _temp_dirrrIrr:)rrrrrrs   zEphemWheelCache.__init__cCs|jdSr*)rJr>r=rrrr>szEphemWheelCache.cleanup)r?r@rArBrr>rCrrrrrIs rIcs@eZdZdZfddZddZddZdd Zd d ZZ S) WheelCachezWraps EphemWheelCache and SimpleWheelCache into a single Cache This Cache allows for gracefully degradation, using the ephem wheel cache when a certain link is not found in the simple wheel cache first. cs0tt|||dht|||_t||_dSrE)rrKrrD _wheel_cacherI _ephem_cacherFrrrrs  zWheelCache.__init__cCs |j|Sr*)rLr,r7rrrr,szWheelCache.get_path_for_linkcCs |j|Sr*)rMr,r7rrrget_ephem_path_for_linksz"WheelCache.get_ephem_path_for_linkcCs0|jj|||d}||k r|S|jj|||dS)N)r'r1r8)rLr9rM)rr'r1r8Zretvalrrrr9szWheelCache.getcCs|j|jdSr*)rLr>rMr=rrrr>s zWheelCache.cleanup) r?r@rArBrr,rNr9r>rCrrrrrKs  rK)%rBr0r%Zloggingr-Zpip._vendor.packaging.utilsrZpip._internal.models.linkrZpip._internal.utils.compatrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.urlsrZpip._internal.wheelrr typingr r r r Zpip._internal.indexrZpip._internal.pep425tagsrZ getLoggerr?ZloggerobjectrrDrIrKrrrrs(         f:PK] V77$__pycache__/collector.cpython-38.pycnu[U .eWF@s dZddlZddlZddlZddlZddlZddlmZddlm Z m Z ddl m Z ddl mZmZmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZm Z ddl!m"Z"m#Z#erDddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5e/j6j7j8Z9e)e:e:fZ;eddZ?ddZ@GdddeAZBddZCGdddeAZDddZEdd ZFd!d"ZGd#d$ZHd%d&ZId'd(ZJd)d*ZKGd+d,d,eLZMdd6d7ZRGd8d9d9eLZSGd:d;d;eLZTdS)?zM The main purpose of this module is to expose LinkCollector.collect_links(). N) OrderedDict)html5librequests)unescape) HTTPError RetryErrorSSLError)parse)requestLink)ARCHIVE_EXTENSIONS)redact_auth_from_url)MYPY_CHECK_RUNNING) path_to_url url_to_path)is_urlvcs) CallableDictIterableListMutableMappingOptionalSequenceTupleUnion)Response) SearchScope) PipSessioncCs6tjD]*}||r|t|dkr|SqdS)zgLook for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. z+:N)rZschemeslower startswithlen)urlschemer%;/usr/lib/python3.8/site-packages/pip/_internal/collector.py_match_vcs_scheme/s  r'cCs(t|j}tD]}||rdSqdS)z2Return whether the URL looks like an archive. TF)r filenamer endswith)r#r(Zbad_extr%r%r&_is_url_like_archive;s   r*cseZdZfddZZS)_NotHTMLcs"tt|||||_||_dSN)superr+__init__ content_type request_desc)selfr/r0 __class__r%r&r.Gsz_NotHTML.__init__)__name__ __module__ __qualname__r. __classcell__r%r%r2r&r+Fsr+cCs.|jdd}|ds*t||jjdS)zCheck the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html. Content-Type text/htmlN)headersgetr r!r+r method)responser/r%r%r&_ensure_html_headerNsr?c@s eZdZdS)_NotHTTPN)r4r5r6r%r%r%r&r@Ysr@cCsDt|\}}}}}|dkr"t|j|dd}|t|dS)zSend a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. >httphttpsT)Zallow_redirectsN) urllib_parseZurlsplitr@headraise_for_statusr?)r#sessionr$netlocpathZqueryZfragmentrespr%r%r&_ensure_html_response]s rJcCsLt|rt||dtdt||j|dddd}|t||S)aAccess an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotHTML` if it is not HTML. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got HTML, and raise `_NotHTML` otherwise. rFzGetting page %sr:z max-age=0)ZAcceptz Cache-Control)r;)r*rJloggerdebugrr<rEr?)r#rFrIr%r%r&_get_html_responsens rNcCs2|r.d|kr.t|d\}}d|kr.|dSdS)zBDetermine if we have any encoding information in our headers. r8charsetN)cgiZ parse_header)r;r/Zparamsr%r%r&_get_encoding_from_headerss  rQcCs.|dD]}|d}|dk r |Sq |S)aDetermine the HTML document's base URL. This looks for a ```` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the HTML file's URL is used as the base URL. :param document: An HTML document representation. The current implementation expects the result of ``html5lib.parse()``. :param page_url: The URL of the HTML document. z.//basehrefN)findallr<)documentpage_urlbaserRr%r%r&_determine_base_urls   rWcCsPt|}|jdkr(tt|j}ntjt|jdd}t |j |dS)zMakes sure a link is fully encoded. That is, if a ' ' shows up in the link, it will be rewritten to %20 (while not over-quoting % or other characters).r9z/@)Zsafe)rH) rCurlparserGurllib_requestZ pathname2url url2pathnamerHZquoteZunquoteZ urlunparse_replace)r#resultrHr%r%r& _clean_links   r]cCsf|d}|sdStt||}|d}|r8t|nd}|d}|rRt|}t||||d}|S)zJ Convert an anchor element in a simple repository page to a Link. rRNzdata-requires-pythonz data-yanked)Z comes_fromZrequires_python yanked_reason)r<r]rCurljoinrr )anchorrUbase_urlrRr#Z pyrequirer^linkr%r%r&_create_link_from_elements   rcccsVtj|j|jdd}|j}t||}|dD]"}t|||d}|dkrJq.|Vq.dS)zP Parse an HTML document, and yield its anchor elements as Link objects. F)Ztransport_encodingZnamespaceHTMLElementsz.//a)rUraN)rr contentencodingr#rWrSrc)pagerTr#rar`rbr%r%r& parse_linkss  rgc@s eZdZdZddZddZdS)HTMLPagez'Represents one page, along with its URLcCs||_||_||_dS)z :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. N)rdrer#)r1rdrer#r%r%r&r.s zHTMLPage.__init__cCs t|jSr,)rr#r1r%r%r&__str__$szHTMLPage.__str__N)r4r5r6__doc__r.rjr%r%r%r&rhsrhcCs|dkrtj}|d||dS)Nz%Could not fetch URL %s: %s - skipping)rLrM)rbreasonmethr%r%r&_handle_get_page_fail(srncCst|j}t|j||jdS)N)rer#)rQr;rhrdr#)r>rer%r%r&_make_html_page3s roc Cs|dkrtd|jddd}t|}|r@td||dSt|\}}}}}}|dkrtj t |r| ds|d7}t|d}td |zt||d }WnDtk rtd |Yn,tk r}ztd ||j|jW5d}~XYntk r0}zt||W5d}~XYntk r\}zt||W5d}~XYntk r}z$d } | t|7} t|| tjdW5d}~XYn\tjk r}zt|d|W5d}~XYn*tjk rt|dYn Xt|SdS)Nz?_get_html_page() missing 1 required keyword argument: 'session'#rzCannot look at %s URL %sfile/z index.htmlz# file: URL is directory, getting %srKzQSkipping page %s because it looks like an archive, and cannot be checked by HEAD.z.sort_pathzfile:z)Path '{0}' is ignored: it is a directory.z:Url '%s' is ignored: it is neither a file nor a directory.zQUrl '%s' is ignored. It is either a non-existing path or lacks a specific scheme.)rvrHexistsr!rrwrealpathlistdirjoinrrLZwarningformatisfiler) locations expand_dirrr#Z is_local_pathZ is_file_urlrHitemr%rr&group_locationsxsF        rc@seZdZdZddZdS)CollectedLinksa Encapsulates all the Link objects collected by a call to LinkCollector.collect_links(), stored separately as-- (1) links from the configured file locations, (2) links from the configured find_links, and (3) a dict mapping HTML page url to links from that page. cCs||_||_||_dS)z :param files: Links from file locations. :param find_links: Links from find_links. :param pages: A dict mapping HTML page url to links from that page. Nr find_linkspages)r1rrrr%r%r&r.s zCollectedLinks.__init__N)r4r5r6rkr.r%r%r%r&rs rc@s4eZdZdZddZeddZddZdd Zd S) LinkCollectorz Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_links() method. cCs||_||_dSr,) search_scoperF)r1rFrr%r%r&r.szLinkCollector.__init__cCs|jjSr,)rrrir%r%r&rszLinkCollector.find_linksccs,|D]"}t||jd}|dkr q|VqdS)zp Yields (page, page_url) from the given locations, skipping locations that have errors. rKN)r}rF)r1rlocationrfr%r%r& _get_pagess zLinkCollector._get_pagescsj}||}t|\}}tjdd\}}ddt||D}ddjD} fddtdd|Dd d|DD} t| } d t| |g} | D]} | d | qt d | i} | D]}tt|| |j<qt|| | d S)zFind all available links for the given project name. :return: All the Link objects (unfiltered), as a CollectedLinks object. T)rcSsg|] }t|qSr%r .0r#r%r%r& sz/LinkCollector.collect_links..cSsg|]}t|dqS)z-fr rr%r%r&rscsg|]}j|r|qSr%)rFZis_secure_origin)rrbrir%r&r s css|]}t|VqdSr,r rr%r%r& sz.LinkCollector.collect_links..css|]}t|VqdSr,r rr%r%r&r sz,{} location(s) to search for versions of {}:z* {} r)rZget_index_urls_locationsrr itertoolschainrrr"rrLrMrrr~rgr#r)r1Z project_namerZindex_locationsZindex_file_locZ index_url_locZ fl_file_locZ fl_url_locZ file_linksZfind_link_linksZ url_locationslinesrbZ pages_linksrfr%rir& collect_linkssD       zLinkCollector.collect_linksN) r4r5r6rkr.propertyrrrr%r%r%r&rs    r)N)N)F)UrkrPrZloggingrrv collectionsrZ pip._vendorrrZpip._vendor.distlib.compatrZpip._vendor.requests.exceptionsrrrZpip._vendor.six.moves.urllibr rCr rYZpip._internal.models.linkr Zpip._internal.utils.filetypesr Zpip._internal.utils.miscrZpip._internal.utils.typingrZpip._internal.utils.urlsrrZpip._internal.vcsrrtypingrrrrrrrrrZxml.etree.ElementTreeZxmlZpip._vendor.requestsrZ!pip._internal.models.search_scoperZpip._internal.network.sessionrZetreeZ ElementTreeZElementZ HTMLElementrxZResponseHeadersZ getLoggerr4rLr'r* Exceptionr+r?r@rJrNrQrWr]rcrgobjectrhrnror}rrrrr%r%r%r&s^        ,         3    6 ;PK]t1:&:&%__pycache__/pep425tags.cpython-38.pycnu[U .eE>@sTdZddlmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl ZddlmZddlmZerddlmZmZmZmZmZmZmZeeeefZeeZe dZ!d d Z"d d Z#d dZ$ddZ%ddZ&ddZ'd-ddZ(ddZ)ddZ*ddZ+ddZ,d d!Z-d"d#Z.d$d%Z/d&d'Z0d(d)Z1d.d+d,Z2e'Z3dS)/z2Generate and work with PEP 425 Compatibility Tags.)absolute_importN) OrderedDict)get_extension_suffixes)MYPY_CHECK_RUNNING)TupleCallableListOptionalUnionDictSetz(.+)_(\d+)_(\d+)_(.+)c CsLz t|WStk rF}ztd|tWYdSd}~XYnXdS)Nz{}) sysconfigget_config_varIOErrorwarningswarnformatRuntimeWarning)varerConfig variable '%s' is unset, Python ABI tag may be incorrect)rloggerdebug)rZfallbackexpectedrvalrrrget_flagYsr2cstd}t}d}|s|dkrttdrd}d}d}|dktddd d rRd }tjd krvtd fdd d rvd}tjdkrtddd ddrd}d|t|||f}n:|r|drd|dd}n|r| dd dd}|S)zXReturn the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).ZSOABIN>rr maxunicoder!rZPy_DEBUGcSs ttdS)NZgettotalrefcount)rrrrrrtzget_abi_tag..)rd)Z WITH_PYMALLOCcsS)NrrZ is_cpythonrrr4xr5m)r7r7ZPy_UNICODE_SIZEcSs tjdkS)Ni)rr3rrrrr4{r5)r0ruz %s%s%s%s%szcpython--r*._) rr rrr2r&r)rsplitreplace)Zsoabiimplabir6r:r<rr9r get_abi_tagfsB   rDcCs tjdkS)Ni)rmaxsizerrrr_is_running_32bitsrFcCstjdkr^t\}}}|d}|dkr6tr6d}n|dkrHtrHd}d|d|d |Stj dd  d d }|d krtrd }|S)z0Return our platform name 'win32', 'linux_x86_64'darwinr>x86_64i386ppc64ppczmacosx_{}_{}_{}rr*r?r= linux_x86_64 linux_i686) rrZmac_verr@rFr distutilsutil get_platformrA)releaser?machineZ split_verresultrrrrPs  rPc Cs$tdkrdSz&ttjd}|d}W5QRXWntttfk rPYdSX|dksft|dkrjdSt |t rdd|D}ndd|D}|dd d d d d gk}||d ddgkM}||dddgkM}||ddddgkM}||dddgkM}||dddd @d kM}|S)N linux_armv7lFrb(cSsg|] }t|qSr)ord).0crrr sz"is_linux_armhf..cSsg|]}|qSrr)rXbrrrrZsrr;ELFr*'%&) rPopenr executablereadrOSError TypeErrorlen isinstancer%)fZelf_header_rawZ elf_headerrSrrris_linux_armhfs&  roc CsNtdkrdSzddl}t|jWSttfk r:YnXtjjj ddS)NrMrLFrr"r`) rP _manylinuxboolZmanylinux1_compatible ImportErrorAttributeErrorpip _internalutilsglibchave_compatible_glibcrqrrris_manylinux1_compatibles  r{c CsNtdkrdSzddl}t|jWSttfk r:YnXtjjj ddS)NrpFrr" ) rPrqrrZmanylinux2010_compatiblersrtrurvrwrxryrzrrris_manylinux2010_compatibles  r}c Csdt}|dkrdS|dkr$ts$dSzddl}t|jWSttfk rPYnXtjj j ddS)N>rM linux_s390x linux_ppc64lerLrT linux_aarch64 linux_ppc64FrTrr") rProrqrrZmanylinux2014_compatiblersrtrurvrwrxry)rrqrrris_manylinux2014_compatibles rcsrg}fddtddddg|||r8||D]&}||kr<|||r<||q<|d|S)zReturn a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine. cs||dkr||fdkS|dkr(||fdkS|dkr<||fdkS|dkrP||fdkS|krx|D]}|||r`dSq`dS) NrK) r`rJrI)rr;rHTFr)r+r,archgarch_supports_archgroupsrrrs      z)get_darwin_arches.._supports_arch)Zfat)rIrK)Zintel)rHrI)Zfat64)rHrJ)Zfat32)rHrIrKZ universal)rappend)r+r,rRarchesrrrrget_darwin_archess%    rc CsFg}|dd}t|dddD] }|dtt||fq |S)Nr!)rangerr#r$r%)r&versionsr+r,rrr!get_all_minor_versions_as_strings>s  rFcCsDg}|dkrt}t|}|p"t}g}|p0t}|rD|g|dd<t}tD]$} | drP|| dddqP| t t || d|s|pt } | d\} } } | d r>t| }|r6|\}}}}d ||}g}ttt|dD]0}tt|||D]}| |||fqqn| g}n| d kr~| g}| d kr| d | | | d| | n| d kr| d| | g}nn|dkrg}tr| d | | tr| d | | tr| d| | | | n| g}|D].}|D]"} | d||df|| fqq |ddD]F}|dkr\q|D]*}|D]} | d||f|| fqhq`qH|D]"} | d|ddd| fq| d||dfddf| d||ddfddft|D]B\}}| d|fddf|dkr| d|dddfq|S)acReturn a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abi: specify the exact abi you want valid tags for, or None. If None, use the local interpreter abi. Nrz.abir>r"r*Znoner?Zmacosxz {}_{}_%i_%sZ manylinux2014>rHi686Z manylinux2010Z manylinux1z%s%s>3130zpy%sany)r(rr rDsetrraddr@extendsortedlistrrP partition _osx_arch_patmatchrrreversedrintrrr}r{ enumerate)rZnoarchrrBrCZ supportedr&ZabisZabi3ssuffixrZ arch_prefixZarch_sepZ arch_suffixrnamer+r,Z actual_archZtplrr:aversionirrr get_supportedHs~              $ $   r)TT)NFNNN)4__doc__Z __future__rZdistutils.utilrNZloggingrrerr r collectionsrZpip._internal.utils.glibcruZpip._internal.utils.compatrZpip._internal.utils.typingrtypingrrrr r r r r%Z Pep425TagZ getLogger__name__r.compilerrr r'r)r(r-r2rDrFrPror{r}rrrrZimplementation_tagrrrrsP    $     !?  yPK]goj]*__pycache__/build_env.cpython-38.opt-1.pycnu[U .e]@sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZddlmZddlmZdd lmZdd lmZdd lmZerdd lmZmZmZmZmZdd l m!Z!e"e#Z$GdddZ%Gddde&Z'Gddde'Z(dS)z;Build Environment used for isolation during sdist building N) OrderedDict)get_python_lib) get_paths) RequirementVersionConflict WorkingSet)__file__)call_subprocess) TempDirectory)MYPY_CHECK_RUNNING) open_spinner)TupleSetIterableOptionalList) PackageFinderc@seZdZddZdS)_PrefixcCsj||_d|_ttjdkrdnd||ddd|_td|d}td|d}||kr\|g|_n ||g|_dS) NFntZ posix_prefix)baseZplatbase)varsZscripts) plat_specificprefixT)pathsetuprosnamebin_dirrlib_dirs)selfrZpurelibZplatlibr ;/usr/lib/python3.8/site-packages/pip/_internal/build_env.py__init__!s   z_Prefix.__init__N)__name__ __module__ __qualname__r"r r r r!rsrc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)BuildEnvironmentzFCreates and manages an isolated environment to install build deps c stdd_tfdddD_g_g_ttjD] }j |j j |j qBddt dd t d d fD}tjjjd _tjjstjttjjd d "}|tdj|jdW5QRXdS)Nz build-env)Zkindc3s(|] }|ttjjj|fVqdSN)rrrjoin _temp_dir.0rrr r! ;sz,BuildEnvironment.__init__..)ZnormalZoverlaycSsh|]}tj|qSr )rrnormcase)r+siter r r! Isz,BuildEnvironment.__init__..F)rTr/zsitecustomize.pywa import os, site, sys # First, drop system-sites related paths. original_sys_path = sys.path[:] known_paths = set() for path in {system_sites!r}: site.addsitedir(path, known_paths=known_paths) system_paths = set( os.path.normcase(path) for path in sys.path[len(original_sys_path):] ) original_sys_path = [ path for path in original_sys_path if os.path.normcase(path) not in system_paths ] sys.path = original_sys_path # Second, add lib directories. # ensuring .pth file are processed. for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) ) system_sitesr)r r)r _prefixes _bin_dirs _lib_dirsreversedlistvaluesappendrextendrrrrr( _site_direxistsmkdiropenwritetextwrapdedentformat)rrr2fpr r,r!r"7s0    zBuildEnvironment.__init__cCsndddD|_|jdd}|jd}|r>||tj|jg}tjtj |dtj |ddS)NcSsi|]}|tj|dqSr')renvirongetr*r r r! osz.BuildEnvironment.__enter__..)PATHZPYTHONNOUSERSITEZ PYTHONPATHrG1) _save_envr4r:splitrpathsepr;rDupdater()rrZold_pathZ pythonpathr r r! __enter__ns   zBuildEnvironment.__enter__cCs:|jD]*\}}|dkr*tj|dq |tj|<q dSr')rIitemsrrDpop)rexc_typeexc_valexc_tbZvarname old_valuer r r!__exit__szBuildEnvironment.__exit__cCs|jdSr')r)cleanupr,r r r!rUszBuildEnvironment.cleanupc Cst}t}|rt|j}|D]p}z"|t|dkrB||Wqtk r}z*|t|j d t|j dfW5d}~XYqXq||fS)zReturn 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs Nr) setrr5findrparseaddrstrargsZas_requirement)rZreqsZmissingZ conflictingZwsZreqer r r!check_requirementss  z#BuildEnvironment.check_requirementsc CsV|j|}d|_|sdStjtjtdddd|jdg}t t j krP| ddD]:}t |j|}|d |d d d t|pd hfqT|j} | r|d| dg| ddD]} |d| gqn | d|jD]} |d| gq|jD]} |d| gq|jr| d| d ||t|} t|| dW5QRXdS)NTZinstallz--ignore-installedz --no-userz--prefixz--no-warn-script-locationz-v)Z no_binaryZ only_binaryz--_-,z:none:z-irrVz--extra-index-urlz --no-indexz --find-linksz--trusted-hostz--pre)spinner)r3rsys executablerrdirname pip_locationloggerZgetEffectiveLevelloggingDEBUGr9getattrformat_controlr:replacer(sorted index_urlsZ find_linksZ trusted_hostsZallow_all_prereleasesr r )rfinder requirementsZprefix_as_stringmessagerr\rkZformatsrnZ extra_indexlinkZhostrbr r r!install_requirementssH           z%BuildEnvironment.install_requirementsN) r#r$r%__doc__r"rMrTrUr^rsr r r r!r&3s7r&c@s8eZdZdZddZddZddZdd Zd d Zd S) NoOpBuildEnvironmentz5A no-op drop-in replacement for BuildEnvironment cCsdSr'r r,r r r!r"szNoOpBuildEnvironment.__init__cCsdSr'r r,r r r!rMszNoOpBuildEnvironment.__enter__cCsdSr'r )rrPrQrRr r r!rTszNoOpBuildEnvironment.__exit__cCsdSr'r r,r r r!rUszNoOpBuildEnvironment.cleanupcCs tdSr')NotImplementedError)rrorprrqr r r!rssz)NoOpBuildEnvironment.install_requirementsN) r#r$r%rtr"rMrTrUrsr r r r!rus ru))rtrhrrcr@ collectionsrZdistutils.sysconfigrZ sysconfigrZpip._vendor.pkg_resourcesrrrZpiprrfZpip._internal.utils.subprocessr Zpip._internal.utils.temp_dirr Zpip._internal.utils.typingr Zpip._internal.utils.uir typingr rrrrZpip._internal.indexrZ getLoggerr#rgrobjectr&rur r r r!s*          PK]~__pycache__/main.cpython-38.pycnu[U ʗReT@s.ddlmZmZdeeeedddZdS))ListOptionalN)argsreturncCsddlm}||S)zThis is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. r)_wrapper)pip._internal.utils.entrypointsr)rrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/main.pymains r )N)typingrrstrintr rrrr sPK]#pO''#__pycache__/__init__.cpython-38.pycnu[U ʗReK@sJddlmZmZddlZddlmZedeeee dddZ dS))ListOptionalN)_log)argsreturncCsddlm}||ddS)zThis is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. r)_wrapperT)_nowarn)pip._internal.utils.entrypointsr)rrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/__init__.pymain s r )N) typingrr*pip._internal.utils.inject_securetransportpipZpip._internal.utilsr init_loggingstrintr r r r r s PK]* N##$__pycache__/build_env.cpython-38.pycnu[U ʗRe?%@sJdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZmZmZmZmZmZddlmZddlmZdd lmZdd lmZdd lmZdd lm Z m!Z!m"Z"dd l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)m*Z*e rddl+m,Z,e-e.Z/GdddZ0e1dddZ2GdddZ3Gddde3Z4dS)z;Build Environment used for isolation during sdist building N) OrderedDict) get_paths) TracebackType) TYPE_CHECKINGIterableListOptionalSetTupleType)where) Requirement)Version)__file__) open_spinner) get_platlibget_prefixed_libs get_purelib)get_default_environmentget_environment)call_subprocess) TempDirectory tempdir_kinds) PackageFinderc@seZdZeddddZdS)_PrefixN)pathreturncCs@||_d|_ttjdkrdnd||ddd|_t||_dS)NFnt posix_prefix)baseplatbase)varsscripts)rsetuprosnamebin_dirrlib_dirs)selfrr)/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/build_env.py__init__ sz_Prefix.__init__)__name__ __module__ __qualname__strr+r)r)r)r*rsrrcCs.ttj}|s t|St|dS)zGet a file to pass to a Python executable, to run the currently-running pip. This is used to run a pip subprocess, for installing requirements into the build environment. z__pip-runner__.py) pathlibPath pip_locationresolveparentis_dirr/r$fsdecode)sourcer)r)r*_get_runnable_pip*sr9c@seZdZdZddddZddddZeeeeeee ddd d Z e e e ee e e fee fd d d Zde e e e ddddZee de e ee ddddZdS)BuildEnvironmentzACreates and manages an isolated environment to install build depsNr0c sttjddtfdddD|_g|_g|_tt|j D] }|j |j |j |j qDddttfD}tjjd|_tj|jst|jttj|jd d d d "}|td j||jdW5QRXdS)NT)kindglobally_managedc3s&|]}|ttjj|fVqdSN)rr$rjoin.0r%temp_dirr)r* @sz,BuildEnvironment.__init__..)normaloverlaycSsh|]}tj|qSr))r$rnormcase)r@siter)r)r* Nsz,BuildEnvironment.__init__..rGzsitecustomize.pywzutf-8)encodinga import os, site, sys # First, drop system-sites related paths. original_sys_path = sys.path[:] known_paths = set() for path in {system_sites!r}: site.addsitedir(path, known_paths=known_paths) system_paths = set( os.path.normcase(path) for path in sys.path[len(original_sys_path):] ) original_sys_path = [ path for path in original_sys_path if os.path.normcase(path) not in system_paths ] sys.path = original_sys_path # Second, add lib directories. # ensuring .pth file are processed. for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) ) system_sitesr')rr BUILD_ENVr _prefixes _bin_dirs _lib_dirsreversedlistvaluesappendr&extendr'rrr$rr> _site_direxistsmkdiropenwritetextwrapdedentformat)r(prefixrKfpr)rAr*r+=s:    zBuildEnvironment.__init__cCsndddD|_|jdd}|jd}|r>||tj|jg}tjtj |dtj |ddS)NcSsi|]}|tj|dqSr=)r$environgetr?r)r)r* usz.BuildEnvironment.__enter__..)PATHPYTHONNOUSERSITE PYTHONPATHrb1) _save_envrNrTsplitr$pathseprUr_updater>)r(rold_path pythonpathr)r)r* __enter__ts   zBuildEnvironment.__enter__exc_typeexc_valexc_tbrcCs:|jD]*\}}|dkr*tj|dq |tj|<q dSr=)rfitemsr$r_pop)r(rnrorpvarname old_valuer)r)r*__exit__szBuildEnvironment.__exit__)reqsrc Cst}t}|rt|dr$t|jnt}|D]}t|}|jdk rV|jddisVq.||j }|sr| |q.t |j t r|j d|j }n|j d|j }|jj|j dds.| ||fq.||fS) zReturn 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs rONextraz==z===T) prereleases)sethasattrrrOrr markerevaluateget_distributionr%add isinstanceversionr specifiercontains) r(rvmissing conflictingenvreq_strreqdistinstalled_req_strr)r)r*check_requirementss*    z#BuildEnvironment.check_requirementsrfinder requirementsprefix_as_stringr;rcCs<|j|}|jrtd|_|s"dS|jt||||ddS)NT)r;)rMr#AssertionError_install_requirementsr9)r(rrrr;r]r)r)r*install_requirementss  z%BuildEnvironment.install_requirements) pip_runnablerrr]r;rc Cs`tj|dddd|jdg}ttjkr0|ddD]:}t|j |}| d| d d d t |pdd hfq4|j}|r| d |dg|ddD]} | d| gqn |d|jD]} | d| gq|jD]} | d| gq|jr|d|jr|d|d| |dti} td|} t|d|| | dW5QRXdS)Ninstallz--ignore-installedz --no-userz--prefixz--no-warn-script-locationz-v) no_binary only_binaryz--_-,z:none:z-irz--extra-index-urlz --no-indexz --find-linksz--trusted-hostz--prez--prefer-binary_PIP_STANDALONE_CERTz Installing zpip subprocess to install ) command_descspinner extra_environ)sys executablerloggergetEffectiveLevelloggingDEBUGrSgetattrformat_controlrTreplacer>sorted index_urls find_links trusted_hostsallow_all_prereleases prefer_binaryr rr)rrrr]r;argsrformatsr extra_indexlinkhostrrr)r)r*rsT            z&BuildEnvironment._install_requirements)r,r-r.__doc__r+rlrr BaseExceptionrrurr/r r rr staticmethodrrr)r)r)r*r::s27   $ r:c@sxeZdZdZddddZddddZeeeeeee ddd d Z ddd d Z d e e e e ddddZdS)NoOpBuildEnvironmentz0A no-op drop-in replacement for BuildEnvironmentNr0cCsdSr=r)r(r)r)r*r+ szNoOpBuildEnvironment.__init__cCsdSr=r)rr)r)r*rl szNoOpBuildEnvironment.__enter__rmcCsdSr=r))r(rnrorpr)r)r*ruszNoOpBuildEnvironment.__exit__cCsdSr=r)rr)r)r*cleanupszNoOpBuildEnvironment.cleanuprrcCs tdSr=)NotImplementedError)r(rrrr;r)r)r*rsz)NoOpBuildEnvironment.install_requirements)r,r-r.rr+rlrr rrrurrr/rr)r)r)r*rs  r)5rrr$r1rrZ collectionsr sysconfigrtypesrtypingrrrrr r r pip._vendor.certifir "pip._vendor.packaging.requirementsr Zpip._vendor.packaging.versionrpiprr3pip._internal.cli.spinnersrpip._internal.locationsrrrpip._internal.metadatarrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrr"pip._internal.index.package_finderr getLoggerr,rrr/r9r:rr)r)r)r*s4   $         MPK]i4,4,(__pycache__/configuration.cpython-38.pycnu[U ʗRe4@s>dZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZejZe d eZerd nd Zd Zed dddddZejej ej!ej"ej#fZ$ej ejej!fZ%ee&Z'eedddZ(ee edddZ)eee efdddZ*GdddZ+dS)a Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from N)AnyDictIterableListNewTypeOptionalTuple)ConfigurationError!ConfigurationFileCouldNotBeLoaded)appdirs)WINDOWS) getLogger) ensure_direnumKindzpip.inizpip.conf)versionhelpuserglobalsiteenvzenv-var)USERGLOBALSITEENVENV_VAR)namereturncCs*|dd}|dr&|dd}|S)zAMake a name consistent regardless of source (environment or file)_-z--N)lowerreplace startswith)rr$/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/configuration.py_normalize_name2s  r&cCs&d|krd|}t||ddS)N.zbKey does not contain dot separated section and key. Perhaps you wanted to use 'global.{}' instead?)formatr split)r error_messager$r$r%_disassemble_key:sr,rcCstddtdD}tjtjt}tjtjdt rEsz+get_configuration_files..pip~z.pip)r site_config_dirsr.r/r0sysprefixr1 expanduserr user_config_dirkindsrrr)global_config_filessite_config_filelegacy_config_filenew_config_filer$r$r%get_configuration_filesDs"  r@cseZdZdZd6eeeddfdd ZddddZee dd d Z e e e e fdd d Ze e d ddZe e ddddZe dd ddZddddZddddZeee e fdddZddddZee edddZe ed d!d"Zddd#d$Ze e e e e fee e fd%d&d'Ze e e e fdd(d)Ze e eee fdd*d+Zeee e fd,d-d.Z e e efdd/d0Z!e edd1d2d3Z"e dd4d5Z#Z$S)7 ConfigurationaHandles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. N)isolated load_onlyrcsjt|dk r4|tkr4tddttt||_||_ ddt D|_ ddt D|_ g|_ dS)Nz5Got invalid value for load_only - should be one of {}z, cSsi|] }|gqSr$r$r2variantr$r$r% rsz*Configuration.__init__..cSsi|] }|iqSr$r$rDr$r$r%rFus)super__init__VALID_LOAD_ONLYr r)r0mapreprrBrCOVERRIDE_ORDER_parsers_config_modified_parsers)selfrBrC __class__r$r%rHes  zConfiguration.__init__r-cCs||js|dS)zs8 $      PK]"q4__pycache__/self_outdated_check.cpython-38.opt-1.pycnu[U .e@s^ddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZmZdd lmZm Z m!Z!dd l"m#Z#ddl$m%Z%e%rddl&Z&ddl&m'Z'ddl(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.dZ/e0e1Z2dddZ3ddZ4Gddde5Z6ddZ7ddZ8dS))absolute_importN) pkg_resources)version) ensure_binary) LinkCollector) PackageFinder) SearchScope)SelectionPreferences)WINDOWS)adjacent_tmp_filecheck_path_ownerreplace) ensure_dirget_installed_versionredact_auth_from_url) get_installer)MYPY_CHECK_RUNNING)Values)AnyDictTextUnion) PipSessionz%Y-%m-%dT%H:%M:%SZFcCs`|jg|j}|jr8|s8tdddd|Dg}|jp@g}tj||d}t ||d}|S)z :param session: The Session to use to make requests. :param suppress_no_index: Whether to ignore the --no-index option when constructing the SearchScope object. zIgnoring indexes: %s,css|]}t|VqdSN)r).0ZurlrE/usr/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py @sz&make_link_collector..) find_links index_urls)session search_scope) Z index_urlZextra_index_urlsZno_indexloggerdebugjoinrrcreater)r!optionssuppress_no_indexr rr"link_collectorrrrmake_link_collector1s    r*cCst|}t|}|Sr)rhashlibZsha224Z hexdigest)keyZ key_bytesnamerrr_get_statefile_namePsr.c@s(eZdZddZeddZddZdS)SelfCheckStatec Csni|_d|_|rjtj|dt|j|_z&t|j}t ||_W5QRXWnt t t fk rhYnXdS)NZ selfcheck) statestatefile_pathospathr%r.r,openjsonloadIOError ValueErrorKeyError)self cache_dirZ statefilerrr__init__Xs zSelfCheckState.__init__cCstjSr)sysprefix)r:rrrr,jszSelfCheckState.keyc Cs|js dSttj|js dSttj|j|j|t|d}t j |ddd}t |j}| t |W5QRXzt|j|jWntk rYnXdS)N)r, last_check pypi_versionT)r:)Z sort_keysZ separators)r1r r2r3dirnamerr,strftimeSELFCHECK_DATE_FMTr5dumpsr writerr r-OSError)r:r@ current_timer0textfrrrsavens  zSelfCheckState.saveN)__name__ __module__ __qualname__r<propertyr,rKrrrrr/Ws r/cCs6zt|}dt|kWStjk r0YdSXdS)zChecks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. pipFN)rZget_distributionrZDistributionNotFound)ZpkgZdistrrrwas_installed_by_pips  rQcCsXtd}|sdSt|}d}zt|jd}tj}d|jkrzd|jkrztj|jdt }|| dkrz|jd}|dkrt ||dd}t d d d } t j|| d } | dj} | dkrWdSt| j}|||t|} || ko|j| jkotd} | s WdStrd }nd}td |||Wn$tk rRtjdddYnXdS)zCheck for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. rPN)r;r?r@i: T)r'r(F)Z allow_yankedZallow_all_prereleases)r)selection_prefsz python -m pipzYou are using pip version %s; however, version %s is available. You should consider upgrading via the '%s install --upgrade pip' command.z5There was an error checking the latest version of pip)exc_info)rpackaging_versionparser/r;datetimeZutcnowr0strptimerDZ total_secondsr*r rr&Zfind_best_candidatebest_candidatestrrrKZ base_versionrQr r#Zwarning Exceptionr$)r!r'Zinstalled_versionZ pip_versionr@r0rHr?r)rRfinderrXZremote_versionZlocal_version_is_olderZpip_cmdrrrpip_self_version_checksp         r\)F)9Z __future__rrVr+r5ZloggingZos.pathr2r=Z pip._vendorrZpip._vendor.packagingrrTZpip._vendor.sixrZpip._internal.collectorrZpip._internal.indexrZ!pip._internal.models.search_scoperZ$pip._internal.models.selection_prefsr Zpip._internal.utils.compatr Zpip._internal.utils.filesystemr r r Zpip._internal.utils.miscrrrZpip._internal.utils.packagingrZpip._internal.utils.typingrZoptparsertypingrrrrZpip._internal.network.sessionrrDZ getLoggerrLr#r*r.objectr/rQr\rrrrs>               ;PK] ,,#__pycache__/download.cpython-38.pycnu[U .eEQ@sddlmZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z ddlmZddlmZddlmZmZddlmZdd lmZdd lmZdd lmZdd lmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'dd l(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3e+rddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:ddl;mZ>ddl?m@Z@ddlAmBZBered0d ZSd1d2ZTd3d4ZUd?d5dZVd@d6d!ZWd7d#ZXd8d"ZYd9d:ZZd;d<Z[dS)A)absolute_importN)requests)CONTENT_CHUNK_SIZEResponse)PY2)parse) HashMismatchInstallationError)PyPI) PipSession) auto_decode) copy2_fixed) ask_path_exists backup_dirconsume display_path format_sizehide_urlpath_to_displayrmtreesplitext) TempDirectory)MYPY_CHECK_RUNNING)DownloadProgressProvider) unpack_file)get_url_scheme)vcs)IOCallableListOptionalTextTuple) TypedDict)Link)Hashes)VersionControlCopytreeKwargsignoresymlinksF)Ztotal) copy_functionr)Zignore_dangling_symlinksr*get_file_contentunpack_vcs_linkunpack_file_urlunpack_http_url unpack_urlparse_content_dispositionsanitize_content_filenamec Cs6|dkrtdt|}|dkr>||}||j|jfS|dkr|rd|drdtd||f|ddd}| d d }t |}|r| dd|d dd}t |}|d rd |d }|}z&t|d }t|}W5QRXWn4tk r,} ztd t| W5d} ~ XYnX||fS)a*Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. :param url: File path or url. :param comes_from: Origin description of requirements. :param session: Instance of pip.download.PipSession. NzAget_file_content() missing 1 required keyword argument: 'session')httpZhttpsfiler3z6Requirements file %s references URL %s, which is local:\/|rbz$Could not open requirements file: %s) TypeErrorrgetraise_for_statusurltext startswithr splitreplace_url_slash_drive_rematchgroup urllib_parseZunquotelstripopenr readIOErrorstr) r>Z comes_fromsessionschemeresppathrDfZcontentexcrR:/usr/lib/python3.8/site-packages/pip/_internal/download.pyr,UsB         z /*([a-z])\|cCs,t|}|dk st|j|t|jddS)N)r>)_get_used_vcs_backendAssertionErrorunpackrr>)linklocation vcs_backendrRrRrSr-s cCs$tjD]}|j|jkr|SqdS)z1 Return a VersionControl object or None. N)rZbackendsrMZschemes)rWrYrRrRrSrTs   rTcOs|SNrR)iterableargskwargsrRrRrS_progress_indicatorsr^c s6ztjd}Wntttfk r0d}YnXtdd}ttj krRd}n&|r\d}n|dkrjd}n|std}nd}|j }fdd} fd d } t } |j t j kr|} n|j} |rt||d } |rtd | t|n td | n|rtd| n td | | | | tt} |r*|| nt| dS)Nzcontent-lengthrZ from_cacheFi@Tc3sTz jj|ddD] }|VqWn.tk rNj|}|sBqJ|Vq0YnXdS)NF)Zdecode_content)rawstreamAttributeErrorrI)Z chunk_sizechunk)rNrRrS resp_reads   z _download_url..resp_readc3s|D]}||VqdSrZ)write)Zchunksrb) content_filerRrSwritten_chunkss z%_download_url..written_chunks)maxzDownloading %s (%s)zDownloading %szUsing cached %s)intheaders ValueErrorKeyErrorr;getattrloggerZgetEffectiveLevelloggingINFOshow_urlr^Znetlocr Zurl_without_fragmentrinforrZcheck_against_chunksr)rNrWrehashes progress_barZ total_lengthZ cached_respZ show_progressrprcrfZprogress_indicatorr>Zdownloaded_chunksrR)rerNrS _download_urlsP   %    rtcCsd}tj||j}tj|rtdt|d}|dkr@d}nj|dkrdtdt|t |nF|dkrt |}td t|t|t ||n|d krt d |rt ||td t|dS) NTz8The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abort)iwbaruFrvz Deleting %srwzBacking up %s to %srxzSaved %s)osrOjoinfilenameexistsrrrmwarningremovershutilZmovesysexitcopyrq)r|rXrWrZdownload_locationresponseZ dest_filerRrRrS _copy_files6    ronc Cs|dkrtdtddv}d}|r0t|||}|rH|}t|d} nt|||j||\}} t||| |r~|s~t||||st |W5QRXdS)Nz@unpack_http_url() missing 1 required keyword argument: 'session'rV)Zkindr) r;r_check_download_dir mimetypes guess_type_download_http_urlrOrrrzunlink) rWrX download_dirrLrrrstemp_diralready_downloaded_path from_path content_typerRrRrSr/s2    c CsTzt||Wn@tjk rN}z tdt|t|t|W5d}~XYnXdS)zCopying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. z>Ignoring special file error '%s' encountered copying %s to %s.N)r rZSpecialFileErrorrmr~rKr)srcdesterRrRrS_copy2_ignoring_special_filesJsrcs`tj|}tj|tj|fdd}t|dd}tsLt|d<tj |f|dS)Ncs6g}|kr|ddg7}tj|kr2|g7}|S)Nz.toxz.nox)rzrOabspath)dnamesZskippedsourceZtarget_basenameZtarget_dirnamerRrSr)es   z!_copy_source_tree..ignoreTr(r+) rzrOrbasenamedirnamedictrrrZcopytree)rtargetZtarget_abspathr)r]rRrrS_copy_source_tree_s    rcCs|j}|r>tj|r"t|t|||r:tddS|rL| |d}|r`t |||}|rj|}n|}t |d}t ||||r|st|||dS)zUnpack link into location. If download_dir is provided and link points to a file, make a copy of the link file inside download_dir. z*Link is a directory, ignoring download_dirNr) file_pathZis_existing_dirrzrOisdirrrrmrqcheck_against_pathrrrrr)rWrXrrrZ link_pathrrrrRrRrSr.~s.      cCsP|jrt||n:|jr*t||||dn"|dkr8t}t||||||ddS)avUnpack link. If link is a VCS link: if only_download, export into download_dir and ignore location else unpack into location for other types of link: - unpack into location - if download_dir, copy the file into download_dir - if only_download, mark location for deletion :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. )rrN)rrrs)Zis_vcsr-is_filer.r r/)rWrXrrLrrrsrRrRrSr0s cCs tj|S)zJ Sanitize the "filename" value from a Content-Disposition header. )rzrOr)r|rRrRrSr2scCs,t|\}}|d}|r$t|}|p*|S)z Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. r|)cgiZ parse_headerr<r2)content_dispositionZdefault_filenameZ_typeZparamsr|rRrRrSr1s  c Cs*|jddd}z |j|ddidd}|Wn8tjk rj}ztd|jj |W5d }~XYnX|j d d }|j } |j d } | rt | | } t | d} | st|} | r| | 7} | s|j|jkrtj |jd} | r| | 7} tj|| } t| d } t||| ||W5QRX| |fS)z6Download link url into temp_dir using provided session#r6rzAccept-EncodingZidentityT)rir`zHTTP error %s while getting %sNz content-typezcontent-dispositionwb)r>rAr<r=rZ HTTPErrorrmZcriticalrZ status_coderir|r1rrZguess_extensionrzrOr{rHrt)rWrLrrrrsZ target_urlrNrQrr|rZextrrerRrRrSrsB       rcCsptj||j}tj|s dStd||rlz||Wn,tk rjt d|t |YdSX|S)z Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.) rzrOr{r|r}rmrqrrr~r)rWrrrZ download_pathrRrRrSr7s   r)NN)NNNr)NN)NNNr)\Z __future__rrrnrrzrerrZ pip._vendorrZpip._vendor.requests.modelsrrZpip._vendor.sixrZpip._vendor.six.moves.urllibrrFZpip._internal.exceptionsrr Zpip._internal.models.indexr Zpip._internal.network.sessionr Zpip._internal.utils.encodingr Zpip._internal.utils.filesystemr Zpip._internal.utils.miscrrrrrrrrrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.uirZpip._internal.utils.unpackingrZpip._internal.utils.urlsrZpip._internal.vcsrtypingrrrr r!r"Zmypy_extensionsr#Zpip._internal.models.linkr$Zpip._internal.utils.hashesr%Z pip._internal.vcs.versioncontrolr&rKboolr'__all__Z getLogger__name__rmr,compileIrCr-rTr^rtrr/rrr.r0r2r1rrrRrRrRrSs        ,               0 d -" 8 .?PK]Hx=)=).__pycache__/configuration.cpython-38.opt-1.pycnu[U .e7@sdZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZddlmZmZddlmZerdd lmZmZmZmZmZmZmZejZed eZee Z!d d Z"d dZ#eddddddZ$e rdndZ%ddZ&Gddde'Z(dS)a Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from N) configparser)ConfigurationError!ConfigurationFileCouldNotBeLoaded)appdirs)WINDOWS expanduser) ensure_direnum)MYPY_CHECK_RUNNING)AnyDictIterableListNewTypeOptionalTupleKindcCs*|dd}|dr&|dd}|S)zFMake a name consistent regardless of source (environment or file) _-z--N)lowerreplace startswith)namer?/usr/lib/python3.8/site-packages/pip/_internal/configuration.py_normalize_name.s  rcCs&d|krd|}t||ddS)N.zbKey does not contain dot separated section and key. Perhaps you wanted to use 'global.{}' instead?)formatrsplit)rZ error_messagerrr_disassemble_key8sr!userglobalZsiteenvzenv-var)USERGLOBALSITEENVENV_VARzpip.inizpip.confcCspddtdD}tjtjt}tjtdt r8dndt}tjt dt}t j |t j |gt j||giS)NcSsg|]}tj|tqSr)ospathjoinCONFIG_BASENAME).0r+rrr Qsz+get_configuration_files..Zpip~z.pip)rZsite_config_dirsr*r+r,sysprefixr-rrZuser_config_dirkindsr&r'r%)Zglobal_config_filesZsite_config_fileZlegacy_config_fileZnew_config_filerrrget_configuration_filesPs( r4cseZdZdZd)fdd ZddZddZd d Zd d Zd dZ ddZ ddZ ddZ e ddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(ZZS)* ConfigurationaHandles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. Nc stt|tjtjtjdg}||krJtdd t t |dd||_ ||_ tjtjtjtjtjg|_ddg|_dd|jD|_dd|jD|_g|_dS) Nz5Got invalid value for load_only - should be one of {}z, versionhelpcSsi|] }|gqSrrr.variantrrr sz*Configuration.__init__..cSsi|] }|iqSrrr9rrrr;s)superr5__init__r3r%r&r'rrr,mapreprisolated load_onlyr(r)_override_order_ignore_env_names_parsers_config_modified_parsers)selfr@rAZ_valid_load_only __class__rrr=ts0 zConfiguration.__init__cCs||js|dS)zELoads configuration from configuration files and environment N)_load_config_filesr@_load_environment_varsrGrrrloadszConfiguration.loadcCs*z|dWStk r$YdSXdS)z@Returns the file with highest priority in configuration rN)_get_parser_to_modify IndexErrorrLrrrget_file_to_editszConfiguration.get_file_to_editcCs |jS)z`Returns key-value pairs like dict.items() representing the loaded configuration ) _dictionaryitemsrLrrrrRszConfiguration.itemscCs4z |j|WStk r.td|YnXdS)z,Get a value from the configuration. No such key - {}N)rQKeyErrorrr)rGkeyrrr get_values zConfiguration.get_valuecCsj||\}}|dk rJt|\}}||s<||||||||j|j|<|||dS)z-Modify a value in the configuration. N) _ensure_have_load_onlyrNr! has_sectionZ add_sectionsetrErA_mark_as_modified)rGrUvaluefnameparsersectionrrrr set_values    zConfiguration.set_valuec Cs|||j|jkr&td||\}}|dk rt|\}}d}||r`|||}|rt | |}z t |}Wnt k rd}YnX|dkr| ||||ntd|j|j|=dS)z,Unset a value in the configuration. rSNFz4Fatal Internal error [id=1]. Please report as a bug.)rWrErArrrNr!rXZ remove_optioniterrRnext StopIterationZremove_sectionrZ) rGrUr\r]r^rZmodified_somethingZ section_itervalrrr unset_values,       zConfiguration.unset_valuec CsX||jD]D\}}td|ttj|t|d}| |W5QRXqdS)z*Save the current in-memory state. z Writing to %swN) rWrFloggerinforr*r+dirnameopenwrite)rGr\r]frrrsaves   zConfiguration.savecCs$|jdkrtdtd|jdS)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rArrfdebugrLrrrrWs z$Configuration._ensure_have_load_onlycCs$i}|jD]}||j|q |S)zs6   $     PK][l:&:&+__pycache__/pep425tags.cpython-38.opt-1.pycnu[U .eE>@sTdZddlmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl ZddlmZddlmZerddlmZmZmZmZmZmZmZeeeefZeeZe dZ!d d Z"d d Z#d dZ$ddZ%ddZ&ddZ'd-ddZ(ddZ)ddZ*ddZ+ddZ,d d!Z-d"d#Z.d$d%Z/d&d'Z0d(d)Z1d.d+d,Z2e'Z3dS)/z2Generate and work with PEP 425 Compatibility Tags.)absolute_importN) OrderedDict)get_extension_suffixes)MYPY_CHECK_RUNNING)TupleCallableListOptionalUnionDictSetz(.+)_(\d+)_(\d+)_(.+)c CsLz t|WStk rF}ztd|tWYdSd}~XYnXdS)Nz{}) sysconfigget_config_varIOErrorwarningswarnformatRuntimeWarning)varerConfig variable '%s' is unset, Python ABI tag may be incorrect)rloggerdebug)rZfallbackexpectedrvalrrrget_flagYsr2cstd}t}d}|s|dkrttdrd}d}d}|dktddd d rRd }tjd krvtd fdd d rvd}tjdkrtddd ddrd}d|t|||f}n:|r|drd|dd}n|r| dd dd}|S)zXReturn the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).ZSOABIN>rr maxunicoder!rZPy_DEBUGcSs ttdS)NZgettotalrefcount)rrrrrrtzget_abi_tag..)rd)Z WITH_PYMALLOCcsS)NrrZ is_cpythonrrr4xr5m)r7r7ZPy_UNICODE_SIZEcSs tjdkS)Ni)rr3rrrrr4{r5)r0ruz %s%s%s%s%szcpython--r*._) rr rrr2r&r)rsplitreplace)Zsoabiimplabir6r:r<rr9r get_abi_tagfsB   rDcCs tjdkS)Ni)rmaxsizerrrr_is_running_32bitsrFcCstjdkr^t\}}}|d}|dkr6tr6d}n|dkrHtrHd}d|d|d |Stj dd  d d }|d krtrd }|S)z0Return our platform name 'win32', 'linux_x86_64'darwinr>x86_64i386ppc64ppczmacosx_{}_{}_{}rr*r?r= linux_x86_64 linux_i686) rrZmac_verr@rFr distutilsutil get_platformrA)releaser?machineZ split_verresultrrrrPs  rPc Cs$tdkrdSz&ttjd}|d}W5QRXWntttfk rPYdSX|dksft|dkrjdSt |t rdd|D}ndd|D}|dd d d d d gk}||d ddgkM}||dddgkM}||ddddgkM}||dddgkM}||dddd @d kM}|S)N linux_armv7lFrb(cSsg|] }t|qSr)ord).0crrr sz"is_linux_armhf..cSsg|]}|qSrr)rXbrrrrZsrr;ELFr*'%&) rPopenr executablereadrOSError TypeErrorlen isinstancer%)fZelf_header_rawZ elf_headerrSrrris_linux_armhfs&  roc CsNtdkrdSzddl}t|jWSttfk r:YnXtjjj ddS)NrLrMFrr"r`) rP _manylinuxboolZmanylinux1_compatible ImportErrorAttributeErrorpip _internalutilsglibchave_compatible_glibcrqrrris_manylinux1_compatibles  r{c CsNtdkrdSzddl}t|jWSttfk r:YnXtjjj ddS)NrpFrr" ) rPrqrrZmanylinux2010_compatiblersrtrurvrwrxryrzrrris_manylinux2010_compatibles  r}c Csdt}|dkrdS|dkr$ts$dSzddl}t|jWSttfk rPYnXtjj j ddS)N> linux_s390xrMrL linux_ppc64lerT linux_aarch64 linux_ppc64FrTrr") rProrqrrZmanylinux2014_compatiblersrtrurvrwrxry)rrqrrris_manylinux2014_compatibles rcsrg}fddtddddg|||r8||D]&}||kr<|||r<||q<|d|S)zReturn a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine. cs||dkr||fdkS|dkr(||fdkS|dkr<||fdkS|dkrP||fdkS|krx|D]}|||r`dSq`dS) NrK) r`rJrI)rr;rHTFr)r+r,archgarch_supports_archgroupsrrrs      z)get_darwin_arches.._supports_arch)Zfat)rIrK)Zintel)rHrI)Zfat64)rHrJ)Zfat32)rHrIrKZ universal)rappend)r+r,rRarchesrrrrget_darwin_archess%    rc CsFg}|dd}t|dddD] }|dtt||fq |S)Nr!)rangerr#r$r%)r&versionsr+r,rrr!get_all_minor_versions_as_strings>s  rFcCsDg}|dkrt}t|}|p"t}g}|p0t}|rD|g|dd<t}tD]$} | drP|| dddqP| t t || d|s|pt } | d\} } } | d r>t| }|r6|\}}}}d ||}g}ttt|dD]0}tt|||D]}| |||fqqn| g}n| d kr~| g}| d kr| d | | | d| | n| d kr| d| | g}nn|dkrg}tr| d | | tr| d | | tr| d| | | | n| g}|D].}|D]"} | d||df|| fqq |ddD]F}|dkr\q|D]*}|D]} | d||f|| fqhq`qH|D]"} | d|ddd| fq| d||dfddf| d||ddfddft|D]B\}}| d|fddf|dkr| d|dddfq|S)acReturn a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abi: specify the exact abi you want valid tags for, or None. If None, use the local interpreter abi. Nrz.abir>r"r*Znoner?Zmacosxz {}_{}_%i_%sZ manylinux2014>i686rHZ manylinux2010Z manylinux1z%s%s>3130zpy%sany)r(rr rDsetrraddr@extendsortedlistrrP partition _osx_arch_patmatchrrreversedrintrrr}r{ enumerate)rZnoarchrrBrCZ supportedr&ZabisZabi3ssuffixrZ arch_prefixZarch_sepZ arch_suffixrnamer+r,Z actual_archZtplrr:aversionirrr get_supportedHs~              $ $   r)TT)NFNNN)4__doc__Z __future__rZdistutils.utilrNZloggingrrerr r collectionsrZpip._internal.utils.glibcruZpip._internal.utils.compatrZpip._internal.utils.typingrtypingrrrr r r r r%Z Pep425TagZ getLogger__name__r.compilerrr r'r)r(r-r2rDrFrPror{r}rrrrZimplementation_tagrrrrsP    $     !?  yPK]$cNbb&__pycache__/index.cpython-38.opt-1.pycnu[U .e@s(dZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z mZmZmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*e$rddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ddl m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>e3e2de2e?e@ffZAe2e?e?e?e4eAe/e?fZBdddgZCeDeEZFd1d!d"ZGGd#d$d$eHZId%d&ZJGd'd(d(eHZKGd)ddeHZLGd*d+d+eHZMGd,ddeHZNd-d.ZOd/d0ZPdS)2z!Routines related to PyPI, indexes)absolute_importN) specifiers)canonicalize_name)parse)BestVersionAlreadyInstalledDistributionNotFoundInvalidWheelFilenameUnsupportedWheel)InstallationCandidate) FormatControl)Link)SelectionPreferences) TargetPython)WHEEL_EXTENSION) indent_log) build_netloc)check_requires_python)MYPY_CHECK_RUNNING)SUPPORTED_EXTENSIONS) url_to_path)Wheel) FrozenSetIterableListOptionalSetTextTupleUnion) _BaseVersion) LinkCollector) SearchScope)InstallRequirement) Pep425Tag)Hashesr BestCandidateResult PackageFinderFcCs~zt|j|d}Wn&tjk r8td|j|YnBX|szdtt|}|shtd||j|dStd||j|dS)aa Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. ) version_infoz2Ignoring invalid Requires-Python (%r) for link: %s.z4Link requires a different Python (%s not in: %r): %sFzBIgnoring failed Requires-Python check (%s not in: %r) for link: %sT) rZrequires_pythonrZInvalidSpecifierloggerdebugjoinmapstr)linkr(ignore_requires_pythonZ is_compatibleversionr%r%7/usr/lib/python3.8/site-packages/pip/_internal/index.py_check_link_requires_python;s8  r3c@s,eZdZdZedZdddZddZdS) LinkEvaluatorzD Responsible for evaluating links for a particular project. z-py([123]\.?[0-9]?)$NcCs4|dkr d}||_||_||_||_||_||_dS)a :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. NF) _allow_yanked_canonical_name_ignore_requires_python_formats_target_python project_name)selfr:canonical_nameformats target_python allow_yankedr0r%r%r2__init__rszLinkEvaluator.__init__c Csd}|jr(|js(|jpd}dd|fS|jr<|j}|j}n|\}}|sPdS|tkrddd|fSd|jkr|t krd|j }d|fSd |j kr|d krd S|t kr,zt |j }Wntk rYd SXt|j|jkrd |j }d|fS|j}||s&|}dd|}d|fS|j}d|jkrP|t krPdd|j fS|sbt||j}|svdd|j fS|j|} | r|d| }| d} | |jjkrdSt||jj|j d} | sdSt!"d||d|fS)aG Determine whether a link is a candidate for installation. :return: A tuple (is_candidate, result), where `result` is (1) a version string if `is_candidate` is True, and (2) if `is_candidate` is False, an optional string to log the reason the link fails to qualify. N Fzyanked for reason: {})Fz not a filezunsupported archive format: %sZbinaryzNo binaries permitted for %sZmacosx10z.zip)Fz macosx10 one)Fzinvalid wheel filenamezwrong project name (not %s)z"none of the wheel's tags match: {}, sourcezNo sources permitted for %szMissing project version for %s)FzPython version is incorrect)r(r0)FNzFound link %s, version: %sT)# is_yankedr5 yanked_reasonformat egg_fragmentextsplitextrr8rr:pathrfilenamerrnamer6r9get_tags supportedZget_formatted_file_tagsr,r1_extract_version_from_fragment_py_version_researchstartgroup py_versionr3Zpy_version_infor7r*r+) r;r/r1reasonZegg_inforIwheelsupported_tagsZ file_tagsmatchrUZsupports_pythonr%r%r2 evaluate_linksx            zLinkEvaluator.evaluate_link)N) __name__ __module__ __qualname____doc__recompilerQr@rZr%r%r%r2r4fs  &r4c Cs|stdt||t|Sg}g}d}|D]>}|j}|js@n"|j|drV|d7}n ||q.||q.|rx|}nt|}t|t|krd} n dt|d dd |D} td t|||j |t||| |S) a Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). zJGiven no hashes to check %s links for project %r: discarding no candidatesr)hashesrDzdiscarding no candidateszdiscarding {} non-matches: {}z css|]}t|jVqdSN)r.r/.0 candidater%r%r2 +sz*filter_unallowed_hashes..zPChecked %s links for project %r against %s hashes (%s matches, %s no digest): %s) r*r+lenlistr/Zhas_hashis_hash_allowedappendrGr,Z digest_count) candidatesrar:Zmatches_or_no_digestZ non_matchesZ match_countrer/ZfilteredZdiscard_messager%r%r2filter_unallowed_hashessL      rlc@seZdZdZdddZdS)CandidatePreferenceszk Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. FcCs||_||_dS)zR :param allow_all_prereleases: Whether to allow all pre-releases. N)allow_all_prereleases prefer_binary)r;rornr%r%r2r@Cs zCandidatePreferences.__init__N)FF)r[r\r]r^r@r%r%r%r2rm<srmc@s(eZdZdZddZddZddZdS) r&zA collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. cCs |dkr n||_||_||_dS)a :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. N)_applicable_candidates _candidatesbest_candidater;rkapplicable_candidatesrrr%r%r2r@Ws zBestCandidateResult.__init__cCs t|jS)z(Iterate through all candidates. )iterrqr;r%r%r2iter_allpszBestCandidateResult.iter_allcCs t|jS)z3Iterate through the applicable candidates. )rurprvr%r%r2iter_applicablevsz#BestCandidateResult.iter_applicableN)r[r\r]r^r@rwrxr%r%r%r2r&Psc@sHeZdZdZedddZdddZdd Zd d Zd d Z ddZ dS)CandidateEvaluatorzm Responsible for filtering and sorting candidates for installation based on what tags are valid. NFcCs:|dkrt}|dkrt}|}|||||||dS)aCreate a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. N)r:rX specifierrornra)rrZ SpecifierSetrN)clsr:r>rornrzrarXr%r%r2createszCandidateEvaluator.createcCs(||_||_||_||_||_||_dS)z :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). N)_allow_all_prereleases_hashes_prefer_binary _project_name _specifier_supported_tags)r;r:rXrzrornrar%r%r2r@s zCandidateEvaluator.__init__csV|jpd}|j}dd|jdd|D|dDfdd|D}t||j|jd S) zM Return the applicable candidates from a list of candidates. NcSsh|] }t|qSr%)r.)rdvr%r%r2 sz?CandidateEvaluator.get_applicable_candidates..css|]}t|jVqdSrbr.r1rdcr%r%r2rfsz?CandidateEvaluator.get_applicable_candidates..)Z prereleasescsg|]}t|jkr|qSr%rrZversionsr%r2 sz@CandidateEvaluator.get_applicable_candidates..)rkrar:)r}rfilterrlr~r)r;rkZallow_prereleasesrzrtr%rr2get_applicable_candidatess   z,CandidateEvaluator.get_applicable_candidatesc Cs|j}t|}d}d}|j}|jrt|j}||sDtd|j|jrNd}| | }|j dk rt d|j } | } t| d| df}n| }t||j} dt|j} | | ||j||fS)a) Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal r%rzB%s is not a supported wheel for this platform. It can't be sorted.rDNz ^(\d+)(.*)$)rrgr/Zis_wheelrrLrOr rZsupport_index_min build_tagr_rYgroupsintrir~rEr1) r;reZ valid_tagsZ support_numrZbinary_preferencer/rWZprirYZbuild_tag_groupsZhas_allowed_hashZ yank_valuer%r%r2 _sort_keys<    zCandidateEvaluator._sort_keycCsH|sdSt||jd}|j}|jrD|jp*d}dj||d}t||S)zy Return the best candidate per the instance's sort order, or None if no candidate is acceptable. NkeyrAzqThe candidate selected for download or install is a yanked version: {candidate} Reason for being yanked: {reason})rerV)maxrr/rErFrGr*Zwarning)r;rkrrr/rVmsgr%r%r2sort_best_candidates   z&CandidateEvaluator.sort_best_candidatecCs"||}||}t|||dS)zF Compute and return a `BestCandidateResult` instance. )rtrr)rrr&rsr%r%r2compute_best_candidate<s  z)CandidateEvaluator.compute_best_candidate)NFFNN)FFN) r[r\r]r^ classmethodr|r@rrrrr%r%r%r2ry}s  ) $<ryc@seZdZdZd&ddZed'ddZeddZej d dZed d Z ed d Z eddZ eddZ ddZddZddZddZddZddZddZd(d d!Zd)d"d#Zd$d%ZdS)*r'zThis finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. NcCsP|dkrt}|pttt}||_||_||_||_||_||_t|_ dS)a This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. N) rmr setr5_candidate_prefsr7_link_collectorr9format_control _logged_links)r;link_collectorr>r?rcandidate_prefsr0r%r%r2r@VszPackageFinder.__init__cCs8|dkrt}t|j|jd}|||||j|j|jdS)afCreate a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. N)rorn)rrr>r?rr0)rrmrornr?rr0)r{rZselection_prefsr>rr%r%r2r|~szPackageFinder.createcCs|jjSrbr search_scopervr%r%r2rszPackageFinder.search_scopecCs ||j_dSrbr)r;rr%r%r2rscCs|jjSrb)r find_linksrvr%r%r2rszPackageFinder.find_linkscCs|jjSrb)r index_urlsrvr%r%r2rszPackageFinder.index_urlsccs|jjjD]}t|Vq dSrb)rZsessionZpip_trusted_originsr)r;Z host_portr%r%r2 trusted_hostsszPackageFinder.trusted_hostscCs|jjSrbrrnrvr%r%r2rnsz#PackageFinder.allow_all_prereleasescCs d|j_dS)NTrrvr%r%r2set_allow_all_prereleasessz'PackageFinder.set_allow_all_prereleasescCs.t|}|j|}t||||j|j|jdS)N)r:r<r=r>r?r0)rrZget_allowed_formatsr4r9r5r7)r;r:r<r=r%r%r2make_link_evaluators z!PackageFinder.make_link_evaluatorcCsPgg}}t}|D]2}||kr|||jr<||q||q||S)z Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates )raddrHrj)r;linksZeggsZno_eggsseenr/r%r%r2 _sort_linkss    zPackageFinder._sort_linkscCs(||jkr$td|||j|dS)NzSkipping link: %s: %s)rr*r+r)r;r/rVr%r%r2_log_skipped_links zPackageFinder._log_skipped_linkcCs<||\}}|s(|r$|j||ddSt|j|t|dS)z If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. )rVN)Zprojectr/r1)rZrr r:r.)r;link_evaluatorr/Z is_candidateresultr%r%r2get_install_candidatesz#PackageFinder.get_install_candidatecCs6g}||D]"}|||}|dk r||q|S)zU Convert links that are candidates to InstallationCandidate objects. N)rrrj)r;rrrkr/rer%r%r2evaluate_linkss   zPackageFinder.evaluate_linksc Cs|j|}||}|j||jd}g}|jD]>\}}td|t |j||d}| |W5QRXq4|j||j d} | r| j ddtdd dd| D| ||S) aFind all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. )rzAnalyzing links from page %sT)reversezLocal files found: %srBcSsg|]}t|jjqSr%)rr/Zurlrcr%r%r2r2sz5PackageFinder.find_all_candidates..)rZ collect_linksrrrZpagesitemsr*r+rextendfilessortr,) r;r:Zcollected_linksrZfind_links_versionsZ page_versionsZpage_urlZ page_linksZ new_versionsZ file_versionsr%r%r2find_all_candidates s8      z!PackageFinder.find_all_candidatescCs"|j}tj||j|j|j||dS)z3Create a CandidateEvaluator object to use. )r:r>rornrzra)rryr|r9rorn)r;r:rzrarr%r%r2make_candidate_evaluator;s z&PackageFinder.make_candidate_evaluatorcCs$||}|j|||d}||S)aFind matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. )r:rzra)rrr)r;r:rzrarkZcandidate_evaluatorr%r%r2find_best_candidateNs z!PackageFinder.find_best_candidatec Cs|jdd}|j|j|j|d}|j}d}|jdk r@t|jj}dd}|dkrz|dkrzt d||| t d|d}|r|dks|j|krd }|s|dk r|rt d |nt d ||jdS|rt d ||| tt d |j|| |jS)zTry to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a Link if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise F)Ztrust_internet)rzraNcSs dtdd|DtdpdS)NrBcSsh|]}t|jqSr%rrr%r%r2r}szKPackageFinder.find_requirement.._format_versions..rZnone)r,sorted parse_version)Z cand_iterr%r%r2_format_versionsws  z8PackageFinder.find_requirement.._format_versionszNCould not find a version that satisfies the requirement %s (from versions: %s)z%No matching distribution found for %sTzLExisting installed version (%s) is most up-to-date and satisfies requirementzUExisting installed version (%s) satisfies requirement (most up-to-date version is %s)z=Installed version (%s) is most up-to-date (past versions: %s)z)Using version %s (newest of versions: %s))rarrMrzrrZ satisfied_byrr1r*Zcriticalrwrr+rxrr/) r;ZreqZupgraderaZbest_candidate_resultrrZinstalled_versionrZbest_installedr%r%r2find_requirementesh        zPackageFinder.find_requirement)NNN)N)NN)NN)r[r\r]r^r@rr|propertyrsetterrrrrnrrrrrrrrrrr%r%r%r2r'OsD  (         1  cCsLt|D].\}}|dkrqt|d||kr|Sqtd||dS)aFind the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 -Nz{} does not match {}) enumerater ValueErrorrG)fragmentr<irr%r%r2_find_name_version_seps  rcCsBzt||d}Wntk r(YdSX||d}|s>dS|S)zParse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. rDN)rr)rr<Z version_startr1r%r%r2rPs  rP)F)Qr^Z __future__rZloggingr_Zpip._vendor.packagingrZpip._vendor.packaging.utilsrZpip._vendor.packaging.versionrrZpip._internal.exceptionsrrrr Zpip._internal.models.candidater Z#pip._internal.models.format_controlr Zpip._internal.models.linkr Z$pip._internal.models.selection_prefsr Z"pip._internal.models.target_pythonrZpip._internal.utils.filetypesrZpip._internal.utils.loggingrZpip._internal.utils.miscrZpip._internal.utils.packagingrZpip._internal.utils.typingrZpip._internal.utils.unpackingrZpip._internal.utils.urlsrZpip._internal.wheelrtypingrrrrrrrrrZpip._internal.collectorr Z!pip._internal.models.search_scoper!Zpip._internal.reqr"Zpip._internal.pep425tagsr#Zpip._internal.utils.hashesr$rr.ZBuildTagZCandidateSortingKey__all__Z getLoggerr[r*r3objectr4rlrmr&ryr'rrPr%r%r%r2s^                 (         + K-ShPK]&$> > *__pycache__/pyproject.cpython-38.opt-1.pycnu[U .eZ@sddlmZddlZddlZddlZddlmZmZddlm Z ddl m Z e rhddl m Z mZmZmZddZd d Zd d ZdS) )absolute_importN)pytomlsix)InstallationError)MYPY_CHECK_RUNNING)AnyTupleOptionalListcCst|totdd|DS)Ncss|]}t|tjVqdS)N) isinstancerZ string_types).0itemr;/usr/lib/python3.8/site-packages/pip/_internal/pyproject.py sz"_is_list_of_str..)r listall)objrrr_is_list_of_strs rcCs2tj|d}tjr.t|tjr.|t }|S)Nzpyproject.toml) ospathjoinrZPY2r Z text_typeencodesysgetfilesystemencoding)Zunpacked_source_directoryrrrrmake_pyproject_pathsrc Cs<tj|}tj|}|rLtj|dd}t|}W5QRX|d}nd}|rr|sr|dk rl|sltdd}n<|rd|kr|dk r|std |dd}n |dkr|}|sdS|dkrd d gd d }d } d|krt| j |dd|d} t | st| j |dd|d} g} | dkr2d } d d g} | | | fS)aLoad the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing? None means the user hasn't explicitly specified. pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file req_name - The name of the requirement we're processing (for error reporting) Returns: None if we should use the legacy code path, otherwise a tuple ( requirements from pyproject.toml, name of PEP 517 backend, requirements we should check are installed after setting up the build environment ) zutf-8)encodingz build-systemNzIDisabling PEP 517 processing is invalid: project does not have a setup.pyT build-backendzbDisabling PEP 517 processing is invalid: project specifies a build backend of {} in pyproject.tomlzsetuptools>=40.8.0Zwheelz setuptools.build_meta:__legacy__)requiresrzO{package} has a pyproject.toml file that does not comply with PEP 518: {reason}rz]it has a 'build-system' table but not 'build-system.requires' which is mandatory in the table)packagereasonz1'build-system.requires' is not a list of strings.) rrisfileioopenrloadgetrformatr) Z use_pep517Zpyproject_tomlZsetup_pyZreq_nameZ has_pyprojectZ has_setupfZpp_tomlZ build_systemZerror_templaterZbackendZcheckrrrload_pyproject_toml#sb          r()Z __future__rr"rrZ pip._vendorrrZpip._internal.exceptionsrZpip._internal.utils.typingrtypingrrr r rrr(rrrrs    PK]q00+__pycache__/exceptions.cpython-38.opt-1.pycnu[U .e(@sdZddlmZddlmZmZmZddlmZddl m Z e rdddl m Z ddl mZddlmZGd d d eZGd d d eZGd ddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZ Gd'd(d(e Z!Gd)d*d*e Z"Gd+d,d,e Z#Gd-d.d.e Z$Gd/d0d0e Z%Gd1d2d2eZ&Gd3d4d4eZ'd5S)6z"Exceptions used throughout package)absolute_import)chaingroupbyrepeat) iteritems)MYPY_CHECK_RUNNING)Optional) Distribution)InstallRequirementc@seZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__rrnz$HashErrors.__str__..)keycSs|jSr' __class__r,rrrr.or/css|]}|VqdSr')body.0r-rrr qsz%HashErrors.__str__.. )r(sortrr)headextendjoin)rlinesclsZ errors_of_clsrrrrls zHashErrors.__str__cCs t|jSr')boolr(rrrr __nonzero__uszHashErrors.__nonzero__cCs|Sr')r?rrrr__bool__xszHashErrors.__bool__N) r rrrrr)rr?r@rrrrr&cs  r&c@s0eZdZdZdZdZddZddZdd ZdS) HashErrora A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. NcCs d|S)a)Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with populate_link() having already been called z %s)_requirement_namerrrrr3s zHashError.bodycCsd|j|fS)Nz%s %s)r9r3rrrrrszHashError.__str__cCs|jrt|jSdS)zReturn a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers unknown package)reqstrrrrrrCszHashError._requirement_name) r rrrrEr9r3rrCrrrrrA|s  rAc@seZdZdZdZdZdS)VcsHashUnsupporteduA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.rzlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:Nr rrrr+r9rrrrrGsrGc@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedrHzUCan't verify hashes for these file:// requirements because they point to directories:NrIrrrrrJsrJc@s(eZdZdZdZdZddZddZdS) HashMissingz2A hash was needed for a requirement but is absent.awHashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded archives actually had. Add lines like these to your requirements files to prevent tampering. (If you did not enable --require-hashes manually, note that it turns on automatically when any package has a hash.)cCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N) gotten_hash)rrNrrrrszHashMissing.__init__cCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p.hash_then_orc3s|]}dt|fVqdS)z Expected %s %sN)nextr4prefixrrr6sz0HashMismatch._hash_comparison..z Got %s r7)rrVr:r)rWZ hexdigestr;)rrZr<rYZ expectedsrr\rrXs  zHashMismatch._hash_comparisonN) r rrrr+r9rr3rXrrrrrTs  rTc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.Nr rrrrr^sr^cs*eZdZdZdfdd ZddZZS) !ConfigurationFileCouldNotBeLoadedz=When there are errors while loading a configuration file could not be loadedNcs&tt||||_||_||_dSr')superr_rreasonfnamer*)rrbrcr*r1rrr(sz*ConfigurationFileCouldNotBeLoaded.__init__cCs4|jdk rd|j}nd|jj}d|j|S)Nz in {}.z. {} zConfiguration file {}{})rcrr*messagerb)rZ message_partrrrr.s z)ConfigurationFileCouldNotBeLoaded.__str__)r`NN)r rrrrr __classcell__rrr1rr_$sr_N)(rZ __future__r itertoolsrrrZpip._vendor.sixrZpip._internal.utils.typingrtypingrZpip._vendor.pkg_resourcesr Zpip._internal.req.req_installr Exceptionr rrrrrrr r!r"r#r$r%r&rArGrJrLrRrTr^r_rrrrs<      ,  % 7PK]2 3AXX$__pycache__/pyproject.cpython-38.pycnu[U ʗRe@sddlZddlZddlmZddlmZmZmZddl m Z ddl m Z m Z ddlmZmZmZeeddd Zeed d d Zed ddddgZeeeeeeedddZdS)N) namedtuple)AnyListOptional)tomli)InvalidRequirement Requirement)InstallationErrorInvalidPyProjectBuildRequiresMissingPyProjectBuildRequires)objreturncCst|totdd|DS)Ncss|]}t|tVqdS)N) isinstancestr).0itemr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/pyproject.py sz"_is_list_of_str..)rlistall)r rrr_is_list_of_strsr)unpacked_source_directoryr cCstj|dS)Nzpyproject.toml)ospathjoin)rrrrmake_pyproject_pathsrBuildSystemDetailsrequiresbackendcheck backend_path) use_pep517pyproject_tomlsetup_pyreq_namer c Cstj|}tj|}|s.|s.t|d|rdt|dd}t|}W5QRX|d}nd}|r|s|dk r|stdd}nJ|rd|kr|dk r|std |dd}n|dkr|pt j d  }|dk st |sdS|dkrd d gd d}|dk s t d|kr t|d|d} t| s>t|dd| D]L} z t| Wn8tk r} zt|d| d| W5d} ~ XYnXqB|d} |dg} g}| dkrd } d d g}t| | || S)aBLoad the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing? None means the user hasn't explicitly specified. pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file req_name - The name of the requirement we're processing (for error reporting) Returns: None if we should use the legacy code path, otherwise a tuple ( requirements from pyproject.toml, name of PEP 517 backend, requirements we should check are installed after setting up the build environment directory paths to import the backend from (backend-path), relative to the project root. ) zW does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.zutf-8)encodingz build-systemNzIDisabling PEP 517 processing is invalid: project does not have a setup.pyT build-backendzbDisabling PEP 517 processing is invalid: project specifies a build backend of {} in pyproject.toml setuptoolszsetuptools>=40.8.0wheelz setuptools.build_meta:__legacy__)rr'r)packagezIt is not a list of strings.)r*reasonz$It contains an invalid requirement: z backend-path)rrisfiler openrloadsreadgetformat importlibutil find_specAssertionErrorr rr rrr)r"r#r$r% has_pyproject has_setupfpp_toml build_systemr requirementerrorrr!r rrrload_pyproject_tomlsx                 r=)importlib.utilr2r collectionsrtypingrrr pip._vendorr"pip._vendor.packaging.requirementsrrpip._internal.exceptionsr r r boolrrrrr=rrrrs$   PK] V77*__pycache__/collector.cpython-38.opt-1.pycnu[U .eWF@s dZddlZddlZddlZddlZddlZddlmZddlm Z m Z ddl m Z ddl mZmZmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZm Z ddl!m"Z"m#Z#erDddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5e/j6j7j8Z9e)e:e:fZ;eddZ?ddZ@GdddeAZBddZCGdddeAZDddZEdd ZFd!d"ZGd#d$ZHd%d&ZId'd(ZJd)d*ZKGd+d,d,eLZMdd6d7ZRGd8d9d9eLZSGd:d;d;eLZTdS)?zM The main purpose of this module is to expose LinkCollector.collect_links(). N) OrderedDict)html5librequests)unescape) HTTPError RetryErrorSSLError)parse)requestLink)ARCHIVE_EXTENSIONS)redact_auth_from_url)MYPY_CHECK_RUNNING) path_to_url url_to_path)is_urlvcs) CallableDictIterableListMutableMappingOptionalSequenceTupleUnion)Response) SearchScope) PipSessioncCs6tjD]*}||r|t|dkr|SqdS)zgLook for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. z+:N)rZschemeslower startswithlen)urlschemer%;/usr/lib/python3.8/site-packages/pip/_internal/collector.py_match_vcs_scheme/s  r'cCs(t|j}tD]}||rdSqdS)z2Return whether the URL looks like an archive. TF)r filenamer endswith)r#r(Zbad_extr%r%r&_is_url_like_archive;s   r*cseZdZfddZZS)_NotHTMLcs"tt|||||_||_dSN)superr+__init__ content_type request_desc)selfr/r0 __class__r%r&r.Gsz_NotHTML.__init__)__name__ __module__ __qualname__r. __classcell__r%r%r2r&r+Fsr+cCs.|jdd}|ds*t||jjdS)zCheck the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html. Content-Type text/htmlN)headersgetr r!r+r method)responser/r%r%r&_ensure_html_headerNsr?c@s eZdZdS)_NotHTTPN)r4r5r6r%r%r%r&r@Ysr@cCsDt|\}}}}}|dkr"t|j|dd}|t|dS)zSend a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. >httphttpsT)Zallow_redirectsN) urllib_parseZurlsplitr@headraise_for_statusr?)r#sessionr$netlocpathZqueryZfragmentrespr%r%r&_ensure_html_response]s rJcCsLt|rt||dtdt||j|dddd}|t||S)aAccess an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotHTML` if it is not HTML. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got HTML, and raise `_NotHTML` otherwise. rFzGetting page %sr:z max-age=0)ZAcceptz Cache-Control)r;)r*rJloggerdebugrr<rEr?)r#rFrIr%r%r&_get_html_responsens rNcCs2|r.d|kr.t|d\}}d|kr.|dSdS)zBDetermine if we have any encoding information in our headers. r8charsetN)cgiZ parse_header)r;r/Zparamsr%r%r&_get_encoding_from_headerss  rQcCs.|dD]}|d}|dk r |Sq |S)aDetermine the HTML document's base URL. This looks for a ```` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the HTML file's URL is used as the base URL. :param document: An HTML document representation. The current implementation expects the result of ``html5lib.parse()``. :param page_url: The URL of the HTML document. z.//basehrefN)findallr<)documentpage_urlbaserRr%r%r&_determine_base_urls   rWcCsPt|}|jdkr(tt|j}ntjt|jdd}t |j |dS)zMakes sure a link is fully encoded. That is, if a ' ' shows up in the link, it will be rewritten to %20 (while not over-quoting % or other characters).r9z/@)Zsafe)rH) rCurlparserGurllib_requestZ pathname2url url2pathnamerHZquoteZunquoteZ urlunparse_replace)r#resultrHr%r%r& _clean_links   r]cCsf|d}|sdStt||}|d}|r8t|nd}|d}|rRt|}t||||d}|S)zJ Convert an anchor element in a simple repository page to a Link. rRNzdata-requires-pythonz data-yanked)Z comes_fromZrequires_python yanked_reason)r<r]rCurljoinrr )anchorrUbase_urlrRr#Z pyrequirer^linkr%r%r&_create_link_from_elements   rcccsVtj|j|jdd}|j}t||}|dD]"}t|||d}|dkrJq.|Vq.dS)zP Parse an HTML document, and yield its anchor elements as Link objects. F)Ztransport_encodingZnamespaceHTMLElementsz.//a)rUraN)rr contentencodingr#rWrSrc)pagerTr#rar`rbr%r%r& parse_linkss  rgc@s eZdZdZddZddZdS)HTMLPagez'Represents one page, along with its URLcCs||_||_||_dS)z :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. N)rdrer#)r1rdrer#r%r%r&r.s zHTMLPage.__init__cCs t|jSr,)rr#r1r%r%r&__str__$szHTMLPage.__str__N)r4r5r6__doc__r.rjr%r%r%r&rhsrhcCs|dkrtj}|d||dS)Nz%Could not fetch URL %s: %s - skipping)rLrM)rbreasonmethr%r%r&_handle_get_page_fail(srncCst|j}t|j||jdS)N)rer#)rQr;rhrdr#)r>rer%r%r&_make_html_page3s roc Cs|dkrtd|jddd}t|}|r@td||dSt|\}}}}}}|dkrtj t |r| ds|d7}t|d}td |zt||d }WnDtk rtd |Yn,tk r}ztd ||j|jW5d}~XYntk r0}zt||W5d}~XYntk r\}zt||W5d}~XYntk r}z$d } | t|7} t|| tjdW5d}~XYn\tjk r}zt|d|W5d}~XYn*tjk rt|dYn Xt|SdS)Nz?_get_html_page() missing 1 required keyword argument: 'session'#rzCannot look at %s URL %sfile/z index.htmlz# file: URL is directory, getting %srKzQSkipping page %s because it looks like an archive, and cannot be checked by HEAD.z.sort_pathzfile:z)Path '{0}' is ignored: it is a directory.z:Url '%s' is ignored: it is neither a file nor a directory.zQUrl '%s' is ignored. It is either a non-existing path or lacks a specific scheme.)rvrHexistsr!rrwrealpathlistdirjoinrrLZwarningformatisfiler) locations expand_dirrr#Z is_local_pathZ is_file_urlrHitemr%rr&group_locationsxsF        rc@seZdZdZddZdS)CollectedLinksa Encapsulates all the Link objects collected by a call to LinkCollector.collect_links(), stored separately as-- (1) links from the configured file locations, (2) links from the configured find_links, and (3) a dict mapping HTML page url to links from that page. cCs||_||_||_dS)z :param files: Links from file locations. :param find_links: Links from find_links. :param pages: A dict mapping HTML page url to links from that page. Nr find_linkspages)r1rrrr%r%r&r.s zCollectedLinks.__init__N)r4r5r6rkr.r%r%r%r&rs rc@s4eZdZdZddZeddZddZdd Zd S) LinkCollectorz Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_links() method. cCs||_||_dSr,) search_scoperF)r1rFrr%r%r&r.szLinkCollector.__init__cCs|jjSr,)rrrir%r%r&rszLinkCollector.find_linksccs,|D]"}t||jd}|dkr q|VqdS)zp Yields (page, page_url) from the given locations, skipping locations that have errors. rKN)r}rF)r1rlocationrfr%r%r& _get_pagess zLinkCollector._get_pagescsj}||}t|\}}tjdd\}}ddt||D}ddjD} fddtdd|Dd d|DD} t| } d t| |g} | D]} | d | qt d | i} | D]}tt|| |j<qt|| | d S)zFind all available links for the given project name. :return: All the Link objects (unfiltered), as a CollectedLinks object. T)rcSsg|] }t|qSr%r .0r#r%r%r& sz/LinkCollector.collect_links..cSsg|]}t|dqS)z-fr rr%r%r&rscsg|]}j|r|qSr%)rFZis_secure_origin)rrbrir%r&r s css|]}t|VqdSr,r rr%r%r& sz.LinkCollector.collect_links..css|]}t|VqdSr,r rr%r%r&r sz,{} location(s) to search for versions of {}:z* {} r)rZget_index_urls_locationsrr itertoolschainrrr"rrLrMrrr~rgr#r)r1Z project_namerZindex_locationsZindex_file_locZ index_url_locZ fl_file_locZ fl_url_locZ file_linksZfind_link_linksZ url_locationslinesrbZ pages_linksrfr%rir& collect_linkssD       zLinkCollector.collect_linksN) r4r5r6rkr.propertyrrrr%r%r%r&rs    r)N)N)F)UrkrPrZloggingrrv collectionsrZ pip._vendorrrZpip._vendor.distlib.compatrZpip._vendor.requests.exceptionsrrrZpip._vendor.six.moves.urllibr rCr rYZpip._internal.models.linkr Zpip._internal.utils.filetypesr Zpip._internal.utils.miscrZpip._internal.utils.typingrZpip._internal.utils.urlsrrZpip._internal.vcsrrtypingrrrrrrrrrZxml.etree.ElementTreeZxmlZpip._vendor.requestsrZ!pip._internal.models.search_scoperZpip._internal.network.sessionrZetreeZ ElementTreeZElementZ HTMLElementrxZResponseHeadersZ getLoggerr4rLr'r* Exceptionr+r?r@rJrNrQrWr]rcrgobjectrhrnror}rrrrr%r%r%r&s^        ,         3    6 ;PK]u%__pycache__/main.cpython-38.opt-1.pycnu[U .eO@sdZddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZeeZd d d ZdS) z Primary application entrypoint. )absolute_importN) autocomplete) parse_command)create_command)PipError) deprecationc Cs|dkrtjdd}ttzt|\}}WnJtk r~}z,tjd|tjt j t dW5d}~XYnXzt t jdWn0t jk r}ztd|W5d}~XYnXt|d|kd}||S)Nz ERROR: %sz%Ignoring error %s when setting localez --isolated)isolated)sysargvrZinstall_warning_loggerrrrstderrwriteoslinesepexitlocale setlocaleLC_ALLErrorloggerdebugrmain)argsZcmd_nameZcmd_argsexceZcommandr6/usr/lib/python3.8/site-packages/pip/_internal/main.pyrs r)N)__doc__Z __future__rrZloggingrr Z pip._internal.cli.autocompletionrZpip._internal.cli.main_parserrZpip._internal.commandsrZpip._internal.exceptionsrZpip._internal.utilsrZ getLogger__name__rrrrrrs       PK]!{.__pycache__/self_outdated_check.cpython-38.pycnu[U ʗReT@sddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,m-Z-ddl.m/Z/dZ0e1e2Z3e4e4dddZ5GdddZ6e GdddZ7e4e8dddZ9e$ej:e4dddZ;e6eje e ge4fee7d d!d"Zr.dumpsrwriterrr r0)r3r;r9statetextfr!r!r"setVs  zSelfCheckState.set) __name__ __module__ __qualname__strr5propertyrr<rrBrNr!r!r!r"r$+s r$c@s,eZdZUeed<eed<edddZdS) UpgradePromptoldnewr6c Cs\trtd}nt}d}ttt|d|jd|jdt|dt|dS)Nz -m pipz/[bold][[reset][blue]notice[reset][bold]][reset]z& A new release of pip available: [red]z[reset] -> [green]z[reset]z To update, run: [green]z install --upgrade pip) rrrrr from_markuprUrVr )r3pip_cmdnoticer!r!r"__rich__~szUpgradePrompt.__rich__N)rOrPrQrR__annotations__rrZr!r!r!r"rTys rT)pkgrcCst|}|dk od|jkS)zChecks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. Npip)r get_distribution installer)r\distr!r!r"was_installed_by_pips ra)sessionoptionsrcCsLtj||dd}tddd}tj||d}|dj}|dkrBdSt|jS)NT)rcsuppress_no_indexF) allow_yankedallow_all_prereleases)link_collectorselection_prefsr])r createrr find_best_candidatebest_candidaterRversion)rbrcrgrhfinderrkr!r!r"_get_current_remote_pip_versions" rn)rKr9 local_versionget_remote_versionrcCs||}|dkr$|}|||t|}td|td|td}td||s`dS||kor|j|jk}|rtt||dSdS)NzRemote version of pip: %szLocal version of pip: %sr]zWas pip installed by pip? %s)rUrV) rBrN parse_versionloggerdebugra base_versionrTrR)rKr9rorpremote_version_strremote_versionpip_installed_by_piplocal_version_is_olderr!r!r"_self_version_check_logics"      ryc Cstd}|sdSzBtt|jdtj|jt t ||d}|dk rTt d|Wn,t k rt dt jddd YnXdS) zCheck for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. r]N)r%)rKr9rorpz[present-rich] %sz6There was an error checking the latest version of pip.zSee below for errorT)exc_info)r r^ryr$r%r<utcnowrl functoolspartialrnrrwarning Exceptionrs)rbrcinstalled_distupgrade_promptr!r!r"pip_self_version_checks&   r)>r<r|rr.loggingoptparseos.pathr*r7 dataclassesrtypingrrrrZpip._vendor.packaging.versionrrqpip._vendor.rich.consolerZpip._vendor.rich.markupr pip._vendor.rich.textr pip._internal.index.collectorr "pip._internal.index.package_finderr pip._internal.metadatar Zpip._internal.metadata.baser$pip._internal.models.selection_prefsrpip._internal.network.sessionrpip._internal.utils.compatrpip._internal.utils.entrypointsrrpip._internal.utils.filesystemrrrpip._internal.utils.miscrr> getLoggerrOrrrRr#r$rTboolraValuesrnryrr!r!r!r"sR              N    PK]ev[v[%__pycache__/exceptions.cpython-38.pycnu[U ʗReQ@sdZddlZddlZddlmZmZmZddlmZm Z m Z m Z m Z ddl mZmZddlmZmZmZddlmZddlmZerdd lmZdd lmZdd lmZdd lmZee d ddZ!e eefeeeedddZ"Gddde#Z$Gddde$Z%Gddde$Z&Gddde$Z'Gddde$Z(Gddde%Z)Gdd d e%Z*Gd!d"d"e$Z+Gd#d$d$e'Z,Gd%d&d&e'Z-Gd'd(d(e'Z.Gd)d*d*e'Z/Gd+d,d,e$Z0Gd-d.d.e$Z1Gd/d0d0e$Z2Gd1d2d2e$Z3Gd3d4d4e$Z4Gd5d6d6e'Z5Gd7d8d8e'Z6Gd9d:d:e'Z7Gd;d<dd>e%Z9Gd?d@d@e%e'Z:GdAdBdBe:e'Z;GdCdDdDe'ZGdIdJdJe=Z?GdKdLdLe=Z@GdMdNdNe=ZAGdOdPdPe=ZBGdQdRdRe'ZCGdSdTdTe&ZDdS)UzExceptions used throughout package. This module MUST NOT try to import from anything within `pip._internal` to operate. This is expected to be importable from any/all files within the subpackage and, thus, should not depend on them. N)chaingroupbyrepeat) TYPE_CHECKINGDictListOptionalUnion)RequestResponse)ConsoleConsoleOptions RenderResult)escape)Text)_Hash)Literal)BaseDistribution)InstallRequirement)sreturncCstd|dk S)Nz^[a-z]+(-[a-z]+)*$)rematch)rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/exceptions.py_is_kebab_casesr)rconsoleprefixindentrcCsJt|tr|}n ||}|j|dd|jd|dd|jddS)Nignore)overflow T) allow_blank) isinstancer render_strjoinsplit)rrrrtextrrr_prefix_with_indent!s   r(c@seZdZdZdS)PipErrorzThe base pip error.N__name__ __module__ __qualname____doc__rrrrr)2sr)c seZdZUdZeed<ddddddeeeeefeeeefeeeefeeeefeeddfdd Z ed d d Z e e e d ddZZS)DiagnosticPipErroraAn error, that presents diagnostic information to the user. This contains a bunch of logic, to enable pretty presentation of our error messages. Each error gets a unique reference. Each error can also include additional context, a hint and/or a note -- which are presented with the main error message in a consistent style. This is adapted from the error output styling in `sphinx-theme-builder`. referenceerrorN)kindr0 note_stmtlinkzLiteral["error", "warning"])r2r0messagecontext hint_stmtr3r4rcs~|dkr t|dstd|j}t|s0td||_||_||_||_||_||_||_ t d|j j d|jddS)Nr0zerror reference not provided!z#error reference must be kebab-case!)hasattrAssertionErrorr0rr2r5r6r3r7r4super__init__ __class__r+)selfr2r0r5r6r7r3r4r>rrr=Cs zDiagnosticPipError.__init__rc Cs8d|jjd|jd|jd|jd|jd|jd S)Nr8z (reference=z , message=z , context=z , note_stmt=z , hint_stmt=z)>)r>r+r0r5r6r3r7r?rrr__repr__as6zDiagnosticPipError.__repr__)roptionsrccsB|jdkrdnd}d|d|jd|jdVdV|js|jdk rt|j|d|d d|d d Vt|j|d|d d|d d Vqt|j|ddd Vn |jV|jdk rdV|jV|jdk s|jdk rdV|jdk rt|j|ddd V|jdk rt|j|ddd V|jdk r>dVd|jVdS)Nr1redyellow[z bold]z [/]: [bold]z[/]u]×[/] u]│[/] )rru ]╰─>[/] z] [/] u [red]×[/] z z[magenta bold]note[/]: z z[cyan bold]hint[/]: zLink: ) r2r0 ascii_onlyr6r(r5r3r7r4)r?rrDcolourrrr__rich_console__ls\          z#DiagnosticPipError.__rich_console__)r+r,r-r.str__annotations__rr rr=rCr r rrK __classcell__rrr@rr/6s*    r/c@seZdZdZdS)ConfigurationErrorz"General exception in configurationNr*rrrrrOsrOc@seZdZdZdS)InstallationErrorz%General exception during installationNr*rrrrrPsrPc@seZdZdZdS)UninstallationErrorz'General exception during uninstallationNr*rrrrrQsrQcs,eZdZdZdZeddfdd ZZS)MissingPyProjectBuildRequireszNRaised when pyproject.toml has `build-system`, but no `build-system.requires`.z'missing-pyproject-build-system-requiresN)packagercs*tjdt|tddtdddS)NCan not process zrThis package has an invalid pyproject.toml file. The [build-system] table is missing the mandatory `requires` key.;This is an issue with the package mentioned above, not pip.+See PEP 518 for the detailed specification.r5r6r3r7r<r=rr)r?rSr@rrr=s z&MissingPyProjectBuildRequires.__init__r+r,r-r.r0rLr=rNrrr@rrRsrRcs.eZdZdZdZeeddfdd ZZS)InvalidPyProjectBuildRequiresz>Raised when pyproject.toml an invalid `build-system.requires`.z'invalid-pyproject-build-system-requiresN)rSreasonrcs0tjdt|td|dtdddS)NrTzKThis package has an invalid `build-system.requires` key in pyproject.toml. rUrVrWrX)r?rSr[r@rrr=s z&InvalidPyProjectBuildRequires.__init__rYrrr@rrZsrZc@s0eZdZdZdeddddZeddd ZdS) NoneMetadataErrora4Raised when accessing a Distribution's "METADATA" or "PKG-INFO". This signifies an inconsistency, when the Distribution claims to have the metadata file (if not, raise ``FileNotFoundError`` instead), but is not actually able to produce its content. This may be due to permission errors. rN)dist metadata_namercCs||_||_dS)z :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)r]r^)r?r]r^rrrr=s zNoneMetadataError.__init__rAcCsd|j|jS)Nz+None {} metadata found for distribution: {})formatr^r]rBrrr__str__szNoneMetadataError.__str__r+r,r-r.rLr=r`rrrrr\s   r\c@seZdZdZedddZdS)UserInstallationInvalidzBA --user install is requested on an environment without user site.rAcCsdS)Nz$User base directory is not specifiedrrBrrrr`szUserInstallationInvalid.__str__N)r+r,r-r.rLr`rrrrrbsrbc@seZdZedddZdS)InvalidSchemeCombinationrAcCs6ddd|jddD}d|d|jddS)Nz, css|]}t|VqdSN)rL).0arrr sz3InvalidSchemeCombination.__str__..z Cannot set z and z together)r%args)r?beforerrrr`sz InvalidSchemeCombination.__str__N)r+r,r-rLr`rrrrrcsrcc@seZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNr*rrrrrksrkc@seZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nr*rrrrrl srlc@seZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.Nr*rrrrrmsrmc@seZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundNr*rrrrrnsrnc@seZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsNr*rrrrrosroc@seZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNr*rrrrrpsrpcs<eZdZdZd eeeddfdd ZedddZZ S) NetworkConnectionErrorzHTTP connection errorN) error_msgresponserequestrcsJ||_||_||_|jdk r6|js6t|dr6|jj|_t|||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. Nrt)rsrtrrr:r<r=)r?rrrsrtr@rrr="s zNetworkConnectionError.__init__rAcCs t|jSrd)rLrrrBrrrr`4szNetworkConnectionError.__str__)NN) r+r,r-r.rLr r r=r`rNrrr@rrqsrqc@seZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.Nr*rrrrru8sruc@seZdZdZdS)UnsupportedWheelzUnsupported wheel.Nr*rrrrrv<srvc@s.eZdZdZeedddZedddZdS) InvalidWheelzInvalid (e.g. corrupt) wheel.locationnamecCs||_||_dSrdrx)r?ryrzrrrr=CszInvalidWheel.__init__rAcCsd|jd|jdS)NzWheel 'z ' located at z is invalid.)rzryrBrrrr`GszInvalidWheel.__str__Nrarrrrrw@srwc@s4eZdZdZdeeeddddZeddd ZdS) MetadataInconsistentzBuilt metadata contains inconsistent information. This is raised when the metadata contains values (e.g. name and version) that do not match the information previously obtained from sdist filename or user-supplied ``#egg=`` value. rN)ireqfieldf_valm_valrcCs||_||_||_||_dSrd)r|r}r~r)r?r|r}r~rrrrr=SszMetadataInconsistent.__init__rAcCsd}||j|j|j|jS)NzJRequested {} has inconsistent {}: filename has {!r}, but metadata has {!r})r_r|r}r~r)r?templaterrrr`[szMetadataInconsistent.__str__rarrrrr{Ks r{cs,eZdZdZdZeddfdd ZZS)LegacyInstallFailurez1Error occurred while executing `setup.py install`zlegacy-install-failureNpackage_detailsrcstjd|ddddS)Nz2Encountered error while trying to install package.z&See above for output from the failure.rUr5r6r7r3)r<r=r?rr@rrr=hs zLegacyInstallFailure.__init__rYrrr@rrcsrcsFeZdZdZdZeeeeeddfdd Z eddd Z Z S) InstallationSubprocessErrorzA subprocess call failed.zsubprocess-exited-with-errorN)command_description exit_code output_linesrcst|dkrtd}n.tdt|dtd|td}tjdt|d||ddd ||_||_dS) NzSee above for output.z[red][z lines of output][/] rHz[red]\[end of output][/]z[green]z)[/] did not run successfully. exit code: zNThis error originates from a subprocess, and is likely not a problem with pip.r) r from_markuplenr%r<r=rrr)r?rrr output_promptr@rrr=vs    z$InstallationSubprocessError.__init__rAcCs|jd|jS)Nz exited with )rrrBrrrr`sz#InstallationSubprocessError.__str__) r+r,r-r.r0rLintrrr=r`rNrrr@rrqs  rcs6eZdZdZeddfdd ZedddZZS) MetadataGenerationFailedzmetadata-generation-failedNrcs tt|jdt|ddddS)Nz4Encountered error while generating package metadata.zSee above for details.rUr)r<rr=rrr@rrr=s  z!MetadataGenerationFailed.__init__rAcCsdS)Nzmetadata generation failedrrBrrrr`sz MetadataGenerationFailed.__str__)r+r,r-r0rLr=r`rNrrr@rrs  rc@sJeZdZdZddddZddddd Zedd d Zedd d Z dS) HashErrorsz:Multiple HashError instances rolled into one for reportingNrAcCs g|_dSrd)errorsrBrrrr=szHashErrors.__init__ HashError)r1rcCs|j|dSrd)rappend)r?r1rrrrszHashErrors.appendcCsbg}|jjdddt|jddD](\}}||j|dd|Dq&|r^d|SdS) NcSs|jSrd)ordererrrz$HashErrors.__str__..)keycSs|jSrdr@rrrrrrcss|]}|VqdSrd)bodyrerrrrrgsz%HashErrors.__str__..r!rH)rsortrrheadextendr%)r?linescls errors_of_clsrrrr`s  zHashErrors.__str__cCs t|jSrd)boolrrBrrr__bool__szHashErrors.__bool__) r+r,r-r.r=rrLr`rrrrrrrs  rc@s\eZdZUdZdZeded<dZdZe ed<e dd d Z e dd d Z e dd dZ dS)ra A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. NrreqrHrhrrAcCsd|S)a=Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with its link already populated by the resolver's _populate_link(). z )_requirement_namerBrrrrs zHashError.bodycCs|jd|S)Nr!)rrrBrrrr`szHashError.__str__cCs|jrt|jSdS)zReturn a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers unknown package)rrLrBrrrrszHashError._requirement_name)r+r,r-r.rrrMrrrrLrr`rrrrrrs   rc@seZdZdZdZdZdS)VcsHashUnsupporteduA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.rzlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:Nr+r,r-r.rrrrrrrsrc@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedrzUCan't verify hashes for these file:// requirements because they point to directories:Nrrrrrrsrc@s6eZdZdZdZdZeddddZedd d ZdS) HashMissingz2A hash was needed for a requirement but is absent.awHashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded archives actually had. Add lines like these to your requirements files to prevent tampering. (If you did not enable --require-hashes manually, note that it turns on automatically when any package has a hash.)N) gotten_hashrcCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N)r)r?rrrrr=szHashMissing.__init__rAcCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p>d||jS)Nr) FAVORITE_HASHrz {} --hash={}:{}r)pip._internal.utils.hashesrr original_linkgetattrr_r)r?rrSrrrrs   zHashMissing.body) r+r,r-r.rrrLr=rrrrrrs  rc@seZdZdZdZdZdS) HashUnpinnedzPA requirement had a hash specified but was not pinned to a specific version.zaIn --require-hashes mode, all requirements must have their versions pinned with ==. These do not:Nrrrrrr2src@sZeZdZdZdZdZeeeefeedfddddZ ed d d Z ed d d Z dS) HashMismatchz Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. zTHESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.rN)allowedgotsrcCs||_||_dS)z :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion N)rr)r?rrrrrr=OszHashMismatch.__init__rAcCsd||S)Nz {}: {})r_r_hash_comparisonrBrrrrYszHashMismatch.bodycsltdddd}g}|jD]B\}}|||fdd|D|d|j|qd|S) aE Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef z chain[str]) hash_namercSst|gtdS)Nz or)rr)rrrr hash_then_orhsz3HashMismatch._hash_comparison..hash_then_orc3s|]}dt|VqdS)z Expected {} {}N)r_nextrrrrrgpsz0HashMismatch._hash_comparison..z Got {} r!) rLritemsrrr_r hexdigestr%)r?rrr expectedsrrrr\s zHashMismatch._hash_comparison) r+r,r-r.rrrrLrr=rrrrrrr=s & rc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.Nr*rrrrrysrcsFeZdZdZd eeeeejddfdd Zeddd Z Z S) !ConfigurationFileCouldNotBeLoadedz8When there are errors while loading a configuration filecould not be loadedN)r[fnamer1rcs"t|||_||_||_dSrd)r<r=r[rr1)r?r[rr1r@rrr=s z*ConfigurationFileCouldNotBeLoaded.__init__rAcCsF|jdk rd|jd}n|jdk s(td|jd}d|j|S)Nz in .z. r!zConfiguration file )rr1r;r[)r? message_partrrrr`s  z)ConfigurationFileCouldNotBeLoaded.__str__)rNN) r+r,r-r.rLr configparserErrorr=r`rNrrr@rr~s r)Er.rr itertoolsrrrtypingrrrrr Zpip._vendor.requests.modelsr r pip._vendor.rich.consoler r rZpip._vendor.rich.markuprpip._vendor.rich.textrhashlibrrpip._internal.metadatarZpip._internal.req.req_installrrLrrr( Exceptionr)r/rOrPrQrRrZr\rbrcrkrlrmrnrorprqrurvrwr{rrrrrrrrrrrrrrrrsj        v ).  * <PK])__pycache__/__init__.cpython-38.opt-1.pycnu[U .eP@s ddlZdS)N)Z*pip._internal.utils.inject_securetransportZpiprr:/usr/lib/python3.8/site-packages/pip/_internal/__init__.pyPK]Օ$$cache.pynu["""Cache Management """ import hashlib import json import logging import os from typing import Any, Dict, List, Optional, Set 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.format_control import FormatControl 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 logger = logging.getLogger(__name__) def _hash_dict(d: Dict[str, str]) -> str: """Return a stable sha224 of a dictionary.""" s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True) return hashlib.sha224(s.encode("ascii")).hexdigest() class Cache: """An abstract class - provides cache directories for data from links :param cache_dir: The root of the cache. :param format_control: An object of FormatControl class to limit binaries being read from the cache. :param allowed_formats: which formats of files the cache should store. ('binary' and 'source' are the only allowed values) """ def __init__( self, cache_dir: str, format_control: FormatControl, allowed_formats: Set[str] ) -> None: super().__init__() assert not cache_dir or os.path.isabs(cache_dir) self.cache_dir = cache_dir or None self.format_control = format_control self.allowed_formats = allowed_formats _valid_formats = {"source", "binary"} assert self.allowed_formats.union(_valid_formats) == _valid_formats def _get_cache_path_parts(self, link: Link) -> List[str]: """Get parts of part that must be os.path.joined with cache_dir""" # We want to generate an url to use as our cache key, we don't want to # just re-use the URL because it might have other items in the fragment # and we don't care about those. key_parts = {"url": link.url_without_fragment} if link.hash_name is not None and link.hash is not None: key_parts[link.hash_name] = link.hash if link.subdirectory_fragment: key_parts["subdirectory"] = link.subdirectory_fragment # Include interpreter name, major and minor version in cache key # to cope with ill-behaved sdists that build a different wheel # depending on the python version their setup.py is being run on, # and don't encode the difference in compatibility tags. # https://github.com/pypa/pip/issues/7296 key_parts["interpreter_name"] = interpreter_name() key_parts["interpreter_version"] = interpreter_version() # Encode our key url with sha224, we'll use this because it has similar # security properties to sha256, but with a shorter total output (and # thus less secure). However the differences don't make a lot of # difference for our use case here. hashed = _hash_dict(key_parts) # We want to nest the directories some to prevent having a ton of top # level directories where we might run out of sub directories on some # FS. parts = [hashed[:2], hashed[2:4], hashed[4:6], hashed[6:]] return parts def _get_candidates(self, link: Link, canonical_package_name: str) -> List[Any]: can_not_cache = not self.cache_dir or not canonical_package_name or not link if can_not_cache: return [] formats = self.format_control.get_allowed_formats(canonical_package_name) if not self.allowed_formats.intersection(formats): return [] candidates = [] path = self.get_path_for_link(link) if os.path.isdir(path): for candidate in os.listdir(path): candidates.append((candidate, path)) return candidates def get_path_for_link(self, link: Link) -> str: """Return a directory to store cached items in for link.""" raise NotImplementedError() def get( self, link: Link, package_name: Optional[str], supported_tags: List[Tag], ) -> Link: """Returns a link to a cached item if it exists, otherwise returns the passed link. """ raise NotImplementedError() class SimpleWheelCache(Cache): """A cache of wheels for future installs.""" def __init__(self, cache_dir: str, format_control: FormatControl) -> None: super().__init__(cache_dir, format_control, {"binary"}) def get_path_for_link(self, link: Link) -> str: """Return a directory to store cached wheels for link Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have plausible version numbers, so that we don't contaminate the cache with things that were not unique. E.g. ./package might have dozens of installs done for it and build a version of 0.0...and if we built and cached a wheel, we'd end up using the same wheel even if the source has been edited. :param link: The link of the sdist for which this will cache wheels. """ parts = self._get_cache_path_parts(link) assert self.cache_dir # Store wheels within the root cache_dir return os.path.join(self.cache_dir, "wheels", *parts) def get( self, link: Link, package_name: Optional[str], supported_tags: List[Tag], ) -> Link: candidates = [] if not package_name: return link canonical_package_name = canonicalize_name(package_name) for wheel_name, wheel_dir in self._get_candidates(link, canonical_package_name): try: wheel = Wheel(wheel_name) except InvalidWheelFilename: continue if canonicalize_name(wheel.name) != canonical_package_name: logger.debug( "Ignoring cached wheel %s for %s as it " "does not match the expected distribution name %s.", wheel_name, link, package_name, ) continue if not wheel.supported(supported_tags): # Built for a different python/arch/etc continue candidates.append( ( wheel.support_index_min(supported_tags), wheel_name, wheel_dir, ) ) if not candidates: return link _, wheel_name, wheel_dir = min(candidates) return Link(path_to_url(os.path.join(wheel_dir, wheel_name))) class EphemWheelCache(SimpleWheelCache): """A SimpleWheelCache that creates it's own temporary cache directory""" def __init__(self, format_control: FormatControl) -> None: self._temp_dir = TempDirectory( kind=tempdir_kinds.EPHEM_WHEEL_CACHE, globally_managed=True, ) super().__init__(self._temp_dir.path, format_control) class CacheEntry: def __init__( self, link: Link, persistent: bool, ): self.link = link self.persistent = persistent class WheelCache(Cache): """Wraps EphemWheelCache and SimpleWheelCache into a single Cache This Cache allows for gracefully degradation, using the ephem wheel cache when a certain link is not found in the simple wheel cache first. """ def __init__(self, cache_dir: str, format_control: FormatControl) -> None: super().__init__(cache_dir, format_control, {"binary"}) self._wheel_cache = SimpleWheelCache(cache_dir, format_control) self._ephem_cache = EphemWheelCache(format_control) def get_path_for_link(self, link: Link) -> str: return self._wheel_cache.get_path_for_link(link) def get_ephem_path_for_link(self, link: Link) -> str: return self._ephem_cache.get_path_for_link(link) def get( self, link: Link, package_name: Optional[str], supported_tags: List[Tag], ) -> Link: cache_entry = self.get_cache_entry(link, package_name, supported_tags) if cache_entry is None: return link return cache_entry.link def get_cache_entry( self, link: Link, package_name: Optional[str], supported_tags: List[Tag], ) -> Optional[CacheEntry]: """Returns a CacheEntry with a link to a cached item if it exists or None. The cache entry indicates if the item was found in the persistent or ephemeral cache. """ retval = self._wheel_cache.get( link=link, package_name=package_name, supported_tags=supported_tags, ) if retval is not link: return CacheEntry(retval, persistent=True) retval = self._ephem_cache.get( link=link, package_name=package_name, supported_tags=supported_tags, ) if retval is not link: return CacheEntry(retval, persistent=False) return None PK]i6SE>E> pep425tags.pynu["""Generate and work with PEP 425 Compatibility Tags.""" from __future__ import absolute_import import distutils.util import logging import platform import re import sys import sysconfig import warnings from collections import OrderedDict import pip._internal.utils.glibc from pip._internal.utils.compat import get_extension_suffixes from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ( Tuple, Callable, List, Optional, Union, Dict, Set ) Pep425Tag = Tuple[str, str, str] logger = logging.getLogger(__name__) _osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)') def get_config_var(var): # type: (str) -> Optional[str] try: return sysconfig.get_config_var(var) except IOError as e: # Issue #1074 warnings.warn("{}".format(e), RuntimeWarning) return None def get_abbr_impl(): # type: () -> str """Return abbreviated implementation name.""" if hasattr(sys, 'pypy_version_info'): pyimpl = 'pp' elif sys.platform.startswith('java'): pyimpl = 'jy' elif sys.platform == 'cli': pyimpl = 'ip' else: pyimpl = 'cp' return pyimpl def version_info_to_nodot(version_info): # type: (Tuple[int, ...]) -> str # Only use up to the first two numbers. return ''.join(map(str, version_info[:2])) def get_impl_ver(): # type: () -> str """Return implementation version.""" impl_ver = get_config_var("py_version_nodot") if not impl_ver or get_abbr_impl() == 'pp': impl_ver = ''.join(map(str, get_impl_version_info())) return impl_ver def get_impl_version_info(): # type: () -> Tuple[int, ...] """Return sys.version_info-like tuple for use in decrementing the minor version.""" if get_abbr_impl() == 'pp': # as per https://github.com/pypa/pip/issues/2882 # attrs exist only on pypy return (sys.version_info[0], sys.pypy_version_info.major, # type: ignore sys.pypy_version_info.minor) # type: ignore else: return sys.version_info[0], sys.version_info[1] def get_impl_tag(): # type: () -> str """ Returns the Tag for this specific implementation. """ return "{}{}".format(get_abbr_impl(), get_impl_ver()) def get_flag(var, fallback, expected=True, warn=True): # type: (str, Callable[..., bool], Union[bool, int], bool) -> bool """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = get_config_var(var) if val is None: if warn: logger.debug("Config variable '%s' is unset, Python ABI tag may " "be incorrect", var) return fallback() return val == expected def get_abi_tag(): # type: () -> Optional[str] """Return the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).""" soabi = get_config_var('SOABI') impl = get_abbr_impl() abi = None # type: Optional[str] if not soabi and impl in {'cp', 'pp'} and hasattr(sys, 'maxunicode'): d = '' m = '' u = '' is_cpython = (impl == 'cp') if get_flag( 'Py_DEBUG', lambda: hasattr(sys, 'gettotalrefcount'), warn=is_cpython): d = 'd' if sys.version_info < (3, 8) and get_flag( 'WITH_PYMALLOC', lambda: is_cpython, warn=is_cpython): m = 'm' if sys.version_info < (3, 3) and get_flag( 'Py_UNICODE_SIZE', lambda: sys.maxunicode == 0x10ffff, expected=4, warn=is_cpython): u = 'u' abi = '%s%s%s%s%s' % (impl, get_impl_ver(), d, m, u) elif soabi and soabi.startswith('cpython-'): abi = 'cp' + soabi.split('-')[1] elif soabi: abi = soabi.replace('.', '_').replace('-', '_') return abi def _is_running_32bit(): # type: () -> bool return sys.maxsize == 2147483647 def get_platform(): # type: () -> str """Return our platform name 'win32', 'linux_x86_64'""" if sys.platform == 'darwin': # distutils.util.get_platform() returns the release based on the value # of MACOSX_DEPLOYMENT_TARGET on which Python was built, which may # be significantly older than the user's current machine. release, _, machine = platform.mac_ver() split_ver = release.split('.') if machine == "x86_64" and _is_running_32bit(): machine = "i386" elif machine == "ppc64" and _is_running_32bit(): machine = "ppc" return 'macosx_{}_{}_{}'.format(split_ver[0], split_ver[1], machine) # XXX remove distutils dependency result = distutils.util.get_platform().replace('.', '_').replace('-', '_') if result == "linux_x86_64" and _is_running_32bit(): # 32 bit Python program (running on a 64 bit Linux): pip should only # install and run 32 bit compiled extensions in that case. result = "linux_i686" return result def is_linux_armhf(): # type: () -> bool if get_platform() != "linux_armv7l": return False # hard-float ABI can be detected from the ELF header of the running # process try: with open(sys.executable, 'rb') as f: elf_header_raw = f.read(40) # read 40 first bytes of ELF header except (IOError, OSError, TypeError): return False if elf_header_raw is None or len(elf_header_raw) < 40: return False if isinstance(elf_header_raw, str): elf_header = [ord(c) for c in elf_header_raw] else: elf_header = [b for b in elf_header_raw] result = elf_header[0:4] == [0x7f, 0x45, 0x4c, 0x46] # ELF magic number result &= elf_header[4:5] == [1] # 32-bit ELF result &= elf_header[5:6] == [1] # little-endian result &= elf_header[18:20] == [0x28, 0] # ARM machine result &= elf_header[39:40] == [5] # ARM EABIv5 result &= (elf_header[37:38][0] & 4) == 4 # EF_ARM_ABI_FLOAT_HARD return result def is_manylinux1_compatible(): # type: () -> bool # Only Linux, and only x86-64 / i686 if get_platform() not in {"linux_x86_64", "linux_i686"}: return False # Check for presence of _manylinux module try: import _manylinux return bool(_manylinux.manylinux1_compatible) except (ImportError, AttributeError): # Fall through to heuristic check below pass # Check glibc version. CentOS 5 uses glibc 2.5. return pip._internal.utils.glibc.have_compatible_glibc(2, 5) def is_manylinux2010_compatible(): # type: () -> bool # Only Linux, and only x86-64 / i686 if get_platform() not in {"linux_x86_64", "linux_i686"}: return False # Check for presence of _manylinux module try: import _manylinux return bool(_manylinux.manylinux2010_compatible) except (ImportError, AttributeError): # Fall through to heuristic check below pass # Check glibc version. CentOS 6 uses glibc 2.12. return pip._internal.utils.glibc.have_compatible_glibc(2, 12) def is_manylinux2014_compatible(): # type: () -> bool # Only Linux, and only supported architectures platform = get_platform() if platform not in {"linux_x86_64", "linux_i686", "linux_aarch64", "linux_armv7l", "linux_ppc64", "linux_ppc64le", "linux_s390x"}: return False # check for hard-float ABI in case we're running linux_armv7l not to # install hard-float ABI wheel in a soft-float ABI environment if platform == "linux_armv7l" and not is_linux_armhf(): return False # Check for presence of _manylinux module try: import _manylinux return bool(_manylinux.manylinux2014_compatible) except (ImportError, AttributeError): # Fall through to heuristic check below pass # Check glibc version. CentOS 7 uses glibc 2.17. return pip._internal.utils.glibc.have_compatible_glibc(2, 17) def get_darwin_arches(major, minor, machine): # type: (int, int, str) -> List[str] """Return a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine. """ arches = [] def _supports_arch(major, minor, arch): # type: (int, int, str) -> bool # Looking at the application support for macOS versions in the chart # provided by https://en.wikipedia.org/wiki/OS_X#Versions it appears # our timeline looks roughly like: # # 10.0 - Introduces ppc support. # 10.4 - Introduces ppc64, i386, and x86_64 support, however the ppc64 # and x86_64 support is CLI only, and cannot be used for GUI # applications. # 10.5 - Extends ppc64 and x86_64 support to cover GUI applications. # 10.6 - Drops support for ppc64 # 10.7 - Drops support for ppc # # Given that we do not know if we're installing a CLI or a GUI # application, we must be conservative and assume it might be a GUI # application and behave as if ppc64 and x86_64 support did not occur # until 10.5. # # Note: The above information is taken from the "Application support" # column in the chart not the "Processor support" since I believe # that we care about what instruction sets an application can use # not which processors the OS supports. if arch == 'ppc': return (major, minor) <= (10, 5) if arch == 'ppc64': return (major, minor) == (10, 5) if arch == 'i386': return (major, minor) >= (10, 4) if arch == 'x86_64': return (major, minor) >= (10, 5) if arch in groups: for garch in groups[arch]: if _supports_arch(major, minor, garch): return True return False groups = OrderedDict([ ("fat", ("i386", "ppc")), ("intel", ("x86_64", "i386")), ("fat64", ("x86_64", "ppc64")), ("fat32", ("x86_64", "i386", "ppc")), ]) # type: Dict[str, Tuple[str, ...]] if _supports_arch(major, minor, machine): arches.append(machine) for garch in groups: if machine in groups[garch] and _supports_arch(major, minor, garch): arches.append(garch) arches.append('universal') return arches def get_all_minor_versions_as_strings(version_info): # type: (Tuple[int, ...]) -> List[str] versions = [] major = version_info[:-1] # Support all previous minor Python versions. for minor in range(version_info[-1], -1, -1): versions.append(''.join(map(str, major + (minor,)))) return versions def get_supported( versions=None, # type: Optional[List[str]] noarch=False, # type: bool platform=None, # type: Optional[str] impl=None, # type: Optional[str] abi=None # type: Optional[str] ): # type: (...) -> List[Pep425Tag] """Return a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abi: specify the exact abi you want valid tags for, or None. If None, use the local interpreter abi. """ supported = [] # Versions must be given with respect to the preference if versions is None: version_info = get_impl_version_info() versions = get_all_minor_versions_as_strings(version_info) impl = impl or get_abbr_impl() abis = [] # type: List[str] abi = abi or get_abi_tag() if abi: abis[0:0] = [abi] abi3s = set() # type: Set[str] for suffix in get_extension_suffixes(): if suffix.startswith('.abi'): abi3s.add(suffix.split('.', 2)[1]) abis.extend(sorted(list(abi3s))) abis.append('none') if not noarch: arch = platform or get_platform() arch_prefix, arch_sep, arch_suffix = arch.partition('_') if arch.startswith('macosx'): # support macosx-10.6-intel on macosx-10.9-x86_64 match = _osx_arch_pat.match(arch) if match: name, major, minor, actual_arch = match.groups() tpl = '{}_{}_%i_%s'.format(name, major) arches = [] for m in reversed(range(int(minor) + 1)): for a in get_darwin_arches(int(major), m, actual_arch): arches.append(tpl % (m, a)) else: # arch pattern didn't match (?!) arches = [arch] elif arch_prefix == 'manylinux2014': arches = [arch] # manylinux1/manylinux2010 wheels run on most manylinux2014 systems # with the exception of wheels depending on ncurses. PEP 599 states # manylinux1/manylinux2010 wheels should be considered # manylinux2014 wheels: # https://www.python.org/dev/peps/pep-0599/#backwards-compatibility-with-manylinux2010-wheels if arch_suffix in {'i686', 'x86_64'}: arches.append('manylinux2010' + arch_sep + arch_suffix) arches.append('manylinux1' + arch_sep + arch_suffix) elif arch_prefix == 'manylinux2010': # manylinux1 wheels run on most manylinux2010 systems with the # exception of wheels depending on ncurses. PEP 571 states # manylinux1 wheels should be considered manylinux2010 wheels: # https://www.python.org/dev/peps/pep-0571/#backwards-compatibility-with-manylinux1-wheels arches = [arch, 'manylinux1' + arch_sep + arch_suffix] elif platform is None: arches = [] if is_manylinux2014_compatible(): arches.append('manylinux2014' + arch_sep + arch_suffix) if is_manylinux2010_compatible(): arches.append('manylinux2010' + arch_sep + arch_suffix) if is_manylinux1_compatible(): arches.append('manylinux1' + arch_sep + arch_suffix) arches.append(arch) else: arches = [arch] # Current version, current API (built specifically for our Python): for abi in abis: for arch in arches: supported.append(('%s%s' % (impl, versions[0]), abi, arch)) # abi3 modules compatible with older version of Python for version in versions[1:]: # abi3 was introduced in Python 3.2 if version in {'31', '30'}: break for abi in abi3s: # empty set if not Python 3 for arch in arches: supported.append(("%s%s" % (impl, version), abi, arch)) # Has binaries, does not use the Python API: for arch in arches: supported.append(('py%s' % (versions[0][0]), 'none', arch)) # No abi / arch, but requires our implementation: supported.append(('%s%s' % (impl, versions[0]), 'none', 'any')) # Tagged specifically as being cross-version compatible # (with just the major version specified) supported.append(('%s%s' % (impl, versions[0][0]), 'none', 'any')) # No abi / arch, generic Python for i, version in enumerate(versions): supported.append(('py%s' % (version,), 'none', 'any')) if i == 0: supported.append(('py%s' % (version[0]), 'none', 'any')) return supported implementation_tag = get_impl_tag() PK]/RCRClegacy_resolve.pynu["""Dependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) """ # The following comment should be removed at some point in the future. # mypy: strict-optional=False # mypy: disallow-untyped-defs=False import logging import sys from collections import defaultdict from itertools import chain from pip._vendor.packaging import specifiers from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, HashError, HashErrors, UnsupportedPythonVersion, ) from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( dist_in_install_path, dist_in_usersite, ensure_dir, normalize_version_info, ) from pip._internal.utils.packaging import ( check_requires_python, get_requires_python, ) from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Callable, DefaultDict, List, Optional, Set, Tuple from pip._vendor import pkg_resources from pip._internal.distributions import AbstractDistribution from pip._internal.network.session import PipSession from pip._internal.index import PackageFinder from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet InstallRequirementProvider = Callable[ [str, InstallRequirement], InstallRequirement ] logger = logging.getLogger(__name__) def _check_dist_requires_python( dist, # type: pkg_resources.Distribution version_info, # type: Tuple[int, int, int] ignore_requires_python=False, # type: bool ): # type: (...) -> None """ Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. """ requires_python = get_requires_python(dist) try: is_compatible = check_requires_python( requires_python, version_info=version_info, ) except specifiers.InvalidSpecifier as exc: logger.warning( "Package %r has an invalid Requires-Python: %s", dist.project_name, exc, ) return if is_compatible: return version = '.'.join(map(str, version_info)) if ignore_requires_python: logger.debug( 'Ignoring failed Requires-Python check for package %r: ' '%s not in %r', dist.project_name, version, requires_python, ) return raise UnsupportedPythonVersion( 'Package {!r} requires a different Python: {} not in {!r}'.format( dist.project_name, version, requires_python, )) class Resolver(object): """Resolves which packages need to be installed/uninstalled to perform \ the requested operation without breaking the requirements of any package. """ _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"} def __init__( self, preparer, # type: RequirementPreparer session, # type: PipSession finder, # type: PackageFinder make_install_req, # type: InstallRequirementProvider use_user_site, # type: bool ignore_dependencies, # type: bool ignore_installed, # type: bool ignore_requires_python, # type: bool force_reinstall, # type: bool upgrade_strategy, # type: str py_version_info=None, # type: Optional[Tuple[int, ...]] ): # type: (...) -> None super(Resolver, self).__init__() assert upgrade_strategy in self._allowed_strategies if py_version_info is None: py_version_info = sys.version_info[:3] else: py_version_info = normalize_version_info(py_version_info) self._py_version_info = py_version_info self.preparer = preparer self.finder = finder self.session = session # This is set in resolve self.require_hashes = None # type: Optional[bool] self.upgrade_strategy = upgrade_strategy self.force_reinstall = force_reinstall self.ignore_dependencies = ignore_dependencies self.ignore_installed = ignore_installed self.ignore_requires_python = ignore_requires_python self.use_user_site = use_user_site self._make_install_req = make_install_req self._discovered_dependencies = \ defaultdict(list) # type: DefaultDict[str, List] def resolve(self, requirement_set): # type: (RequirementSet) -> None """Resolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. """ # make the wheelhouse if self.preparer.wheel_download_dir: ensure_dir(self.preparer.wheel_download_dir) # If any top-level requirement has a hash specified, enter # hash-checking mode, which requires hashes from all. root_reqs = ( requirement_set.unnamed_requirements + list(requirement_set.requirements.values()) ) self.require_hashes = ( requirement_set.require_hashes or any(req.has_hash_options for req in root_reqs) ) # Display where finder is looking for packages search_scope = self.finder.search_scope locations = search_scope.get_formatted_locations() if locations: logger.info(locations) # Actually prepare the files, and collect any exceptions. Most hash # exceptions cannot be checked ahead of time, because # req.populate_link() needs to be called before we can make decisions # based on link type. discovered_reqs = [] # type: List[InstallRequirement] hash_errors = HashErrors() for req in chain(root_reqs, discovered_reqs): try: discovered_reqs.extend( self._resolve_one(requirement_set, req) ) except HashError as exc: exc.req = req hash_errors.append(exc) if hash_errors: raise hash_errors def _is_upgrade_allowed(self, req): # type: (InstallRequirement) -> bool if self.upgrade_strategy == "to-satisfy-only": return False elif self.upgrade_strategy == "eager": return True else: assert self.upgrade_strategy == "only-if-needed" return req.is_direct def _set_req_to_reinstall(self, req): # type: (InstallRequirement) -> None """ Set a requirement to be installed. """ # Don't uninstall the conflict if doing a user install and the # conflict is not a user install. if ((not self.use_user_site or dist_in_usersite(req.satisfied_by)) and dist_in_install_path(req.satisfied_by)): req.conflicts_with = req.satisfied_by req.satisfied_by = None def _check_skip_installed(self, req_to_install): # type: (InstallRequirement) -> Optional[str] """Check if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. """ if self.ignore_installed: return None req_to_install.check_if_exists(self.use_user_site) if not req_to_install.satisfied_by: return None if self.force_reinstall: self._set_req_to_reinstall(req_to_install) return None if not self._is_upgrade_allowed(req_to_install): if self.upgrade_strategy == "only-if-needed": return 'already satisfied, skipping upgrade' return 'already satisfied' # Check for the possibility of an upgrade. For link-based # requirements we have to pull the tree down and inspect to assess # the version #, so it's handled way down. if not req_to_install.link: try: self.finder.find_requirement(req_to_install, upgrade=True) except BestVersionAlreadyInstalled: # Then the best version is installed. return 'already up-to-date' except DistributionNotFound: # No distribution found, so we squash the error. It will # be raised later when we re-try later to do the install. # Why don't we just raise here? pass self._set_req_to_reinstall(req_to_install) return None def _get_abstract_dist_for(self, req): # type: (InstallRequirement) -> AbstractDistribution """Takes a InstallRequirement and returns a single AbstractDist \ representing a prepared variant of the same. """ assert self.require_hashes is not None, ( "require_hashes should have been set in Resolver.resolve()" ) if req.editable: return self.preparer.prepare_editable_requirement( req, self.require_hashes, self.use_user_site, self.finder, ) # satisfied_by is only evaluated by calling _check_skip_installed, # so it must be None here. assert req.satisfied_by is None skip_reason = self._check_skip_installed(req) if req.satisfied_by: return self.preparer.prepare_installed_requirement( req, self.require_hashes, skip_reason ) upgrade_allowed = self._is_upgrade_allowed(req) # We eagerly populate the link, since that's our "legacy" behavior. req.populate_link(self.finder, upgrade_allowed, self.require_hashes) abstract_dist = self.preparer.prepare_linked_requirement( req, self.session, self.finder, self.require_hashes ) # NOTE # The following portion is for determining if a certain package is # going to be re-installed/upgraded or not and reporting to the user. # This should probably get cleaned up in a future refactor. # req.req is only avail after unpack for URL # pkgs repeat check_if_exists to uninstall-on-upgrade # (#14) if not self.ignore_installed: req.check_if_exists(self.use_user_site) if req.satisfied_by: should_modify = ( self.upgrade_strategy != "to-satisfy-only" or self.force_reinstall or self.ignore_installed or req.link.scheme == 'file' ) if should_modify: self._set_req_to_reinstall(req) else: logger.info( 'Requirement already satisfied (use --upgrade to upgrade):' ' %s', req, ) return abstract_dist def _resolve_one( self, requirement_set, # type: RequirementSet req_to_install # type: InstallRequirement ): # type: (...) -> List[InstallRequirement] """Prepare a single requirements file. :return: A list of additional InstallRequirements to also install. """ # Tell user what we are doing for this requirement: # obtain (editable), skipping, processing (local url), collecting # (remote url or package name) if req_to_install.constraint or req_to_install.prepared: return [] req_to_install.prepared = True # register tmp src for cleanup in case something goes wrong requirement_set.reqs_to_cleanup.append(req_to_install) abstract_dist = self._get_abstract_dist_for(req_to_install) # Parse and return dependencies dist = abstract_dist.get_pkg_resources_distribution() # This will raise UnsupportedPythonVersion if the given Python # version isn't compatible with the distribution's Requires-Python. _check_dist_requires_python( dist, version_info=self._py_version_info, ignore_requires_python=self.ignore_requires_python, ) more_reqs = [] # type: List[InstallRequirement] def add_req(subreq, extras_requested): sub_install_req = self._make_install_req( str(subreq), req_to_install, ) parent_req_name = req_to_install.name to_scan_again, add_to_parent = requirement_set.add_requirement( sub_install_req, parent_req_name=parent_req_name, extras_requested=extras_requested, ) if parent_req_name and add_to_parent: self._discovered_dependencies[parent_req_name].append( add_to_parent ) more_reqs.extend(to_scan_again) with indent_log(): # We add req_to_install before its dependencies, so that we # can refer to it when adding dependencies. if not requirement_set.has_requirement(req_to_install.name): # 'unnamed' requirements will get added here req_to_install.is_direct = True requirement_set.add_requirement( req_to_install, parent_req_name=None, ) if not self.ignore_dependencies: if req_to_install.extras: logger.debug( "Installing extra requirements: %r", ','.join(req_to_install.extras), ) missing_requested = sorted( set(req_to_install.extras) - set(dist.extras) ) for missing in missing_requested: logger.warning( '%s does not provide the extra \'%s\'', dist, missing ) available_requested = sorted( set(dist.extras) & set(req_to_install.extras) ) for subreq in dist.requires(available_requested): add_req(subreq, extras_requested=available_requested) if not req_to_install.editable and not req_to_install.satisfied_by: # XXX: --no-install leads this to report 'Successfully # downloaded' for only non-editable reqs, even though we took # action on them. requirement_set.successfully_downloaded.append(req_to_install) return more_reqs def get_installation_order(self, req_set): # type: (RequirementSet) -> List[InstallRequirement] """Create the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. """ # The current implementation, which we may change at any point # installs the user specified things in the order given, except when # dependencies must come earlier to achieve topological order. order = [] ordered_reqs = set() # type: Set[InstallRequirement] def schedule(req): if req.satisfied_by or req in ordered_reqs: return if req.constraint: return ordered_reqs.add(req) for dep in self._discovered_dependencies[req.name]: schedule(dep) order.append(req) for install_req in req_set.requirements.values(): schedule(install_req) return order PK]Z]commands/debug.pynu[import locale import logging import os import sys from optparse import Values from types import ModuleType from typing import Any, Dict, List, Optional import pip._vendor from pip._vendor.certifi import where from pip._vendor.packaging.version import parse as parse_version from pip import __file__ as pip_location from pip._internal.cli import cmdoptions from pip._internal.cli.base_command import Command from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.status_codes import SUCCESS from pip._internal.configuration import Configuration from pip._internal.metadata import get_environment from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import get_pip_version logger = logging.getLogger(__name__) def show_value(name: str, value: Any) -> None: logger.info("%s: %s", name, value) def show_sys_implementation() -> None: logger.info("sys.implementation:") implementation_name = sys.implementation.name with indent_log(): show_value("name", implementation_name) def create_vendor_txt_map() -> Dict[str, str]: vendor_txt_path = os.path.join( os.path.dirname(pip_location), "_vendor", "vendor.txt" ) with open(vendor_txt_path) as f: # Purge non version specifying lines. # Also, remove any space prefix or suffixes (including comments). lines = [ line.strip().split(" ", 1)[0] for line in f.readlines() if "==" in line ] # Transform into "module" -> version dict. return dict(line.split("==", 1) for line in lines) # type: ignore def get_module_from_module_name(module_name: str) -> ModuleType: # Module name can be uppercase in vendor.txt for some reason... module_name = module_name.lower() # PATCH: setuptools is actually only pkg_resources. if module_name == "setuptools": module_name = "pkg_resources" __import__(f"pip._vendor.{module_name}", globals(), locals(), level=0) return getattr(pip._vendor, module_name) def get_vendor_version_from_module(module_name: str) -> Optional[str]: module = get_module_from_module_name(module_name) version = getattr(module, "__version__", None) if not version: # Try to find version in debundled module info. env = get_environment([os.path.dirname(module.__file__)]) dist = env.get_distribution(module_name) if dist: version = str(dist.version) return version def show_actual_vendor_versions(vendor_txt_versions: Dict[str, str]) -> None: """Log the actual version and print extra info if there is a conflict or if the actual version could not be imported. """ for module_name, expected_version in vendor_txt_versions.items(): extra_message = "" actual_version = get_vendor_version_from_module(module_name) if not actual_version: extra_message = ( " (Unable to locate actual module version, using" " vendor.txt specified version)" ) actual_version = expected_version elif parse_version(actual_version) != parse_version(expected_version): extra_message = ( " (CONFLICT: vendor.txt suggests version should" " be {})".format(expected_version) ) logger.info("%s==%s%s", module_name, actual_version, extra_message) def show_vendor_versions() -> None: logger.info("vendored library versions:") vendor_txt_versions = create_vendor_txt_map() with indent_log(): show_actual_vendor_versions(vendor_txt_versions) def show_tags(options: Values) -> None: tag_limit = 10 target_python = make_target_python(options) tags = target_python.get_tags() # Display the target options that were explicitly provided. formatted_target = target_python.format_given() suffix = "" if formatted_target: suffix = f" (target: {formatted_target})" msg = "Compatible tags: {}{}".format(len(tags), suffix) logger.info(msg) if options.verbose < 1 and len(tags) > tag_limit: tags_limited = True tags = tags[:tag_limit] else: tags_limited = False with indent_log(): for tag in tags: logger.info(str(tag)) if tags_limited: msg = ( "...\n[First {tag_limit} tags shown. Pass --verbose to show all.]" ).format(tag_limit=tag_limit) logger.info(msg) def ca_bundle_info(config: Configuration) -> str: levels = set() for key, _ in config.items(): levels.add(key.split(".")[0]) if not levels: return "Not specified" levels_that_override_global = ["install", "wheel", "download"] global_overriding_level = [ level for level in levels if level in levels_that_override_global ] if not global_overriding_level: return "global" if "global" in levels: levels.remove("global") return ", ".join(levels) class DebugCommand(Command): """ Display debug information. """ usage = """ %prog """ ignore_require_venv = True def add_options(self) -> None: cmdoptions.add_target_python_options(self.cmd_opts) self.parser.insert_option_group(0, self.cmd_opts) self.parser.config.load() def run(self, options: Values, args: List[str]) -> int: logger.warning( "This command is only meant for debugging. " "Do not use this with automation for parsing and getting these " "details, since the output and options of this command may " "change without notice." ) show_value("pip version", get_pip_version()) show_value("sys.version", sys.version) show_value("sys.executable", sys.executable) show_value("sys.getdefaultencoding", sys.getdefaultencoding()) show_value("sys.getfilesystemencoding", sys.getfilesystemencoding()) show_value( "locale.getpreferredencoding", locale.getpreferredencoding(), ) show_value("sys.platform", sys.platform) show_sys_implementation() show_value("'cert' config value", ca_bundle_info(self.parser.config)) show_value("REQUESTS_CA_BUNDLE", os.environ.get("REQUESTS_CA_BUNDLE")) show_value("CURL_CA_BUNDLE", os.environ.get("CURL_CA_BUNDLE")) show_value("pip._vendor.certifi.where()", where()) show_value("pip._vendor.DEBUNDLED", pip._vendor.DEBUNDLED) show_vendor_versions() show_tags(options) return SUCCESS PK]-*if.commands/__pycache__/hash.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlZddlmZddlmZddl m Z m Z ddl m Z mZeeZGdddeZd d ZdS) )absolute_importN)Command)ERROR) FAVORITE_HASH STRONG_HASHES) read_chunks write_outputcs0eZdZdZdZdZfddZddZZS) HashCommandz Compute a hash of a local package archive. These can be used with --hash in a requirements file to do repeatable installs. z%prog [options] ...Tc sJtt|j|||jjdddtdtddtd|j d|jdS) Nz-az --algorithm algorithmZstorez$The hash algorithm to use: one of %sz, )destchoicesactiondefaulthelpr) superr __init__Zcmd_optsZ add_optionrrjoinparserZinsert_option_group)selfargskw __class__?/usr/lib/python3.8/site-packages/pip/_internal/commands/hash.pyrszHashCommand.__init__cCs>|s|jtjtS|j}|D]}td||t||q dS)Nz%s: --hash=%s:%s)rZ print_usagesysstderrrr r _hash_of_file)rZoptionsrr pathrrrrun)szHashCommand.run) __name__ __module__ __qualname____doc__ZusageZignore_require_venvrr __classcell__rrrrr s  r c Cs@t|d(}t|}t|D]}||qW5QRX|S)z!Return the hash digest of a file.rb)openhashlibnewrupdateZ hexdigest)rr archivehashchunkrrrr4s    r)Z __future__rr'ZloggingrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrZpip._internal.utils.hashesrrZpip._internal.utils.miscrrZ getLoggerr Zloggerr rrrrrs    "PK]1 ط"".commands/__pycache__/list.cpython-38.opt-1.pycnu[U .e4)@sddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZmZmZdd lmZeeZGd dde ZddZddZddZ dS))absolute_importN)six) zip_longest) cmdoptions)IndexGroupCommand) CommandError) PackageFinder)SelectionPreferences)make_link_collector)dist_is_editableget_installed_distributions write_output) get_installercsdeZdZdZdZfddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ZS) ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. z %prog [options]cstt|j|||j}|jdddddd|jddddd d|jd d ddd d|jd ddddd|jjdddddd|t|jddddd|jddddddd|jddddd |jd!d"d#d$d |jd%dd#d&d'd(ttj|j }|j d)||j d)|dS)*Nz-oz --outdated store_trueFzList outdated packages)actiondefaulthelpz-uz --uptodatezList uptodate packagesz-ez --editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--useruserz,Only output packages installed in user-site.)destrrrz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatZstore list_formatcolumns)rfreezejsonzBSelect the output format among: columns (default), freeze, or json)rrrchoicesrz--not-required not_requiredz>List packages that are not dependencies of installed packages.)rrrz--exclude-editableZ store_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)rrrrr) superr__init__cmd_optsZ add_optionrZ list_pathZmake_option_groupZ index_groupparserZinsert_option_group)selfargskwrZ index_opts __class__?/usr/lib/python3.8/site-packages/pip/_internal/commands/list.pyr&s zListCommand.__init__cCs(t||d}td|jd}tj||dS)zK Create a package finder appropriate to this list command. )optionsF)Z allow_yankedZallow_all_prereleases)link_collectorselection_prefs)r r prerZcreate)r!r(sessionr)r*r&r&r'_build_package_findervs z!ListCommand._build_package_findercCs|jr|jrtdt|t|j|j|j|j |j d}|j rL| ||}|jr`| ||}n|jrr|||}|||dS)Nz5Options --outdated and --uptodate cannot be combined.)Z local_onlyZ user_onlyZeditables_onlyZinclude_editablespaths)outdatedZuptodaterrZcheck_list_path_optionr ZlocalrZeditablerpathrget_not_required get_outdated get_uptodateoutput_package_listing)r!r(r"packagesr&r&r'runs&     zListCommand.runcCsdd|||DS)NcSsg|]}|j|jkr|qSr&latest_versionZparsed_version.0distr&r&r' s z,ListCommand.get_outdated..iter_packages_latest_infosr!r5r(r&r&r'r2s zListCommand.get_outdatedcCsdd|||DS)NcSsg|]}|j|jkr|qSr&r7r9r&r&r'r<s z,ListCommand.get_uptodate..r=r?r&r&r'r3s zListCommand.get_uptodatecs:t|D]}dd|Dq fdd|DS)Ncss|] }|jVqdSNkey)r:Z requirementr&r&r' sz/ListCommand.get_not_required..csh|]}|jkr|qSr&rA)r:ZpkgZdep_keysr&r' s z/ListCommand.get_not_required..)setupdateZrequires)r!r5r(r;r&rDr'r1szListCommand.get_not_requiredc cs||}|||}|D]t}d}||j}|jsDdd|D}|j|jd}||} | dkrfq| j} | j j rzd}nd}| |_ ||_ |VqW5QRXdS)NunknowncSsg|]}|jjs|qSr&)versionZ is_prerelease)r: candidater&r&r'r<sz:ListCommand.iter_packages_latest_infos..) project_nameZwheelZsdist) Z_build_sessionr-Zfind_all_candidatesrBr+Zmake_candidate_evaluatorrKZsort_best_candidaterIlinkZis_wheelr8latest_filetype) r!r5r(r,finderr;typZall_candidatesZ evaluatorZbest_candidateZremote_versionr&r&r'r>s(    z&ListCommand.iter_packages_latest_infoscCst|ddd}|jdkr:|r:t||\}}|||n^|jdkr|D]4}|jdkrltd|j|j|jqHtd|j|jqHn|jd krtt ||dS) NcSs |jSr@)rKlower)r;r&r&r'z4ListCommand.output_package_listing..rArrz %s==%s (%s)z%s==%sr) sortedrformat_for_columnsoutput_package_listing_columnsverboser rKrIlocationformat_for_json)r!r5r(dataheaderr;r&r&r'r4s"   z"ListCommand.output_package_listingcCsbt|dkr|d|t|\}}t|dkrL|ddtdd||D] }t|qPdS)NrrS cSsd|S)N-r&)xr&r&r'rQrRz.)leninserttabulatejoinmapr )r!rZr[Z pkg_stringssizesvalr&r&r'rVs    z*ListCommand.output_package_listing_columns)__name__ __module__ __qualname____doc__Zusagerr-r6r2r3r1r>r4rV __classcell__r&r&r$r'rs PrcCspdgtdd|D}|D]}ddt||D}qg}|D](}dddt||D}||q>||fS)Nrcss|]}t|VqdSr@)r_r:r^r&r&r'rCsztabulate..cSs"g|]\}}t|tt|qSr&)maxr_strr:scr&r&r'r<sztabulate..r\cSs*g|]"\}}|dk r"t||ndqS)N)rmljustrnr&r&r'r<s)rlrrbappend)ZvalsrdrowresultZdisplayr&r&r'ras  racCs|j}|rddddg}nddg}g}|jdks@tdd|DrJ|d|jdkr^|d |D]l}|j|jg}|r||j||j|jdkst|r||j |jdkr|t |||qb||fS) z_ Convert the package data into something usable by output_package_listing_columns. ZPackageZVersionZLatestZTyperScss|]}t|VqdSr@)r rkr&r&r'rCsz%format_for_columns..ZLocationZ Installer) r/rWanyrsrKrIr8rMr rXr)Zpkgsr(Zrunning_outdatedr[rZZprojrtr&r&r'rUs(         rUcCsvg}|D]b}|jt|jd}|jdkr@|j|d<t||d<|jr`t|j|d<|j |d<| |qt |S)N)namerIrSrXZ installerr8rM) rKrZ text_typerIrWrXrr/r8rMrsrdumps)r5r(rZr;infor&r&r'rY+s      rY)!Z __future__rrZloggingZ pip._vendorrZpip._vendor.six.movesrZpip._internal.clirZpip._internal.cli.req_commandrZpip._internal.exceptionsrZpip._internal.indexrZ$pip._internal.models.selection_prefsr Z!pip._internal.self_outdated_checkr Zpip._internal.utils.miscr r r Zpip._internal.utils.packagingrZ getLoggerrfZloggerrrarUrYr&r&r&r's$           Y%PK]qCUU)commands/__pycache__/wheel.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd lmZmZeeZ Gddde Z!dS)N)Values)List) WheelCache) cmdoptions)RequirementCommand with_cleanup)SUCCESS) CommandError)get_build_tracker)InstallRequirement) ensure_dirnormalize_path) TempDirectory)buildshould_build_for_wheel_commandc@s<eZdZdZdZddddZeeee e ddd Z dS) WheelCommanda Build Wheel archives for your requirements and dependencies. Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. For more details, see the wheel docs: https://wheel.readthedocs.io/en/latest/ 'pip wheel' uses the build system interface as described here: https://pip.pypa.io/en/stable/reference/build-system/ z %prog [options] ... %prog [options] -r ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...N)returncCs|jjddddtjdd|jt|jt|jt|jt|jt |jt |jt |jt |jt |jt|jt|jt|jt|jt|jjddd d d d |jt|jt|jt|jjd d d dd|jtttj|j}|jd||jd|jdS)Nz-wz --wheel-dir wheel_dirdirzLBuild wheels into , where the default is the current working directory.)destmetavardefaulthelpz --no-verify no_verify store_trueFz%Don't verify if built wheel is valid.)ractionrrz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.)rrrr)cmd_opts add_optionoscurdirr no_binary only_binary prefer_binaryno_build_isolation use_pep517 no_use_pep517check_build_deps constraintseditable requirementssrcignore_requires_pythonno_deps progress_barconfig_settings build_optionsglobal_optionsrequire_hashesmake_option_group index_groupparserinsert_option_group)self index_optsr8/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/wheel.py add_options)sZ  zWheelCommand.add_options)optionsargsrc Cst|||}|||}t|j|j}t|j|_t |j| t }t |j ddd}|||||}|j||||||jd|jd} |j| ||||j|jd} ||| j|dd} g} | jD](} | jr| | qt| r| | qt| ||j |jpg|jpgd\}}|D]|} | j r>| j jsBt!| j"sNt!zt#$| j"|jWn>t%k r}zt&'d | j(||| W5d}~XYnXq(t)|d krt*d t+S) NwheelT)deletekindglobally_managedF)temp_build_dirr; build_trackersessionfinder download_dir use_user_site verbosity)preparerrDr; wheel_cacher+r$)check_supported_wheels)rIverifyr/r0z Building wheel for %s failed: %srz"Failed to build one or more wheels),rcheck_install_build_globalget_default_session_build_package_finderr cache_dirformat_controlr rr enter_contextr rno_cleanget_requirementsmake_requirement_preparerrG make_resolverr+r$trace_basic_inforesolver)valuesis_wheelsave_linked_requirementrappendrrr/r0linkAssertionErrorlocal_file_pathshutilcopyOSErrorloggerwarningnamelenr r)r6r;r<rCrDrIrB directoryreqsrHresolverrequirement_set reqs_to_buildreqbuild_successesbuild_failureser8r8r9runesz              zWheelCommand.run) __name__ __module__ __qualname____doc__usager:rrrstrintror8r8r8r9rs  <r)"loggingrr_optparsertypingrpip._internal.cacherZpip._internal.clirpip._internal.cli.req_commandrrpip._internal.cli.status_codesrpip._internal.exceptionsr ,pip._internal.operations.build.build_trackerr Zpip._internal.req.req_installr pip._internal.utils.miscr r pip._internal.utils.temp_dirrpip._internal.wheel_builderrr getLoggerrprbrr8r8r8r9s           PK]   /commands/__pycache__/wheel.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlmZddlmZddlm Z ddl m Z m Z ddl mZddlmZdd lmZdd lmZdd lmZerdd lmZdd lmZmZeeZGddde ZdS))absolute_importN) WheelCache) cmdoptions)RequirementCommand) CommandErrorPreviousBuildDirError)RequirementSet)RequirementTracker) TempDirectory)MYPY_CHECK_RUNNING) WheelBuilder)Values)AnyListcs,eZdZdZdZfddZddZZS) WheelCommanda Build Wheel archives for your requirements and dependencies. Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. For more details, see the wheel docs: https://wheel.readthedocs.io/en/latest/ Requirements: setuptools>=0.8, and wheel. 'pip wheel' uses the bdist_wheel setuptools extension from the wheel package to build individual wheels. z %prog [options] ... %prog [options] -r ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...csztt|j|||j}|jddddtjdd|t|t |t |jddd d d d |t |t |t |t|t|t|t|t|t|t|t|jd dd d dd|jddddd|t|tttj|j}|jd||jd|dS)Nz-wz --wheel-dir wheel_dirdirzLBuild wheels into , where the default is the current working directory.)destmetavardefaulthelpz--build-option build_optionsoptionsappendz9Extra arguments to be supplied to 'setup.py bdist_wheel'.)rractionrz--global-optionglobal_optionszZExtra global options to be supplied to the setup.py call before the 'bdist_wheel' command.)rrrrz--pre store_trueFzYInclude pre-release and development versions. By default, pip only finds stable versions.)rrrr)superr__init__cmd_optsZ add_optionoscurdirrZ no_binaryZ only_binaryZ prefer_binaryZno_build_isolation use_pep517Z no_use_pep517Z constraintsZeditable requirementssrcignore_requires_pythonZno_deps build_dirZ progress_barno_cleanrequire_hashesZmake_option_groupZ index_groupparserZinsert_option_group)selfargskwrZ index_opts __class__@/usr/lib/python3.8/site-packages/pip/_internal/commands/wheel.pyr3shzWheelCommand.__init__c Cszt||jr tj|j|_tj|j|_||}|||}|j pP|j }t |j |j }t }t|j|dd}t|jd} zz|| ||||||j||||jd} |j| |||||j|jd} | | t| ||jpg|jpg|j d} | | j} t | dkr"t!dWnt"k rBd |_ YnXW5|j s`| |XW5QRXW5QRXdS) NZwheel)deleteZkind)r()Ztemp_build_dirr req_trackerZwheel_download_dir)preparerfindersessionr wheel_cacher%r")rrr'rz"Failed to build one or more wheelsT)#rZcheck_install_build_globalr&r pathabspathZsrc_dirZget_default_sessionZ_build_package_finderr'r cache_dirZformat_controlr r rr(Z cleanup_filesZcleanupZpopulate_requirement_setZmake_requirement_preparerrZ make_resolverr%r"Zresolver rrZbuildr#valueslenrr)r*rr+r5r4Z build_deleter6r2Z directoryZrequirement_setr3ZresolverwbZbuild_failuresr/r/r0runqs|      zWheelCommand.run)__name__ __module__ __qualname____doc__Zusagerr= __classcell__r/r/r-r0rs >r) Z __future__rZloggingr Zpip._internal.cacherZpip._internal.clirZpip._internal.cli.req_commandrZpip._internal.exceptionsrrZpip._internal.reqrZpip._internal.req.req_trackerr Zpip._internal.utils.temp_dirr Zpip._internal.utils.typingr Zpip._internal.wheelr Zoptparser typingrrZ getLoggerr>Zloggerrr/r/r/r0s           PK]c}2commands/__pycache__/download.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZmZmZdd lmZeeZGd d d e ZdS) )absolute_importN) cmdoptions)make_target_python)RequirementCommand)RequirementSet)RequirementTracker)check_path_owner) ensure_dirnormalize_path write_output) TempDirectorycs,eZdZdZdZfddZddZZS)DownloadCommandaL Download packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports downloading from "requirements files", which provide an easy way to specify a whole environment to be downloaded. a %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ... %prog [options] ... %prog [options] ...c sNtt|j|||j}|t|t|t|t |t |t |t |t |t|t|t|t|t|t|t|t|jddddddtjddt|ttj|j}|jd ||jd |dS) Nz-dz--destz--destination-dirz--destination-directory download_dirdirzDownload packages into .)destmetavardefaulthelpr)superr __init__cmd_optsZ add_optionrZ constraintsZ requirements build_dirZno_depsZglobal_optionsZ no_binaryZ only_binaryZ prefer_binarysrcZpreno_cleanrequire_hashesZ progress_barZno_build_isolationZ use_pep517Z no_use_pep517oscurdirZadd_target_python_optionsZmake_option_groupZ index_groupparserZinsert_option_group)selfargskwrZ index_opts __class__C/usr/lib/python3.8/site-packages/pip/_internal/commands/download.pyr)sF zDownloadCommand.__init__c CsLd|_g|_t|tj|j|_t|j |_ t |j | |}t |}|j |||d}|jph|j }|jrt|jstd|jd|_t}t|j|dd}t|jd} || ||||d|j||||j d} |j| ||||jd} | | d d d | jD} | r$td | |js4| W5QRXW5QRX| S) NT)optionssession target_pythonzThe directory '%s' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.Zdownload)deleteZkind)r)Ztemp_build_dirr% req_trackerr)preparerfinderr&r%Zpy_version_info cSsg|] }|jqSr#)name).0Zreqr#r#r$ sz'DownloadCommand.run..zSuccessfully downloaded %s)!Zignore_installedZ editablesrZcheck_dist_restrictionrpathabspathZsrc_dirr rr Zget_default_sessionrZ_build_package_finderrr cache_dirrloggerZwarningrr rrZpopulate_requirement_setZmake_requirement_preparerZ make_resolverZpython_versionZresolvejoinZsuccessfully_downloadedr Z cleanup_files) rr%rr&r'r+Z build_deleter)Z directoryZrequirement_setr*ZresolverZ downloadedr#r#r$runQsv         zDownloadCommand.run)__name__ __module__ __qualname____doc__Zusagerr5 __classcell__r#r#r!r$r s  (r )Z __future__rZloggingrZpip._internal.clirZpip._internal.cli.cmdoptionsrZpip._internal.cli.req_commandrZpip._internal.reqrZpip._internal.req.req_trackerrZpip._internal.utils.filesystemrZpip._internal.utils.miscr r r Zpip._internal.utils.temp_dirr Z getLoggerr6r3r r#r#r#r$s         PK]:z8z81commands/__pycache__/install.cpython-38.opt-1.pycnu[U .e_@sddlmZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZmZmZdd lmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5e1rddl m6Z6ddl7m8Z8m9Z9m:Z:ddl;mZ>ddl4m?Z?e@eAZBddZCddZDd d!ZEGd"d#d#eZFd$d%ZGd&d'ZHdS)()absolute_importN)path) SUPPRESS_HELP) pkg_resources)canonicalize_name) WheelCache) cmdoptions)make_target_python)RequirementCommand)ERRORSUCCESS) CommandErrorInstallationErrorPreviousBuildDirErrordistutils_scheme)check_install_conflicts)RequirementSetinstall_given_reqs)RequirementTracker)check_path_owner) ensure_dirget_installed_version(protect_pip_from_modification_on_windows write_output) TempDirectory)MYPY_CHECK_RUNNING)virtualenv_no_global) WheelBuilder)Values)AnyListOptional) FormatControl)InstallRequirement)BinaryAllowedPredicatecCs(z ddl}Wntk r"YdSXdS)z8 Return whether the wheel package is installed. rNFT)wheel ImportError)r&r(B/usr/lib/python3.8/site-packages/pip/_internal/commands/install.pyis_wheel_installed<s  r*cCs*t}|j|dd}|r&|j|dd|S)zQ Build wheels for requirements, depending on whether wheel is installed. T)Z should_unpack)r*Zbuild)builderpep517_requirementslegacy_requirementsZshould_build_legacybuild_failuresr(r(r) build_wheelsHs r/csfdd}|S)Ncs&|jr dSt|j}|}d|kS)NTZbinary) use_pep517rnameZget_allowed_formats)reqZcanonical_nameZallowed_formatsformat_controlr(r)check_binary_allowedhs   z6get_check_binary_allowed..check_binary_allowedr()r4r5r(r3r)get_check_binary_allowedfs r6cs<eZdZdZdZfddZddZddZd d ZZ S) InstallCommandaI Install packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports installing from "requirements files", which provide an easy way to specify a whole environment to be installed. a% %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...cs^tt|j|||j}|t|t|t|t |t |jdddddddt ||jddd d d |jd dd t d |jdddddd|jdddddd|t |t|jdddd dd |jdddddgdd|jddd d d |jd!d"d#d d$d |t|t|t|t|t|t|jd%d d&d'd(d)|jd*d d&d+d,|jd-d d.d'd/d)|jd0d d1d'd2d)|t|t|t|t|t|tttj|j}|jd3||jd3|dS)4Nz-tz--target target_dirdirzInstall packages into . By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.)destmetavardefaulthelp--user use_user_site store_truezInstall to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.))r:actionr=z --no-userZ store_falsez--root root_pathz=Install everything relative to this alternate root directory.z--prefix prefix_pathzIInstallation prefix where lib, bin and other top-level folders are placedz-Uz --upgradeupgradezUpgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategyupgrade_strategyzonly-if-neededZeageraGDetermines how dependency upgrading should be handled [default: %default]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" - are upgraded only when they do not satisfy the requirements of the upgraded package(s).)r:r<choicesr=z--force-reinstallforce_reinstallz;Reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_installedzIgnore the installed packages, overwriting them. This can break your system if the existing package is of a different version or was installed with a different package manager!z --compilecompileTz'Compile Python source files to bytecode)rAr:r<r=z --no-compilez.Do not compile Python source files to bytecode)rAr:r=z--no-warn-script-locationwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictswarn_about_conflictsz%Do not warn about broken dependenciesr)superr7__init__cmd_optsZ add_optionr requirementsZ constraintsZno_depsZpreZeditableZadd_target_python_optionsr build_dirsrcignore_requires_pythonZno_build_isolationr0Z no_use_pep517install_optionsglobal_optionsZ no_binaryZ only_binaryZ prefer_binaryno_cleanrequire_hashesZ progress_barZmake_option_groupZ index_groupparserZinsert_option_group)selfargskwrNZ index_opts __class__r(r)rMs   zInstallCommand.__init__c*Cst|dd}tdkrZ|sZttjd}|dkrLttjd}t d|d}|j rj|j }|j rtj|j |_ tj|dd tj|j|_|jpg}|jr|jrtd trtd |d |d d}d}|jrJd|_tj|j|_tj|jr,tj|js,tdtdd}|j}|d||jpTg} ||} t|} |j || | |j!d} |j"p|j } t#|j$|j%}|j$rt&|j$st d|j$d|_$t'}t|j | dd}t(|j)|j d}zz*|,|||| | ||j-|||d}|j.|| | |||j|j|j!|j/||j0d }|1|z|2d}Wnt3k rzd}Yn X|j4dk}t5|dt6| j%}g}g}|j78D]$}|j0r||n ||qt9||gg|d}t:|||d}|rtd;d o.|j?}|r@|@||jA}|jrRd!}tB||| |jC||j|jD||jd" }tE|j||jC|j|jFd#} tGH| }!tI|tJKd$d%}"g}#|"D]R}|jL}$z$tM|jL|!d&}%|%r|$d'|%7}$WntNk rYnX|#|$qd(<|#}&|&r tOd)|&WntPk r}'zN|jQd*k}(tR|'|(|j})t jS|)|(d+tTWYWHW5QRW5QRSd}'~'XYntUk rd|_"YnXW5|j"s|*|+XW5QRXW5QRX|jr|V|j||j tWS),NcSs ttdpttdotjtjkS)NZ real_prefix base_prefix)hasattrsysr]prefixr(r(r(r)is_venvs   z#InstallCommand.run..is_venvrz __main__.pyz -m pipzgRunning pip install with root privileges is generally not a good idea. Try `%s install --user` instead.zto-satisfy-onlyT)Z check_targetzVCan not combine '--user' and '--prefix' as they imply different installation locationszZCan not perform a '--user' install. User site-packages are not visible in this virtualenv.r>z --prefix=z=Target path exists but is not a directory, will not continue.target)kindz--home=)optionssession target_pythonrRzThe directory '%s' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.Zinstall)deleterc)rVZcheck_supported_wheels)Ztemp_build_dirrd req_tracker) preparerfinderrerd wheel_cacher?rHrRrGrEr0Zpip) modifying_pip)Z build_optionsrTr5)r+r,r-zPCould not build wheels for {} which use PEP 517 and cannot be installed directlyz, css|] }|jVqdSN)r1).0rr(r(r) sz%InstallCommand.run..F)roothomer`Z pycompilerJr?)userrrrqr`isolatedr1)key) working_set- zSuccessfully installed %sexc_info)XrZcheck_install_build_globalosgetuidrbasenamer_argv executableloggerwarningrDrErPabspathZcheck_dist_restrictionZsrc_dirrSr?rCr rrappendr8rHexistsisdirrrTZget_default_sessionr Z_build_package_finderrRrUr cache_dirr4rrrrVZ cleanup_filesZcleanupZpopulate_requirement_setZmake_requirement_preparerZ make_resolverrGr0ZresolveZget_requirementKeyErrorZ satisfied_byrr6rOvaluesrr/formatjoinZget_installation_orderZignore_dependenciesrK_warn_about_conflictsrJrrBrIget_lib_location_guessesZ isolated_moderZ WorkingSetsortedoperator attrgetterr1r ExceptionrEnvironmentError verbositycreate_env_error_messageerrorr r_handle_target_dirr )*rXrdrYraZcommandrErStarget_temp_dirZtarget_temp_dir_pathrTrerfrjZ build_deleterkrhZ directoryZrequirement_setriZresolverZpip_reqrlr5r-r,r2Z wheel_builderr. to_installZshould_warn_about_conflictsrJZ installedZ lib_locationsrvZreqsitemsitemZinstalled_versionZinstalled_descrshow_tracebackmessager(r(r)runs                   4 zInstallCommand.runc sft|g}|Jtd|jd}|d}|d}|d}tj|rP||tj|rn||krn||tj|r|||D]} t| D]} | |krtj|| tfdd|ddDrqtj|| } tj| r>|st d | qtj | rt d | qtj | r4t | n t| t tj| | | qqW5QRXdS) N)rrpurelibplatlibdatac3s|]}|VqdSrm) startswith)rnsddirr(r)rp+sz4InstallCommand._handle_target_dir..zKTarget directory %s already exists. Specify --upgrade to force replacement.zTarget directory %s already exists and is a link. Pip will not automatically replace links, please remove if replacement is desired.)rrrr|rrlistdirranyrrislinkrshutilZrmtreeremoveZmove) rXr8rrDZ lib_dir_listschemeZ purelib_dirZ platlib_dirZdata_dirZlib_dirrZtarget_item_dirr(rr)rsP        z!InstallCommand._handle_target_dirc Cszt|\}}Wn$tk r4tjdddYdSX|\}}|D]2}||d}||D]}td|||dqZqB|D]8}||d}||D]\} } } td||| | | qqzdS)NzError checking for conflicts.Trzrz*%s %s requires %s, which is not installed.ryzF%s %s has requirement %s, but you'll have %s %s which is incompatible.)rrrrZcritical) rXrZ package_setZ _dep_infoZmissingZ conflictingZ project_nameversionZ dependencyZdep_nameZ dep_versionr2r(r(r)rIs4   z$InstallCommand._warn_about_conflicts) __name__ __module__ __qualname____doc__ZusagerMrrr __classcell__r(r(r[r)r7ss  w8r7cOstd||}|d|dgS)Nrrr)rr)rYkwargsrr(r(r)rdsrcCsg}|d|s,|d|t|n |d|dd7<|jtjkrd}d}|st||d|gn |||d d |dS) z{Format an error message for an EnvironmentError It may occur anytime during the execution of the install command. z5Could not install packages due to an EnvironmentErrorz: .r z"Consider using the `--user` optionzCheck the permissionsz or z. r)rstrerrnoZEACCESextendlowerrstrip)rrZusing_user_sitepartsZuser_option_partZpermissions_partr(r(r)ris&      r)IZ __future__rrZloggingrr|rr_rZoptparserZ pip._vendorrZpip._vendor.packaging.utilsrZpip._internal.cacherZpip._internal.clirZpip._internal.cli.cmdoptionsr Zpip._internal.cli.req_commandr Zpip._internal.cli.status_codesr r Zpip._internal.exceptionsr rrZpip._internal.locationsrZpip._internal.operations.checkrZpip._internal.reqrrZpip._internal.req.req_trackerrZpip._internal.utils.filesystemrZpip._internal.utils.miscrrrrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrZpip._internal.wheelrrtypingr r!r"Z#pip._internal.models.format_controlr#Zpip._internal.req.req_installr$r%Z getLoggerrrr*r/r6r7rrr(r(r(r)sT                        tPK]4')commands/__pycache__/debug.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z m Z mZddlZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%e&e'Z(e)e ddddZ*ddddZ+e e)e)fdddZ,e)e dddZ-e)ee)dddZ.e e)e)fddddZ/dddd Z0edd!d"d#Z1ee)d$d%d&Z2Gd'd(d(eZ3dS))N)Values) ModuleType)AnyDictListOptional)where)parse) cmdoptions)Command)make_target_python)SUCCESS) Configuration)get_environment) indent_log)get_pip_version)namevaluereturncCstd||dS)Nz%s: %s)loggerinfo)rrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/debug.py show_valuesrrc Cs2tdtjj}ttd|W5QRXdS)Nzsys.implementation:r)rrsysimplementationrrr)implementation_namerrrshow_sys_implementations rc Cs>tjdd}dd|D}W5QRXtdd|DS)Nz pip._vendorz vendor.txtcSs(g|] }d|kr|dddqS)== r)stripsplit.0linerrr )sz)create_vendor_txt_map..css|]}|ddVqdS)rr!N)r#r$rrr .sz(create_vendor_txt_map..) importlib resources open_text readlinesdict)flinesrrrcreate_vendor_txt_map%s r0) module_namercCs:|}|dkrd}td|ttddttj|S)N setuptools pkg_resourcesz pip._vendor.r)level)lower __import__globalslocalsgetattrpip_vendor)r1rrrget_module_from_module_name1s r<cCsVt|}t|dd}|sR|jdk s&tttj|jg}||}|rRt |j }|S)N __version__) r<r9__file__AssertionErrorrospathdirnameget_distributionstrversion)r1modulerEenvdistrrrget_vendor_version_from_module<s   rI)vendor_txt_versionsrcCsZ|D]L\}}d}t|}|s*d}|}nt|t|krDd|}td|||qdS)z{Log the actual version and print extra info if there is a conflict or if the actual version could not be imported. zM (Unable to locate actual module version, using vendor.txt specified version)z5 (CONFLICT: vendor.txt suggests version should be {})z%s==%s%sN)itemsrI parse_versionformatrr)rJr1Zexpected_versionZ extra_messageZactual_versionrrrshow_actual_vendor_versionsKsrOc Cs.tdt}tt|W5QRXdS)Nzvendored library versions:)rrr0rrO)rJrrrshow_vendor_versions`s rP)optionsrc Csd}t|}|}|}d}|r0d|d}dt||}t||jdkrrt||krrd}|d|}nd}t8|D]}tt |q|rd j|d }t|W5QRXdS) N rKz (target: )zCompatible tags: {}{}r!TFz?... [First {tag_limit} tags shown. Pass --verbose to show all.]) tag_limit) r get_tags format_givenrNlenrrverboserrD) rQrT target_pythontagsZformatted_targetsuffixmsgZ tags_limitedtagrrr show_tagshs,  r^)configrcstt}|D]\}}||ddq|s4dSdddgfdd|D}|sXd Sd |krj|d d |S) N.rz Not specifiedinstallwheeldownloadcsg|]}|kr|qSrr)r%r4Zlevels_that_override_globalrrr'sz"ca_bundle_info..globalz, )setrLaddr#removejoin)r_Zlevelskey_Zglobal_overriding_levelrrdrca_bundle_infos   rlc@s<eZdZdZdZdZddddZeee e dd d Z dS) DebugCommandz$ Display debug information. z %prog TNrcCs,t|j|jd|j|jjdS)Nr)r add_target_python_optionscmd_optsparserinsert_option_groupr_load)selfrrr add_optionss zDebugCommand.add_options)rQargsrcCstdtdttdtjtdtjtdttdttdt tdtj t td t |jjtd tjd td tjd td ttd tjjtt|tS)NzThis command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.z pip versionz sys.versionzsys.executablezsys.getdefaultencodingzsys.getfilesystemencodingzlocale.getpreferredencodingz sys.platformz'cert' config valueREQUESTS_CA_BUNDLECURL_CA_BUNDLEzpip._vendor.certifi.where()zpip._vendor.DEBUNDLED)rwarningrrrrE executablegetdefaultencodinggetfilesystemencodinglocalegetpreferredencodingplatformrrlrpr_r@environgetrr:r; DEBUNDLEDrPr^r )rsrQrurrrruns,     zDebugCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvrtrrrDintrrrrrrms rm)4importlib.resourcesr)r|loggingr@roptparsertypesrtypingrrrr pip._vendorr:pip._vendor.certifirZpip._vendor.packaging.versionr rMZpip._internal.clir pip._internal.cli.base_commandr Zpip._internal.cli.cmdoptionsr pip._internal.cli.status_codesr pip._internal.configurationrpip._internal.metadatarpip._internal.utils.loggingrpip._internal.utils.miscr getLoggerrrrDrrr0r<rIrOrPr^rlrmrrrrs:                PK]'$DD)commands/__pycache__/check.cpython-38.pycnu[U ʗRe@svddlZddlmZddlmZddlmZddlmZm Z ddl m Z m Z ddl mZeeZGdd d eZdS) N)Values)List)Command)ERRORSUCCESS)check_package_set!create_package_set_from_installed) write_outputc@s*eZdZdZdZeeeedddZ dS) CheckCommandz7Verify installed packages have compatible dependencies.z %prog [options])optionsargsreturnc Cst\}}t|\}}|D].}||j}||D]} td||| dq0q|D]4}||j}||D]\} } } td||| | | qdqN|s|s|rtStdtSdS)Nz*%s %s requires %s, which is not installed.rz-%s %s has requirement %s, but you have %s %s.zNo broken requirements found.)rrversionr rr) selfr r package_setZ parsing_probsmissing conflicting project_namer dependencydep_name dep_versionreqr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/check.pyruns4      zCheckCommand.runN) __name__ __module__ __qualname____doc__usagerrstrintrrrrrr sr )loggingoptparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.operations.checkrrpip._internal.utils.miscr getLoggerrloggerr rrrrs     PK](commands/__pycache__/show.cpython-38.pycnu[U ʗRe@sddlZddlmZddlmZmZmZmZmZm Z ddl m Z ddl m Z ddlmZmZddlmZmZddlmZeeZGd d d e ZGd d d eZeeeeddfd ddZeeeeedddZdS)N)Values) GeneratorIterableIteratorList NamedTupleOptionalcanonicalize_name)Command)ERRORSUCCESS)BaseDistributionget_default_environment) write_outputc@s<eZdZdZdZdZddddZeee e dd d Z dS) ShowCommandzx Show information about one or more installed packages. The output is in RFC-compliant mail header format. z$ %prog [options] ...TN)returncCs,|jjddddddd|jd|jdS) Nz-fz--filesfiles store_trueFz7Show the full list of installed files for each package.)destactiondefaulthelpr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/show.py add_optionss zShowCommand.add_options)optionsargsrcCs8|stdtS|}t|}t||j|jds4tStS)Nz.ERROR: Please provide a package name or names.) list_filesverbose)loggerwarningr search_packages_info print_resultsrr$r )rr!r"queryresultsrrrrun&s zShowCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvr rrstrintr+rrrrrs  rc@seZdZUeed<eed<eed<eeed<eeed<eed<eed<eeed<eed <eed <eeed <eed <eed <eed<eeed<eeeed<dS) _PackageInfonameversionlocationrequires required_by installermetadata_version classifierssummaryhomepage project_urlsauthor author_emaillicense entry_pointsrN)r,r-r.r2__annotations__rrrrrrr44s      r4)r)rc#st}dd|Ddd|D}tfddt||D}|rXtdd|ttt dfd d }|D]0}z |}Wnt k rYqtYnXtd d | Dt j d }t||t j d }z| d} | jdd} Wntk rg} YnX|} | dkrd} nt| } |j} t|jt |j|jpBd|||j|jpTd| dg| dd| dd| dg| dd| dd| dd| | dVqtdS)z Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. cSsi|] }|j|qSr)canonical_name.0distrrr Psz(search_packages_info..cSsg|] }t|qSrr )rGr5rrr Qsz(search_packages_info..csg|]\}}|kr|qSrr)rGr5pkg installedrrrJSszPackage(s) not found: %s, ) current_distrcsfddDS)Nc3s4|],}jdd|Dkr|jdp*dVqdS)cSsh|]}t|jqSr)r r5)rGdrrr ]szRsearch_packages_info.._get_requiring_packages...NameUNKNOWNN)rEiter_dependenciesmetadatarFrOrr Ys zHsearch_packages_info.._get_requiring_packages..)valuesrVrLrVr_get_requiring_packagesXs z5search_packages_info.._get_requiring_packagescss|] }|jVqdS)N)r5)rGreqrrrrWfsz'search_packages_info..)keyzentry_points.txtF)keependsN ClassifierSummaryz Home-pagez Project-URLAuthorz Author-emailLicense)r5r6r7r8r9r:r;r<r=r>r?r@rArBrCr)riter_all_distributionssortedzipr%r&joinrrr2KeyErrorrTlower read_text splitlinesFileNotFoundErroriter_declared_entriesrUr4raw_namer6r7r:r;get_allget)r)envZ query_namesmissingrYZ query_namerHr8r9Zentry_points_textrCZ files_iterrrUrrLrr'GsX               r') distributionsr#r$rc Cspd}t|D]\\}}d}|dkr*tdtd|jtd|jtd|jtd|jtd |jtd |jtd |jtd |j td d |j tdd |j |r,td|j td|jtd|jD]}td|qtd|jD]}td|qtd|jD]}td|q|r td|jdkrNtdq |jD]} td| qTq |S)zC Print the information from installed distributions found. FTrz---zName: %sz Version: %sz Summary: %sz Home-page: %sz Author: %szAuthor-email: %sz License: %sz Location: %sz Requires: %srNzRequired-by: %szMetadata-Version: %sz Installer: %sz Classifiers:z %sz Entry-points:z Project-URLs:zFiles:Nz+Cannot locate RECORD or installed-files.txt) enumeraterr5r6r=r>r@rArBr7rer8r9r;r:r<rCstripr?r) rqr#r$Zresults_printedirH classifierentry project_urllinerrrr(sD                 r()loggingoptparsertypingrrrrrrpip._vendor.packaging.utilsr pip._internal.cli.base_commandr pip._internal.cli.status_codesr r pip._internal.metadatarrpip._internal.utils.miscr getLoggerr,r%rr4r2r'boolr(rrrrs       %EPK]]j  /commands/__pycache__/check.cpython-38.opt-1.pycnu[U .e@sNddlZddlmZddlmZmZddlmZee Z GdddeZ dS)N)Command)check_package_set!create_package_set_from_installed) write_outputc@seZdZdZdZddZdS) CheckCommandz7Verify installed packages have compatible dependencies.z %prog [options]c Cst\}}t|\}}|D].}||j}||D]} td||| dq0q|D]4}||j}||D]\} } } td||| | | qdqN|s|s|rdStddS)Nz*%s %s requires %s, which is not installed.rz-%s %s has requirement %s, but you have %s %s.zNo broken requirements found.)rrversionr) selfZoptionsargsZ package_setZ parsing_probsZmissingZ conflictingZ project_namerZ dependencyZdep_nameZ dep_versionZreqr @/usr/lib/python3.8/site-packages/pip/_internal/commands/check.pyruns2      zCheckCommand.runN)__name__ __module__ __qualname____doc__Zusager r r r r rsr) ZloggingZpip._internal.cli.base_commandrZpip._internal.operations.checkrrZpip._internal.utils.miscrZ getLoggerrZloggerrr r r r s    PK]s̈́0commands/__pycache__/search.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddlmZddlmZdd lmZmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z e!e"Z#GdddeeZ$ddZ%dddZ&ddZ'dS))absolute_importN) OrderedDict) pkg_resources)parse) xmlrpc_client)Command)SessionCommandMixin)NO_MATCHES_FOUNDSUCCESS) CommandError)PyPI)PipXmlrpcTransport)get_terminal_size) indent_log) write_outputcs8eZdZdZdZdZfddZddZdd ZZ S) SearchCommandz@Search for PyPI packages whose name or summary contains .z %prog [options] Tcs@tt|j|||jjddddtjdd|jd|jdS)Nz-iz--indexindexZURLz3Base URL of Python Package Index (default %default))destmetavardefaulthelpr) superr__init__Zcmd_optsZ add_optionr Zpypi_urlparserZinsert_option_group)selfargskw __class__A/usr/lib/python3.8/site-packages/pip/_internal/commands/search.pyr%szSearchCommand.__init__cCsT|s td|}|||}t|}d}tjrksz!print_results..cSsg|] }|jqSr)Z project_name)r?prrr r@psr,r-r5r<   z %-*s - %sz%s (%s)zINSTALLED: %s (latest)z INSTALLED: %sz=LATEST: %s (pre-release; install with "pip install --pre")z LATEST: %s)maxrZ working_setr8r>textwrapZwrapjoinrZget_distributionrr4 parse_versionZpreUnicodeEncodeError) r*Zname_column_widthr!Zinstalled_packagesr;r,r-ZlatestZ target_widthlineZdistrrr r'gsJ          r'cCs t|tdS)N)key)rIrL)r5rrr r8sr8)NN)(Z __future__rZloggingr$rJ collectionsrZ pip._vendorrZpip._vendor.packaging.versionrrLZpip._vendor.six.movesrZpip._internal.cli.base_commandrZpip._internal.cli.req_commandrZpip._internal.cli.status_codesr r Zpip._internal.exceptionsr Zpip._internal.models.indexr Zpip._internal.network.xmlrpcr Zpip._internal.utils.compatrZpip._internal.utils.loggingrZpip._internal.utils.miscrZ getLoggerr/Zloggerrr#r'r8rrrr s*              - )PK]A 3commands/__pycache__/uninstall.cpython-38.opt-1.pycnu[U .e @svddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZGd d d eeZd S) )absolute_import)canonicalize_name)Command)SessionCommandMixin)InstallationError)parse_requirements)install_req_from_line)(protect_pip_from_modification_on_windowscs,eZdZdZdZfddZddZZS)UninstallCommandaB Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: - Pure distutils packages installed with ``python setup.py install``, which leave behind no metadata to determine what files were installed. - Script wrappers installed by ``python setup.py develop``. zU %prog [options] ... %prog [options] -r ...c sVtt|j|||jjddddgddd|jjdd d d d d |jd|jdS)Nz-rz --requirement requirementsappendfilezjUninstall all the packages listed in the given requirements file. This option can be used multiple times.)destactiondefaultmetavarhelpz-yz--yesyes store_truez2Don't ask for confirmation of uninstall deletions.)rrrr)superr __init__Zcmd_optsZ add_optionparserZinsert_option_group)selfargskw __class__D/usr/lib/python3.8/site-packages/pip/_internal/commands/uninstall.pyrs$ zUninstallCommand.__init__c Cs||}i}|D]&}t||jd}|jr||t|j<q|jD],}t|||dD]}|jrR||t|j<qRq@|stdt|jdt d|kd| D]&}|j |j |j dkd}|r|qdS) N)isolated)optionssessionzLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))nameZpip)Z modifying_pipr)Z auto_confirmverbose)Zget_default_sessionrZ isolated_moder"rr rrdictr valuesZ uninstallr verbosityZcommit) rr rr!Zreqs_to_uninstallr"ZreqfilenameZuninstall_pathsetrrrrun2sB     zUninstallCommand.run)__name__ __module__ __qualname____doc__Zusagerr( __classcell__rrrrr s  r N)Z __future__rZpip._vendor.packaging.utilsrZpip._internal.cli.base_commandrZpip._internal.cli.req_commandrZpip._internal.exceptionsrZpip._internal.reqrZpip._internal.req.constructorsrZpip._internal.utils.miscr r rrrrs        PK]}` ` 0commands/__pycache__/freeze.cpython-38.opt-1.pycnu[U .e @s|ddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZd d d d hZGd ddeZdS))absolute_importN) WheelCache) cmdoptions)Command) FormatControl)freeze) stdlib_pkgsZpipZ setuptoolsZ distributeZwheelcs0eZdZdZdZdZfddZddZZS) FreezeCommandzx Output installed packages in requirements format. packages are listed in a case-insensitive sorted order. z %prog [options])ext://sys.stderrr c stt|j|||jjddddgddd|jjdd d dgd d d|jjd dddddd|jjdddddd|jt|jjdddddtd|jjddddd|j d|jdS) Nz-rz --requirement requirementsappendfilez}Use the order in the given requirements file and its comments when generating output. This option can be used multiple times.)destactiondefaultmetavarhelpz-fz --find-links find_linksZURLzs        PK]`z -commands/__pycache__/uninstall.cpython-38.pycnu[U ʗRe`@sddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZdd lmZdd lmZdd lmZmZdd lmZeeZGd dde e ZdS)N)Values)List)canonicalize_name) cmdoptions)Command)SessionCommandMixinwarn_if_run_as_root)SUCCESS)InstallationError)parse_requirements)install_req_from_line#install_req_from_parsed_requirement)(protect_pip_from_modification_on_windowsc@s8eZdZdZdZddddZeeee ddd Z dS) UninstallCommandaB Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: - Pure distutils packages installed with ``python setup.py install``, which leave behind no metadata to determine what files were installed. - Script wrappers installed by ``python setup.py develop``. zU %prog [options] ... %prog [options] -r ...N)returnc CsT|jjddddgddd|jjdd d d d d |jt|jd|jdS)Nz-rz --requirement requirementsappendfilezjUninstall all the packages listed in the given requirements file. This option can be used multiple times.)destactiondefaultmetavarhelpz-yz--yesyes store_truez2Don't ask for confirmation of uninstall deletions.)rrrr)cmd_opts add_optionrroot_user_actionparserinsert_option_group)selfr!/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py add_options%s$ zUninstallCommand.add_options)optionsargsrc Cs||}i}|D]4}t||jd}|jr:||t|j<qtd|q|jD]:}t|||dD]&}t ||jd}|jr`||t|j<q`qN|st d|jd|jdt d|kd| D]&}|j |j|jd kd } | r| q|jd krttS) N)isolatedzSInvalid requirement: %r ignored - the uninstall command expects named requirements.)r$sessionz*You must give at least one requirement to z (see "pip help z")pip) modifying_pipr) auto_confirmverbosewarn)get_default_sessionr isolated_modenamerloggerwarningrr r r rvalues uninstallr verbositycommitrrr ) r r$r%r'Zreqs_to_uninstallr/reqfilename parsed_reqZuninstall_pathsetr!r!r"run<sT      zUninstallCommand.run) __name__ __module__ __qualname____doc__usager#rrstrintr9r!r!r!r"rs r)loggingoptparsertypingrpip._vendor.packaging.utilsrZpip._internal.clirpip._internal.cli.base_commandrpip._internal.cli.req_commandrrpip._internal.cli.status_codesr pip._internal.exceptionsr pip._internal.reqr pip._internal.req.constructorsr r pip._internal.utils.miscr getLoggerr:r0rr!r!r!r"s          PK]B/]''(commands/__pycache__/list.cpython-38.pycnu[U ʗRet/@sXddlZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$m%Z%erddl&m'Z'GdddeZ(e e(Z)e*e+Z,GdddeZ-dee eee.ee.fdddZ/dee.dddZ0dS)N)Values) TYPE_CHECKING GeneratorListOptionalSequenceTuplecastcanonicalize_name) cmdoptions)IndexGroupCommand)SUCCESS) CommandError) LinkCollector) PackageFinder)BaseDistributionget_environment)SelectionPreferences) PipSession) stdlib_pkgs)tabulate write_output)DistributionVersionc@s"eZdZUdZeed<eed<dS)_DistWithLatestInfozGive the distribution object a couple of extra fields. These will be populated during ``get_outdated()``. This is dirty but makes the rest of the code much cleaner. latest_versionlatest_filetypeN)__name__ __module__ __qualname____doc__r__annotations__strr#r#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/list.pyrs rc@seZdZdZdZdZddddZeee dd d Z ee e e d d d ZdeddddZdeddddZdeddddZdeeddddZdeddddZe e e e e ddddZdS) ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. Tz %prog [options]N)returncCs*|jjdddddd|jjddddd d|jjd d ddd d|jjd ddddd|jjdddddd|jt|jjddddd|jjddddddd|jjddddd |jjd!d"d#d$d |jjd%dd#d&d'd(|jtttj|j}|jd)||jd)|jdS)*Nz-oz --outdated store_trueFzList outdated packages)actiondefaulthelpz-uz --uptodatezList uptodate packagesz-ez --editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--useruserz,Only output packages installed in user-site.)destr(r)r*z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatstore list_formatcolumns)r/freezejsonzBSelect the output format among: columns (default), freeze, or json)r(r,r)choicesr*z--not-required not_requiredz>List packages that are not dependencies of installed packages.)r(r,r*z--exclude-editable store_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)r(r,r*r)r) cmd_opts add_optionr list_path list_excludemake_option_group index_groupparserinsert_option_group)self index_optsr#r#r$ add_options2s   zListCommand.add_options)optionssessionr&cCs*tj||d}td|jd}tj||dS)zK Create a package finder appropriate to this list command. )rAF) allow_yankedallow_all_prereleases)link_collectorselection_prefs)rcreaterprer)r>rArBrErFr#r#r$_build_package_findersz!ListCommand._build_package_finder)rAargsr&cCs|jr|jrtdt|tt}|jrB|dd|jDddt |j j |j |j |j|j|dD}|jr|||}|jr|||}n|jr|||}|||tS)Nz5Options --outdated and --uptodate cannot be combined.css|]}t|VqdSNr ).0nr#r#r$ sz"ListCommand.run..cSsg|]}td|qS)r)r )rLdr#r#r$ sz#ListCommand.run..) local_only user_onlyeditables_onlyinclude_editablesskip)outdatedZuptodaterr check_list_path_optionsetrexcludesupdaterpathiter_installed_distributionslocalr+editabler5r3get_not_required get_outdated get_uptodateoutput_package_listingr)r>rArJrUpackagesr#r#r$runs.      zListCommand.run_ProcessedDistsrcrAr&cCsdd|||DS)NcSsg|]}|j|jkr|qSr#rversionrLdistr#r#r$rPs z,ListCommand.get_outdated..iter_packages_latest_infosr>rcrAr#r#r$r`s zListCommand.get_outdatedcCsdd|||DS)NcSsg|]}|j|jkr|qSr#rgrir#r#r$rPs z,ListCommand.get_uptodate..rkrmr#r#r$ras zListCommand.get_uptodatecs$dd|Dtfdd|DS)NcSs(h|] }|pdD]}t|jqqS)r#)iter_dependenciesr name)rLrjdepr#r#r$ sz/ListCommand.get_not_required..csh|]}|jkr|qSr#canonical_name)rLpkgZdep_keysr#r$rqs )listrmr#rur$r_s zListCommand.get_not_required)rNNc #s^|J}||dtddfdd }t||D]}|dk r<|Vq.latest_info..) project_namewheelsdist) find_all_candidatesrsrHmake_candidate_evaluatorsort_best_candidaterhlinkis_wheelrr)rjZall_candidatesZ evaluatorbest_candidateremote_versiontypfinderrAr#r$ latest_infos$  z;ListCommand.iter_packages_latest_infos..latest_info)_build_sessionrIrmap)r>rcrArBrrjr#rr$rls  z&ListCommand.iter_packages_latest_infoscCst|ddd}|jdkr:|r:t||\}}|||n^|jdkr|D]4}|jdkrltd|j|j|jqHtd|j|jqHn|jd krtt ||dS) NcSs|jSrKrr)rjr#r#r$ z4ListCommand.output_package_listing..)keyr/r0z %s==%s (%s)z%s==%sr1) sortedr.format_for_columnsoutput_package_listing_columnsverboserraw_namerhlocationformat_for_json)r>rcrAdataheaderrjr#r#r$rbs&   z"ListCommand.output_package_listing)rrr&cCsbt|dkr|d|t|\}}t|dkrL|ddtdd||D] }t|qPdS)Nrr cSsd|S)N-r#)xr#r#r$r$rz.)leninsertrjoinrr)r>rrZ pkg_stringssizesvalr#r#r$rs    z*ListCommand.output_package_listing_columns)rrrr ignore_require_venvusager@rrrrIrr"intrdr`rar_rrlrbrr#r#r#r$r%'sBV %    '  r%re)pkgsrAr&cCsddg}|j}|r |ddgtdd|D}|r@|d|jdkrT|d |jdkrh|d g}|D]}|jt|jg}|r|t|j||j |r||j pd |jdkr||j pd |jdkr||j ||qp||fS) z_ Convert the package data into something usable by output_package_listing_columns. PackageVersionZLatestTypecss|] }|jVqdSrK)r^)rLrr#r#r$rN7sz%format_for_columns..zEditable project locationrZLocationZ Installer) rVextendanyappendrrr"rhrreditable_project_locationr installer)rrArZrunning_outdatedZ has_editablesrZprojrowr#r#r$r*s2          rrfcCsg}|D]r}|jt|jd}|jdkr@|jp0d|d<|j|d<|jr^t|j|d<|j|d<|j }|rp||d<| |qt |S) N)rorhrrrrrrr) rr"rhrrrrVrrrrr1dumps)rcrArrjinforr#r#r$rWs     r)1r1loggingoptparsertypingrrrrrrr pip._vendor.packaging.utilsr Zpip._internal.clir pip._internal.cli.req_commandr pip._internal.cli.status_codesrpip._internal.exceptionsrpip._internal.index.collectorr"pip._internal.index.package_finderrpip._internal.metadatarr$pip._internal.models.selection_prefsrpip._internal.network.sessionrpip._internal.utils.compatrpip._internal.utils.miscrrZpip._internal.metadata.baserrre getLoggerrloggerr%r"rrr#r#r#r$s8 $              -PK]c~ ~ ,commands/__pycache__/__init__.cpython-38.pycnu[U ʗRe*@s.UdZddlZddlmZddlmZmZmZddlm Z eddZ e dd d e d d d e ddde ddde ddde ddde ddde ddde d d!d"e d#d$d%e d&d'd(e d)d*d+e d,d-d.e d/d0d1e d2d3d4e d5d6d7e d8d9d:d;Z ee e fe d<<e ee d=d>d?Ze ee d@dAdBZdS)Cz% Package containing all pip commands N) namedtuple)AnyDictOptional)Command CommandInfoz module_path, class_name, summaryzpip._internal.commands.installInstallCommandzInstall packages.zpip._internal.commands.downloadDownloadCommandzDownload packages.z pip._internal.commands.uninstallUninstallCommandzUninstall packages.zpip._internal.commands.freeze FreezeCommandz1Output installed packages in requirements format.zpip._internal.commands.inspectInspectCommandzInspect the python environment.zpip._internal.commands.list ListCommandzList installed packages.zpip._internal.commands.show ShowCommandz*Show information about installed packages.zpip._internal.commands.check CheckCommandz7Verify installed packages have compatible dependencies.z$pip._internal.commands.configurationConfigurationCommandz&Manage local and global configuration.zpip._internal.commands.search SearchCommandzSearch PyPI for packages.zpip._internal.commands.cache CacheCommandz%Inspect and manage pip's wheel cache.zpip._internal.commands.index IndexCommandz3Inspect information available from package indexes.zpip._internal.commands.wheel WheelCommandz$Build wheels from your requirements.zpip._internal.commands.hash HashCommandz#Compute hashes of package archives.z!pip._internal.commands.completionCompletionCommandz-A helper command used for command completion.zpip._internal.commands.debug DebugCommandz&Show information useful for debugging.zpip._internal.commands.help HelpCommandzShow help for commands.)installdownload uninstallfreezeinspectlistshowcheckconfigsearchcacheindexwheelhash completiondebughelp commands_dict)namekwargsreturncKs:t|\}}}t|}t||}|f||d|}|S)zF Create an instance of the Command class with the given name. )r+summary)r* importlib import_modulegetattr)r+r, module_path class_namer.module command_classcommandr7/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/__init__.pycreate_commandms   r9)r+r-cCs6ddlm}|}||t}|r.|dSdSdS)zCommand name auto-correct.r)get_close_matchesN)difflibr:lowerr*keys)r+r:close_commandsr7r7r8get_similar_commandsys  r?)__doc__r/ collectionsrtypingrrrpip._internal.cli.base_commandrrr*str__annotations__r9r?r7r7r7r8s   Y PK]Ce.commands/__pycache__/show.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z mZddlmZeeZGd d d e Zd d ZdddZdS))absolute_importN) FeedParser) pkg_resourcescanonicalize_name)Command)ERRORSUCCESS) write_outputcs0eZdZdZdZdZfddZddZZS) ShowCommandzx Show information about one or more installed packages. The output is in RFC-compliant mail header format. z$ %prog [options] ...Tcs>tt|j|||jjddddddd|jd|jdS) Nz-fz--filesfiles store_trueFz7Show the full list of installed files for each package.)destactiondefaulthelpr)superr __init__Zcmd_optsZ add_optionparserZinsert_option_group)selfargskw __class__?/usr/lib/python3.8/site-packages/pip/_internal/commands/show.pyrszShowCommand.__init__cCs8|stdtS|}t|}t||j|jds4tStS)Nz.ERROR: Please provide a package name or names.) list_filesverbose)loggerwarningrsearch_packages_info print_resultsr rr )rZoptionsrqueryresultsrrrrun*s zShowCommand.run) __name__ __module__ __qualname____doc__ZusageZignore_require_venvrr$ __classcell__rrrrr s  r c#sTitjD]}|t|j<q dd|D}tfddt||D}|r^tdd|dd}fdd|DD]ԉjj j d d D|jd }d }d }t tj rd rd }d d|D} fdd| D} fdd| D}drnd}nPdrXd} fdd| D} fdd| D}drnd}drd} | |d<drƈdD]"} | r| |d<qƐqt} | || } dD]}| |||<qg}|D](} | dr|| tdd q||d<|rHt||d<|Vqxd S)z Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. cSsg|] }t|qSrr).0namerrr Bsz(search_packages_info..csg|]\}}|kr|qSrr)r*r+pkg installedrrr,DszPackage(s) not found: %s, cst|fddtjDS)Ncs(g|] }dd|Dkr|jqS)cSsg|]}t|jqSr)rr+)r*Zrequiredrrrr,NszSsearch_packages_info..get_requiring_packages...)requires project_namer*r-Zcanonical_namerrr,KszHsearch_packages_info..get_requiring_packages..)rr working_set)Z package_namerr4rget_requiring_packagesIs z4search_packages_info..get_requiring_packagescsg|]}|kr|qSrrr3r.rrr,RscSsg|] }|jqSr)r2)r*Zdeprrrr,Ws)r+versionlocationr1 required_byNZRECORDcSsg|]}|ddqS),r)split)r*lrrrr,`scsg|]}tjj|qSr)ospathjoinr8r*pdistrrr,ascsg|]}tj|jqSrr=r>relpathr8r@rBrrr,bsZMETADATAzinstalled-files.txtcsg|]}tjj|qSr)r=r>r?Zegg_infor@rBrrr,jscsg|]}tj|jqSrrDr@rBrrr,kszPKG-INFOzentry_points.txt entry_pointsZ INSTALLER installer)metadata-versionsummary home-pageauthor author-emaillicensez Classifier: classifiersr )rr5rr2sortedziprrr?r7r8r1 isinstanceZDistInfoDistributionZ has_metadataZget_metadata_linesZ get_metadatastriprZfeedcloseget splitlines startswithappendlen)r"rAZ query_namesZmissingr6packageZ file_listZmetadatalinespathsrFlineZ feed_parserZ pkg_info_dictkeyrNr)rCr/rr 7sl                    r Fc Csd}t|D]\}}d}|dkr*tdtd|ddtd|d dtd |d dtd |d dtd|ddtd|ddtd|ddtd|ddtdd|dgtdd|dg|rdtd|ddtd|ddtd|d gD]}td!|q(td"|d#gD]}td!|qN|r td$|d%gD]}td!|q|d%|kr td&q |S)'zD Print the informations from installed distributions found. FTrz---zName: %sr+z Version: %sr7z Summary: %srIz Home-page: %srJz Author: %srKzAuthor-email: %srLz License: %srMz Location: %sr8z Requires: %sr0r1zRequired-by: %sr9zMetadata-Version: %srHz Installer: %srGz Classifiers:rNz %sz Entry-points:rFzFiles:r z!Cannot locate installed-files.txt) enumerater rTr?rR) Z distributionsrrZresults_printedirCZ classifierentryr\rrrr!sB  r!)FF)Z __future__rZloggingr=Z email.parserrZ pip._vendorrZpip._vendor.packaging.utilsrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrr Zpip._internal.utils.miscr Z getLoggerr%rr r r!rrrrs       #XPK]ly"y"1commands/__pycache__/configuration.cpython-38.pycnu[U ʗRe%@sddlZddlZddlZddlmZddlmZmZmZddl m Z ddl m Z m Z ddlmZmZmZmZddlmZddlmZdd lmZmZeeZGd d d e ZdS) N)Values)AnyListOptional)Command)ERRORSUCCESS) ConfigurationKindget_configuration_fileskinds)PipError) indent_log)get_prog write_outputc@s*eZdZdZdZdZddddZeee e dd d Z ee e ed d d Zeee ddddZeee ddddZeee ddddZeee ddddZeee ddddZeddddZddddZeee ddddZee e e edd d!Zddd"d#Zee d$d%d&ZdS)'ConfigurationCommanda Manage local and global configuration. Subcommands: - list: List the active configuration (or from the file specified) - edit: Edit the configuration file in an editor - get: Get the value associated with command.option - set: Set the command.option=value - unset: Unset the value associated with command.option - debug: List the configuration files and values defined under them Configuration keys should be dot separated command and option name, with the special prefix "global" affecting any command. For example, "pip config set global.index-url https://example.org/" would configure the index url for all commands, but "pip config set download.timeout 10" would configure a 10 second timeout only for "pip download" commands. If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen to the user file by default. Ta$ %prog [] list %prog [] [--editor ] edit %prog [] get command.option %prog [] set command.option value %prog [] unset command.option %prog [] debug N)returncCsl|jjdddddd|jjdddd d d|jjd d dd d d|jjdddd dd|jd|jdS)Nz--editoreditorstorez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)destactiondefaulthelpz--global global_file store_trueFz+Use the system-wide configuration file onlyz--user user_filez$Use the user configuration file onlyz--site site_filez3Use the current environment configuration file onlyr)cmd_opts add_optionparserinsert_option_groupselfr#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/configuration.py add_options:s: z ConfigurationCommand.add_options)optionsargsrc Cs|j|j|j|j|j|jd}|r.|d|krHtddt |t S|d}z|j ||dkd}Wn:t k r}zt|j dt WYSd}~XYnXt|j|d|_|jz||||ddWn<t k r}zt|j dt WYSd}~XYnXtS) N)listeditgetsetunsetdebugrzNeed an action (%s) to perform.z, )r*r+r,r)) need_value)isolated load_only) list_valuesopen_in_editorget_nameset_name_value unset_namelist_config_valuesloggererrorjoinsortedr_determine_filer r'r isolated_mode configurationloadr)r"r&r'handlersrr0er#r#r$run`sB    zConfigurationCommand.run)r&r.rcCsddtj|jftj|jftj|jffD}|s`|s8dStddttjDrXtjStjSnt |dkrt|dSt ddS)NcSsg|]\}}|r|qSr#r#).0keyvaluer#r#r$ sz8ConfigurationCommand._determine_file..css|]}tj|VqdS)N)ospathexists)rCsite_config_filer#r#r$ sz7ConfigurationCommand._determine_file..r1rzLNeed exactly one file to operate upon (--user, --site, --global) to perform.) r USERrGLOBALrSITEranyr lenr )r"r&r.Z file_optionsr#r#r$r<s&      z$ConfigurationCommand._determine_filecCs8|j|dddt|jD]\}}td||qdS)Nr(rn%s=%r) _get_n_argsr;r>itemsrr"r&r'rDrEr#r#r$r2sz ConfigurationCommand.list_valuescCs*|j|ddd}|j|}td|dS)Nz get [name]r1rQz%s)rTr> get_valuerrVr#r#r$r4s zConfigurationCommand.get_namecCs.|j|ddd\}}|j|||dS)Nzset [name] [value]rQ)rTr> set_value_save_configurationrVr#r#r$r5sz#ConfigurationCommand.set_name_valuecCs(|j|ddd}|j||dS)Nz unset [name]r1rQ)rTr> unset_valuerZ)r"r&r'rDr#r#r$r6s zConfigurationCommand.unset_namec Cs|j|ddd|t|jD]T\}}td||D]<}t,tj |}td|||rn| |W5QRXqiter_config_filesrrrGrHrIprint_config_file_values)r"r&r'variantfilesfnameZ file_existsr#r#r$r7s   z'ConfigurationCommand.list_config_values)r`rc Cs<|j|D]&\}}ttd||W5QRXqdS)z.Get key-value pairs from the file of a variantz%s: %sN)r>get_values_in_configrUrr)r"r`namerEr#r#r$r_sz-ConfigurationCommand.print_config_file_valuesc CsRtddt8t|jD]"\}}d|}td||q W5QRXdS)z5Get key-values pairs present as environment variablesr\env_varPIP_rSN)rrr;r>get_environ_varsupper)r"rDrErer#r#r$r]s  z)ConfigurationCommand.print_env_var_valuesc Cs||}|j}|dkr$tdzt||gWnbtk rf}z|jsT||_W5d}~XYn4tjk r}ztd |j W5d}~XYnXdS)Nz%Could not determine appropriate file.z*Editor Subprocess exited with exit code {}) _determine_editorr>get_file_to_editr subprocess check_callFileNotFoundErrorfilenameCalledProcessErrorformat returncode)r"r&r'rrbrAr#r#r$r3s   z#ConfigurationCommand.open_in_editor)r'examplerRrcCs<t||kr$d|t|}t||dkr4|dS|SdS)zAHelper to make sure the command got the right number of argumentszJGot unexpected number of arguments, expected {}. (example: "{} config {}")r1rN)rPrprr )r"r'rrrRmsgr#r#r$rTs z ConfigurationCommand._get_n_argscCs:z|jWn&tk r4tdtdYnXdS)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)r>save Exceptionr8 exceptionr r!r#r#r$rZsz(ConfigurationCommand._save_configuration)r&rcCsD|jdk r|jSdtjkr$tjdSdtjkr8tjdStddS)NZVISUALZEDITORz"Could not determine editor to use.)rrGenvironr )r"r&r#r#r$ri s     z&ConfigurationCommand._determine_editor)__name__ __module__ __qualname____doc__ignore_require_venvusager%rrstrintrBboolrr r<r2r4r5r6r7r_r]r3rrTrZrir#r#r#r$rs" &- r)loggingrGrkoptparsertypingrrrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.configurationr r r r pip._internal.exceptionsr pip._internal.utils.loggingrpip._internal.utils.miscrr getLoggerrxr8rr#r#r#r$s     PK]GWGmm.commands/__pycache__/completion.cpython-38.pycnu[U ʗRe!@srddlZddlZddlmZddlmZddlmZddlm Z ddl m Z dZ dd d d d Z Gd ddeZdS)N)Values)List)Command)SUCCESS)get_progzD # pip {shell} completion start{script}# pip {shell} completion end a _pip_completion() {{ COMPREPLY=( $( COMP_WORDS="${{COMP_WORDS[*]}}" \ COMP_CWORD=$COMP_CWORD \ PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) ) }} complete -o default -F _pip_completion {prog} aM function _pip_completion {{ local words cword read -Ac words read -cn cword reply=( $( COMP_WORDS="$words[*]" \ COMP_CWORD=$(( cword-1 )) \ PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) }} compctl -K _pip_completion {prog} au function __fish_complete_pip set -lx COMP_WORDS (commandline -o) "" set -lx COMP_CWORD ( \ math (contains -i -- (commandline -t) $COMP_WORDS)-1 \ ) set -lx PIP_AUTO_COMPLETE 1 string split \ -- (eval $COMP_WORDS[1]) end complete -fa "(__fish_complete_pip)" -c {prog} a if ((Test-Path Function:\TabExpansion) -and -not ` (Test-Path Function:\_pip_completeBackup)) {{ Rename-Item Function:\TabExpansion _pip_completeBackup }} function TabExpansion($line, $lastWord) {{ $lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart() if ($lastBlock.StartsWith("{prog} ")) {{ $Env:COMP_WORDS=$lastBlock $Env:COMP_CWORD=$lastBlock.Split().Length - 1 $Env:PIP_AUTO_COMPLETE=1 (& {prog}).Split() Remove-Item Env:COMP_WORDS Remove-Item Env:COMP_CWORD Remove-Item Env:PIP_AUTO_COMPLETE }} elseif (Test-Path Function:\_pip_completeBackup) {{ # Fall back on existing tab expansion _pip_completeBackup $line $lastWord }} }} )bashzshfish powershellc@s8eZdZdZdZddddZeeee ddd Z dS) CompletionCommandz3A helper command to be used for command completion.TN)returncCst|jjddddddd|jjdd dd dd d|jjd d ddddd|jjddddddd|jd|jdS)Nz--bashz-b store_constrshellzEmit completion code for bash)actionconstdesthelpz--zshz-zrzEmit completion code for zshz--fishz-fr zEmit completion code for fishz --powershellz-pr z#Emit completion code for powershellr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/completion.py add_optionsLsB zCompletionCommand.add_options)optionsargsr cCszt}ddt|D}|j|krZtt|jdjtd}t t j||jdt St j dd|t SdS) z-Prints the completion code of the given shellcSsg|] }d|qS)z--r).0rrrr ssz)CompletionCommand.run..)prog)scriptrzERROR: You must pass {} z or N)COMPLETION_SCRIPTSkeyssortedrtextwrapdedentgetformatrprintBASE_COMPLETIONrsysstderrwritejoin)rrrZshellsZ shell_optionsr!rrrrunps zCompletionCommand.run) __name__ __module__ __qualname____doc__ignore_require_venvrrrstrintr/rrrrr Gs$r )r+r%optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrpip._internal.utils.miscrr*r"r rrrrs        9PK]y~ 4commands/__pycache__/completion.cpython-38.opt-1.pycnu[U .e @sXddlmZddlZddlZddlmZddlmZdZdddd Z Gd d d eZ dS) )absolute_importN)Command)get_progzJ # pip %(shell)s completion start%(script)s# pip %(shell)s completion end a _pip_completion() { COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \ COMP_CWORD=$COMP_CWORD \ PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) ) } complete -o default -F _pip_completion %(prog)s aM function _pip_completion { local words cword read -Ac words read -cn cword reply=( $( COMP_WORDS="$words[*]" \ COMP_CWORD=$(( cword-1 )) \ PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) } compctl -K _pip_completion %(prog)s aw function __fish_complete_pip set -lx COMP_WORDS (commandline -o) "" set -lx COMP_CWORD ( \ math (contains -i -- (commandline -t) $COMP_WORDS)-1 \ ) set -lx PIP_AUTO_COMPLETE 1 string split \ -- (eval $COMP_WORDS[1]) end complete -fa "(__fish_complete_pip)" -c %(prog)s )bashzshfishcs,eZdZdZdZfddZddZZS)CompletionCommandz3A helper command to be used for command completion.Tcsltt|j|||j}|jddddddd|jdd dd dd d|jd d ddddd|jd|dS)Nz--bashz-b store_constrshellzEmit completion code for bash)actionconstdesthelpz--zshz-zrzEmit completion code for zshz--fishz-frzEmit completion code for fishr)superr__init__cmd_optsZ add_optionparserZinsert_option_group)selfargskwr __class__E/usr/lib/python3.8/site-packages/pip/_internal/commands/completion.pyr8s6zCompletionCommand.__init__cCsrt}ddt|D}|j|krXtt|jddti}tt ||jdnt j dd |dS) z-Prints the completion code of the given shellcSsg|] }d|qS)z--r).0r rrr Usz)CompletionCommand.run..prog)scriptr zERROR: You must pass %s z or N)COMPLETION_SCRIPTSkeyssortedr textwrapdedentgetrprintBASE_COMPLETIONsysstderrwritejoin)rZoptionsrZshellsZ shell_optionsrrrrrunRs   zCompletionCommand.run)__name__ __module__ __qualname____doc__Zignore_require_venvrr+ __classcell__rrrrr3s r) Z __future__rr'r"Zpip._internal.cli.base_commandrZpip._internal.utils.miscrr&rrrrrrs     #PK]` ,commands/__pycache__/download.cpython-38.pycnu[U ʗRe@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZddlmZdd lmZmZmZdd lmZeeZGd d d e ZdS) N)Values)List) cmdoptions)make_target_python)RequirementCommand with_cleanup)SUCCESS)get_build_tracker) ensure_dirnormalize_path write_output) TempDirectoryc@s<eZdZdZdZddddZeeee e ddd Z dS) DownloadCommandaL Download packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports downloading from "requirements files", which provide an easy way to specify a whole environment to be downloaded. a %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ... %prog [options] ... %prog [options] ...N)returnc Cs\|jt|jt|jt|jt|jt|jt|jt |jt |jt |jt |jt |jt|jt|jt|jt|jt|jjddddddtjddt|jttj|j}|jd ||jd |jdS) Nz-dz--destz--destination-dirz--destination-directory download_dirdirzDownload packages into .)destmetavardefaulthelpr)cmd_opts add_optionr constraints requirementsno_depsglobal_options no_binary only_binary prefer_binarysrcprerequire_hashes progress_barno_build_isolation use_pep517 no_use_pep517check_build_depsignore_requires_pythonoscurdiradd_target_python_optionsmake_option_group index_groupparserinsert_option_group)self index_optsr1/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/download.py add_options%sB zDownloadCommand.add_options)optionsargsrc Cs.d|_g|_t|t|j|_t|j||}t|}|j ||||j d}| t }t |j ddd}|||||}|j||||||jd|jd} |j| |||j |j|jd} ||| j|dd} g} | jD]2} | jdkr| jdk st| | | | jq| r*td d | t S) NT)r4session target_pythonr'download)deletekindglobally_managedF)temp_build_dirr4 build_trackerr6finderr use_user_site verbosity)preparerr>r4r'r$py_version_info)check_supported_wheelszSuccessfully downloaded %s )!ignore_installed editablesrcheck_dist_restrictionr rr get_default_sessionr_build_package_finderr' enter_contextr r no_cleanget_requirementsmake_requirement_preparerr@ make_resolverr$python_versiontrace_basic_inforesolvervalues satisfied_bynameAssertionErrorsave_linked_requirementappendr joinr)r/r4r5r6r7r>r= directoryreqsrAresolverrequirement_setZ downloadedreqr1r1r2runLsb         zDownloadCommand.run) __name__ __module__ __qualname____doc__usager3rrrstrintr^r1r1r1r2rs  'r)loggingr(optparsertypingrZpip._internal.clirZpip._internal.cli.cmdoptionsrpip._internal.cli.req_commandrrpip._internal.cli.status_codesr,pip._internal.operations.build.build_trackerr pip._internal.utils.miscr r r pip._internal.utils.temp_dirr getLoggerr_loggerrr1r1r1r2s        PK]!گ7commands/__pycache__/configuration.cpython-38.opt-1.pycnu[U .e:@sddlZddlZddlZddlmZddlmZmZddlm Z m Z m Z ddl m Z ddlmZmZeeZGdddeZdS) N)Command)ERRORSUCCESS) Configurationget_configuration_fileskinds)PipError)get_prog write_outputcsxeZdZdZdZdZfddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZZS)ConfigurationCommanda9Manage local and global configuration. Subcommands: list: List the active configuration (or from the file specified) edit: Edit the configuration file in an editor get: Get the value associated with name set: Set the name=value unset: Unset the value associated with name If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen on the to the user file by default. Tz %prog [] list %prog [] [--editor ] edit %prog [] get name %prog [] set name value %prog [] unset name cstt|j||d|_|jjdddddd|jjdddd d d|jjd d dd d d|jjdddd dd|jd|jdS)Nz--editoreditorZstorez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)destactiondefaulthelpz--global global_file store_trueFz+Use the system-wide configuration file onlyz--user user_filez$Use the user configuration file onlyz--site site_filez3Use the current environment configuration file onlyr)superr __init__ configurationZcmd_optsZ add_optionparserZinsert_option_group)selfargskwargs __class__H/usr/lib/python3.8/site-packages/pip/_internal/commands/configuration.pyr0s> zConfigurationCommand.__init__c Cs|j|j|j|j|jd}|r*|d|krHtddt |t S|d}z|j ||dkd}Wn:t k r}zt|j dt WYSd}~XYnXt|j|d|_|jz||||ddWn<t k r}zt|j dt WYSd}~XYnXtS) N)listeditgetsetunsetrzNeed an action ({}) to perform.z, )r"r#r$r!) need_value)isolated load_only) list_valuesopen_in_editorget_nameset_name_value unset_nameloggererrorformatjoinsortedr_determine_filerrrZ isolated_moderloadr)roptionsrZhandlersrr'errrrunZs>    zConfigurationCommand.runcCsddtj|jftj|jftj|jffD}|s`|s8dStddttjDrXtjStjSnt |dkrt|dSt ddS)NcSsg|]\}}|r|qSrr).0keyvaluerrr sz8ConfigurationCommand._determine_file..css|]}tj|VqdS)N)ospathexists)r8Zsite_config_filerrr sz7ConfigurationCommand._determine_file..r(rzLNeed exactly one file to operate upon (--user, --site, --global) to perform.) rZUSERrZGLOBALrZSITEranyrlenr)rr5r%Z file_optionsrrrr3s$     z$ConfigurationCommand._determine_filecCs8|j|dddt|jD]\}}td||qdS)Nr rnz%s=%r) _get_n_argsr2ritemsr rr5rr9r:rrrr)sz ConfigurationCommand.list_valuescCs*|j|ddd}|j|}td|dS)Nz get [name]r(rBz%s)rDrZ get_valuer rFrrrr+s zConfigurationCommand.get_namecCs.|j|ddd\}}|j|||dS)Nzset [name] [value]rB)rDrZ set_value_save_configurationrFrrrr,sz#ConfigurationCommand.set_name_valuecCs(|j|ddd}|j||dS)Nz unset [name]r(rB)rDrZ unset_valuerH)rr5rr9rrrr-s zConfigurationCommand.unset_namec Csp||}|j}|dkr$tdzt||gWn4tjk rj}ztd|jW5d}~XYnXdS)Nz%Could not determine appropriate file.z*Editor Subprocess exited with exit code {}) _determine_editorrZget_file_to_editr subprocessZ check_callZCalledProcessErrorr0 returncode)rr5rr Zfnamer6rrrr*s  z#ConfigurationCommand.open_in_editorcCs<t||kr$d|t|}t||dkr4|dS|SdS)zJHelper to make sure the command got the right number of arguments zJGot unexpected number of arguments, expected {}. (example: "{} config {}")r(rN)rAr0r r)rrZexamplerCmsgrrrrDs z ConfigurationCommand._get_n_argscCs>z|jWn*tk r8tjdddtdYnXdS)Nz:Unable to save configuration. Please report this as a bug.r()exc_infozInternal Error.)rZsave Exceptionr.r/r)rrrrrHsz(ConfigurationCommand._save_configurationcCsD|jdk r|jSdtjkr$tjdSdtjkr8tjdStddS)NZVISUALZEDITORz"Could not determine editor to use.)r r<environr)rr5rrrrIs     z&ConfigurationCommand._determine_editor)__name__ __module__ __qualname____doc__Zignore_require_venvZusagerr7r3r)r+r,r-r*rDrHrI __classcell__rrrrr s *+ r )Zloggingr<rJZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrrZpip._internal.configurationrrrZpip._internal.exceptionsrZpip._internal.utils.miscr r Z getLoggerrPr.r rrrrs   PK]aq /commands/__pycache__/debug.cpython-38.opt-1.pycnu[U .eB @sddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZerdd lmZmZdd lmZeeZd dZddZddZGdddeZ dS))absolute_importN) cmdoptions)Command)make_target_python)SUCCESS) indent_log)get_pip_version)MYPY_CHECK_RUNNING) format_tag)AnyList)ValuescCstd||dS)Nz{}: {})loggerinfoformat)namevaluer@/usr/lib/python3.8/site-packages/pip/_internal/commands/debug.py show_valuesrc CsFtdttdr"tj}|j}nd}ttd|W5QRXdS)Nzsys.implementation:implementationr)rrhasattrsysrrrr)rZimplementation_namerrrshow_sys_implementations  rc Csd}t|}|}|}d}|r.d|}dt||}t||jdkrpt||krpd}|d|}nd}t8|D]}tt |q|rdj|d }t|W5QRXdS) N rz (target: {})zCompatible tags: {}{}TFz?... [First {tag_limit} tags shown. Pass --verbose to show all.]) tag_limit) rZget_tagsZ format_givenrlenrrverboserr ) optionsrZ target_pythonZtagsZformatted_targetsuffixmsgZ tags_limitedtagrrr show_tags,s,  r$cs0eZdZdZdZdZfddZddZZS) DebugCommandz$ Display debug information. z %prog Tcs4tt|j|||j}t||jd|dS)Nr)superr%__init__cmd_optsrZadd_target_python_optionsparserZinsert_option_group)selfargskwr( __class__rrr'Ws zDebugCommand.__init__cCsvtdtdttdtjtdtjtdttdttdt tdtj t t |tS) NzThis command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.z pip versionz sys.versionzsys.executablezsys.getdefaultencodingzsys.getfilesystemencodingzlocale.getpreferredencodingz sys.platform)rZwarningrrrversion executablegetdefaultencodinggetfilesystemencodinglocaleZgetpreferredencodingplatformrr$r)r*r r+rrrrun^s     zDebugCommand.run) __name__ __module__ __qualname____doc__ZusageZignore_require_venvr'r5 __classcell__rrr-rr%Ns  r%)!Z __future__rr3ZloggingrZpip._internal.clirZpip._internal.cli.base_commandrZpip._internal.cli.cmdoptionsrZpip._internal.cli.status_codesrZpip._internal.utils.loggingrZpip._internal.utils.miscrZpip._internal.utils.typingr Zpip._internal.wheelr typingr r Zoptparser Z getLoggerr6rrrr$r%rrrrs&            "PK],q q *commands/__pycache__/freeze.cpython-38.pycnu[U ʗRe @s|ddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZd d d d hZGd ddeZdS)N)Values)List) cmdoptions)Command)SUCCESS)freeze) stdlib_pkgspip setuptoolsZ distributewheelc@s<eZdZdZdZdZddddZeee e dd d Z dS) FreezeCommandzx Output installed packages in requirements format. packages are listed in a case-insensitive sorted order. z %prog [options])ext://sys.stderrr N)returnc Cs|jjddddgddd|jjdd d d d d d|jjddd d dd|jt|jjddd ddtd|jjddd dd|jt|j d|jdS)Nz-rz --requirement requirementsappendfilez}Use the order in the given requirements file and its comments when generating output. This option can be used multiple times.)destactiondefaultmetavarhelpz-lz--locallocal store_trueFzUIf in a virtualenv that has global access, do not output globally-installed packages.)rrrrz--useruserz,Only output packages installed in user-site.z--all freeze_allz,Do not skip these packages in the output: {}z, )rrrz--exclude-editableexclude_editablez%Exclude editable package from output.r) cmd_opts add_optionr list_pathformatjoinDEV_PKGS list_excludeparserinsert_option_group)selfr&/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/freeze.py add_optionssR   zFreezeCommand.add_options)optionsargsrc Csptt}|js|t|jr*||jt|t|j |j |j |j |j ||jdD]}tj|dqVtS)N) requirement local_only user_onlypathsisolatedskipr )setrrupdater!excludesrcheck_list_path_optionrrrrpath isolated_modersysstdoutwriter)r%r)r*r0liner&r&r'runMs"    zFreezeCommand.run) __name__ __module__ __qualname____doc__usage log_streamsr(rrstrintr<r&r&r&r'r s 4r )r8optparsertypingrZpip._internal.clirpip._internal.cli.base_commandrpip._internal.cli.status_codesrZpip._internal.operations.freezerpip._internal.utils.compatrr!r r&r&r&r's        PK]L`@@(commands/__pycache__/help.cpython-38.pycnu[U ʗRel@sPddlmZddlmZddlmZddlmZddlm Z GdddeZ dS) )Values)List)Command)SUCCESS) CommandErrorc@s.eZdZdZdZdZeeee dddZ dS) HelpCommandzShow help for commandsz %prog T)optionsargsreturnc Csddlm}m}m}z |d}Wntk r8tYSX||kr|||}d|dg}|rn|d|dtd|||} | j tS)Nr) commands_dictcreate_commandget_similar_commandszunknown command ""zmaybe you meant "z - ) pip._internal.commandsr r r IndexErrorrappendrjoinparser print_help) selfrr r r r cmd_nameguessmsgcommandr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/help.pyruns   zHelpCommand.runN) __name__ __module__ __qualname____doc__usageignore_require_venvrrstrintrrrrrr srN) optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrpip._internal.exceptionsrrrrrrs     PK]@kk(commands/__pycache__/hash.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZddlmZmZeeZGdd d eZeeed d d ZdS) N)Values)List)Command)ERRORSUCCESS) FAVORITE_HASH STRONG_HASHES) read_chunks write_outputc@s<eZdZdZdZdZddddZeee e dd d Z dS) HashCommandz Compute a hash of a local package archive. These can be used with --hash in a requirements file to do repeatable installs. z%prog [options] ...TN)returnc Cs:|jjdddtdtddtd|jd|jdS) Nz-az --algorithm algorithmstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr)cmd_opts add_optionrrformatjoinparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/hash.py add_optionss zHashCommand.add_options)optionsargsr cCs>|s|jtjtS|j}|D]}td||t||q tS)Nz%s: --hash=%s:%s) r print_usagesysstderrrr r _hash_of_filer)rrrr pathrrrrun(szHashCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvrrrstrintr%rrrrr s r )r$r r c Cs@t|d(}t|}t|D]}||qW5QRX|S)z!Return the hash digest of a file.rb)openhashlibnewr update hexdigest)r$r archivehashchunkrrrr#5s    r#)r0loggingr!optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.utils.hashesrrpip._internal.utils.miscr r getLoggerr&loggerr r,r#rrrrs    &PK][KK+commands/__pycache__/install.cpython-38.pycnu[U ʗRekv@shddlZddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z ddl mZddlmZddlmZddlmZddlmZdd lmZmZmZdd lmZmZdd lmZm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;mZ>ddl?m@Z@ddlAmBZBmCZCddlDmEZEmFZFmGZGe9eHZIe&eEdddZJGdd d eZKd1eLe eMe eMeLe eMe eMd"d#d$ZNe eMeLeLd%d&d'ZOd2e eLe eMe eMe eMeLeLd(d)d*ZPe e1e e eMdd+d,d-ZQeReLeLeMd.d/d0ZSdS)3N) SUPPRESS_HELPValues)IterableListOptional)canonicalize_name) print_json) WheelCache) cmdoptions)make_target_python)RequirementCommandwarn_if_run_as_root with_cleanup)ERRORSUCCESS) CommandErrorInstallationError) get_scheme)get_environment) FormatControl)InstallationReport)get_build_tracker)ConflictDetailscheck_install_conflicts)install_given_reqs)InstallRequirement)WINDOWS)parse_distutils_argstest_writable_dir) getLogger) ensure_dirget_pip_version(protect_pip_from_modification_on_windows write_output) TempDirectory)running_under_virtualenvvirtualenv_no_global)BinaryAllowedPredicatebuild should_build_for_install_command)format_controlreturncsttdfdd }|S)N)reqr,cs t|jp d}|}d|kS)Nbinary)rnameget_allowed_formats)r-canonical_nameallowed_formatsr+/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/install.pycheck_binary_allowed8s z6get_check_binary_allowed..check_binary_allowed)rbool)r+r7r5r4r6get_check_binary_allowed7sr9c@szeZdZdZdZddddZeeee e ddd Z e e e dd d d Zeeeed ddZee ddddZdS)InstallCommandaI Install packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports installing from "requirements files", which provide an easy way to specify a whole environment to be installed. a% %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...N)r,cCs|jt|jt|jt|jt|jt|jjdddddd|jjddd d dd d t|j|jjd dddd|jjdddt d|jjddd ddd |jjddd ddd |jt |jjdddddd|jjddddd gd!d"|jjd#d$dd%d|jjd&d'd(dd)d|jt |jt |jt |jt|jt|jt|jt|jt|jjd*dd+d,d-d|jjd.dd+d/d0|jjd1dd2d,d3d|jjd4dd5d,d6d|jt|jt|jt|jt|jt|jtttj|j}|jd7||jd7|j|jjd8d9d:dd;d dS). By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.)r>metavarr?r@z--user use_user_sitezInstall to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.))r>r=r@z --no-user store_falsez--root root_pathz=Install everything relative to this alternate root directory.z--prefix prefix_pathzIInstallation prefix where lib, bin and other top-level folders are placedz-Uz --upgradeupgradezUpgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategyupgrade_strategyzonly-if-neededeageraGDetermines how dependency upgrading should be handled [default: %default]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" - are upgraded only when they do not satisfy the requirements of the upgraded package(s).)r>r?choicesr@z--force-reinstallforce_reinstallz;Reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_installedzIgnore the installed packages, overwriting them. This can break your system if the existing package is of a different version or was installed with a different package manager!z --compilecompileTz'Compile Python source files to bytecodez --no-compilez.Do not compile Python source files to bytecode)r=r>r@z--no-warn-script-locationwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictswarn_about_conflictsz%Do not warn about broken dependenciesrz--reportjson_report_filefilezGenerate a JSON file describing what pip did to install the provided requirements. Can be used in combination with --dry-run and --ignore-installed to 'resolve' the requirements. When - is used as file name it writes to stdout.)cmd_opts add_optionr requirements constraintsno_depspreeditableadd_target_python_optionsrsrcignore_requires_pythonno_build_isolation use_pep517 no_use_pep517check_build_depsconfig_settingsinstall_optionsglobal_options no_binary only_binary prefer_binaryrequire_hashes progress_barroot_user_actionmake_option_group index_groupparserinsert_option_group)self index_optsr5r5r6 add_optionsTs      zInstallCommand.add_options)optionsargsr,c, s|jr|jdk rtdt|d}|jr2|j}tj|dd|jpHg}t dt t |j|j |j|j|jd|_d}d}|jrd|_tj|j|_tj|jrtj|jstdtdd }|j}|||jpg}||}t|} |j||| |jd } t|j|j} |t } t|j! d dd } z,|"||| |}|D] }d|_#qLt$||j|j%| || || |j|j&d }|j'|| || |j|j|j|j(||j)d }|*| |j+||j d}|j,r0t -dt.|j/}|j,dkrt0|1dn2t2|j,ddd}t3j4|1|dddW5QRX|j5rrt6dd|j/D}|rlt7dd8dd|Dt9WSz|:d}Wnt;k rd}Yn X|j| jfd d!|j?@D}tA|| dggd"\}}d#d!|D}|rtBd$Cd%8||D]}|j)sd&|_Dq|E|}d}|jF oF|jG}|rX|H|}|jI} |jsn|j rrd} tJ||||j||j | |j|jKd' }!tL|j||j|j |jd(}"tM|"}#|!jNtOPd)d*g}$|!D]V}%|%jQ}&z(|#R|&}'|'dk r|&d|'jS}&WntTk rYnX|$U|&q|dk rF|jV||W|d+d8|$}(|(r`t7d,|(WnRtXk r})z2|j&d-k}*tY|)|*|j}+t jZ|+|*d.t[WYSd})~)XYnX|jr|st\|]|j||j|j^d/krt_t9S)0Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT) check_targetzUsing %s)rGrArF isolated_modez=Target path exists but is not a directory, will not continue.target)kind)rqsession target_pythonr\install)deletervglobally_managed)temp_build_dirrq build_trackerrwfinderrD verbosity) preparerr~rq wheel_cacherDrMr\rLrIr^)check_supported_wheelszu--report is currently an experimental option. The output format may change in a future release without prior warning.-)datawzutf-8)encodingF)indent ensure_asciicss"|]}|jd|jdfVqdS)r0versionN)metadata.0rr5r5r6 sz%InstallCommand.run..zWould install %s css|]}d|VqdS)rN)join)ritemr5r5r6rspip) modifying_pipcsg|]}t|r|qSr5)r*rr7r5r6 s z&InstallCommand.run..)rverify build_optionsrccSsg|]}|jr|jqSr5)r^r0rr5r5r6rszYCould not build wheels for {}, which is required to install pyproject.toml-based projectsz, i )roothomeprefixrOrD pycompile)userrrrisolatedr0)key)resolver_variantzSuccessfully installed %s)exc_infowarn)`rDrArr check_install_build_globalrHrIcheck_dist_restrictionrbloggerverboser"decide_user_installrGrFrtrMospathabspathexistsisdirr% enter_contextrcget_default_sessionr _build_package_finderr\r cache_dirr+rno_cleanget_requirementspermit_editable_wheels'reject_location_related_install_optionsmake_requirement_preparerr make_resolverrLr^trace_basic_inforesolverQwarningrrequirements_to_installrto_dictopenjsondumpr<sortedr$rrget_requirementKeyError satisfied_byr#r9rUvaluesr)rformatlegacy_install_reasonget_installation_orderignore_dependenciesrP_determine_conflictsrOrrNget_lib_location_guessesrsortoperator attrgetterr0get_distributionr Exceptionappend_warn_about_conflictsdetermine_resolver_variantOSErrorcreate_os_error_messageerrorrAssertionError_handle_target_dirrir ),rnrqrrrIrbtarget_temp_dirtarget_temp_dir_pathrcrwrxr~rr} directoryreqsr-rresolverrequirement_setreportfwould_install_itemspip_reqr reqs_to_build_build_failurespep517_build_failure_namesr to_install conflictsshould_warn_about_conflictsrO installed lib_locationsenvitemsresultrinstalled_distinstalled_descrshow_tracebackmessager5rr6runs                                  zInstallCommand.run)rArrHr,c sNt|g}td|jd}|j}|j}|j}tj|rB||tj|r`||kr`||tj|rv|||D]} t | D]} | |krtj || t fdd|ddDrqtj || } tj| r0|st d| qtj| r t d| qtj| r&t| n t| ttj | | | qqzdS)Nr.)rc3s|]}|VqdSN) startswith)rsddirr5r6r*sz4InstallCommand._handle_target_dir..zKTarget directory %s already exists. Specify --upgrade to force replacement.zTarget directory %s already exists and is a link. pip will not automatically replace links, please remove if replacement is desired.)r!rrpurelibplatlibrrrrlistdirranyrrislinkrshutilrmtreeremovemove) rnrArrH lib_dir_listscheme purelib_dir platlib_dirdata_dirlib_dirrtarget_item_dirr5rr6rsH       z!InstallCommand._handle_target_dir)rr,cCs0z t|WStk r*tdYdSXdS)NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)rrr exception)rnrr5r5r6rEs z#InstallCommand._determine_conflicts)conflict_detailsrr,c Cs|\}\}}|s|sdSg}|dkr0|dn|dks.rr)allsetrr r5r5r6site_packages_writablesr#)rDrGrArFrtr,cCs|dk r|stddS|rF|r*tdtr8tdtddS|dksRt|sZ|rhtddStjs|td dSt||d rtd dSt d dS) aZDetermine whether to do a user install based on the input options. If use_user_site is False, no additional checks are done. If use_user_site is True, it is checked for compatibility with other options. If use_user_site is None, the default behaviour depends on the environment, which is provided by the other arguments. Nz$Non-user install by explicit requestFzVCan not combine '--user' and '--prefix' as they imply different installation locationszZCan not perform a '--user' install. User site-packages are not visible in this virtualenv.z User install by explicit requestTz3Non-user install due to --prefix or --target optionz4Non-user install because user site-packages disabledr z0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable) rdebugrr'rrsiteENABLE_USER_SITEr#info)rDrGrArFrtr5r5r6rs8        r)rUrqr,cCsttttddd}g}|D]0}|j}t|}|r |d|||q |rzt|}|rz|d|||sdStdd |dS) zIf any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. ) option_namesr,cSsdd|DS)NcSsg|]}d|ddqS)z--{}rr)rreplace)rr0r5r5r6rszSreject_location_related_install_options..format_options..r5)r(r5r5r6format_optionssz?reject_location_related_install_options..format_optionsz {!r} from {}z{!r} from command lineNzLocation-changing options found in --install-option: {}. This is unsupported, use pip-level options like --user, --prefix, --root, and --target instead.z; ) rrrrbrrrkeysrr)rUrqr* offendersr rblocation_optionsr5r5r6rs2 r)rrusing_user_siter,cCsg}|d|s,|d|t|n |d|dd7<|jtjkrd}d}tsz|sz||d|gn |||d tr|jtjkr|j rt |j d kr|d d | dS) zrFormat an error message for an OSError It may occur anytime during the execution of the install command. z,Could not install packages due to an OSErrorz: .rrz"Consider using the `--user` optionzCheck the permissionsz or z. izHINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths r.) rrerrnoEACCESr&extendlowerrENOENTfilenamelenrstrip)rrr.ruser_option_partpermissions_partr5r5r6rs>         r)FNNFN)NNNF)Tr0rrrrr%optparserrtypingrrrpip._vendor.packaging.utilsrpip._vendor.richrpip._internal.cacher Zpip._internal.clir Zpip._internal.cli.cmdoptionsr pip._internal.cli.req_commandr r rpip._internal.cli.status_codesrrpip._internal.exceptionsrrpip._internal.locationsrpip._internal.metadatar#pip._internal.models.format_controlr(pip._internal.models.installation_reportr,pip._internal.operations.build.build_trackerrpip._internal.operations.checkrrpip._internal.reqrZpip._internal.req.req_installrpip._internal.utils.compatr"pip._internal.utils.distutils_argsrpip._internal.utils.filesystemrpip._internal.utils.loggingr pip._internal.utils.miscr!r"r#r$pip._internal.utils.temp_dirr%pip._internal.utils.virtualenvr&r'pip._internal.wheel_builderr(r)r*rrr9r:r8rrr#rrrrr5r5r5r6s                  M   >  (PK]7œ.commands/__pycache__/help.cpython-38.opt-1.pycnu[U .e@sDddlmZddlmZddlmZddlmZGdddeZdS))absolute_import)Command)SUCCESS) CommandErrorc@s eZdZdZdZdZddZdS) HelpCommandzShow help for commandsz %prog Tc Csddlm}m}m}z |d}Wntk r8tYSX||krt||}d|g}|rf|d|td|||} | j tS)Nr) commands_dictcreate_commandget_similar_commandszunknown command "%s"zmaybe you meant "%s"z - ) Zpip._internal.commandsrrr IndexErrorrappendrjoinparserZ print_help) selfZoptionsargsrrr Zcmd_nameZguessmsgZcommandr?/usr/lib/python3.8/site-packages/pip/_internal/commands/help.pyruns    zHelpCommand.runN)__name__ __module__ __qualname____doc__ZusageZignore_require_venvrrrrrr srN) Z __future__rZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrZpip._internal.exceptionsrrrrrrs    PK]e?$ $ 2commands/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e@s:dZddlmZddlZddlmZmZddlmZerPddl m Z ddl m Z edd Z ed e d d d fde dddfde dddfde dddfde dddfde dd d!fd"e d#d$d%fd&e d'd(d)fd*e d+d,d-fd.e d/d0d1fd2e d3d4d5fd6e d7d8d9fd:e d;de d?d@dAfgZdBdCZdDdEZdS)Fz% Package containing all pip commands )absolute_importN) OrderedDict namedtuple)MYPY_CHECK_RUNNING)Any)Command CommandInfoz module_path, class_name, summaryZinstallzpip._internal.commands.installZInstallCommandzInstall packages.Zdownloadzpip._internal.commands.downloadZDownloadCommandzDownload packages.Z uninstallz pip._internal.commands.uninstallZUninstallCommandzUninstall packages.Zfreezezpip._internal.commands.freezeZ FreezeCommandz1Output installed packages in requirements format.listzpip._internal.commands.listZ ListCommandzList installed packages.Zshowzpip._internal.commands.showZ ShowCommandz*Show information about installed packages.Zcheckzpip._internal.commands.checkZ CheckCommandz7Verify installed packages have compatible dependencies.Zconfigz$pip._internal.commands.configurationZConfigurationCommandz&Manage local and global configuration.searchzpip._internal.commands.searchZ SearchCommandzSearch PyPI for packages.Zwheelzpip._internal.commands.wheelZ WheelCommandz$Build wheels from your requirements.hashzpip._internal.commands.hashZ HashCommandz#Compute hashes of package archives.Z completionz!pip._internal.commands.completionZCompletionCommandz-A helper command used for command completion.debugzpip._internal.commands.debugZ DebugCommandz&Show information useful for debugging.helpzpip._internal.commands.helpZ HelpCommandzShow help for commands.cKs:t|\}}}t|}t||}|f||d|}|S)zF Create an instance of the Command class with the given name. )namesummary) commands_dict importlib import_modulegetattr)rkwargsZ module_path class_namermoduleZ command_classZcommandrC/usr/lib/python3.8/site-packages/pip/_internal/commands/__init__.pycreate_commandZs   rcCs6ddlm}|}||t}|r.|dSdSdS)zCommand name auto-correct.r)get_close_matchesFN)Zdifflibrlowerrkeys)rrZclose_commandsrrrget_similar_commandsgs  r)__doc__Z __future__rr collectionsrrZpip._internal.utils.typingrtypingrZpip._internal.cli.base_commandrrrrrrrrrs     < PK]V *commands/__pycache__/search.cpython-38.pycnu[U ʗReA@s|ddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z m Z mZddlmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lm Z dd l!m"Z"ddl#m$Z$e rddl m%Z%Gddde%Z&e'e(Z)GdddeeZ*e e e+e+fe ddddZ,e+e+ddddZ-d e dee.ee.ddddZ/e e+e+dddZ0dS)!N) OrderedDict)Values) TYPE_CHECKINGDictListOptional)parse)Command)SessionCommandMixin)NO_MATCHES_FOUNDSUCCESS) CommandError)get_default_environment)PyPI)PipXmlrpcTransport) indent_log) write_output) TypedDictc@s*eZdZUeed<eed<eeed<dS)TransformedHitnamesummaryversionsN)__name__ __module__ __qualname__str__annotations__rrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/search.pyrs rc@s^eZdZdZdZdZddddZeee e dd d Z ee eee e e fd d d Z dS) SearchCommandz@Search for PyPI packages whose name or summary contains .z %prog [options] TN)returncCs.|jjddddtjdd|jd|jdS)Nz-iz--indexindexURLz3Base URL of Python Package Index (default %default))destmetavardefaulthelpr)cmd_opts add_optionrpypi_urlparserinsert_option_group)selfrrr add_options)s zSearchCommand.add_options)optionsargsr cCsV|s td|}|||}t|}d}tjr>td}t||d|rRt St S)Nz)Missing required argument (search query).r)terminal_width) r searchtransform_hitssysstdoutisattyshutilget_terminal_size print_resultsr r )r,r.r/queryZ pypi_hitshitsr0rrrrun5s    zSearchCommand.run)r9r.r c Cs|j}||}t||}tj||}z|||dd}Wn@tjjk r~}zdj|j |j d} t | W5d}~XYnXt |t st|S)N)rrorz-XMLRPC request failed [code: {code}] {string})codestring)r!get_default_sessionrxmlrpcclient ServerProxyr1Faultformat faultCode faultStringr isinstancelistAssertionError) r,r9r. index_urlsession transportpypir:faultmessagerrrr1Es  zSearchCommand.search)rrr__doc__usageignore_require_venvr-rrrintr;rr1rrrrr"s  r)r:r cCst}|D]n}|d}|d}|d}||krF|||gd||<q ||d||t||dkr |||d<q t|S)z The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. rrversion)rrrr)rkeysappendhighest_versionrHvalues)r:packageshitrrrTrrrr2Xs  r2)rlatestr c Csrt}||}|dk rntJ|j|kr8td|jn,td|jt|jrZtd|n td|W5QRXdS)NzINSTALLED: %s (latest)z INSTALLED: %sz=LATEST: %s (pre-release; install with `pip install --pre`)z LATEST: %s)rget_distributionrrTr parse_versionpre)rr[envdistrrrprint_dist_installation_infots    ra)r:name_column_widthr0r c Cs|sdS|dkr&tdd|Dd}|D]}|d}|dp@d}t|ddg}|dk r||d }|d krt||}d d |d |}|d|d} | |d|} zt| t||Wq*tk rYq*Xq*dS)Nc Ss.g|]&}t|dtt|ddgqS)rr-)lenrWget).0rZrrr sz!print_results..rrrrc   z ()z - ) maxrWretextwrapwrapjoinrraUnicodeEncodeError) r:rbr0rZrrr[Z target_widthZ summary_linesZ name_latestlinerrrr8s6    r8)rr cCs t|tdS)N)key)rpr])rrrrrWsrW)NN)1loggingr6r3rq xmlrpc.clientr@ collectionsroptparsertypingrrrrZpip._vendor.packaging.versionrr]pip._internal.cli.base_commandr pip._internal.cli.req_commandr pip._internal.cli.status_codesr r pip._internal.exceptionsr pip._internal.metadatarpip._internal.models.indexrZpip._internal.network.xmlrpcrpip._internal.utils.loggingrpip._internal.utils.miscrrr getLoggerrloggerrrr2rarSr8rWrrrrsB             6  &PK]commands/hash.pynu[import hashlib import logging import sys from optparse import Values from typing import List from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES from pip._internal.utils.misc import read_chunks, write_output logger = logging.getLogger(__name__) class HashCommand(Command): """ Compute a hash of a local package archive. These can be used with --hash in a requirements file to do repeatable installs. """ usage = "%prog [options] ..." ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "-a", "--algorithm", dest="algorithm", choices=STRONG_HASHES, action="store", default=FAVORITE_HASH, help="The hash algorithm to use: one of {}".format( ", ".join(STRONG_HASHES) ), ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: if not args: self.parser.print_usage(sys.stderr) return ERROR algorithm = options.algorithm for path in args: write_output( "%s:\n--hash=%s:%s", path, algorithm, _hash_of_file(path, algorithm) ) return SUCCESS def _hash_of_file(path: str, algorithm: str) -> str: """Return the hash digest of a file.""" with open(path, "rb") as archive: hash = hashlib.new(algorithm) for chunk in read_chunks(archive): hash.update(chunk) return hash.hexdigest() PK]W/AAcommands/search.pynu[import logging import shutil import sys import textwrap import xmlrpc.client from collections import OrderedDict from optparse import Values from typing import TYPE_CHECKING, Dict, List, Optional from pip._vendor.packaging.version import parse as parse_version from pip._internal.cli.base_command import Command from pip._internal.cli.req_command import SessionCommandMixin from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS from pip._internal.exceptions import CommandError from pip._internal.metadata import get_default_environment from pip._internal.models.index import PyPI from pip._internal.network.xmlrpc import PipXmlrpcTransport from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import write_output if TYPE_CHECKING: from typing import TypedDict class TransformedHit(TypedDict): name: str summary: str versions: List[str] logger = logging.getLogger(__name__) class SearchCommand(Command, SessionCommandMixin): """Search for PyPI packages whose name or summary contains .""" usage = """ %prog [options] """ ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "-i", "--index", dest="index", metavar="URL", default=PyPI.pypi_url, help="Base URL of Python Package Index (default %default)", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: if not args: raise CommandError("Missing required argument (search query).") query = args pypi_hits = self.search(query, options) hits = transform_hits(pypi_hits) terminal_width = None if sys.stdout.isatty(): terminal_width = shutil.get_terminal_size()[0] print_results(hits, terminal_width=terminal_width) if pypi_hits: return SUCCESS return NO_MATCHES_FOUND def search(self, query: List[str], options: Values) -> List[Dict[str, str]]: index_url = options.index session = self.get_default_session(options) transport = PipXmlrpcTransport(index_url, session) pypi = xmlrpc.client.ServerProxy(index_url, transport) try: hits = pypi.search({"name": query, "summary": query}, "or") except xmlrpc.client.Fault as fault: message = "XMLRPC request failed [code: {code}]\n{string}".format( code=fault.faultCode, string=fault.faultString, ) raise CommandError(message) assert isinstance(hits, list) return hits def transform_hits(hits: List[Dict[str, str]]) -> List["TransformedHit"]: """ The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. """ packages: Dict[str, "TransformedHit"] = OrderedDict() for hit in hits: name = hit["name"] summary = hit["summary"] version = hit["version"] if name not in packages.keys(): packages[name] = { "name": name, "summary": summary, "versions": [version], } else: packages[name]["versions"].append(version) # if this is the highest version, replace summary and score if version == highest_version(packages[name]["versions"]): packages[name]["summary"] = summary return list(packages.values()) def print_dist_installation_info(name: str, latest: str) -> None: env = get_default_environment() dist = env.get_distribution(name) if dist is not None: with indent_log(): if dist.version == latest: write_output("INSTALLED: %s (latest)", dist.version) else: write_output("INSTALLED: %s", dist.version) if parse_version(latest).pre: write_output( "LATEST: %s (pre-release; install" " with `pip install --pre`)", latest, ) else: write_output("LATEST: %s", latest) def print_results( hits: List["TransformedHit"], name_column_width: Optional[int] = None, terminal_width: Optional[int] = None, ) -> None: if not hits: return if name_column_width is None: name_column_width = ( max( [ len(hit["name"]) + len(highest_version(hit.get("versions", ["-"]))) for hit in hits ] ) + 4 ) for hit in hits: name = hit["name"] summary = hit["summary"] or "" latest = highest_version(hit.get("versions", ["-"])) if terminal_width is not None: target_width = terminal_width - name_column_width - 5 if target_width > 10: # wrap and indent summary to fit terminal summary_lines = textwrap.wrap(summary, target_width) summary = ("\n" + " " * (name_column_width + 3)).join(summary_lines) name_latest = f"{name} ({latest})" line = f"{name_latest:{name_column_width}} - {summary}" try: write_output(line) print_dist_installation_info(name, latest) except UnicodeEncodeError: pass def highest_version(versions: List[str]) -> str: return max(versions, key=parse_version) PK]6lcommands/check.pynu[import logging from optparse import Values from typing import List from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.operations.check import ( check_package_set, create_package_set_from_installed, ) from pip._internal.utils.misc import write_output logger = logging.getLogger(__name__) class CheckCommand(Command): """Verify installed packages have compatible dependencies.""" usage = """ %prog [options]""" def run(self, options: Values, args: List[str]) -> int: package_set, parsing_probs = create_package_set_from_installed() missing, conflicting = check_package_set(package_set) for project_name in missing: version = package_set[project_name].version for dependency in missing[project_name]: write_output( "%s %s requires %s, which is not installed.", project_name, version, dependency[0], ) for project_name in conflicting: version = package_set[project_name].version for dep_name, dep_version, req in conflicting[project_name]: write_output( "%s %s has requirement %s, but you have %s %s.", project_name, version, req, dep_name, dep_version, ) if missing or conflicting or parsing_probs: return ERROR else: write_output("No broken requirements found.") return SUCCESS PK] commands/freeze.pynu[import sys from optparse import Values from typing import List from pip._internal.cli import cmdoptions from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.operations.freeze import freeze from pip._internal.utils.compat import stdlib_pkgs DEV_PKGS = {"pip", "setuptools", "distribute", "wheel"} class FreezeCommand(Command): """ Output installed packages in requirements format. packages are listed in a case-insensitive sorted order. """ usage = """ %prog [options]""" log_streams = ("ext://sys.stderr", "ext://sys.stderr") def add_options(self) -> None: self.cmd_opts.add_option( "-r", "--requirement", dest="requirements", action="append", default=[], metavar="file", help=( "Use the order in the given requirements file and its " "comments when generating output. This option can be " "used multiple times." ), ) self.cmd_opts.add_option( "-l", "--local", dest="local", action="store_true", default=False, help=( "If in a virtualenv that has global access, do not output " "globally-installed packages." ), ) self.cmd_opts.add_option( "--user", dest="user", action="store_true", default=False, help="Only output packages installed in user-site.", ) self.cmd_opts.add_option(cmdoptions.list_path()) self.cmd_opts.add_option( "--all", dest="freeze_all", action="store_true", help=( "Do not skip these packages in the output:" " {}".format(", ".join(DEV_PKGS)) ), ) self.cmd_opts.add_option( "--exclude-editable", dest="exclude_editable", action="store_true", help="Exclude editable package from output.", ) self.cmd_opts.add_option(cmdoptions.list_exclude()) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: skip = set(stdlib_pkgs) if not options.freeze_all: skip.update(DEV_PKGS) if options.excludes: skip.update(options.excludes) cmdoptions.check_list_path_option(options) for line in freeze( requirement=options.requirements, local_only=options.local, user_only=options.user, paths=options.path, isolated=options.isolated_mode, skip=skip, exclude_editable=options.exclude_editable, ): sys.stdout.write(line + "\n") return SUCCESS PK]qC commands/completion.pynu[import sys import textwrap from optparse import Values from typing import List from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.utils.misc import get_prog BASE_COMPLETION = """ # pip {shell} completion start{script}# pip {shell} completion end """ COMPLETION_SCRIPTS = { "bash": """ _pip_completion() {{ COMPREPLY=( $( COMP_WORDS="${{COMP_WORDS[*]}}" \\ COMP_CWORD=$COMP_CWORD \\ PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) ) }} complete -o default -F _pip_completion {prog} """, "zsh": """ function _pip_completion {{ local words cword read -Ac words read -cn cword reply=( $( COMP_WORDS="$words[*]" \\ COMP_CWORD=$(( cword-1 )) \\ PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) }} compctl -K _pip_completion {prog} """, "fish": """ function __fish_complete_pip set -lx COMP_WORDS (commandline -o) "" set -lx COMP_CWORD ( \\ math (contains -i -- (commandline -t) $COMP_WORDS)-1 \\ ) set -lx PIP_AUTO_COMPLETE 1 string split \\ -- (eval $COMP_WORDS[1]) end complete -fa "(__fish_complete_pip)" -c {prog} """, } class CompletionCommand(Command): """A helper command to be used for command completion.""" ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "--bash", "-b", action="store_const", const="bash", dest="shell", help="Emit completion code for bash", ) self.cmd_opts.add_option( "--zsh", "-z", action="store_const", const="zsh", dest="shell", help="Emit completion code for zsh", ) self.cmd_opts.add_option( "--fish", "-f", action="store_const", const="fish", dest="shell", help="Emit completion code for fish", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ["--" + shell for shell in sorted(shells)] if options.shell in shells: script = textwrap.dedent( COMPLETION_SCRIPTS.get(options.shell, "").format(prog=get_prog()) ) print(BASE_COMPLETION.format(script=script, shell=options.shell)) return SUCCESS else: sys.stderr.write( "ERROR: You must pass {}\n".format(" or ".join(shell_options)) ) return SUCCESS PK]Ô""" ignore_require_venv = True def run(self, options: Values, args: List[str]) -> int: from pip._internal.commands import ( commands_dict, create_command, get_similar_commands, ) try: # 'pip help' with no args is handled by pip.__init__.parseopt() cmd_name = args[0] # the command we need help for except IndexError: return SUCCESS if cmd_name not in commands_dict: guess = get_similar_commands(cmd_name) msg = [f'unknown command "{cmd_name}"'] if guess: msg.append(f'maybe you meant "{guess}"') raise CommandError(" - ".join(msg)) command = create_command(cmd_name) command.parser.print_help() return SUCCESS PK] wycommands/wheel.pynu[import logging import os import shutil from optparse import Values from typing import List from pip._internal.cache import WheelCache from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import RequirementCommand, with_cleanup from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import CommandError from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_tracker import get_requirement_tracker from pip._internal.utils.misc import ensure_dir, normalize_path from pip._internal.utils.temp_dir import TempDirectory from pip._internal.wheel_builder import build, should_build_for_wheel_command logger = logging.getLogger(__name__) class WheelCommand(RequirementCommand): """ Build Wheel archives for your requirements and dependencies. Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. For more details, see the wheel docs: https://wheel.readthedocs.io/en/latest/ Requirements: setuptools>=0.8, and wheel. 'pip wheel' uses the bdist_wheel setuptools extension from the wheel package to build individual wheels. """ usage = """ %prog [options] ... %prog [options] -r ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option( "-w", "--wheel-dir", dest="wheel_dir", metavar="dir", default=os.curdir, help=( "Build wheels into , where the default is the " "current working directory." ), ) self.cmd_opts.add_option(cmdoptions.no_binary()) self.cmd_opts.add_option(cmdoptions.only_binary()) self.cmd_opts.add_option(cmdoptions.prefer_binary()) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.no_use_pep517()) self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.editable()) self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.progress_bar()) self.cmd_opts.add_option( "--no-verify", dest="no_verify", action="store_true", default=False, help="Don't verify if built wheel is valid.", ) self.cmd_opts.add_option(cmdoptions.build_options()) self.cmd_opts.add_option(cmdoptions.global_options()) self.cmd_opts.add_option( "--pre", action="store_true", default=False, help=( "Include pre-release and development versions. By default, " "pip only finds stable versions." ), ) self.cmd_opts.add_option(cmdoptions.require_hashes()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, self.cmd_opts) @with_cleanup def run(self, options: Values, args: List[str]) -> int: cmdoptions.check_install_build_global(options) session = self.get_default_session(options) finder = self._build_package_finder(options, session) wheel_cache = WheelCache(options.cache_dir, options.format_control) options.wheel_dir = normalize_path(options.wheel_dir) ensure_dir(options.wheel_dir) req_tracker = self.enter_context(get_requirement_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="wheel", globally_managed=True, ) reqs = self.get_requirements(args, options, finder, session) preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, req_tracker=req_tracker, session=session, finder=finder, download_dir=options.wheel_dir, use_user_site=False, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, wheel_cache=wheel_cache, ignore_requires_python=options.ignore_requires_python, use_pep517=options.use_pep517, ) self.trace_basic_info(finder) requirement_set = resolver.resolve(reqs, check_supported_wheels=True) reqs_to_build: List[InstallRequirement] = [] for req in requirement_set.requirements.values(): if req.is_wheel: preparer.save_linked_requirement(req) elif should_build_for_wheel_command(req): reqs_to_build.append(req) # build wheels build_successes, build_failures = build( reqs_to_build, wheel_cache=wheel_cache, verify=(not options.no_verify), build_options=options.build_options or [], global_options=options.global_options or [], ) for req in build_successes: assert req.link and req.link.is_wheel assert req.local_file_path # copy from cache to target directory try: shutil.copy(req.local_file_path, options.wheel_dir) except OSError as e: logger.warning( "Building wheel for %s failed: %s", req.name, e, ) build_failures.append(req) if len(build_failures) != 0: raise CommandError("Failed to build one or more wheels") return SUCCESS PK]`+llcommands/install.pynu[import errno import operator import os import shutil import site from optparse import SUPPRESS_HELP, Values from typing import Iterable, List, Optional from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cache import WheelCache from pip._internal.cli import cmdoptions from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.req_command import ( RequirementCommand, warn_if_run_as_root, with_cleanup, ) from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.exceptions import CommandError, InstallationError from pip._internal.locations import get_scheme from pip._internal.metadata import get_environment from pip._internal.models.format_control import FormatControl from pip._internal.operations.check import ConflictDetails, check_install_conflicts from pip._internal.req import install_given_reqs from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_tracker import get_requirement_tracker from pip._internal.utils.compat import WINDOWS from pip._internal.utils.distutils_args import parse_distutils_args from pip._internal.utils.filesystem import test_writable_dir from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ( ensure_dir, get_pip_version, protect_pip_from_modification_on_windows, write_output, ) from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.virtualenv import ( running_under_virtualenv, virtualenv_no_global, ) from pip._internal.wheel_builder import ( BinaryAllowedPredicate, build, should_build_for_install_command, ) logger = getLogger(__name__) def get_check_binary_allowed(format_control: FormatControl) -> BinaryAllowedPredicate: def check_binary_allowed(req: InstallRequirement) -> bool: canonical_name = canonicalize_name(req.name or "") allowed_formats = format_control.get_allowed_formats(canonical_name) return "binary" in allowed_formats return check_binary_allowed class InstallCommand(RequirementCommand): """ Install packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports installing from "requirements files", which provide an easy way to specify a whole environment to be installed. """ usage = """ %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.pre()) self.cmd_opts.add_option(cmdoptions.editable()) self.cmd_opts.add_option( "-t", "--target", dest="target_dir", metavar="dir", default=None, help=( "Install packages into . " "By default this will not replace existing files/folders in " ". Use --upgrade to replace existing packages in " "with new versions." ), ) cmdoptions.add_target_python_options(self.cmd_opts) self.cmd_opts.add_option( "--user", dest="use_user_site", action="store_true", help=( "Install to the Python user install directory for your " "platform. Typically ~/.local/, or %APPDATA%\\Python on " "Windows. (See the Python documentation for site.USER_BASE " "for full details.)" ), ) self.cmd_opts.add_option( "--no-user", dest="use_user_site", action="store_false", help=SUPPRESS_HELP, ) self.cmd_opts.add_option( "--root", dest="root_path", metavar="dir", default=None, help="Install everything relative to this alternate root directory.", ) self.cmd_opts.add_option( "--prefix", dest="prefix_path", metavar="dir", default=None, help=( "Installation prefix where lib, bin and other top-level " "folders are placed" ), ) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option( "-U", "--upgrade", dest="upgrade", action="store_true", help=( "Upgrade all specified packages to the newest available " "version. The handling of dependencies depends on the " "upgrade-strategy used." ), ) self.cmd_opts.add_option( "--upgrade-strategy", dest="upgrade_strategy", default="only-if-needed", choices=["only-if-needed", "eager"], help=( "Determines how dependency upgrading should be handled " "[default: %default]. " '"eager" - dependencies are upgraded regardless of ' "whether the currently installed version satisfies the " "requirements of the upgraded package(s). " '"only-if-needed" - are upgraded only when they do not ' "satisfy the requirements of the upgraded package(s)." ), ) self.cmd_opts.add_option( "--force-reinstall", dest="force_reinstall", action="store_true", help="Reinstall all packages even if they are already up-to-date.", ) self.cmd_opts.add_option( "-I", "--ignore-installed", dest="ignore_installed", action="store_true", help=( "Ignore the installed packages, overwriting them. " "This can break your system if the existing package " "is of a different version or was installed " "with a different package manager!" ), ) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.no_use_pep517()) self.cmd_opts.add_option(cmdoptions.install_options()) self.cmd_opts.add_option(cmdoptions.global_options()) self.cmd_opts.add_option( "--compile", action="store_true", dest="compile", default=True, help="Compile Python source files to bytecode", ) self.cmd_opts.add_option( "--no-compile", action="store_false", dest="compile", help="Do not compile Python source files to bytecode", ) self.cmd_opts.add_option( "--no-warn-script-location", action="store_false", dest="warn_script_location", default=True, help="Do not warn when installing scripts outside PATH", ) self.cmd_opts.add_option( "--no-warn-conflicts", action="store_false", dest="warn_about_conflicts", default=True, help="Do not warn about broken dependencies", ) self.cmd_opts.add_option(cmdoptions.no_binary()) self.cmd_opts.add_option(cmdoptions.only_binary()) self.cmd_opts.add_option(cmdoptions.prefer_binary()) self.cmd_opts.add_option(cmdoptions.require_hashes()) self.cmd_opts.add_option(cmdoptions.progress_bar()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, self.cmd_opts) @with_cleanup def run(self, options: Values, args: List[str]) -> int: if options.use_user_site and options.target_dir is not None: raise CommandError("Can not combine '--user' and '--target'") cmdoptions.check_install_build_global(options) upgrade_strategy = "to-satisfy-only" if options.upgrade: upgrade_strategy = options.upgrade_strategy cmdoptions.check_dist_restriction(options, check_target=True) install_options = options.install_options or [] logger.verbose("Using %s", get_pip_version()) options.use_user_site = decide_user_install( options.use_user_site, prefix_path=options.prefix_path, target_dir=options.target_dir, root_path=options.root_path, isolated_mode=options.isolated_mode, ) target_temp_dir: Optional[TempDirectory] = None target_temp_dir_path: Optional[str] = None if options.target_dir: options.ignore_installed = True options.target_dir = os.path.abspath(options.target_dir) if ( # fmt: off os.path.exists(options.target_dir) and not os.path.isdir(options.target_dir) # fmt: on ): raise CommandError( "Target path exists but is not a directory, will not continue." ) # Create a target directory for using with the target option target_temp_dir = TempDirectory(kind="target") target_temp_dir_path = target_temp_dir.path self.enter_context(target_temp_dir) global_options = options.global_options or [] session = self.get_default_session(options) target_python = make_target_python(options) finder = self._build_package_finder( options=options, session=session, target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) wheel_cache = WheelCache(options.cache_dir, options.format_control) req_tracker = self.enter_context(get_requirement_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="install", globally_managed=True, ) try: reqs = self.get_requirements(args, options, finder, session) # Only when installing is it permitted to use PEP 660. # In other circumstances (pip wheel, pip download) we generate # regular (i.e. non editable) metadata and wheels. for req in reqs: req.permit_editable_wheels = True reject_location_related_install_options(reqs, options.install_options) preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, req_tracker=req_tracker, session=session, finder=finder, use_user_site=options.use_user_site, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, wheel_cache=wheel_cache, use_user_site=options.use_user_site, ignore_installed=options.ignore_installed, ignore_requires_python=options.ignore_requires_python, force_reinstall=options.force_reinstall, upgrade_strategy=upgrade_strategy, use_pep517=options.use_pep517, ) self.trace_basic_info(finder) requirement_set = resolver.resolve( reqs, check_supported_wheels=not options.target_dir ) try: pip_req = requirement_set.get_requirement("pip") except KeyError: modifying_pip = False else: # If we're not replacing an already installed pip, # we're not modifying it. modifying_pip = pip_req.satisfied_by is None protect_pip_from_modification_on_windows(modifying_pip=modifying_pip) check_binary_allowed = get_check_binary_allowed(finder.format_control) reqs_to_build = [ r for r in requirement_set.requirements.values() if should_build_for_install_command(r, check_binary_allowed) ] _, build_failures = build( reqs_to_build, wheel_cache=wheel_cache, verify=True, build_options=[], global_options=[], ) # If we're using PEP 517, we cannot do a legacy setup.py install # so we fail here. pep517_build_failure_names: List[str] = [ r.name for r in build_failures if r.use_pep517 # type: ignore ] if pep517_build_failure_names: raise InstallationError( "Could not build wheels for {}, which is required to " "install pyproject.toml-based projects".format( ", ".join(pep517_build_failure_names) ) ) # For now, we just warn about failures building legacy # requirements, as we'll fall through to a setup.py install for # those. for r in build_failures: if not r.use_pep517: r.legacy_install_reason = 8368 to_install = resolver.get_installation_order(requirement_set) # Check for conflicts in the package set we're installing. conflicts: Optional[ConflictDetails] = None should_warn_about_conflicts = ( not options.ignore_dependencies and options.warn_about_conflicts ) if should_warn_about_conflicts: conflicts = self._determine_conflicts(to_install) # Don't warn about script install locations if # --target or --prefix has been specified warn_script_location = options.warn_script_location if options.target_dir or options.prefix_path: warn_script_location = False installed = install_given_reqs( to_install, install_options, global_options, root=options.root_path, home=target_temp_dir_path, prefix=options.prefix_path, warn_script_location=warn_script_location, use_user_site=options.use_user_site, pycompile=options.compile, ) lib_locations = get_lib_location_guesses( user=options.use_user_site, home=target_temp_dir_path, root=options.root_path, prefix=options.prefix_path, isolated=options.isolated_mode, ) env = get_environment(lib_locations) installed.sort(key=operator.attrgetter("name")) items = [] for result in installed: item = result.name try: installed_dist = env.get_distribution(item) if installed_dist is not None: item = f"{item}-{installed_dist.version}" except Exception: pass items.append(item) if conflicts is not None: self._warn_about_conflicts( conflicts, resolver_variant=self.determine_resolver_variant(options), ) installed_desc = " ".join(items) if installed_desc: write_output( "Successfully installed %s", installed_desc, ) except OSError as error: show_traceback = self.verbosity >= 1 message = create_os_error_message( error, show_traceback, options.use_user_site, ) logger.error(message, exc_info=show_traceback) # noqa return ERROR if options.target_dir: assert target_temp_dir self._handle_target_dir( options.target_dir, target_temp_dir, options.upgrade ) warn_if_run_as_root() return SUCCESS def _handle_target_dir( self, target_dir: str, target_temp_dir: TempDirectory, upgrade: bool ) -> None: ensure_dir(target_dir) # Checking both purelib and platlib directories for installed # packages to be moved to target directory lib_dir_list = [] # Checking both purelib and platlib directories for installed # packages to be moved to target directory scheme = get_scheme("", home=target_temp_dir.path) purelib_dir = scheme.purelib platlib_dir = scheme.platlib data_dir = scheme.data if os.path.exists(purelib_dir): lib_dir_list.append(purelib_dir) if os.path.exists(platlib_dir) and platlib_dir != purelib_dir: lib_dir_list.append(platlib_dir) if os.path.exists(data_dir): lib_dir_list.append(data_dir) for lib_dir in lib_dir_list: for item in os.listdir(lib_dir): if lib_dir == data_dir: ddir = os.path.join(data_dir, item) if any(s.startswith(ddir) for s in lib_dir_list[:-1]): continue target_item_dir = os.path.join(target_dir, item) if os.path.exists(target_item_dir): if not upgrade: logger.warning( "Target directory %s already exists. Specify " "--upgrade to force replacement.", target_item_dir, ) continue if os.path.islink(target_item_dir): logger.warning( "Target directory %s already exists and is " "a link. pip will not automatically replace " "links, please remove if replacement is " "desired.", target_item_dir, ) continue if os.path.isdir(target_item_dir): shutil.rmtree(target_item_dir) else: os.remove(target_item_dir) shutil.move(os.path.join(lib_dir, item), target_item_dir) def _determine_conflicts( self, to_install: List[InstallRequirement] ) -> Optional[ConflictDetails]: try: return check_install_conflicts(to_install) except Exception: logger.exception( "Error while checking for conflicts. Please file an issue on " "pip's issue tracker: https://github.com/pypa/pip/issues/new" ) return None def _warn_about_conflicts( self, conflict_details: ConflictDetails, resolver_variant: str ) -> None: package_set, (missing, conflicting) = conflict_details if not missing and not conflicting: return parts: List[str] = [] if resolver_variant == "legacy": parts.append( "pip's legacy dependency resolver does not consider dependency " "conflicts when selecting packages. This behaviour is the " "source of the following dependency conflicts." ) else: assert resolver_variant == "2020-resolver" parts.append( "pip's dependency resolver does not currently take into account " "all the packages that are installed. This behaviour is the " "source of the following dependency conflicts." ) # NOTE: There is some duplication here, with commands/check.py for project_name in missing: version = package_set[project_name][0] for dependency in missing[project_name]: message = ( "{name} {version} requires {requirement}, " "which is not installed." ).format( name=project_name, version=version, requirement=dependency[1], ) parts.append(message) for project_name in conflicting: version = package_set[project_name][0] for dep_name, dep_version, req in conflicting[project_name]: message = ( "{name} {version} requires {requirement}, but {you} have " "{dep_name} {dep_version} which is incompatible." ).format( name=project_name, version=version, requirement=req, dep_name=dep_name, dep_version=dep_version, you=("you" if resolver_variant == "2020-resolver" else "you'll"), ) parts.append(message) logger.critical("\n".join(parts)) def get_lib_location_guesses( user: bool = False, home: Optional[str] = None, root: Optional[str] = None, isolated: bool = False, prefix: Optional[str] = None, ) -> List[str]: scheme = get_scheme( "", user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) return [scheme.purelib, scheme.platlib] def site_packages_writable(root: Optional[str], isolated: bool) -> bool: return all( test_writable_dir(d) for d in set(get_lib_location_guesses(root=root, isolated=isolated)) ) def decide_user_install( use_user_site: Optional[bool], prefix_path: Optional[str] = None, target_dir: Optional[str] = None, root_path: Optional[str] = None, isolated_mode: bool = False, ) -> bool: """Determine whether to do a user install based on the input options. If use_user_site is False, no additional checks are done. If use_user_site is True, it is checked for compatibility with other options. If use_user_site is None, the default behaviour depends on the environment, which is provided by the other arguments. """ # In some cases (config from tox), use_user_site can be set to an integer # rather than a bool, which 'use_user_site is False' wouldn't catch. if (use_user_site is not None) and (not use_user_site): logger.debug("Non-user install by explicit request") return False if use_user_site: if prefix_path: raise CommandError( "Can not combine '--user' and '--prefix' as they imply " "different installation locations" ) if virtualenv_no_global(): raise InstallationError( "Can not perform a '--user' install. User site-packages " "are not visible in this virtualenv." ) logger.debug("User install by explicit request") return True # If we are here, user installs have not been explicitly requested/avoided assert use_user_site is None # user install incompatible with --prefix/--target if prefix_path or target_dir: logger.debug("Non-user install due to --prefix or --target option") return False # If user installs are not enabled, choose a non-user install if not site.ENABLE_USER_SITE: logger.debug("Non-user install because user site-packages disabled") return False # If we have permission for a non-user install, do that, # otherwise do a user install. if site_packages_writable(root=root_path, isolated=isolated_mode): logger.debug("Non-user install because site-packages writeable") return False logger.info( "Defaulting to user installation because normal site-packages " "is not writeable" ) return True def reject_location_related_install_options( requirements: List[InstallRequirement], options: Optional[List[str]] ) -> None: """If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. """ def format_options(option_names: Iterable[str]) -> List[str]: return ["--{}".format(name.replace("_", "-")) for name in option_names] offenders = [] for requirement in requirements: install_options = requirement.install_options location_options = parse_distutils_args(install_options) if location_options: offenders.append( "{!r} from {}".format( format_options(location_options.keys()), requirement ) ) if options: location_options = parse_distutils_args(options) if location_options: offenders.append( "{!r} from command line".format(format_options(location_options.keys())) ) if not offenders: return raise CommandError( "Location-changing options found in --install-option: {}." " This is unsupported, use pip-level options like --user," " --prefix, --root, and --target instead.".format("; ".join(offenders)) ) def create_os_error_message( error: OSError, show_traceback: bool, using_user_site: bool ) -> str: """Format an error message for an OSError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to show a traceback parts.append("Could not install packages due to an OSError") if not show_traceback: parts.append(": ") parts.append(str(error)) else: parts.append(".") # Spilt the error indication from a helper message (if any) parts[-1] += "\n" # Suggest useful actions to the user: # (1) using user site-packages or (2) verifying the permissions if error.errno == errno.EACCES: user_option_part = "Consider using the `--user` option" permissions_part = "Check the permissions" if not running_under_virtualenv() and not using_user_site: parts.extend( [ user_option_part, " or ", permissions_part.lower(), ] ) else: parts.append(permissions_part) parts.append(".\n") # Suggest the user to enable Long Paths if path length is # more than 260 if ( WINDOWS and error.errno == errno.ENOENT and error.filename and len(error.filename) > 260 ): parts.append( "HINT: This error might have occurred since " "this system does not have Windows Long Path " "support enabled. You can find information on " "how to enable this at " "https://pip.pypa.io/warnings/enable-long-paths\n" ) return "".join(parts).strip() + "\n" PK]BIcommands/show.pynu[import csv import logging import pathlib from optparse import Values from typing import Iterator, List, NamedTuple, Optional, Tuple from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.metadata import BaseDistribution, get_default_environment from pip._internal.utils.misc import write_output logger = logging.getLogger(__name__) class ShowCommand(Command): """ Show information about one or more installed packages. The output is in RFC-compliant mail header format. """ usage = """ %prog [options] ...""" ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "-f", "--files", dest="files", action="store_true", default=False, help="Show the full list of installed files for each package.", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: if not args: logger.warning("ERROR: Please provide a package name or names.") return ERROR query = args results = search_packages_info(query) if not print_results( results, list_files=options.files, verbose=options.verbose ): return ERROR return SUCCESS class _PackageInfo(NamedTuple): name: str version: str location: str requires: List[str] required_by: List[str] installer: str metadata_version: str classifiers: List[str] summary: str homepage: str author: str author_email: str license: str entry_points: List[str] files: Optional[List[str]] def _convert_legacy_entry(entry: Tuple[str, ...], info: Tuple[str, ...]) -> str: """Convert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. """ while entry and entry[0] == "..": if not info or info[-1] == "..": info += ("..",) else: info = info[:-1] entry = entry[1:] return str(pathlib.Path(*info, *entry)) def search_packages_info(query: List[str]) -> Iterator[_PackageInfo]: """ Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. """ env = get_default_environment() installed = {dist.canonical_name: dist for dist in env.iter_distributions()} query_names = [canonicalize_name(name) for name in query] missing = sorted( [name for name, pkg in zip(query, query_names) if pkg not in installed] ) if missing: logger.warning("Package(s) not found: %s", ", ".join(missing)) def _get_requiring_packages(current_dist: BaseDistribution) -> Iterator[str]: return ( dist.metadata["Name"] or "UNKNOWN" for dist in installed.values() if current_dist.canonical_name in {canonicalize_name(d.name) for d in dist.iter_dependencies()} ) def _files_from_record(dist: BaseDistribution) -> Optional[Iterator[str]]: try: text = dist.read_text("RECORD") except FileNotFoundError: return None # This extra Path-str cast normalizes entries. return (str(pathlib.Path(row[0])) for row in csv.reader(text.splitlines())) def _files_from_legacy(dist: BaseDistribution) -> Optional[Iterator[str]]: try: text = dist.read_text("installed-files.txt") except FileNotFoundError: return None paths = (p for p in text.splitlines(keepends=False) if p) root = dist.location info = dist.info_directory if root is None or info is None: return paths try: info_rel = pathlib.Path(info).relative_to(root) except ValueError: # info is not relative to root. return paths if not info_rel.parts: # info *is* root. return paths return ( _convert_legacy_entry(pathlib.Path(p).parts, info_rel.parts) for p in paths ) for query_name in query_names: try: dist = installed[query_name] except KeyError: continue requires = sorted((req.name for req in dist.iter_dependencies()), key=str.lower) required_by = sorted(_get_requiring_packages(dist), key=str.lower) try: entry_points_text = dist.read_text("entry_points.txt") entry_points = entry_points_text.splitlines(keepends=False) except FileNotFoundError: entry_points = [] files_iter = _files_from_record(dist) or _files_from_legacy(dist) if files_iter is None: files: Optional[List[str]] = None else: files = sorted(files_iter) metadata = dist.metadata yield _PackageInfo( name=dist.raw_name, version=str(dist.version), location=dist.location or "", requires=requires, required_by=required_by, installer=dist.installer, metadata_version=dist.metadata_version or "", classifiers=metadata.get_all("Classifier", []), summary=metadata.get("Summary", ""), homepage=metadata.get("Home-page", ""), author=metadata.get("Author", ""), author_email=metadata.get("Author-email", ""), license=metadata.get("License", ""), entry_points=entry_points, files=files, ) def print_results( distributions: Iterator[_PackageInfo], list_files: bool, verbose: bool, ) -> bool: """ Print the information from installed distributions found. """ results_printed = False for i, dist in enumerate(distributions): results_printed = True if i > 0: write_output("---") write_output("Name: %s", dist.name) write_output("Version: %s", dist.version) write_output("Summary: %s", dist.summary) write_output("Home-page: %s", dist.homepage) write_output("Author: %s", dist.author) write_output("Author-email: %s", dist.author_email) write_output("License: %s", dist.license) write_output("Location: %s", dist.location) write_output("Requires: %s", ", ".join(dist.requires)) write_output("Required-by: %s", ", ".join(dist.required_by)) if verbose: write_output("Metadata-Version: %s", dist.metadata_version) write_output("Installer: %s", dist.installer) write_output("Classifiers:") for classifier in dist.classifiers: write_output(" %s", classifier) write_output("Entry-points:") for entry in dist.entry_points: write_output(" %s", entry.strip()) if list_files: write_output("Files:") if dist.files is None: write_output("Cannot locate RECORD or installed-files.txt") else: for line in dist.files: write_output(" %s", line.strip()) return results_printed PK]m((commands/download.pynu[import logging import os from optparse import Values from typing import List from pip._internal.cli import cmdoptions from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.req_command import RequirementCommand, with_cleanup from pip._internal.cli.status_codes import SUCCESS from pip._internal.req.req_tracker import get_requirement_tracker from pip._internal.utils.misc import ensure_dir, normalize_path, write_output from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) class DownloadCommand(RequirementCommand): """ Download packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports downloading from "requirements files", which provide an easy way to specify a whole environment to be downloaded. """ usage = """ %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ... %prog [options] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.global_options()) self.cmd_opts.add_option(cmdoptions.no_binary()) self.cmd_opts.add_option(cmdoptions.only_binary()) self.cmd_opts.add_option(cmdoptions.prefer_binary()) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option(cmdoptions.pre()) self.cmd_opts.add_option(cmdoptions.require_hashes()) self.cmd_opts.add_option(cmdoptions.progress_bar()) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.no_use_pep517()) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option( "-d", "--dest", "--destination-dir", "--destination-directory", dest="download_dir", metavar="dir", default=os.curdir, help="Download packages into .", ) cmdoptions.add_target_python_options(self.cmd_opts) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, self.cmd_opts) @with_cleanup def run(self, options: Values, args: List[str]) -> int: options.ignore_installed = True # editable doesn't really make sense for `pip download`, but the bowels # of the RequirementSet code require that property. options.editables = [] cmdoptions.check_dist_restriction(options) options.download_dir = normalize_path(options.download_dir) ensure_dir(options.download_dir) session = self.get_default_session(options) target_python = make_target_python(options) finder = self._build_package_finder( options=options, session=session, target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) req_tracker = self.enter_context(get_requirement_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="download", globally_managed=True, ) reqs = self.get_requirements(args, options, finder, session) preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, req_tracker=req_tracker, session=session, finder=finder, download_dir=options.download_dir, use_user_site=False, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, ignore_requires_python=options.ignore_requires_python, py_version_info=options.python_version, ) self.trace_basic_info(finder) requirement_set = resolver.resolve(reqs, check_supported_wheels=True) downloaded: List[str] = [] for req in requirement_set.requirements.values(): if req.satisfied_by is None: assert req.name is not None preparer.save_linked_requirement(req) downloaded.append(req.name) if downloaded: write_output("Successfully downloaded %s", " ".join(downloaded)) return SUCCESS PK]җ""commands/configuration.pynu[import logging import os import subprocess from optparse import Values from typing import Any, List, Optional from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.configuration import ( Configuration, Kind, get_configuration_files, kinds, ) from pip._internal.exceptions import PipError from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import get_prog, write_output logger = logging.getLogger(__name__) class ConfigurationCommand(Command): """ Manage local and global configuration. Subcommands: - list: List the active configuration (or from the file specified) - edit: Edit the configuration file in an editor - get: Get the value associated with name - set: Set the name=value - unset: Unset the value associated with name - debug: List the configuration files and values defined under them If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen to the user file by default. """ ignore_require_venv = True usage = """ %prog [] list %prog [] [--editor ] edit %prog [] get name %prog [] set name value %prog [] unset name %prog [] debug """ def add_options(self) -> None: self.cmd_opts.add_option( "--editor", dest="editor", action="store", default=None, help=( "Editor to use to edit the file. Uses VISUAL or EDITOR " "environment variables if not provided." ), ) self.cmd_opts.add_option( "--global", dest="global_file", action="store_true", default=False, help="Use the system-wide configuration file only", ) self.cmd_opts.add_option( "--user", dest="user_file", action="store_true", default=False, help="Use the user configuration file only", ) self.cmd_opts.add_option( "--site", dest="site_file", action="store_true", default=False, help="Use the current environment configuration file only", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: handlers = { "list": self.list_values, "edit": self.open_in_editor, "get": self.get_name, "set": self.set_name_value, "unset": self.unset_name, "debug": self.list_config_values, } # Determine action if not args or args[0] not in handlers: logger.error( "Need an action (%s) to perform.", ", ".join(sorted(handlers)), ) return ERROR action = args[0] # Determine which configuration files are to be loaded # Depends on whether the command is modifying. try: load_only = self._determine_file( options, need_value=(action in ["get", "set", "unset", "edit"]) ) except PipError as e: logger.error(e.args[0]) return ERROR # Load a new configuration self.configuration = Configuration( isolated=options.isolated_mode, load_only=load_only ) self.configuration.load() # Error handling happens here, not in the action-handlers. try: handlers[action](options, args[1:]) except PipError as e: logger.error(e.args[0]) return ERROR return SUCCESS def _determine_file(self, options: Values, need_value: bool) -> Optional[Kind]: file_options = [ key for key, value in ( (kinds.USER, options.user_file), (kinds.GLOBAL, options.global_file), (kinds.SITE, options.site_file), ) if value ] if not file_options: if not need_value: return None # Default to user, unless there's a site file. elif any( os.path.exists(site_config_file) for site_config_file in get_configuration_files()[kinds.SITE] ): return kinds.SITE else: return kinds.USER elif len(file_options) == 1: return file_options[0] raise PipError( "Need exactly one file to operate upon " "(--user, --site, --global) to perform." ) def list_values(self, options: Values, args: List[str]) -> None: self._get_n_args(args, "list", n=0) for key, value in sorted(self.configuration.items()): write_output("%s=%r", key, value) def get_name(self, options: Values, args: List[str]) -> None: key = self._get_n_args(args, "get [name]", n=1) value = self.configuration.get_value(key) write_output("%s", value) def set_name_value(self, options: Values, args: List[str]) -> None: key, value = self._get_n_args(args, "set [name] [value]", n=2) self.configuration.set_value(key, value) self._save_configuration() def unset_name(self, options: Values, args: List[str]) -> None: key = self._get_n_args(args, "unset [name]", n=1) self.configuration.unset_value(key) self._save_configuration() def list_config_values(self, options: Values, args: List[str]) -> None: """List config key-value pairs across different config files""" self._get_n_args(args, "debug", n=0) self.print_env_var_values() # Iterate over config files and print if they exist, and the # key-value pairs present in them if they do for variant, files in sorted(self.configuration.iter_config_files()): write_output("%s:", variant) for fname in files: with indent_log(): file_exists = os.path.exists(fname) write_output("%s, exists: %r", fname, file_exists) if file_exists: self.print_config_file_values(variant) def print_config_file_values(self, variant: Kind) -> None: """Get key-value pairs from the file of a variant""" for name, value in self.configuration.get_values_in_config(variant).items(): with indent_log(): write_output("%s: %s", name, value) def print_env_var_values(self) -> None: """Get key-values pairs present as environment variables""" write_output("%s:", "env_var") with indent_log(): for key, value in sorted(self.configuration.get_environ_vars()): env_var = f"PIP_{key.upper()}" write_output("%s=%r", env_var, value) def open_in_editor(self, options: Values, args: List[str]) -> None: editor = self._determine_editor(options) fname = self.configuration.get_file_to_edit() if fname is None: raise PipError("Could not determine appropriate file.") try: subprocess.check_call([editor, fname]) except subprocess.CalledProcessError as e: raise PipError( "Editor Subprocess exited with exit code {}".format(e.returncode) ) def _get_n_args(self, args: List[str], example: str, n: int) -> Any: """Helper to make sure the command got the right number of arguments""" if len(args) != n: msg = ( "Got unexpected number of arguments, expected {}. " '(example: "{} config {}")' ).format(n, get_prog(), example) raise PipError(msg) if n == 1: return args[0] else: return args def _save_configuration(self) -> None: # We successfully ran a modifying command. Need to save the # configuration. try: self.configuration.save() except Exception: logger.exception( "Unable to save configuration. Please report this as a bug." ) raise PipError("Internal Error.") def _determine_editor(self, options: Values) -> str: if options.editor is not None: return options.editor elif "VISUAL" in os.environ: return os.environ["VISUAL"] elif "EDITOR" in os.environ: return os.environ["EDITOR"] else: raise PipError("Could not determine editor to use.") PK]/# commands/uninstall.pynu[import logging from optparse import Values from typing import List from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli.base_command import Command from pip._internal.cli.req_command import SessionCommandMixin, warn_if_run_as_root from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import InstallationError from pip._internal.req import parse_requirements from pip._internal.req.constructors import ( install_req_from_line, install_req_from_parsed_requirement, ) from pip._internal.utils.misc import protect_pip_from_modification_on_windows logger = logging.getLogger(__name__) class UninstallCommand(Command, SessionCommandMixin): """ Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: - Pure distutils packages installed with ``python setup.py install``, which leave behind no metadata to determine what files were installed. - Script wrappers installed by ``python setup.py develop``. """ usage = """ %prog [options] ... %prog [options] -r ...""" def add_options(self) -> None: self.cmd_opts.add_option( "-r", "--requirement", dest="requirements", action="append", default=[], metavar="file", help=( "Uninstall all the packages listed in the given requirements " "file. This option can be used multiple times." ), ) self.cmd_opts.add_option( "-y", "--yes", dest="yes", action="store_true", help="Don't ask for confirmation of uninstall deletions.", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: session = self.get_default_session(options) reqs_to_uninstall = {} for name in args: req = install_req_from_line( name, isolated=options.isolated_mode, ) if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req else: logger.warning( "Invalid requirement: %r ignored -" " the uninstall command expects named" " requirements.", name, ) for filename in options.requirements: for parsed_req in parse_requirements( filename, options=options, session=session ): req = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode ) if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req if not reqs_to_uninstall: raise InstallationError( f"You must give at least one requirement to {self.name} (see " f'"pip help {self.name}")' ) protect_pip_from_modification_on_windows( modifying_pip="pip" in reqs_to_uninstall ) for req in reqs_to_uninstall.values(): uninstall_pathset = req.uninstall( auto_confirm=options.yes, verbose=self.verbosity > 0, ) if uninstall_pathset: uninstall_pathset.commit() warn_if_run_as_root() return SUCCESS PK]Xǫ//commands/list.pynu[import json import logging from optparse import Values from typing import TYPE_CHECKING, Iterator, List, Optional, Sequence, Tuple, cast from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import IndexGroupCommand from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import CommandError from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import BaseDistribution, get_environment from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.network.session import PipSession from pip._internal.utils.compat import stdlib_pkgs from pip._internal.utils.misc import tabulate, write_output from pip._internal.utils.parallel import map_multithread if TYPE_CHECKING: from pip._internal.metadata.base import DistributionVersion class _DistWithLatestInfo(BaseDistribution): """Give the distribution object a couple of extra fields. These will be populated during ``get_outdated()``. This is dirty but makes the rest of the code much cleaner. """ latest_version: DistributionVersion latest_filetype: str _ProcessedDists = Sequence[_DistWithLatestInfo] logger = logging.getLogger(__name__) class ListCommand(IndexGroupCommand): """ List installed packages, including editables. Packages are listed in a case-insensitive sorted order. """ ignore_require_venv = True usage = """ %prog [options]""" def add_options(self) -> None: self.cmd_opts.add_option( "-o", "--outdated", action="store_true", default=False, help="List outdated packages", ) self.cmd_opts.add_option( "-u", "--uptodate", action="store_true", default=False, help="List uptodate packages", ) self.cmd_opts.add_option( "-e", "--editable", action="store_true", default=False, help="List editable projects.", ) self.cmd_opts.add_option( "-l", "--local", action="store_true", default=False, help=( "If in a virtualenv that has global access, do not list " "globally-installed packages." ), ) self.cmd_opts.add_option( "--user", dest="user", action="store_true", default=False, help="Only output packages installed in user-site.", ) self.cmd_opts.add_option(cmdoptions.list_path()) self.cmd_opts.add_option( "--pre", action="store_true", default=False, help=( "Include pre-release and development versions. By default, " "pip only finds stable versions." ), ) self.cmd_opts.add_option( "--format", action="store", dest="list_format", default="columns", choices=("columns", "freeze", "json"), help="Select the output format among: columns (default), freeze, or json", ) self.cmd_opts.add_option( "--not-required", action="store_true", dest="not_required", help="List packages that are not dependencies of installed packages.", ) self.cmd_opts.add_option( "--exclude-editable", action="store_false", dest="include_editable", help="Exclude editable package from output.", ) self.cmd_opts.add_option( "--include-editable", action="store_true", dest="include_editable", help="Include editable package from output.", default=True, ) self.cmd_opts.add_option(cmdoptions.list_exclude()) index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, self.cmd_opts) def _build_package_finder( self, options: Values, session: PipSession ) -> PackageFinder: """ Create a package finder appropriate to this list command. """ link_collector = LinkCollector.create(session, options=options) # Pass allow_yanked=False to ignore yanked versions. selection_prefs = SelectionPreferences( allow_yanked=False, allow_all_prereleases=options.pre, ) return PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, ) def run(self, options: Values, args: List[str]) -> int: if options.outdated and options.uptodate: raise CommandError("Options --outdated and --uptodate cannot be combined.") cmdoptions.check_list_path_option(options) skip = set(stdlib_pkgs) if options.excludes: skip.update(canonicalize_name(n) for n in options.excludes) packages: "_ProcessedDists" = [ cast("_DistWithLatestInfo", d) for d in get_environment(options.path).iter_installed_distributions( local_only=options.local, user_only=options.user, editables_only=options.editable, include_editables=options.include_editable, skip=skip, ) ] # get_not_required must be called firstly in order to find and # filter out all dependencies correctly. Otherwise a package # can't be identified as requirement because some parent packages # could be filtered out before. if options.not_required: packages = self.get_not_required(packages, options) if options.outdated: packages = self.get_outdated(packages, options) elif options.uptodate: packages = self.get_uptodate(packages, options) self.output_package_listing(packages, options) return SUCCESS def get_outdated( self, packages: "_ProcessedDists", options: Values ) -> "_ProcessedDists": return [ dist for dist in self.iter_packages_latest_infos(packages, options) if dist.latest_version > dist.version ] def get_uptodate( self, packages: "_ProcessedDists", options: Values ) -> "_ProcessedDists": return [ dist for dist in self.iter_packages_latest_infos(packages, options) if dist.latest_version == dist.version ] def get_not_required( self, packages: "_ProcessedDists", options: Values ) -> "_ProcessedDists": dep_keys = { canonicalize_name(dep.name) for dist in packages for dep in (dist.iter_dependencies() or ()) } # Create a set to remove duplicate packages, and cast it to a list # to keep the return type consistent with get_outdated and # get_uptodate return list({pkg for pkg in packages if pkg.canonical_name not in dep_keys}) def iter_packages_latest_infos( self, packages: "_ProcessedDists", options: Values ) -> Iterator["_DistWithLatestInfo"]: with self._build_session(options) as session: finder = self._build_package_finder(options, session) def latest_info( dist: "_DistWithLatestInfo", ) -> Optional["_DistWithLatestInfo"]: all_candidates = finder.find_all_candidates(dist.canonical_name) if not options.pre: # Remove prereleases all_candidates = [ candidate for candidate in all_candidates if not candidate.version.is_prerelease ] evaluator = finder.make_candidate_evaluator( project_name=dist.canonical_name, ) best_candidate = evaluator.sort_best_candidate(all_candidates) if best_candidate is None: return None remote_version = best_candidate.version if best_candidate.link.is_wheel: typ = "wheel" else: typ = "sdist" dist.latest_version = remote_version dist.latest_filetype = typ return dist for dist in map_multithread(latest_info, packages): if dist is not None: yield dist def output_package_listing( self, packages: "_ProcessedDists", options: Values ) -> None: packages = sorted( packages, key=lambda dist: dist.canonical_name, ) if options.list_format == "columns" and packages: data, header = format_for_columns(packages, options) self.output_package_listing_columns(data, header) elif options.list_format == "freeze": for dist in packages: if options.verbose >= 1: write_output( "%s==%s (%s)", dist.raw_name, dist.version, dist.location ) else: write_output("%s==%s", dist.raw_name, dist.version) elif options.list_format == "json": write_output(format_for_json(packages, options)) def output_package_listing_columns( self, data: List[List[str]], header: List[str] ) -> None: # insert the header first: we need to know the size of column names if len(data) > 0: data.insert(0, header) pkg_strings, sizes = tabulate(data) # Create and add a separator. if len(data) > 0: pkg_strings.insert(1, " ".join(map(lambda x: "-" * x, sizes))) for val in pkg_strings: write_output(val) def format_for_columns( pkgs: "_ProcessedDists", options: Values ) -> Tuple[List[List[str]], List[str]]: """ Convert the package data into something usable by output_package_listing_columns. """ header = ["Package", "Version"] running_outdated = options.outdated if running_outdated: header.extend(["Latest", "Type"]) has_editables = any(x.editable for x in pkgs) if has_editables: header.append("Editable project location") if options.verbose >= 1: header.append("Location") if options.verbose >= 1: header.append("Installer") data = [] for proj in pkgs: # if we're working on the 'outdated' list, separate out the # latest_version and type row = [proj.raw_name, str(proj.version)] if running_outdated: row.append(str(proj.latest_version)) row.append(proj.latest_filetype) if has_editables: row.append(proj.editable_project_location or "") if options.verbose >= 1: row.append(proj.location or "") if options.verbose >= 1: row.append(proj.installer) data.append(row) return data, header def format_for_json(packages: "_ProcessedDists", options: Values) -> str: data = [] for dist in packages: info = { "name": dist.raw_name, "version": str(dist.version), } if options.verbose >= 1: info["location"] = dist.location or "" info["installer"] = dist.installer if options.outdated: info["latest_version"] = str(dist.latest_version) info["latest_filetype"] = dist.latest_filetype editable_project_location = dist.editable_project_location if editable_project_location: info["editable_project_location"] = editable_project_location data.append(info) return json.dumps(data) PK]ACcommands/__init__.pynu[""" Package containing all pip commands """ import importlib from collections import namedtuple from typing import Any, Dict, Optional from pip._internal.cli.base_command import Command CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary") # This dictionary does a bunch of heavy lifting for help output: # - Enables avoiding additional (costly) imports for presenting `--help`. # - The ordering matters for help display. # # Even though the module path starts with the same "pip._internal.commands" # prefix, the full path makes testing easier (specifically when modifying # `commands_dict` in test setup / teardown). commands_dict: Dict[str, CommandInfo] = { "install": CommandInfo( "pip._internal.commands.install", "InstallCommand", "Install packages.", ), "download": CommandInfo( "pip._internal.commands.download", "DownloadCommand", "Download packages.", ), "uninstall": CommandInfo( "pip._internal.commands.uninstall", "UninstallCommand", "Uninstall packages.", ), "freeze": CommandInfo( "pip._internal.commands.freeze", "FreezeCommand", "Output installed packages in requirements format.", ), "list": CommandInfo( "pip._internal.commands.list", "ListCommand", "List installed packages.", ), "show": CommandInfo( "pip._internal.commands.show", "ShowCommand", "Show information about installed packages.", ), "check": CommandInfo( "pip._internal.commands.check", "CheckCommand", "Verify installed packages have compatible dependencies.", ), "config": CommandInfo( "pip._internal.commands.configuration", "ConfigurationCommand", "Manage local and global configuration.", ), "search": CommandInfo( "pip._internal.commands.search", "SearchCommand", "Search PyPI for packages.", ), "cache": CommandInfo( "pip._internal.commands.cache", "CacheCommand", "Inspect and manage pip's wheel cache.", ), "index": CommandInfo( "pip._internal.commands.index", "IndexCommand", "Inspect information available from package indexes.", ), "wheel": CommandInfo( "pip._internal.commands.wheel", "WheelCommand", "Build wheels from your requirements.", ), "hash": CommandInfo( "pip._internal.commands.hash", "HashCommand", "Compute hashes of package archives.", ), "completion": CommandInfo( "pip._internal.commands.completion", "CompletionCommand", "A helper command used for command completion.", ), "debug": CommandInfo( "pip._internal.commands.debug", "DebugCommand", "Show information useful for debugging.", ), "help": CommandInfo( "pip._internal.commands.help", "HelpCommand", "Show help for commands.", ), } def create_command(name: str, **kwargs: Any) -> Command: """ Create an instance of the Command class with the given name. """ module_path, class_name, summary = commands_dict[name] module = importlib.import_module(module_path) command_class = getattr(module, class_name) command = command_class(name=name, summary=summary, **kwargs) return command def get_similar_commands(name: str) -> Optional[str]: """Command name auto-correct.""" from difflib import get_close_matches name = name.lower() close_commands = get_close_matches(name, commands_dict.keys()) if close_commands: return close_commands[0] else: return None PK][FI[I[0req/__pycache__/req_install.cpython-38.opt-1.pycnu[U .e@sLddlmZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mm?Z?ddl@mAZAddlBmCZCmDZDddlEmFZFddlGmHZHddlImJZJddlKmLZLeHr.ddlMmNZNmOZOmPZPmQZQmRZRmSZSmTZTddlmUZUddlVmWZWdd lXmYZYdd!lZm[Z[dd"l\m]Z]dd#l^m_Z_e`eaZbGd$d%d%ecZddS)&)absolute_importN) change_root) pkg_resourcessix) Requirement)canonicalize_name)Version)parse)Pep517HookCaller) pep425tagswheel)NoOpBuildEnvironment)InstallationError)Link)get_metadata_generator)load_pyproject_tomlmake_pyproject_path)UninstallPathSet) native_str)Hashes) indent_log)PIP_DELETE_MARKER_FILENAMEhas_delete_marker_file) _make_build_dirask_path_exists backup_dir display_pathdist_in_install_pathdist_in_site_packagesdist_in_usersite ensure_dirget_installed_versionhide_urlredact_auth_from_urlrmtree) get_metadata)make_setuptools_shim_args)call_subprocessrunner_with_spinner_message) TempDirectory)MYPY_CHECK_RUNNING)running_under_virtualenv)vcs)AnyDictIterableListOptionalSequenceUnion)BuildEnvironment) WheelCache) PackageFinder) Distribution) SpecifierSet)Markerc @speZdZdZdPddZddZd d Zd d Zd dZe ddZ e ddZ e ddZ e ddZ dQddZe ddZdRddZddZd d!Zd"d#Zd$d%Zd&d'Ze d(d)ZdSd*d+Ze d,d-Ze d.d/Ze d0d1Zd2d3Zd4d5Zd6d7Ze d8d9Zd:d;Zdd?Z!dTd@dAZ"dUdBdCZ#dVdDdEZ$dFdGZ%dHdIZ&dJdKZ'dWdLdMZ(dNdOZ)dS)XInstallRequirementz Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. NFc Cs||_||_| |_|dkr"d|_ntjtj||_||_| |_ |dkr`|r`|j r`t |j }||_ |_ | rx| |_n |rdd|jD|_nt|_|dkr|r|j}||_d|_d|_d|_d|_d|_| r| ni|_d|_d|_||_t|_d|_d|_g|_d|_ ||_!dS)NcSsh|]}t|qSr;)rZ safe_extra.0extrar;r;A/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py wsz.InstallRequirement.__init__..F)"req comes_from constraint source_dirospathnormpathabspatheditable _wheel_cacheurlrlink original_linkextrassetmarkermarkers satisfied_byconflicts_with_temp_build_dir_ideal_build_dirinstall_succeededoptionsZpreparedZ is_directisolatedr build_envmetadata_directorypyproject_requiresrequirements_to_checkpep517_backend use_pep517) selfrArBrDrIrLrQr^rXrWZ wheel_cacherCrNr;r;r?__init__TsH    zInstallRequirement.__init__cCs|jr,t|j}|jrD|dt|jj7}n|jr@t|jj}nd}|jdk rb|dt|jj7}|jrt |jt j r~|j}n |j }|r|d|7}|S)Nz from %szz in %sz (from %s)) rAstrrLr#rKrRrlocationrB isinstancer string_types from_pathr_srBr;r;r?__str__s     zInstallRequirement.__str__cCsd|jjt||jfS)Nz<%s object: %s editable=%r>) __class____name__rarIr_r;r;r?__repr__s zInstallRequirement.__repr__cs>t|t}fddt|D}dj|jjd|dS)z>An un-tested helper for getting state, for debugging. c3s|]}d||VqdS)z{}={!r}N)format)r=attrZ attributesr;r? sz2InstallRequirement.format_debug..z<{name} object: {{{state}}}>z, )namestate)varssortedrmrirjjoin)r_namesrrr;ror? format_debugs zInstallRequirement.format_debugcCsh|jdkr||||_|jdk rd|sd|j}t}|jj|j|j|d|_||jkrdtd|jdS)aEnsure that if a link can be found for this, that it is found. Note that self.link may still be None - if Upgrade is False and the requirement is already installed. If require_hashes is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have undeterministic contents due to file modification times. N)rLZ package_namesupported_tagszUsing cached wheel link: %s) rLZfind_requirementrJr Z get_supportedgetrqloggerdebug)r_finderZupgradeZrequire_hashesZold_linkrxr;r;r? populate_links  z InstallRequirement.populate_linkcCs |jdkrdStt|jjSN)rArrZ safe_namerqrkr;r;r?rqs zInstallRequirement.namecCs|jjSr~)rA specifierrkr;r;r?rszInstallRequirement.specifiercCs$|j}t|dko"tt|jdkS)zReturn whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. >=====)rlennextiteroperator)r_Z specifiersr;r;r? is_pinneds zInstallRequirement.is_pinnedcCs t|jSr~)r!rqrkr;r;r?installed_versionsz$InstallRequirement.installed_versioncs0|sd}jdk r(tfdd|DSdSdS)N)c3s|]}jd|iVqdS)r>N)rQZevaluater<rkr;r?rpsz3InstallRequirement.match_markers..T)rQany)r_Zextras_requestedr;rkr? match_markers s  z InstallRequirement.match_markerscCst|jdiS)zReturn whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. hashes)boolrWryrkr;r;r?has_hash_optionss z#InstallRequirement.has_hash_optionsTcCsJ|jdi}|r|jn|j}|rB|jrB||jg|jt |S)aReturn a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() r) rWrycopyrLrMhash setdefaultZ hash_nameappendr)r_Ztrust_internetZ good_hashesrLr;r;r?r#s  zInstallRequirement.hashescCsR|jdkrdSt|j}|jrNt|jtjr4|j}n |j}|rN|d|7}|S)z@Format a nice indicator to show where this "comes from" Nz->)rArarBrcrrdrerfr;r;r?re9s    zInstallRequirement.from_pathcCs||jdk r|jjS|jdkr6tdd|_||_|jjS|jrH|j}n|j}tj |snt d|t |tj ||S)Nz req-buildkindzCreating directory %s)rTrFrAr)rUrIrqlowerrEexistsrzr{rru)r_ build_dirrqr;r;r?ensure_build_locationIs      z(InstallRequirement.ensure_build_locationcCs|jdk rdS|j}d|_||j}tj|rBtdt|t d|t|jt|t |j|tj tj||_t|dd|_|jr|j}tjj||jd}tj||}tj tj|}||_d|_dS)aMove self._temp_build_dir to "self._ideal_build_dir/self.req.name" For some requirements (e.g. a path to a directory), the name of the package is not available until we run egg_info, so the build_location will return a temporary directory and store the _ideal_build_dir. This is only called to "fix" the build directory after generating metadata. NzCannot update repository at %s; repository location is unknownfile+r)rK) rLrzr{rDZschemerKrr,Z get_backendr"obtainZexport)r_rZvc_typerKZ vcs_backendZ hidden_urlr;r;r?update_editables    z"InstallRequirement.update_editablecCsB||std|jdS|jp&|j}t|}||||S)a Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. z#Skipping %s as it is not installed.N) rrzrrqrRrSrZ from_distremove)r_Z auto_confirmverboserZdistZuninstalled_pathsetr;r;r? uninstalls    zInstallRequirement.uninstallcCs(|t|dd}|tjjd}|S)Nr/)rreplacerErFr)r_rqrr;r;r?_clean_zip_namesz"InstallRequirement._clean_zip_namecCs(tj||}|||}|jd|S)Nr)rErFrurrq)r_rF parentdirrootdirrqr;r;r?_get_archive_names z$InstallRequirement._get_archive_namec Csd}d|j|jdf}tj||}tj|rtdt|d}|dkrRd}nj|dkrvt d t|t |nF|d krt |}t d t|t|t ||n|d krtd |sdStj|dtjdd}|tjtj|j}t|D]\} } } d| kr| d| D]6} |j| | |d} t| d}d|_||dq | D]>}|tkrnq\|j|| |d}tj| |}|||q\qW5QRXtdt|dS)z}Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. Tz %s-%s.ziprz8The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)bort )iwbarFrz Deleting %srzBacking up %s to %srN)Z allowZip64z pip-egg-info)rrrirzSaved %s)rqrrErFrurrrrzrrrrrrexitzipfileZZipFileZ ZIP_DEFLATEDnormcaserHrwalkrZZipInfoZ external_attrZwritestrrwriter)r_rZcreate_archiveZ archive_nameZ archive_pathZresponseZ dest_fileZ zip_outputdirdirpathZdirnames filenamesdirnameZ dir_arcnameZzipdirfilenameZ file_arcnamer;r;r?archivesx       zInstallRequirement.archivec  sh|dk r |ng}|jr*|j|||ddS|jrnt|j} t| |j|j|j|||||dd|_ dSt ||j dg}t ||j dg}t dd} tj| jd} ||| ||} td |j} t*|j| | ||jd W5QRXW5QRXtj| s8td | W5QRdSd|_ fd d }t| \}|D],}tj|}|drX||}qqXtd|W5QRW5QRdSW5QRXg}t| L}|D]@}|}tj|r|tjj 7}|!tj"|||qW5QRX|#t$|tj|d}t|d}|%d|dW5QRXW5QRXdS)N)r)rrrrrrTrrrecordrzinstall-record.txtzRunning setup.py install for {})cmdrzRecord file %s not foundcs&dkstj|s|St|SdSr~)rErFisabsr)rFrr;r? prepend_rootsz0InstallRequirement.install..prepend_rootrz;Could not find .egg-info directory in install record for %szinstalled-files.txtr )&rIrrr Z wheel_versionrDZcheck_compatibilityrqrrVrrWryr)rErFruget_install_argsr(rmrrYrrrzr{openrrrstripisdirrrrsortr r)r_rrrrrrrrrZtemp_dirrecord_filename install_argsrrflineZ directoryZ egg_info_dirZ new_linesrZinst_files_pathr;rr?installEs           "   zInstallRequirement.installc Cst|j||jdd}|dd|g7}|dg7}|dk r@|d|g7}|dk rT|d|g7}|rd|dg7}n |d g7}trd t}|d tjt j d d ||j g7}|S)NT)rrZunbuffered_outputrz--recordz#--single-version-externally-managedz--rootz--prefixz --compilez --no-compilepythonz--install-headersZincludeZsite) r&rrXr+ sysconfigZget_python_versionrErFrurrrq)r_rrrrrrZ py_ver_strr;r;r?rs0       z#InstallRequirement.get_install_args) NFNNNFNNFr;)N)T)NNNTFT)r;N)T)FFF)NNNNTFT)*rj __module__ __qualname____doc__r`rhrlrwr}propertyrqrrrrrrrerrrrrrrrrrrrrrrrrrrrrrrrr;r;r;r?r:Ms  W      8 +     %     B `r:)eZ __future__rrZloggingrErrrrZdistutils.utilrZ pip._vendorrrZ"pip._vendor.packaging.requirementsrZpip._vendor.packaging.utilsrZpip._vendor.packaging.versionrr rZpip._vendor.pep517.wrappersr Z pip._internalr r Zpip._internal.build_envr Zpip._internal.exceptionsrZpip._internal.models.linkrZ*pip._internal.operations.generate_metadatarZpip._internal.pyprojectrrZpip._internal.req.req_uninstallrZpip._internal.utils.compatrZpip._internal.utils.hashesrZpip._internal.utils.loggingrZ pip._internal.utils.marker_filesrrZpip._internal.utils.miscrrrrrrrr r!r"r#r$Zpip._internal.utils.packagingr%Z$pip._internal.utils.setuptools_buildr&Zpip._internal.utils.subprocessr'r(Zpip._internal.utils.temp_dirr)Zpip._internal.utils.typingr*Zpip._internal.utils.virtualenvr+Zpip._internal.vcsr,typingr-r.r/r0r1r2r3r4Zpip._internal.cacher5Zpip._internal.indexr6Zpip._vendor.pkg_resourcesr7Z pip._vendor.packaging.specifiersr8Zpip._vendor.packaging.markersr9Z getLoggerrjrzobjectr:r;r;r;r?sV               8      $       PK]\s&req/__pycache__/req_set.cpython-38.pycnu[U ʗRe* @sXddlZddlmZddlmZmZddlmZddlm Z e e Z GdddZ dS)N) OrderedDict)DictList)canonicalize_name)InstallRequirementc@seZdZdeddddZedddZedd d Zedd d d Z edd ddZ eedddZ eedddZ e eedddZe eedddZdS)RequirementSetTN)check_supported_wheelsreturncCst|_||_g|_dS)zCreate a RequirementSet.N)r requirementsrunnamed_requirements)selfrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_set.py__init__ szRequirementSet.__init__)r cCs4tdd|jDddd}ddd|DS)Ncss|]}|js|VqdSN) comes_from.0reqr r r sz)RequirementSet.__str__..cSst|jp dSNrnamerr r rz(RequirementSet.__str__..key css|]}t|jVqdSrstrrrr r rrs)sortedr valuesjoin)r r r r r__str__s zRequirementSet.__str__cCsBt|jddd}d}|j|jjt|ddd|DdS) NcSst|jp dSrrrr r rrrz)RequirementSet.__repr__..rz4<{classname} object; {count} requirement(s): {reqs}>z, css|]}t|jVqdSrr rr r rr&sz*RequirementSet.__repr__..) classnamecountreqs)r"r r#format __class____name__lenr$)r r format_stringr r r__repr__szRequirementSet.__repr__) install_reqr cCs|jr t|j|dSr)rAssertionErrorr append)r r/r r radd_unnamed_requirement)s z&RequirementSet.add_unnamed_requirementcCs"|js tt|j}||j|<dSr)rr0rr )r r/ project_namer r radd_named_requirement-s  z$RequirementSet.add_named_requirement)rr cCs t|}||jko|j|j Sr)rr constraintr rr3r r rhas_requirement3s  zRequirementSet.has_requirementcCs.t|}||jkr|j|Std|dS)NzNo project with the name )rr KeyErrorr6r r rget_requirement;s  zRequirementSet.get_requirementcCs|jt|jSr)r listr r#r r r rall_requirementsCszRequirementSet.all_requirementscCsdd|jDS)zReturn the list of requirements that need to be installed. TODO remove this property together with the legacy resolver, since the new resolver only returns requirements that need to be installed. cSsg|]}|js|js|qSr )r5 satisfied_by)rr/r r r Nsz:RequirementSet.requirements_to_install..)r<r;r r rrequirements_to_installGsz&RequirementSet.requirements_to_install)T)r+ __module__ __qualname__boolrr!r%r.rr2r4r7r9propertyrr<r?r r r rr s r)logging collectionsrtypingrrpip._vendor.packaging.utilsrZpip._internal.req.req_installr getLoggerr+loggerrr r r rs     PK]B)44'req/__pycache__/req_file.cpython-38.pycnu[U ʗRe^D@sUdZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZmZddlmZddlmZmZddlmZddlmZdd lmZdd lmZdd lm Z e rdd lm!Z!dd l"m#Z#dgZ$eee%e&fZ'e e&gee&effZ(e)dej*Z+e)dZ,e)dZ-ej.ej/ej0ej1ej2ej3ej4ej5ej6ej7ej8ej9ej:ej;gZd<ej?ej@ejAgZBee dej=fe>d<ddeBDZCGdddZDGdddZEdBe&eedeejeFe eDddfdddZGe&e'dd d!ZHdCeEeejeDd"d#d$ZIdDee&e%edeejeedd%d&d'ZJdEeEeejedeeeeDd(d)d*ZKGd+d,d,ZLede(d-d.d/ZMe&ee&e&fd0d1d2ZNGd3d4d4eOZPejQd5d6d7ZRe'e'd8d9d:ZSe'e'd8d;d<ZTe'e'd8d=d>ZUe&eee&e&fd?d@dAZVdS)Fz Requirements file parsing N)Values) TYPE_CHECKINGAnyCallableDict GeneratorIterableListOptionalTuple) cmdoptions)InstallationErrorRequirementsFileParseError) SearchScope) PipSession)raise_for_status) auto_decode)get_url_scheme)NoReturn) PackageFinderparse_requirementsz^(http|https|file):z (^|\s+)#.*$z#(?P\$\{(?P[A-Z0-9_]+)\}).SUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQcCsg|]}t|jqS)strdest).0orr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.py Nsrc @s8eZdZdeeeeeeeefeeddddZdS)ParsedRequirementN) requirement is_editable comes_from constraintoptions line_sourcereturncCs(||_||_||_||_||_||_dSN)r!r"r#r%r$r&)selfr!r"r#r$r%r&rrr__init__Rs zParsedRequirement.__init__)NN) __name__ __module__ __qualname__rboolr rrr*rrrrr Qsr c@s$eZdZeeeeeddddZdS) ParsedLineN)filenamelinenoargsoptsr$r'cCsZ||_||_||_||_|r0d|_d|_||_n&|jrPd|_d|_|jd|_nd|_dS)NTFr)r0r1r3r$is_requirementr"r! editables)r)r0r1r2r3r$rrrr*dszParsedLine.__init__)r+r,r-rintrr.r*rrrrr/csr/Fr)r0sessionfinderr%r$r'c csFt|}t||}|||D]"}t||||d}|dk r|VqdS)aqParse a requirements file and yield ParsedRequirement instances. :param filename: Path or url of requirements file. :param session: PipSession instance. :param finder: Instance of pip.index.PackageFinder. :param options: cli options. :param constraint: If true, parsing a constraint file rather than requirements file. )r%r8r7N)get_line_parserRequirementsFileParserparse handle_line) r0r7r8r%r$ line_parserparser parsed_line parsed_reqrrrr~s )contentr'cCs,t|dd}t|}t|}t|}|S)zxSplit, filter, and join lines, and return a line iterator :param content: the content of the requirements file )start) enumerate splitlines join_linesignore_commentsexpand_env_variables)rA lines_enumrrr preprocesss rJ)liner%r'cCsd|jrdnd|j|j}|js&t|jrBt|j|j||jdS|rTt ||j i}t D],}||j j kr\|j j |r\|j j |||<q\d|jd|j}t|j|j||j||dSdS)Nz{} {} (line {})z-cz-r)r!r"r#r$line  of )r!r"r#r$r%r&)formatr$r0r1r4AssertionErrorr"r r!r check_install_build_globalr3SUPPORTED_OPTIONS_REQ_DEST__dict__)rKr%line_comes_from req_optionsrr&rrrhandle_requirement_lines8  rU)r3r0r1r8r%r7r'cs8r4|jr|j_|jr4jfdd|jD|r4|j}|j}|jrT|jg}|jdkrbg}|jrt||j|jr|jd}tj tj |} tj | |} tj | r| }|||r||t||d} | |_|jr||jr||r4|jp gD]$} d|d|} |j| | dqdS) Nc3s|]}|jkr|VqdSr()features_enabled)rfr%rr s z%handle_option_line..Tr) find_links index_urlsrLrM)source)require_hashesrVextendrZr[ index_urlno_indexextra_index_urlsospathdirnameabspathjoinexistsappendupdate_index_urlsr search_scopepreset_allow_all_prereleases prefer_binaryset_prefer_binary trusted_hostsadd_trusted_host)r3r0r1r8r%r7rZr[valuereq_dirrelative_to_reqs_filerjhostr\rrXrhandle_option_linesL       ru)rKr%r8r7r'cCs4|jrt||}|St|j|j|j|||dSdS)aHandle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The session - updated by non-requirement lines. Returns a ParsedRequirement object if the line is a requirement line, otherwise returns None. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder. N)r4rUrur3r0r1)rKr%r8r7r@rrrr<s r<c@sreZdZeeddddZeeee ddfdddZ eeee ddfddd Z eeee ddfdd d Z dS) r:N)r7r=r'cCs||_||_dSr()_session _line_parser)r)r7r=rrrr*<szRequirementsFileParser.__init__)r0r$r'ccs|||EdHdS)z*Parse a given file, yielding parsed lines.N)_parse_and_recurse)r)r0r$rrrr;DszRequirementsFileParser.parseccs|||D]}|js|jjs&|jjr|jjr@|jjd}d}n|jjd}d}t|rjtj ||}n t|st j t j ||}|||EdHq |Vq dS)NrFT) _parse_filer4r3 requirements constraints SCHEME_REsearchurllibr;urljoinrbrcrfrdrx)r)r0r$rKreq_pathnested_constraintrrrrxJs(     z)RequirementsFileParser._parse_and_recursec cst||j\}}t|}|D]j\}}z||\}} Wn<tk rr} zd|d| j} t| W5d} ~ XYnXt|||| |VqdS)NzInvalid requirement:  )get_file_contentrvrJrwOptionParsingErrormsgrr/) r)r0r$_rArI line_numberrKargs_strr3errrrryis z"RequirementsFileParser._parse_file) r+r,r-r LineParserr*rr.rr/r;rxryrrrrr:;s     r:)r8r'cs ttttfdfdd }|S)NrKr'csJt}|}d|_r j|_t|\}}|t||\}}||fSr() build_parserget_default_valuesr_format_controlbreak_args_options parse_argsshlexsplit)rKr>defaultsr options_strr3rr8rr parse_lines z#get_line_parser..parse_line)rr r)r8rrrrr9sr9rcCsf|d}g}|dd}|D]2}|ds6|dr<qRq|||dqd|d|fS)zBreak up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.  N-z--r)r startswithrhpoprf)rKtokensr2r%tokenrrrrs    rc@seZdZeddddZdS)rN)rr'cCs ||_dSr()rr)rrrrr*szOptionParsingError.__init__)r+r,r-rr*rrrrrsr)r'cCsJtjdd}tt}|D]}|}||qttdddd}||_|S)z7 Return a parser for parsing requirement lines F)add_help_optionr)r)rr'cSs t|dSr()rrrrr parser_exitsz!build_parser..parser_exit)optparse OptionParserrr add_optionrrexit)r>option_factoriesoption_factoryoptionrrrrrs  r)rIr'ccsd}g}|D]\}}|dr(t|rvt|r:d|}|rj|||dk sTt|d|fVg}q||fVq |s~|}||dq |r|dk st|d|fVdS)zJoins a line ending in '' with the previous line (except when following comments). The joined line takes on the index of the first line. N\r)endswith COMMENT_REmatchrhrOrfstrip)rIprimary_line_numbernew_linerrKrrrrFs$      rFccs4|D]*\}}td|}|}|r||fVqdS)z1 Strips comments and filter empty lines. rN)rsubr)rIrrKrrrrGs   rGccsL|D]B\}}t|D]$\}}t|}|s.q|||}q||fVqdS)aReplace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. These points are the result of a discussion on the `github pull request #3514 `_. Valid characters in variable names follow the `POSIX standard `_ and are limited to uppercase letter, digits and the `_` (underscore). N) ENV_VAR_REfindallrbgetenvreplace)rIrrKenv_varvar_namerqrrrrHs  rH)urlr7r'c Cst|}|dkr.||}t||j|jfSz&t|d}t|}W5QRXWn0tk r}zt d|W5d}~XYnX||fS)aGets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance. )httphttpsfilerbz"Could not open requirements file: N) rgetrrtextopenrreadOSErrorr )rr7schemeresprWrAexcrrrrs    r)NNF)N)NNN)NNN)W__doc__rrbrer urllib.parser~rtypingrrrrrrr r r Zpip._internal.clir pip._internal.exceptionsr r!pip._internal.models.search_scoperpip._internal.network.sessionrpip._internal.network.utilsrpip._internal.utils.encodingrpip._internal.utils.urlsrr"pip._internal.index.package_finderr__all__r6r ReqFileLinesrcompileIr|rrr_extra_index_urlr`r{rzeditablerZ no_binary only_binaryrmr]rk trusted_hostuse_new_featurerOption__annotations__install_optionsglobal_optionshashrrQr r/r.rrJrUrur<r:r9r ExceptionrrrrFrGrHrrrrrs ,            1 ? ,F PK]: _$$-req/__pycache__/req_file.cpython-38.opt-1.pycnu[U .e7 @sdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZmZdd lmZer dd lmZmZmZmZmZm Z m!Z!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ee"e+e!fZ,dgZ-e.dej/Z0e.dZ1e.dZ2ej3ej4ej5ej6ej7ej8ej9ej:ej;ejej?g Z@ejAejBejCgZDddeDDZEd)ddZFddZGd*ddZHddZIdd ZJd!d"ZKd#d$ZLd%d&ZMd'd(ZNdS)+z Requirements file parsing )absolute_importN) filterfalse)parse) cmdoptions)get_file_contentRequirementsFileParseError) SearchScope)install_req_from_editableinstall_req_from_line)MYPY_CHECK_RUNNING)AnyCallableIteratorListNoReturnOptionalTextTuple)InstallRequirement) WheelCache) PackageFinder) PipSessionparse_requirementsz^(http|https|file):z (^|\s+)#.*$z#(?P\$\{(?P[A-Z0-9_]+)\})cCsg|]}t|jqS)strdest).0orr>/usr/lib/python3.8/site-packages/pip/_internal/req/req_file.py Ksr Fc csj|dkrtdt|||d\}} t| |} | D]4\} } t| || |||||||d } | D] }|VqXq0dS)a1Parse a requirements file and yield InstallRequirement instances. :param filename: Path or url of requirements file. :param finder: Instance of pip.index.PackageFinder. :param comes_from: Origin description of requirements. :param options: cli options. :param session: Instance of pip.download.PipSession. :param constraint: If true, parsing a constraint file rather than requirements file. :param wheel_cache: Instance of pip.wheel.WheelCache :param use_pep517: Value of the --use-pep517 option. NzCparse_requirements() missing 1 required keyword argument: 'session') comes_fromsession) use_pep517 constraint) TypeErrorr preprocess process_line)filenamefinderr!optionsr"r$ wheel_cacher#_content lines_enum line_numberlineZreq_iterreqrrrrNs*    cCs6t|dd}t|}t|}t||}t|}|S)zSplit, filter, and join lines, and return a line iterator :param content: the content of the requirements file :param options: cli options )start) enumerate splitlines join_linesignore_comments skip_regexexpand_env_variables)r-r*r.rrrr&ys  r&c ! cst|} | } d| _|r"|j| _t|\} } tjdkrB| d} | t | | \}}d| rbdnd||f}| r|r||j nd}|rt ||i}tD]&}||jkr|j|r|j|||<qd||}t| |||||| |d Vn|jr |r|j nd}t|jd ||| ||d Vn|js0|jr|jrH|jd }d}n|jd }d }t|rpt||}n"t|stjtj||}t|||||||d }|D] }|Vqn|jr|j|_n|r|j }|j!}|jr|jg}|j"d krg}|j#r|$|j#|j rd|j d }tjtj%|}tj||}tj&|rZ|}|'|t(||d}||_)|j*r|+|j,pgD] }d||} |j-|| dqdS)a#Process a single requirements line; This can result in creating/yielding requirements, or updating the finder. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder. :param constraint: If True, parsing a constraints file. :param options: OptionParser options that we may update N)utf8z%s %s (line %s)z-cz-rFz line {} of {})r!r#isolatedr*r+r$ line_sourcer)r!r#r$r>r+T)r$r+) find_links index_urls)source). build_parserZget_default_values index_urlZformat_controlbreak_args_optionssys version_infoencode parse_argsshlexsplitZ isolated_moderZcheck_install_build_globalSUPPORTED_OPTIONS_REQ_DEST__dict__formatr Z editablesr requirements constraints SCHEME_REsearch urllib_parseZurljoinospathjoindirnamerrequire_hashesr@rAno_indexZextra_index_urlsextendabspathexistsappendr search_scopepreZset_allow_all_prereleasesZ trusted_hostsZadd_trusted_host)!r0r(r/r)r!r*r"r+r#r$parserdefaultsZargs_strZ options_strZoptsr,Zline_comes_fromr>Z req_optionsrr?Zreq_pathZnested_constraintZ parsed_reqsr1r@rAvalueZreq_dirZrelative_to_reqs_filer^ZhostrBrrrr's                   r'cCsf|d}g}|dd}|D]2}|ds6|dr<qRq|||dqd|d|fS)zBreak up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.  N-z--r)rK startswithr]poprV)r0tokensargsr*tokenrrrrEs    rEcsDtjdd}tt}|D]}|}||qfdd}||_|S)z7 Return a parser for parsing requirement lines F)Zadd_help_optioncsd|f}t|dS)NzInvalid requirement: %s %sr)selfmsgr0rr parser_exit6s z!build_parser..parser_exit)optparseZ OptionParserSUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQZ add_optionexit)r0r`Zoption_factoriesZoption_factoryZoptionrmrrlrrC(s   rCccsd}g}|D]v\}}|dr(t|rjt|r:d|}|r^|||d|fVg}q||fVq |sr|}||dq |r|d|fVdS)zJoins a line ending in '' with the previous line (except when following comments). The joined line takes on the index of the first line. N\rc)endswith COMMENT_REmatchr]rVstrip)r.Zprimary_line_numberZnew_liner/r0rrrr6Bs     r6ccs4|D]*\}}td|}|}|r||fVqdS)z1 Strips comments and filter empty lines. rsN)rusubrw)r.r/r0rrrr7`s   r7cs2|r |jnd}|r.t|tfdd|}|S)zs Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once Ncs|dS)Nr2)rR)epatternrrvzskip_regex..)Zskip_requirements_regexrecompiler)r.r*r8rrzrr8ls  r8ccsL|D]B\}}t|D]$\}}t|}|s.q|||}q||fVqdS)aReplace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. These points are the result of a discussion on the `github pull request #3514 `_. Valid characters in variable names follow the `POSIX standard `_ and are limited to uppercase letter, digits and the `_` (underscore). N) ENV_VAR_REfindallrTgetenvreplace)r.r/r0Zenv_varZvar_namerbrrrr9zs  r9)NNNNFNN)NNNNNNF)O__doc__Z __future__rrnrTr~rJrFZpip._vendor.six.movesrZpip._vendor.six.moves.urllibrrSZpip._internal.clirZpip._internal.downloadrZpip._internal.exceptionsrZ!pip._internal.models.search_scoper Zpip._internal.req.constructorsr r Zpip._internal.utils.typingr typingr rrrrrrrZpip._internal.reqrZpip._internal.cacherZpip._internal.indexrZpip._internal.network.sessionrintZ ReqFileLines__all__rIrQrurrPZeditablerOrYrDr@Zextra_index_urlZ always_unzipZ no_binaryZ only_binaryr_Z trusted_hostrXroZinstall_optionsZglobal_optionshashrprLrr&r'rErCr6r7r8r9rrrrs        (       +  PK][_ߝCC2req/__pycache__/req_uninstall.cpython-38.opt-1.pycnu[U .e&\@s|ddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZddlmZmZmZddlmZddlmZmZmZmZmZmZmZmZmZdd lm Z m!Z!dd l"m#Z#e#r dd l$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-dd l.m/Z/e0e1Z2d dZ3ddZ4e4ddZ5ddZ6ddZ7ddZ8Gddde9Z:Gddde9Z;Gddde9Z.unique) functoolswraps)r3r4r(r2r)_unique=sr7ccstt|d}|D]t}tj|j|d}|V|drtj |\}}|dd}tj||d}|Vtj||d}|VqdS)a Yield all the uninstallation paths for dist based on RECORD-without-.py[co] Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc and .pyo in the same directory. UninstallPathSet.add() takes care of the __pycache__ .py[co]. ZRECORDr.pyN.pyc.pyo) csvreaderr Zget_metadata_linesr!r"r#locationendswithsplit)r%rrowr"Zdnr3baser(r(r)uninstallation_pathsJs   rDcsJtjjt}t|tdD]*tfdd|D}|s|q|S)zCompact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.keyc3s:|]2}|do0t|dkVqdS)*N) startswithrstriplen).0Z shortpathr"sepr(r) lszcompact..)r!r"rMr,sortedrJanyr-)pathsZ short_pathsZ should_skipr(rLr)compactbs rRc stdd|D}t|}ttdd|Dtd}t}dd|D]tfdd|DrfqJt}t}tD]B\}}|fdd|D|fd d|Dq|||sJ| || tj qJtt |j ||BS) zReturns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. css|]}tj||fVqdSr+)r!r"normcaserKpr(r(r)rN}sz&compress_for_rename..css|]}tj|dVqdS)rN)r!r"r@rTr(r(r)rNsrEcWstjtjj|Sr+)r!r"rSr#)ar(r(r) norm_joinsz&compress_for_rename..norm_joinc3s |]}tj|VqdSr+)r!r"rSrH)rKw)rootr(r)rNsc3s|]}|VqdSr+r()rKddirnamerWrYr(r)rNsc3s|]}|VqdSr+r()rKfr[r(r)rNs)dictr,rOvaluesrJrPr!walkupdatedifference_updater-rMmap __getitem__) rQZcase_mapZ remainingZ uncheckedZ wildcardsZ all_filesZ all_subdirsZsubdirsfilesr(r[r)compress_for_renamevs6    rfc Cst|}t}t}t}|D]>}|dr.q|ds@d|krR|tj|||qtttjj|}t|}|D]d}t |D]T\}} } | D]D} | drqtj || } tj | rtj| |kr|| qqq||dd|DB}||fS)asReturns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are removed. The second set contains files that would have been skipped in the above folders. r:z __init__.py .dist-infocSsh|]}tj|dqS)rG)r!r"r#)rKfolderr(r(r) sz.compress_for_output_listing..) r,r?r-r!r"r\rcrSrRr`r#isfile) rQ will_remove will_skipZfoldersrer"Z_normcased_filesrhdirpath_ZdirfilesZfnameZfile_r(r(r)compress_for_output_listings4     roc@sLeZdZdZddZddZddZdd Zd d Zd d Z e ddZ dS)StashedUninstallPathSetzWA set of file rename operations to stash files while tentatively uninstalling them.cCsi|_g|_dSr+) _save_dirs_movesselfr(r(r)__init__sz StashedUninstallPathSet.__init__cCsDz t|}Wntk r*tdd}YnX||jtj|<|jS)zStashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir. uninstallZkind)rOSErrorrrqr!r"rS)rtr"save_dirr(r(r)_get_directory_stashs  z,StashedUninstallPathSet._get_directory_stashcCstj|}tj|d}}d}||krfz|j|}WqWntk rPYnXtj||}}q"tj|}tdd}||j|<tj||}|r|tjjkrtj |j|S|jS)zStashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.Nrvrw) r!r"rSr\rqKeyErrorrrelpathcurdirr#)rtr"headZold_headryr|r(r(r)_get_file_stashs"     z'StashedUninstallPathSet._get_file_stashcCsltj|otj| }|r*||}n ||}|j||f|r^tj|r^t|t |||S)zStashes the directory or file and returns its new location. Handle symlinks as files to avoid modifying the symlink targets. ) r!r"isdirislinkrzrrrr$rmdirr)rtr"Z path_is_dirnew_pathr(r(r)stashs    zStashedUninstallPathSet.stashcCs,|jD]\}}|q g|_i|_dS)z0Commits the uninstall by removing stashed files.N)rqitemsZcleanuprr)rtrnryr(r(r)commits zStashedUninstallPathSet.commitc Cs|jD]}tjd|q|jD]\}}zTtd||tj|sPtj|r\t |ntj |rpt |t ||Wq t k r}ztd|td|W5d}~XYq Xq |dS)z2Undoes the uninstall by moving stashed files back.Moving to %s from %szReplacing %s from %szFailed to restore %sz Exception: %sN)r)rrlogginginfologgerdebugr!r"rjrunlinkrrrrxerrorr)rtrUrr"Zexr(r(r)rollback&s     z StashedUninstallPathSet.rollbackcCs t|jSr+)boolrrrsr(r(r) can_rollback:sz$StashedUninstallPathSet.can_rollbackN) __name__ __module__ __qualname____doc__rurzrrrrpropertyrr(r(r(r)rps rpc@s^eZdZdZddZddZddZdd Zdd d Zd dZ ddZ ddZ e ddZ dS)UninstallPathSetzMA set of file paths to be removed in the uninstallation of a requirement.cCs(t|_t|_i|_||_t|_dSr+)r,rQ_refusepthr%rp _moved_paths)rtr%r(r(r)ruCs zUninstallPathSet.__init__cCst|S)zs Return True if the given path is one we are permitted to remove/modify, False otherwise. )r)rtr"r(r(r) _permittedKszUninstallPathSet._permittedcCstj|\}}tjt|tj|}tj|s:dS||rR|j |n |j |tj |ddkrt r| t |dS)Nr8)r!r"r@r#rrSexistsrrQr-rsplitextr r)rtr"r~tailr(r(r)r-Ts   zUninstallPathSet.addcCsLt|}||r<||jkr*t||j|<|j||n |j|dSr+)rrrUninstallPthEntriesr-r)rtpth_fileentryr(r(r)add_pthhs   zUninstallPathSet.add_pthFc Cs|jstd|jjdS|jjd|jj}td|tp|sP||r|j}t |j}t t |D]}| |t d|ql|jD] }|qtd|W5QRXdS)z[Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).z7Can't uninstall '%s'. No files were found to uninstall.N-zUninstalling %s:zRemoving file or directory %szSuccessfully uninstalled %s)rQrrr% project_nameversionr _allowed_to_proceedrrfrOrRrrrr_remove)rtZ auto_confirmverboseZdist_name_versionZmovedZ for_renamer"rr(r(r)rrs&    zUninstallPathSet.removecCsndd}|st|j\}}nt|j}t}|d||d||d|j|r`|dt|jtddd kS) zIDisplay which files would be deleted and prompt for confirmation c SsD|sdSt|t"tt|D]}t|q&W5QRXdSr+)rrr rOrR)msgrQr"r(r(r)_displays  z6UninstallPathSet._allowed_to_proceed.._displayz Would remove:z+Would not remove (might be manually added):z%Would not remove (outside of prefix):zWill actually move:zProceed (y/n)? )ynr)rorQr,rrfr )rtrrrkrlr(r(r)rs     z$UninstallPathSet._allowed_to_proceedcCsR|jjstd|jjdStd|jj|j|j D] }|q@dS)z1Rollback the changes previously made by remove().z'Can't roll back %s; was not uninstalledNzRolling back uninstall of %s) rrrrr%rrrrr_)rtrr(r(r)rs zUninstallPathSet.rollbackcCs|jdS)z?Remove temporary save dir: rollback will no longer be possible.N)rrrsr(r(r)rszUninstallPathSet.commitc st|j}t|s.td|j|tj||S|ddt dt dhDkrhtd|j|||S||}t |}d t |j}|jotj|j}t|jdd}|r|jd r|j|s||j|d r|d D]&}tjtj|j|} || qn|d r|d rB|d ngfd d|d DD]J} tj|j| } || || d|| d|| dqbn|rtd |jn|jdr ||jtj|jd} tjtj|jd} || d| n|rP|jdrPt |D]} || q.ZstdlibZ platstdlibzsz.UninstallPathSet.from_dist..r8r:r;zCannot uninstall {!r}. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.z.eggrzeasy-install.pthz./rgrAz)Not sure how to uninstall: %s - Check: %sZscriptsz.batconsole_scripts)groupF gui_scriptsT)0rr>rrrrFsysprefix sysconfigZget_pathrformatrZ to_filenamerZegg_infor!r"rgetattrZ _providerr?r-Z has_metadataZ get_metadata splitlinesnormpathr#rr@r\rrDopenrSreadlinestriprZmetadata_isdirZmetadata_listdirr rrrZ get_entry_mapkeysextendr*)clsr%Z dist_pathr'Zdevelop_egg_linkZdevelop_egg_link_egg_infoZegg_info_existsZdistutils_egg_infoZinstalled_filer"Z top_level_pkgZeasy_install_eggZeasy_install_pthfhZ link_pointerZscriptr&Z_scripts_to_removernamersr(rr) from_dists                      zUninstallPathSet.from_distN)FF)rrrrrurr-rrrrr classmethodrr(r(r(r)r@s  rc@s,eZdZddZddZddZddZd S) rcCs0tj|std|||_t|_d|_dS)Nz.Cannot remove entries from nonexistent file %s)r!r"rjrfiler,entries _saved_lines)rtrr(r(r)ruIs zUninstallPthEntries.__init__cCs<tj|}tr,tj|ds,|dd}|j|dS)Nr\/)r!r"rSr splitdrivereplacerr-)rtrr(r(r)r-Ss  zUninstallPthEntries.addc Cstd|jt|jd}|}||_W5QRXtdd|DrLd}nd}|r~|d|ds~|d|d|d<|j D]>}z$td || ||dWqt k rYqXqt|jd }| |W5QRXdS) NzRemoving pth entries from %s:rbcss|]}d|kVqdS)s Nr()rKliner(r(r)rNjsz-UninstallPthEntries.remove..z  zutf-8zRemoving entry: %swb) rrrr readlinesrrPr?encoderr ValueError writelines)rtrlinesZendlinerr(r(r)rcs"  zUninstallPthEntries.removec CsR|jdkrtd|jdStd|jt|jd}||jW5QRXdS)Nz.Cannot roll back changes to %s, none were madeFz!Rolling %s back to previous staterT)rrrrrrr)rtrr(r(r)rzs zUninstallPthEntries.rollbackN)rrrrur-rrr(r(r(r)rHs r)=Z __future__rr<r5rr!rrZ pip._vendorrZpip._internal.exceptionsrZpip._internal.locationsrrZpip._internal.utils.compatrrr Zpip._internal.utils.loggingr Zpip._internal.utils.miscr r r rrrrrrZpip._internal.utils.temp_dirrrZpip._internal.utils.typingrtypingrrrrrrrrrZpip._vendor.pkg_resourcesr Z getLoggerrrr*r7rDrRrfroobjectrprrr(r(r(r)s<    ,  ,    (3o PK]=N  'req/__pycache__/__init__.cpython-38.pycnu[U ʗRe @sddlZddlZddlmZmZmZmZmZddlm Z ddl m Z ddl m Z ddlmZdd d d gZeeZGd d d Zee eeee fddfdddZee eeeeeeeeeeeeeeed dd ZdS)N) GeneratorListOptionalSequenceTuple) indent_log)parse_requirements)InstallRequirement)RequirementSetr r r install_given_reqsc@s*eZdZeddddZedddZdS)InstallationResultN)namereturncCs ||_dS)Nr)selfrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/__init__.py__init__szInstallationResult.__init__)rcCsd|jdS)NzInstallationResult(name=)r)rrrr__repr__szInstallationResult.__repr__)__name__ __module__ __qualname__strrrrrrrr sr ) requirementsrccs.|D]$}|jstd||j|fVqdS)Nz%invalid to-be-installed requirement: )rAssertionError)rreqrrr_validate_requirementssr) rinstall_optionsglobal_optionsroothomeprefixwarn_script_location use_user_site pycompilerc  Cstt|} | r(tdd| g} t| D]\} } | j rvtd| t| j dd} W5QRXnd} z| j ||||||||dWn(t k r| r| j s| YnX| r| j r| | t| qs6       PK]sL%0%0+req/__pycache__/constructors.cpython-38.pycnu[U ʗRe@ @sdZddlZddlZddlZddlmZmZmZmZm Z m Z ddl m Z ddl mZmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)dddgZ*e+e,Z-ej./Z0e1e e1ee1fdddZ2ee1ee1dddZ3e1e ee1e1ee1fdddZ4e1ddddZ5e1e1d d!d"Z6Gd#d$d$Z7e1e7dd%d&Z8d>e1ee ee1fee9e9eee1efe9e9e9eee1e1fed( d)dZ:e1e9d*d+d,Z;e1e1ee1d-d.d/Zd@e1eee9ee9e9eee1e1fed5d6d7Z?dAee9ee9e9eee1e1fed8d9d:Z@eeed;d~s z2check_first_requirement_in_file..css|]}|VqdSN)striprCr&r&r'rFsz #N\)openfindendswithrHnextr )r>flinesrEr&r&r'check_first_requirement_in_filess   rR)reqrcCs^tj|sd|dSd}z t|Wn tk rHtd|YnX|d|d7}|S)zReturns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path z File 'z' does not exist.z The path does exist. z&Cannot parse '%s' as requirements filezThe argument you provided (zx) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.)r0rexistsrRr loggerdebug)rSmsgr&r&r'deduce_helpful_msgs    rXc@s0eZdZeeeeeeeedddZ dS)RequirementParts requirementr<markersr$cCs||_||_||_||_dSrGrZ)selfr[r<r\r$r&r&r'__init__szRequirementParts.__init__N) __name__ __module__ __qualname__rr rrrstrr^r&r&r&r'rYs rYcCsdt|\}}}|dk rJz t|}WqNtk rFtd|dYqNXnd}t|}t||d|S)NInvalid requirement: '')rr r r rrY)r-namer8extras_overriderSr<r&r&r'parse_req_from_editables rgF) r- comes_from use_pep517isolatedoptions constraint user_suppliedpermit_editable_wheelsconfig_settingsrc Csbt|} t| j||d|| j||||r0|dgng|rB|dgng|rT|dini|| jdS)NTinstall_optionsglobal_optionshashes) rhrmeditablernr<rlrirjrprq hash_optionsror$)rgrr[r<getr$) r-rhrirjrkrlrmrnropartsr&r&r'rs" )rercCs>tjj|krdStjjdk r,tjj|kr,dS|dr:dSdS)akChecks whether the string "looks like" a path on the filesystem. This does not check whether the target actually exists, only judge from the appearance. Returns true if any of the following conditions is true: * a path separator is found (either os.path.sep or os.path.altsep); * a dot is found (which represents the current directory). TN.F)r0rsepaltsepr2)rer&r&r'_looks_like_paths  rz)rrercCst|r4tj|r4t|r$t|Std|dt|s@dStj|rTt|S| dd}t |dkr|t|ds|dSt d|t|S) aK First, it checks whether a provided path is an installable directory. If it is, returns the path. If false, check if the path is an archive file (such as a .whl). The function checks if the path is a file. If false, if the path has an @, it will treat it as a PEP 440 URL requirement and return the path. z Directory zC is not installable. Neither 'setup.py' nor 'pyproject.toml' found.N@rrrzARequirement %r looks like a filename, but the file does not exist) rzr0rr1rrr risfilesplitlenrUwarning)rre urlreq_partsr&r&r'_get_url_from_paths$    r)re line_sourcercsnt|rd}nd}||krF||d\}}|}|s.with_source) req_as_stringrcsz t}Wntk rtjjkr:d}|t7}n(dkr^tfddtDs^d}nd}d}|r|d|7}t|Yn4X|j D]*}t |}| d rd |d }t|q|S) NzIt looks like a path.=c3s|]}|kVqdSrGr&)rDoprr&r'rFZszAparse_req_from_line.._parse_req_string..z,= is not a valid operator. Did you mean == ?rKzInvalid requirement: z Hint: ]zExtras after version 'z'.) rr r0rrxrXany operatorsr specifierrbrN)rrSadd_msgrWspecspec_str)rrr'_parse_req_stringSs*      z.parse_req_from_line.._parse_req_string)rr}rHrr0rnormpathabspathrr(rschemer searchr8ris_wheelrr>reversionr3r,rbr rY)rer marker_sepmarkers_as_stringr\rrr<extras_as_stringpr8wheelr$rrSr&)rrr'parse_req_from_linesH       r) rerhrirjrkrlrrmrorc Csdt||} t| j|| j| j|||r.|dgng|r@|dgng|rR|dini||| j|d S)aCreates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. :param line_source: An optional string describing where the line is from, for logging purposes in case of an error. rprqrr) r<r\rirjrprqrtrorlr$rm)rrr[r<r\rur$) rerhrirjrkrlrrmrorvr&r&r'rxs  ) req_stringrhrjrirmrorcCsz t|}Wn$tk r0td|dYnXtjtjg}|jrl|rl|jrl|jj|krltd |j |t ||||||dS)NrcrdzkPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI. {} depends on {} )rjrirmro) rr r r file_storage_domainrr8r<netlocr7rer)rrhrjrirmrorSdomains_not_allowedr&r&r'install_req_from_req_strings:  r) parsed_reqrjrirmrorc CsL|jr$t|j|j||j|||d}n$t|j|j|||j|j|j||d }|S)N)rhrirlrjrmro)rhrirjrkrlrrmro) is_editablerr[rhrlrrkr)rrjrirmrorSr&r&r'#install_req_from_parsed_requirements,  r)r<ireqrcCs6t|j|j|j||j|j|j|j|j|j |j |j d S)N) rSrhrsr<r\rirjrprqrtrorm) rrSrhrsr\rirjrprqrtrorm)r<rr&r&r'install_req_from_link_and_ireqsr)NNFNFFFN)NNFNFNFN)NFNFN)FNFN)B__doc__loggingr0r typingrrrrrrZpip._vendor.packaging.markersr"pip._vendor.packaging.requirementsr r Z pip._vendor.packaging.specifiersr pip._internal.exceptionsr pip._internal.models.indexr rpip._internal.models.linkrpip._internal.models.wheelrZpip._internal.req.req_filerZpip._internal.req.req_installrpip._internal.utils.filetypesrpip._internal.utils.miscrpip._internal.utils.packagingrpip._internal.utils.urlsrpip._internal.vcsrr__all__ getLoggerr_rU _operatorskeysrrbr(r,rrRrXrYrgboolrrzrrrrrrr&r&r&r's                "7 "\ & * "PK]Mt(t(1req/__pycache__/constructors.cpython-38.opt-1.pycnu[U .e48@sdZddlZddlZddlZddlmZddlmZmZddl m Z ddl m Z m Z ddlmZddlmZmZdd lmZdd lmZdd lmZdd lmZdd lmZmZddlmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&erddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/dddgZ0e1e2Z3e j45Z6ddZ7ddZ8ddZ9ddZ:ddZ;Gd d!d!e<Z=d"d#Z>d/d%dZ?d&d'Z@d(d)ZAd*d+ZBd0d,dZCd1d-d.ZDdS)2a~Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used elsewhere within pip to create instances of InstallRequirement. N)Marker)InvalidRequirement Requirement) Specifier)RequirementParseErrorparse_requirements)InstallationError)PyPITestPyPI)Link)make_pyproject_path)InstallRequirement)ARCHIVE_EXTENSIONS)is_installable_dirsplitext)MYPY_CHECK_RUNNING) path_to_url)is_urlvcs)Wheel)AnyDictOptionalSetTupleUnion) WheelCacheinstall_req_from_editableinstall_req_from_lineparse_editablecCs t|d}|tkrdSdS)z9Return True if `name` is a considered as an archive file.TF)rlowerr)nameZextr#B/usr/lib/python3.8/site-packages/pip/_internal/req/constructors.pyis_archive_file4sr%cCs6td|}d}|r*|d}|d}n|}||fS)Nz^(.+)(\[[^\]]+\])$r )rematchgroup)pathmextrasZpath_no_extrasr#r#r$ _strip_extras=s   r-cCs|s tStd|jS)N placeholder)setrr!r,)r,r#r#r$convert_extrasJsr0c Cs`|}t|\}}tj|rptjtj|dshdtj|}t|}tj |r`|d7}t |t |}| drt|j}|r||td| jfS||dfStD]&}| d|rd||f}qqd |krt d ||d d d  }t|s:d |dddtjDd} t | t|j}|sVt d|||dfS)aParses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir .[some_extra] zsetup.pyzMFile "setup.py" not found. Directory cannot be installed in editable mode: {}zb (A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)zfile:r.Nz%s:z%s+%s+z{} is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).r rzFor --editable=%s only z, cSsg|]}|jdqS)z+URLr").0Zbackendr#r#r$ sz"parse_editable..z is currently supportedzZCould not detect requirement name for '%s', please specify one with #egg=your_package_name)r-osr*isdirexistsjoinformatabspathr isfilerrr! startswithr egg_fragmentrr,rsplitZ get_backendZbackends) editable_requrlZ url_no_extrasr,msgZpyproject_pathZ package_nameZversion_controlZvc_typeZ error_messager#r#r$rQsb          c Csd}tj|rd}zFt|d2}tt||dd|ddd7}W5QRXWqtk rtj d |d d YqXn |d |7}|S) zReturns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path z It does exist.rz The argument you provided z(%s) appears to be az" requirements file. If that is thez# case, use the '-r' flag to installz" the packages specified within it.z2Cannot parse '%s' as requirements fileT)exc_infoz File '%s' does not exist.) r5r*r7opennextrreadrloggerdebug)reqrAfpr#r#r$deduce_helpful_msgs.   rLc@seZdZddZdS)RequirementPartscCs||_||_||_||_dSN) requirementlinkmarkersr,)selfrOrPrQr,r#r#r$__init__szRequirementParts.__init__N)__name__ __module__ __qualname__rSr#r#r#r$rMsrMcCs`t|\}}}|dk rFz t|}WqJtk rBtd|YqJXnd}t|}t||d|S)NInvalid requirement: '%s')rrrrr rM)r?r"r@Zextras_overriderJrPr#r#r$parse_req_from_editables rXFc CsLt|}|jjdkr|jjnd}t|j||d|j||||r>|ni||jd S)NfileT) source_dirZeditablerP constraint use_pep517isolatedoptions wheel_cacher,)rXrPschemeZ file_pathr rOr,) r? comes_fromr\r]r^r_r[partsrZr#r#r$rs  cCs>tjj|krdStjjdk r,tjj|kr,dS|dr:dSdS)akChecks whether the string "looks like" a path on the filesystem. This does not check whether the target actually exists, only judge from the appearance. Returns true if any of the following conditions is true: * a path separator is found (either os.path.sep or os.path.altsep); * a dot is found (which represents the current directory). TN.F)r5r*sepaltsepr<r2r#r#r$_looks_like_paths  rfcCst|r0tj|r0t|r$t|Std|t|slenrHZwarning)r*r"Z urlreq_partsr#r#r$_get_url_from_path s(   ricst|rd}nd}||krF||d\}}|}|s.with_sourcezIt looks like a path.=c3s|]}|kVqdSrNr#)r3op) req_as_stringr#r$ jsz&parse_req_from_line..z,= is not a valid operator. Did you mean == ?rBzInvalid requirement: {!r}z Hint: {}) rr>striprr5r*normpathr:r r-rir`r'searchr@rZis_wheelrfilenamer"versionr=r0rrrdrLany operatorsr9rrM)r"rlZ marker_sepZmarkers_as_stringrQr*rPZextras_as_stringpr@Zwheelr,rmrJZadd_msgrAr#)rlrpr$parse_req_from_line+sj         rzc Cs6t||}t|j||j|j|||r&|ni|||jd S)aCreates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. :param line_source: An optional string describing where the line is from, for logging purposes in case of an error. )rPrQr\r]r^r_r[r,)rzr rOrPrQr,) r"rar\r]r^r_r[rlrbr#r#r$rzs  cCszz t|}Wn tk r,td|YnXtjtjg}|jrh|rh|jrh|jj|krhtd|j |ft |||||dS)NrWzkPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI. %s depends on %s )r]r_r\) rrrr Zfile_storage_domainr r@rPZnetlocr"r )Z req_stringrar]r_r\rJZdomains_not_allowedr#r#r$install_req_from_req_strings,  r{)NNFNNF)NNFNNFN)NFNN)E__doc__Zloggingr5r'Zpip._vendor.packaging.markersrZ"pip._vendor.packaging.requirementsrrZ pip._vendor.packaging.specifiersrZpip._vendor.pkg_resourcesrrZpip._internal.exceptionsrZpip._internal.models.indexr r Zpip._internal.models.linkr Zpip._internal.pyprojectr Zpip._internal.req.req_installr Zpip._internal.utils.filetypesrZpip._internal.utils.miscrrZpip._internal.utils.typingrZpip._internal.utils.urlsrZpip._internal.vcsrrZpip._internal.wheelrtypingrrrrrrZpip._internal.cacher__all__Z getLoggerrTrHZ _operatorskeysrxr%r-r0rrLobjectrMrXrrfrirzrr{r#r#r#r$sr                J "Q PK]5%yR *req/__pycache__/req_tracker.cpython-38.pycnu[U .e{ @sddlmZddlZddlZddlZddlZddlZddlmZddl m Z e rddl m Z ddl mZmZmZmZddlmZddlmZeeZGd d d eZdS) )absolute_importN) TempDirectory)MYPY_CHECK_RUNNING) TracebackType)IteratorOptionalSetType)InstallRequirement)Linkc@sReZdZddZddZddZddZd d Zd d Zd dZ e j ddZ dS)RequirementTrackercCsjtjd|_|jdkrJtddd|_|jj|_tjd<td|jnd|_td|jt |_ dS)NZPIP_REQ_TRACKERFz req-tracker)deleteZkindzCreated requirements tracker %rz Re-using requirements tracker %r) osenvironget_rootr _temp_dirpathloggerdebugset_entriesselfrA/usr/lib/python3.8/site-packages/pip/_internal/req/req_tracker.py__init__s zRequirementTracker.__init__cCs|SNrrrrr __enter__&szRequirementTracker.__enter__cCs |dSr)cleanup)rexc_typeZexc_valZexc_tbrrr__exit__*szRequirementTracker.__exit__cCs$t|j}tj|j|Sr) hashlibZsha224Zurl_without_fragmentencodeZ hexdigestrrjoinr)rlinkZhashedrrr _entry_path3szRequirementTracker._entry_pathc Cs|j}t|}||}z,t|}td||fW5QRXWnztk r}z\|jtjkrd||j ksrt t|d}| |W5QRX|j |t d||jW5d}~XYnXdS)Nz%s is already being built: %swzAdded %s to build tracker %r)r%strr&open LookupErrorreadIOErrorerrnoZENOENTrAssertionErrorwriteaddrrr)rreqr%infoZ entry_pathfperrrr08s       zRequirementTracker.addcCs6|j}|j|t||td||jdS)Nz Removed %s from build tracker %r) r%rremoverunlinkr&rrr)rr1r%rrrr5Ks zRequirementTracker.removecCsNt|jD]}||q |jdk }|r2|jtd|r@dnd|jdS)Nz%s build tracker %rZRemovedZCleaned)rrr5rrrrr)rr1r5rrrrRs    zRequirementTracker.cleanupccs||dV||dSr)r0r5)rr1rrrtrack]s zRequirementTracker.trackN) __name__ __module__ __qualname__rrr!r&r0r5r contextlibcontextmanagerr7rrrrr s   r )Z __future__rr;r-r"ZloggingrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrtypesrtypingrrrr Zpip._internal.req.req_installr Zpip._internal.models.linkr Z getLoggerr8robjectr rrrrs       PK]ޏǸXX*req/__pycache__/req_install.cpython-38.pycnu[U ʗRe@s4ddlZddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZddlmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZm Z dd l!m"Z"m#Z#dd l$m%Z%dd l&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m2Z6ddl7m8Z9ddl:m;Z<ddl=m>Z>ddl?m@Z@mAZAddlBmCZCddlDmEZEddlFmGZGmHZHddlImJZJddlKmLZLmMZMmNZNmOZOmPZPmQZQddlRmSZSddlTmUZUddlVmWZWmXZXddlYmZZZdd l[m\Z\e]e^Z_Gd!d"d"Z`e`ead#d$d%ZbdS)&N)Any CollectionDictIterableListOptionalSequenceUnion)Marker) Requirement) SpecifierSet)canonicalize_name)Version)parse)Pep517HookCaller)BuildEnvironmentNoOpBuildEnvironment)InstallationErrorLegacyInstallFailure) get_scheme)BaseDistributionget_default_environmentget_directory_distributionget_wheel_distribution)FilesystemWheel) DirectUrl)Link)generate_metadata)generate_editable_metadata)install_editable)install) install_wheel)load_pyproject_tomlmake_pyproject_path)UninstallPathSet) deprecated)direct_url_for_editabledirect_url_from_link)Hashes)ConfiguredPep517HookCallerask_path_exists backup_dir display_pathhide_urlredact_auth_from_url safe_extra)runner_with_spinner_message) TempDirectory tempdir_kinds)running_under_virtualenv)vcsc@seZdZdZdSeeeeedfeee ee eeeee eee eee ee efee eefee eeeddddZedd d Zedd d Zedd dZeeedddZeedddZeedddZeedddZdTeeeedddZeedddZdUeedddZeedd d!Zeeeed"d#d$Z ddd%d&Z!ddd'd(Z"edd)d*d+Z#eedd,d-Z$eedd.d/Z%eedd0d1Z&eedd2d3Z'eedd4d5Z(ddd6d7Z)ddd8d9Z*ddd:d;Z+ee,ddd?Z/ddd@dAZ0dVeeeddBdCdDZ1dddEdFZ2dWeeee3dGdHdIZ4eeeedJdKdLZ5eeddMdNdOZ6dXe eee7eeeeeeeeeeddP dQdRZ8dS)YInstallRequirementz Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. FN)req comes_fromeditablelinkmarkers use_pep517isolatedinstall_optionsglobal_options hash_optionsconfig_settings constraintextras user_suppliedpermit_editable_wheelsreturncCs|dkst|tst|||_||_| |_||_||_d|_d|_ |jrp|sRt|j rpt j t j |j|_ |dkr|r|jrt|j}||_|_d|_d|_d|_|jr|jj r|jj|_| r| |_n |rdd|jD|_nt|_|dkr|r|j}||_d|_d|_d|_d|_|r,|ng|_| r<| ng|_ | rL| ni|_!| |_"d|_#||_$||_%t&|_'d|_(d|_)g|_*d|_+||_,d|_-dS)NFcSsh|] }t|qSr7r/.0extrar7r7/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_install.py sz.InstallRequirement.__init__..). isinstancer AssertionErrorr8r9rCr:rFlegacy_install_reason source_diris_fileospathnormpathabspath file_pathurlrr; original_linkoriginal_link_is_in_wheel_cache download_infolocal_file_pathrDsetmarkerr< satisfied_byshould_reinstall_temp_build_dirinstall_succeededr?r@rArBpreparedrEr>r build_envmetadata_directorypyproject_requiresrequirements_to_checkpep517_backendr=needs_more_preparation)selfr8r9r:r;r<r=r>r?r@rArBrCrDrErFr7r7rK__init__Ks\   zInstallRequirement.__init__)rGcCs|jr.t|j}|jrF|dt|jj7}n|jrBt|jj}nd}|jdk rf|dt|jj7}|j rt |j tr|j }n |j }|r|d|d7}|S)Nz from {}zz in {}z (from )) r8strr;formatr.rWr^r,locationr9rM from_pathrisr9r7r7rK__str__s     zInstallRequirement.__str__cCsd|jjt||jS)Nz<{} object: {} editable={!r}>)rm __class____name__rlr:rir7r7rK__repr__s zInstallRequirement.__repr__cs>t|t}fddt|D}dj|jjd|dS)z5An un-tested helper for getting state, for debugging.c3s|]}d||VqdS)z{}={!r}N)rm)rIattr attributesr7rK sz2InstallRequirement.format_debug..z<{name} object: {{{state}}}>z, )namestate)varssortedrmrsrtjoin)rinamesr|r7rxrK format_debugszInstallRequirement.format_debugcCs|jdkrdS|jjSN)r8r{rur7r7rKr{s zInstallRequirement.namec Csl|js dS|jst|jHtd}|j|(d|jkW5QRW5QRSQRXW5QRXdS)NFz1Checking if build backend supports build_editablebuild_editable)r=rgrNrcr1subprocess_runner_supported_features)rirunnerr7r7rKsupports_pyproject_editables z.InstallRequirement.supports_pyproject_editablecCs|jjSr)r8 specifierrur7r7rKrszInstallRequirement.specifiercCs$|j}t|dko"tt|jdkS)zReturn whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. >=====)rlennextiteroperator)ri specifiersr7r7rK is_pinnedszInstallRequirement.is_pinned)extras_requestedrGcs0|sd}jdk r(tfdd|DSdSdS)N)c3s|]}jd|iVqdS)rJN)r<evaluaterHrur7rKrzsz3InstallRequirement.match_markers..T)r<any)rirr7rurK match_markerss  z InstallRequirement.match_markerscCs t|jS)zReturn whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. )boolrArur7r7rKhas_hash_options sz#InstallRequirement.has_hash_optionsT)trust_internetrGcCsB|j}|r|jn|j}|r:|jr:||jg|jt|S)aReturn a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() ) rAcopyr;rXhash setdefault hash_nameappendr()rir good_hashesr;r7r7rKhashess   zInstallRequirement.hashescCsP|jdkrdSt|j}|jrLt|jtr2|j}n |j}|rL|d|7}|S)z8Format a nice indicator to show where this "comes from" Nz->)r8rlr9rMrorpr7r7rKro)s     zInstallRequirement.from_path) build_dir autodeleteparallel_buildsrGcCs|dk s t|jdk r*|jjs"t|jjS|jdkrLttjdd|_|jjSt|j}|rn|dt j }t j |std|t |t j||}|rdnd}t||tjddjS)NT)kindglobally_managed_zCreating directory %sF)rSdeleterr)rNr`rSr8r2r3 REQ_BUILDr r{uuiduuid4hexrRexistsloggerdebugmakedirsr)rirrrdir_nameactual_build_dir delete_argr7r7rKensure_build_location7s0         z(InstallRequirement.ensure_build_locationcCsn|jdkst|jdk st|jdk s*ttt|jdtrDd}nd}td|jd||jdg|_dS)z*Set requirement after generating metadata.NrrrrName) r8rNmetadatarPrM parse_versionrr r)riopr7r7rK_set_requirementbsz#InstallRequirement._set_requirementcCsDt|jd}t|jj|kr"dStd|j||jt||_dS)NrzeGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.)r rr8r{rwarningr )ri metadata_namer7r7rKwarn_on_mismatching_namexsz+InstallRequirement.warn_on_mismatching_name) use_user_siterGcCs|jdkrdSt|jj}|s&dS|jjj|jdd}|sd|_|r||jrVd|_ qt r|j rt d|j d|jq|jrd|_ n|jrd|_ d|_n||_dS)zFind an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. NT) prereleaseszNWill not install to the user site because it will lack sys.path precedence to z in )r8rget_distributionr{rcontainsversionr^ in_usersiter_r4in_site_packagesrraw_namernin_install_pathr:)rir existing_distversion_compatibler7r7rKcheck_if_existss0  z"InstallRequirement.check_if_existscCs|js dS|jjS)NF)r;is_wheelrur7r7rKrszInstallRequirement.is_wheelcCstj|j|jr|jjpdS)Nr)rRrSrrPr;subdirectory_fragmentrur7r7rKunpacked_source_directorysz,InstallRequirement.unpacked_source_directorycCs(|jstd|tj|jd}|S)NNo source dir for zsetup.pyrPrNrRrSrr)risetup_pyr7r7rK setup_py_pathsz InstallRequirement.setup_py_pathcCs(|jstd|tj|jd}|S)Nrz setup.cfgr)ri setup_cfgr7r7rKsetup_cfg_pathsz!InstallRequirement.setup_cfg_pathcCs|jstd|t|jS)Nr)rPrNr#rrur7r7rKpyproject_toml_pathsz&InstallRequirement.pyproject_toml_pathcCs`t|j|j|jt|}|dkr*d|_dSd|_|\}}}}||_||_t||j||d|_ dS)aALoad the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we should follow the PEP 517 or legacy (setup.py) code path. NFT) backend_path) r"r=rrrlrfrer)rrg)ripyproject_toml_datarequiresbackendcheckrr7r7rKr"s& z&InstallRequirement.load_pyproject_tomlcCsD|jr@|jr@|s@tj|js@tj|js@td|ddS)zCheck that an editable requirement if valid for use with PEP 517/518. This verifies that an editable that has a pyproject.toml either supports PEP 660 or as a setup.py or a setup.cfg zProject z has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.N) r:r=rrRrSisfilerrrrur7r7rKisolated_editable_sanity_checks   z1InstallRequirement.isolated_editable_sanity_checkcCs|js t|jpd|j}|jrp|jdk s0t|jrZ|jrZ|rZt |j |j|d|_ qt |j |j|d|_ nt |j |j|j|j|d|_ |js|n||dS)zEnsure that project metadata is available. Under PEP 517 and PEP 660, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. zfrom N)rcrdetails)rcrrPr>r)rPrNr{r;r=rgr:rFrrrcrdrgenerate_metadata_legacyrrr>rrassert_source_matches_version)rirr7r7rKprepare_metadatas>     z#InstallRequirement.prepare_metadatacCst|ds|j|_|jS)N _metadata)hasattrget_distrrrur7r7rKr+s  zInstallRequirement.metadatacCsF|jrt|jS|jr2|jr2tt|jt|jStd|ddS)NzInstallRequirement zC has no metadata directory and no wheel: can't make a distribution.) rdrr[rrrr r{rNrur7r7rKr2s   zInstallRequirement.get_distcCsR|js t|jd}|jjr8||jjkr8td||ntdt|j||dS)Nrz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s) rPrNrr8rrrrr,)rirr7r7rKr>s  z0InstallRequirement.assert_source_matches_version) parent_dirrrrGcCs |jdkr|j|||d|_dS)aAEnsure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir N)rr)rPr)rirrrr7r7rKensure_has_source_dirPs  z(InstallRequirement.ensure_has_source_dircCs|jstd|jdS|js"t|js,t|jjdkrCannot update repository at %s; repository location is unknownfilezUnsupported VCS URL r)rW verbosity) r;rrrPr:rNschemer5get_backend_for_schemerWr-obtain)ri vcs_backend hidden_urlr7r7rKupdate_editablegs    z"InstallRequirement.update_editable) auto_confirmverboserGcCsV|js tt|jj}|s0td|jdStd|t |}| |||S)a Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. z#Skipping %s as it is not installed.NzFound existing installation: %s) r8rNrrr{rrinfor$ from_distremove)rirrdistuninstalled_pathsetr7r7rK uninstall{s    zInstallRequirement.uninstall)rS parentdirrootdirrGcCs8tttddd}tj||}|||}|jd|S)N)r{prefixrGcSsN||tjjs&td|d||t|dd}|tjjd}|S)Nzname z doesn't start with prefix r/) startswithrRrSseprNrreplace)r{rr7r7rK_clean_zip_names z=InstallRequirement._get_archive_name.._clean_zip_namer)rlrRrSrr{)rirSrrrr{r7r7rK_get_archive_names z$InstallRequirement._get_archive_name)rrGc Cs|js t|dkrdSd}d|j|jd}tj||}tj|rt dt |d}|dkrjd}nj|d krt d t |t |nF|d krt|}t d t |t |t||n|d krtd|sdStj|d tjdd}|tjtj|j}t|D]~\} } } | D]6} |j| | |d} t| d}d|_||dq$| D]0}|j|| |d}tj| |}|||q`qW5QRXt dt |dS)z}Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. NTz {}-{}.ziprz8The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)bort )iwbarFrz Deleting %srzBacking up %s to %sr) allowZip64)rrrirzSaved %s) rPrNrmr{rrRrSrrr*r,rrrr+shutilmovesysexitzipfileZipFile ZIP_DEFLATEDnormcaserUrwalkrZipInfo external_attrwritestrwriter)rircreate_archive archive_name archive_pathresponse dest_file zip_outputdirdirpathdirnames filenamesdirname dir_arcnamezipdirfilename file_arcnamer7r7rKarchivesr    zInstallRequirement.archive) r?r@roothomerwarn_script_locationr pycompilerGc Cst|j||||j|d} |dk r$|ng}|jrd|jsdt||||||j|j|j|j|jd d|_ dS|jr|j stt d} |jrt |j} n|j rt|j |j|j} t|j|j | t|j||| |jdd|_ dSt||j}t||j}z8t|||||||| |j|j|j|j|jt|jd} WnJtk rR} zd|_ | W5d} ~ XYntk rnd|_ YnX| |_ | r|jdkrtd|jd ddd dS) N)userrrr>r)rrrr{rr>rcrT)rreq_descriptionr!r  direct_url requested)r?r@rrrrr!rrr>req_namercrr#Fi zg{} was installed using the legacy 'setup.py install' method, because a wheel could not be built for it.z+to fix the wheel build issue reported abovereason replacementgone_inissue)rr{r>r:rinstall_editable_legacyrrcrrar[rNr&rXr'rPrYr!rlr8rElistr@r?install_legacyr ExceptionrOr%rm) rir?r@rrrr rr!rr$successexcr7r7rKr s         zInstallRequirement.install) FNNNFNNNNFr7FF)N)T)FF)FF)NNNNTFT)9rt __module__ __qualname____doc__rr r rlrrr rrrrjrrrvrpropertyr{ functools lru_cacherr rrrrrr(rrorrrrrrrrrr"rrrrrrrrrr$rrrrr r7r7r7rKr6Ds    o     +&,    F r6)r8rGcCs>d}|jsd}n|jrd}n |jr&d}|r:tddddd|S) Nrz3Unnamed requirements are not allowed as constraintsz4Editable requirements are not allowed as constraintszConstraints cannot have extrasaConstraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms.z+replacing the constraint with a requirementi r')r{r:rDr%)r8problemr7r7rKcheck_invalid_constraint_typeUsr9)cr6loggingrRrrrrtypingrrrrrrrr Zpip._vendor.packaging.markersr "pip._vendor.packaging.requirementsr Z pip._vendor.packaging.specifiersr pip._vendor.packaging.utilsr Zpip._vendor.packaging.versionrrrZpip._vendor.pep517.wrappersrpip._internal.build_envrrpip._internal.exceptionsrrpip._internal.locationsrpip._internal.metadatarrrrZpip._internal.metadata.baserpip._internal.models.direct_urlrpip._internal.models.linkr'pip._internal.operations.build.metadatar0pip._internal.operations.build.metadata_editabler.pip._internal.operations.build.metadata_legacyr0pip._internal.operations.install.editable_legacyrr,'pip._internal.operations.install.legacyr r.&pip._internal.operations.install.wheelr!pip._internal.pyprojectr"r#pip._internal.req.req_uninstallr$pip._internal.utils.deprecationr%&pip._internal.utils.direct_url_helpersr&r'pip._internal.utils.hashesr(pip._internal.utils.miscr)r*r+r,r-r.pip._internal.utils.packagingr0pip._internal.utils.subprocessr1pip._internal.utils.temp_dirr2r3pip._internal.utils.virtualenvr4pip._internal.vcsr5 getLoggerrtrr6rlr9r7r7r7rKs^(                          PK](nII,req/__pycache__/req_uninstall.cpython-38.pycnu[U ʗRe]@sddlZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZddlmZdd lmZmZdd lmZm Z m!Z!m"Z"m#Z#dd l$m%Z%m&Z&ee'Z(e)e)e*e e)ddfd d dZ+ede eddffede eddffdddZ,e,ee e)ddfdddZ-e e)ee)dddZ.e e)ee)dddZ/e e)eee)ee)fdddZ0GdddZ1Gdd d Z2Gd!d"d"Z3dS)#N)cache_from_source) AnyCallableDict GeneratorIterableListOptionalSetTuple)UninstallationError)get_bin_prefix get_bin_user)BaseDistribution)WINDOWS)egg_link_path_from_location) getLogger indent_log)askis_localnormalize_pathrenamesrmtree)AdjacentTempDirectory TempDirectory)bin_dir script_nameis_guireturnccsVtj||}|VtsdS|dV|dV|rF|dVn |dVdS)zCreate the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names Nz.exez .exe.manifestz -script.pywz -script.py)ospathjoinr)rrrexe_namer#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py _script_namess  r%.)fnrcs.tttttddfdfdd }|S)N)argskwrc?s2t}||D]}||kr|||VqdSN)setadd)r'r(seenitemr&r#r$unique*s  z_unique..unique) functoolswrapsrr)r&r/r#r.r$_unique's"r2distrc cs|j}|dk std|}|dkrzdj|d}|j}|rD|dkrdd|j|j}|d|7}n|d|7}t||D]n}tj ||}|V| d r~tj |\}} | dd } tj || d }|Vtj || d }|Vq~dS) a Yield all the uninstallation paths for dist based on RECORD-without-.py[co] Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc and .pyo in the same directory. UninstallPathSet.add() takes care of the __pycache__ .py[co]. If RECORD is not found, raises UninstallationError, with possible information from the INSTALLER file. https://packaging.python.org/specifications/recording-installed-packages/ Nz not installedz/Cannot uninstall {dist}, RECORD file not found.)r4pipz{}=={}zZ You might be able to recover from this via: 'pip install --force-reinstall --no-deps {}'.z' Hint: The package was installed by {}..py.pyc.pyo) locationAssertionErroriter_declared_entriesformat installerraw_nameversionr rr r!endswithsplit) r4r:entriesmsgr>depentryr dnr&baser#r#r$uninstallation_paths5s2    rI)pathsrcsJtjjt}t|tdD]*tfdd|D}|s|q|S)zCompact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.keyc3s:|]2}|do0t|dkVqdS)*N) startswithrstriplen).0 shortpathr sepr#r$ jszcompact..)rr rTr*sortedrPanyr+)rJ short_paths should_skipr#rSr$compactas rZc sdd|D}t|}tdd|Dtd}t}ttddd|D]tfd d |DrfqJt}t}tD]B\}}|fd d |D|fd d |Dq|||sJ| || tj qJtt |j ||BS) zReturns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. cSsi|]}tj||qSr#)rr normcaserQpr#r#r$ zs z'compress_for_rename..cSsh|]}tj|dqS)r)rr rBr\r#r#r$ |sz&compress_for_rename..rK)arcWstjtjj|Sr))rr r[r!)r`r#r#r$ norm_joinsz&compress_for_rename..norm_joinc3s |]}tj|VqdSr))rr r[rN)rQw)rootr#r$rUsz&compress_for_rename..c3s|]}|VqdSr)r#)rQddirnamerarcr#r$rUsc3s|]}|VqdSr)r#)rQfrer#r$rUs)r*rVvaluesrPstrrWrwalkupdatedifference_updater+rTmap __getitem__) rJcase_map remaining unchecked wildcards all_files all_subdirssubdirsfilesr#rer$compress_for_renamets" rwc Cst|}t}t}t}|D]>}|dr.q|ds@d|krR|tj|||qtttjj|}t|}|D]d}t |D]T\}} } | D]D} | drqtj || } tj | rtj| |kr|| qqq||dd|DB}||fS)asReturns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are removed. The second set contains files that would have been skipped in the above folders. r8z __init__.pyz .dist-infocSsh|]}tj|dqS)rM)rr r!)rQfolderr#r#r$r_sz.compress_for_output_listing..) r*rAr+rr rfrmr[rZrjr!isfile) rJ will_remove will_skipfoldersrvr _normcased_filesrxdirpath_dirfilesfnamefile_r#r#r$compress_for_output_listings2     rc@s|eZdZdZddddZeedddZeedd d Zeedd d Zddd dZ ddddZ e e dddZ dS)StashedUninstallPathSetzWA set of file rename operations to stash files while tentatively uninstalling them.NrcCsi|_g|_dSr)) _save_dirs_movesselfr#r#r$__init__sz StashedUninstallPathSet.__init__r rcCsDz t|}Wntk r*tdd}YnX||jtj|<|jS)zStashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir. uninstallkind)rOSErrorrrrr r[)rr save_dirr#r#r$_get_directory_stashs  z,StashedUninstallPathSet._get_directory_stashcCstj|}tj|d}}d}||krfz|j|}WqWntk rPYnXtj||}}q"tj|}tdd}||j|<tj||}|r|tjjkrtj |j|S|jS)zStashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.Nrr) rr r[rfrKeyErrorrrelpathcurdirr!)rr headold_headrrr#r#r$_get_file_stashs"     z'StashedUninstallPathSet._get_file_stashcCsltj|otj| }|r*||}n ||}|j||f|r^tj|r^t|t |||S)zStashes the directory or file and returns its new location. Handle symlinks as files to avoid modifying the symlink targets. ) rr isdirislinkrrrappendrmdirr)rr path_is_dirnew_pathr#r#r$stashs    zStashedUninstallPathSet.stashcCs,|jD]\}}|q g|_i|_dS)z0Commits the uninstall by removing stashed files.N)ritemscleanupr)rrrr#r#r$commits zStashedUninstallPathSet.commitc Cs|jD]}tjd|q|jD]\}}zTtd||tj|sPtj|r\t|ntj |rpt |t ||Wq t k r}zt d|td|W5d}~XYq Xq |dS)z2Undoes the uninstall by moving stashed files back.Moving to %s from %szReplacing %s from %szFailed to restore %sz Exception: %sN)r)rloggerinfodebugrr ryrunlinkrrrrerrorr)rr]rr exr#r#r$rollbacks     z StashedUninstallPathSet.rollbackcCs t|jSr))boolrrr#r#r$ can_rollback,sz$StashedUninstallPathSet.can_rollback)__name__ __module__ __qualname____doc__rrirrrrrpropertyrrr#r#r#r$rsrc@seZdZdZeddddZeedddZeddd d Z eedd d d Z deeddddZ eedddZ ddddZ ddddZeeddddZdS)UninstallPathSetzMA set of file paths to be removed in the uninstallation of a requirement.Nr3cCs(t|_t|_i|_||_t|_dSr))r*_paths_refuse_pth_distr _moved_paths)rr4r#r#r$r5s zUninstallPathSet.__init__rcCst|S)zs Return True if the given path is one we are permitted to remove/modify, False otherwise. )r)rr r#r#r$ _permitted<szUninstallPathSet._permittedcCstj|\}}tjt|tj|}tj|s:dS||rR|j |n |j |tj |ddkr| t |dS)Nr6) rr rBr!rr[existsrrr+rsplitextr)rr rtailr#r#r$r+Ds   zUninstallPathSet.add)pth_filerFrcCsLt|}||r<||jkr*t||j|<|j||n |j|dSr))rrrUninstallPthEntriesr+r)rrrFr#r#r$add_pthWs   zUninstallPathSet.add_pthF) auto_confirmverboserc Cs|jstd|jjdS|jjd|jj}td|tp|sR||r|j}t |j}t t |D]}| |t d|qn|jD] }|qtd|W5QRXdS)z\Remove paths in ``self._paths`` with confirmation (unless ``auto_confirm`` is True).z7Can't uninstall '%s'. No files were found to uninstall.N-zUninstalling %s:zRemoving file or directory %szSuccessfully uninstalled %s)rrrrr?r@r_allowed_to_proceedrrwrVrZrrrrhremove)rrrdist_name_versionmoved for_renamer pthr#r#r$r`s$    zUninstallPathSet.remove)rrcCs|tttdddd}|s*t|j\}}nt|j}t}|d||d||d|j|rn|dt|jtd d d kS) z@Display which files would be deleted and prompt for confirmationN)rDrJrc SsD|sdSt|t"tt|D]}t|q&W5QRXdSr))rrrrVrZ)rDrJr r#r#r$_displays  z6UninstallPathSet._allowed_to_proceed.._displayz Would remove:z+Would not remove (might be manually added):z%Would not remove (outside of prefix):zWill actually move:zProceed (Y/n)? )ynr)rirrrr*rrwr)rrrrzr{r#r#r$r}s     z$UninstallPathSet._allowed_to_proceedrcCsR|jjstd|jjdStd|jj|j|j D] }|q@dS)z1Rollback the changes previously made by remove().z'Can't roll back %s; was not uninstalledNzRolling back uninstall of %s) rrrrrr?rrrrh)rrr#r#r$rs zUninstallPathSet.rollbackcCs|jdS)z?Remove temporary save dir: rollback will no longer be possible.N)rrrr#r#r$rszUninstallPathSet.commitc s|j}|j}|dkr*td|j||St|}|jsTtd|j|tj||S|ddt dt dhDkrtd|j|||S||}t |j }|j o|dk otj|o||jd }|r|dk r|||}|dk r|D]} |tj|| qn|d rz|d } Wntk rLgYnX| jd d fd d|d DD]N} tj|| } || || d|| d|| dqvn*|jrtd|j n|jr0||tj|d} tjtj|d}| |d| n|j!rTt"|D]} || q@n|rt#|"}tj$|%&}t|}W5QRXtj'||st(d|d|j d|d||tjtj|d}| ||nt)d|||j*rt+}nt,}zH|-D]:}|tj||t.r|tj||dqWntt/fk rlYnXt0t1t2t1ddfddd}|||D]}||q|S)Nz-Not uninstalling %s since it is not installedz1Not uninstalling %s at %s, outside environment %scSsh|] }|r|qSr#r#r\r#r#r$r_sz-UninstallPathSet.from_dist..stdlib platstdlibzsz.UninstallPathSet.from_dist..r6r8r9zCannot uninstall {!r}. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.rzeasy-install.pthz./z Egg-link z& does not match installed location of z (at )z)Not sure how to uninstall: %s - Check: %sz.bat)r4rrcssP|D]B}|jdkr,t||jdEdHq|jdkrt||jdEdHqdS)Nconsole_scriptsF gui_scriptsT)iter_entry_pointsgroupr%name)r4r entry_pointr#r#r$iter_scripts_to_remove9s    z:UninstallPathSet.from_dist..iter_scripts_to_remove)3r: info_locationrrcanonical_namerlocalsysprefix sysconfigget_pathrr?"installed_with_setuptools_egg_inforr rrAsetuptools_filenamer+r<r!is_file read_textFileNotFoundError splitlinesinstalled_by_distutilsr r=installed_as_eggrBrfrinstalled_with_dist_inforIopenr[readlinestripsamefiler;r in_usersiterr iter_distutils_script_namesrNotADirectoryErrorrrir)clsr4 dist_locationrnormalized_dist_locationpaths_to_removedevelop_egg_linksetuptools_flat_installationinstalled_filesinstalled_filenamespace_packages top_level_pkgr easy_install_eggeasy_install_pthfh link_pointernormalized_link_pointerrscriptrsr#rr$ from_dists                  " zUninstallPathSet.from_dist)FF)rrrrrrrirrr+rrrrr classmethodrr#r#r#r$r1s  rc@sHeZdZeddddZeddddZddd d Zedd d ZdS) rN)rrcCs||_t|_d|_dSr))filer*rC _saved_lines)rrr#r#r$rJszUninstallPthEntries.__init__)rFrcCs<tj|}tr,tj|ds,|dd}|j|dS)Nr\/)rr r[r splitdrivereplacerCr+)rrFr#r#r$r+Os  zUninstallPthEntries.addrc Cs td|jtj|js.td|jdSt|jd}|}||_ W5QRXt dd|Drld}nd}|r|d | d s|d| d |d<|j D]>}z$td |||| d Wqtk rYqXqt|jd }||W5QRXdS) NzRemoving pth entries from %s:z.Cannot remove entries from nonexistent file %srbcss|]}d|kVqdS)s Nr#)rQliner#r#r$rUisz-UninstallPthEntries.remove..z  zutf-8zRemoving entry: %swb)rrrrr rywarningr readlinesrrWrAencoderCr ValueError writelines)rrlinesendlinerFr#r#r$r^s(  zUninstallPthEntries.removec CsR|jdkrtd|jdStd|jt|jd}||jW5QRXdS)Nz.Cannot roll back changes to %s, none were madeFz!Rolling %s back to previous staterT)rrrrrrr)rrr#r#r$rys zUninstallPthEntries.rollback) rrrrirr+rrrr#r#r#r$rIsr)4r0rrrimportlib.utilrtypingrrrrrrr r r pip._internal.exceptionsr pip._internal.locationsr rpip._internal.metadatarpip._internal.utils.compatrpip._internal.utils.egg_linkrpip._internal.utils.loggingrrpip._internal.utils.miscrrrrrpip._internal.utils.temp_dirrrrrrirr%r2rIrZrwrrrrr#r#r#r$s@ ,      +"$2iPK]5(e e 0req/__pycache__/req_tracker.cpython-38.opt-1.pycnu[U .e{ @sddlmZddlZddlZddlZddlZddlZddlmZddl m Z e rddl m Z ddl mZmZmZmZddlmZddlmZeeZGd d d eZdS) )absolute_importN) TempDirectory)MYPY_CHECK_RUNNING) TracebackType)IteratorOptionalSetType)InstallRequirement)Linkc@sReZdZddZddZddZddZd d Zd d Zd dZ e j ddZ dS)RequirementTrackercCsjtjd|_|jdkrJtddd|_|jj|_tjd<td|jnd|_td|jt |_ dS)NZPIP_REQ_TRACKERFz req-tracker)deleteZkindzCreated requirements tracker %rz Re-using requirements tracker %r) osenvironget_rootr _temp_dirpathloggerdebugset_entriesselfrA/usr/lib/python3.8/site-packages/pip/_internal/req/req_tracker.py__init__s zRequirementTracker.__init__cCs|SNrrrrr __enter__&szRequirementTracker.__enter__cCs |dSr)cleanup)rexc_typeZexc_valZexc_tbrrr__exit__*szRequirementTracker.__exit__cCs$t|j}tj|j|Sr) hashlibZsha224Zurl_without_fragmentencodeZ hexdigestrrjoinr)rlinkZhashedrrr _entry_path3szRequirementTracker._entry_pathc Cs|j}t|}||}z,t|}td||fW5QRXWnltk r}zN|jtjkrdt|d}| |W5QRX|j |t d||jW5d}~XYnXdS)Nz%s is already being built: %swzAdded %s to build tracker %r)r%strr&open LookupErrorreadIOErrorerrnoZENOENTwriteraddrrr)rreqr%infoZ entry_pathfperrrr/8s      zRequirementTracker.addcCs6|j}|j|t||td||jdS)Nz Removed %s from build tracker %r) r%rremoverunlinkr&rrr)rr0r%rrrr4Ks zRequirementTracker.removecCsNt|jD]}||q |jdk }|r2|jtd|r@dnd|jdS)Nz%s build tracker %rZRemovedZCleaned)rrr4rrrrr)rr0r4rrrrRs    zRequirementTracker.cleanupccs||dV||dSr)r/r4)rr0rrrtrack]s zRequirementTracker.trackN) __name__ __module__ __qualname__rrr!r&r/r4r contextlibcontextmanagerr6rrrrr s   r )Z __future__rr:r-r"ZloggingrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrtypesrtypingrrrr Zpip._internal.req.req_installr Zpip._internal.models.linkr Z getLoggerr7robjectr rrrrs       PK]Z,req/__pycache__/req_set.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZerdd lmZmZmZmZmZdd lmZeeZGd d d eZdS))absolute_importN) OrderedDict)canonicalize_name) pep425tags)InstallationError) indent_log)MYPY_CHECK_RUNNING)Wheel)DictIterableListOptionalTuple)InstallRequirementc@sXeZdZdddZddZddZd d Zd d ZdddZddZ ddZ ddZ d S)RequirementSetFTcCs*t|_||_||_g|_g|_g|_dS)z!Create a RequirementSet. N)r requirementsrequire_hashescheck_supported_wheelsunnamed_requirementsZsuccessfully_downloadedreqs_to_cleanup)selfrrr=/usr/lib/python3.8/site-packages/pip/_internal/req/req_set.py__init__s zRequirementSet.__init__cCs4tdd|jDddd}ddd|DS)Ncss|]}|js|VqdSN)Z comes_from.0reqrrr +sz)RequirementSet.__str__..cSs t|jSrrnamerrrr,z(RequirementSet.__str__..key css|]}t|jVqdSrstrrrrrrr.s)sortedrvaluesjoin)rrrrr__str__(s zRequirementSet.__str__cCsBt|jddd}d}|j|jjt|ddd|DdS) NcSs t|jSrrr!rrrr"4r#z)RequirementSet.__repr__..r$z4<{classname} object; {count} requirement(s): {reqs}>z, css|]}t|jVqdSrr'rrrrr;sz*RequirementSet.__repr__..)Z classnamecountZreqs)r)rr*format __class____name__lenr+)rr format_stringrrr__repr__0szRequirementSet.__repr__cCs|j|dSr)rappend)r install_reqrrradd_unnamed_requirement>sz&RequirementSet.add_unnamed_requirementcCst|j}||j|<dSr)rr r)rr5 project_namerrradd_named_requirementCs z$RequirementSet.add_named_requirementNc Cs||s$td|j|jgdfS|jrd|jjrdt|jj}t }|j rd| |sdt d|j|js~|||gdfSz||j}Wntk rd}YnX|dko|o|j o|j|jko|jj|jjk}|rt d|||jf|s |||g|fS|js|js"g|fS|joB|jo@|jj|jjk }|rd|j|t d|jd|_ttt|jt|jB|_td||j|g|fS)a&Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside the Requirements set. parent_req must already be added. Note that None implies that this is a user supplied requirement, vs an inferred one. :param extras_requested: an iterable of extras used to evaluate the environment markers. :return: Additional requirements to scan. That is either [] if the requirement is not applicable, or [install_req] if the requirement is applicable and has just been added. z6Ignoring %s: markers '%s' don't match your environmentNz-%s is not a supported wheel on this platform.z5Double requirement given: %s (already in %s, name=%r)zhCould not satisfy constraints for '%s': installation from path or url cannot be constrained to a versionFzSetting %s extras to: %s)Z match_markersloggerinfor ZmarkerslinkZis_wheelr filenamerZ get_supportedrZ supportedrr6get_requirementKeyError constraintZextrasrZ specifierr8pathrr4tupler)setdebug) rr5Zparent_req_nameZextras_requestedZwheelZtagsZ existing_reqZhas_conflicting_requirementZdoes_not_satisfy_constraintrrradd_requirementJs           zRequirementSet.add_requirementcCs t|}||jko|j|j Sr)rrr?rr r7rrrhas_requirements  zRequirementSet.has_requirementcCs,t|}||jkr|j|Std|dS)NzNo project with the name %r)rrr>rErrrr=s  zRequirementSet.get_requirementc Cs4tdt|jD] }|qW5QRXdS)zClean up files, remove builds.zCleaning up...N)r9rCrrZremove_temporary_source)rrrrr cleanup_filess  zRequirementSet.cleanup_files)FT)NN) r0 __module__ __qualname__rr,r3r6r8rDrFr=rGrrrrrs   p  r)Z __future__rZlogging collectionsrZpip._vendor.packaging.utilsrZ pip._internalrZpip._internal.exceptionsrZpip._internal.utils.loggingrZpip._internal.utils.typingrZpip._internal.wheelr typingr r r r rZpip._internal.req.req_installrZ getLoggerr0r9objectrrrrrs          PK]PA-req/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e @sddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z erhdd l mZmZmZd d d d gZeeZddd ZdS))absolute_importN) indent_log)MYPY_CHECK_RUNNING)parse_requirements)InstallRequirement)RequirementSet)AnyListSequencerrrinstall_given_reqsc Os|r tdddd|Dt|D]}|jrbtd|jt|jdd}W5QRXz|j||f||Wn0tk r|jo|j }|r| YnX|jo|j}|r| | q,W5QRX|S)zu Install everything in the given list. (to be called after having downloaded and unpacked the packages) z!Installing collected packages: %sz, cSsg|] }|jqSr )name).0Zreqr r >/usr/lib/python3.8/site-packages/pip/_internal/req/__init__.py +sz&install_given_reqs..zFound existing installation: %sT)Z auto_confirm) loggerinfojoinrZconflicts_withZ uninstallZinstall ExceptionZinstall_succeededZrollbackZcommitZremove_temporary_source) Z to_installZinstall_optionsZglobal_optionsargskwargsZ requirementZuninstalled_pathsetZshould_rollbackZ should_commitr r rr sN)r )Z __future__rZloggingZpip._internal.utils.loggingrZpip._internal.utils.typingrZreq_filerZ req_installrZreq_setrtypingr r r __all__Z getLogger__name__rr r r r rs       PK]2req/req_tracker.pynu[import contextlib import hashlib import logging import os from types import TracebackType from typing import Dict, Iterator, Optional, Set, Type, Union from pip._internal.models.link import Link from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) @contextlib.contextmanager def update_env_context_manager(**changes: str) -> Iterator[None]: target = os.environ # Save values from the target and change them. non_existent_marker = object() saved_values: Dict[str, Union[object, str]] = {} for name, new_value in changes.items(): try: saved_values[name] = target[name] except KeyError: saved_values[name] = non_existent_marker target[name] = new_value try: yield finally: # Restore original values in the target. for name, original_value in saved_values.items(): if original_value is non_existent_marker: del target[name] else: assert isinstance(original_value, str) # for mypy target[name] = original_value @contextlib.contextmanager def get_requirement_tracker() -> Iterator["RequirementTracker"]: root = os.environ.get("PIP_REQ_TRACKER") with contextlib.ExitStack() as ctx: if root is None: root = ctx.enter_context(TempDirectory(kind="req-tracker")).path ctx.enter_context(update_env_context_manager(PIP_REQ_TRACKER=root)) logger.debug("Initialized build tracking at %s", root) with RequirementTracker(root) as tracker: yield tracker class RequirementTracker: def __init__(self, root: str) -> None: self._root = root self._entries: Set[InstallRequirement] = set() logger.debug("Created build tracker: %s", self._root) def __enter__(self) -> "RequirementTracker": logger.debug("Entered build tracker: %s", self._root) return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: self.cleanup() def _entry_path(self, link: Link) -> str: hashed = hashlib.sha224(link.url_without_fragment.encode()).hexdigest() return os.path.join(self._root, hashed) def add(self, req: InstallRequirement) -> None: """Add an InstallRequirement to build tracking.""" assert req.link # Get the file to write information about this requirement. entry_path = self._entry_path(req.link) # Try reading from the file. If it exists and can be read from, a build # is already in progress, so a LookupError is raised. try: with open(entry_path) as fp: contents = fp.read() except FileNotFoundError: pass else: message = "{} is already being built: {}".format(req.link, contents) raise LookupError(message) # If we're here, req should really not be building already. assert req not in self._entries # Start tracking this requirement. with open(entry_path, "w", encoding="utf-8") as fp: fp.write(str(req)) self._entries.add(req) logger.debug("Added %s to build tracker %r", req, self._root) def remove(self, req: InstallRequirement) -> None: """Remove an InstallRequirement from build tracking.""" assert req.link # Delete the created file and the corresponding entries. os.unlink(self._entry_path(req.link)) self._entries.remove(req) logger.debug("Removed %s from build tracker %r", req, self._root) def cleanup(self) -> None: for req in set(self._entries): self.remove(req) logger.debug("Removed build tracker: %r", self._root) @contextlib.contextmanager def track(self, req: InstallRequirement) -> Iterator[None]: self.add(req) yield self.remove(req) PK]\\req/req_uninstall.pynu[import csv import functools import os import sys import sysconfig from importlib.util import cache_from_source from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple from pip._vendor import pkg_resources from pip._vendor.pkg_resources import Distribution from pip._internal.exceptions import UninstallationError from pip._internal.locations import get_bin_prefix, get_bin_user from pip._internal.utils.compat import WINDOWS from pip._internal.utils.egg_link import egg_link_path_from_location from pip._internal.utils.logging import getLogger, indent_log from pip._internal.utils.misc import ( ask, dist_in_usersite, dist_is_local, is_local, normalize_path, renames, rmtree, ) from pip._internal.utils.temp_dir import AdjacentTempDirectory, TempDirectory logger = getLogger(__name__) def _script_names(dist: Distribution, script_name: str, is_gui: bool) -> List[str]: """Create the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names """ if dist_in_usersite(dist): bin_dir = get_bin_user() else: bin_dir = get_bin_prefix() exe_name = os.path.join(bin_dir, script_name) paths_to_remove = [exe_name] if WINDOWS: paths_to_remove.append(exe_name + ".exe") paths_to_remove.append(exe_name + ".exe.manifest") if is_gui: paths_to_remove.append(exe_name + "-script.pyw") else: paths_to_remove.append(exe_name + "-script.py") return paths_to_remove def _unique(fn: Callable[..., Iterator[Any]]) -> Callable[..., Iterator[Any]]: @functools.wraps(fn) def unique(*args: Any, **kw: Any) -> Iterator[Any]: seen: Set[Any] = set() for item in fn(*args, **kw): if item not in seen: seen.add(item) yield item return unique @_unique def uninstallation_paths(dist: Distribution) -> Iterator[str]: """ Yield all the uninstallation paths for dist based on RECORD-without-.py[co] Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc and .pyo in the same directory. UninstallPathSet.add() takes care of the __pycache__ .py[co]. If RECORD is not found, raises UninstallationError, with possible information from the INSTALLER file. https://packaging.python.org/specifications/recording-installed-packages/ """ try: r = csv.reader(dist.get_metadata_lines("RECORD")) except FileNotFoundError as missing_record_exception: msg = "Cannot uninstall {dist}, RECORD file not found.".format(dist=dist) try: installer = next(dist.get_metadata_lines("INSTALLER")) if not installer or installer == "pip": raise ValueError() except (OSError, StopIteration, ValueError): dep = "{}=={}".format(dist.project_name, dist.version) msg += ( " You might be able to recover from this via: " "'pip install --force-reinstall --no-deps {}'.".format(dep) ) else: msg += " Hint: The package was installed by {}.".format(installer) raise UninstallationError(msg) from missing_record_exception for row in r: path = os.path.join(dist.location, row[0]) yield path if path.endswith(".py"): dn, fn = os.path.split(path) base = fn[:-3] path = os.path.join(dn, base + ".pyc") yield path path = os.path.join(dn, base + ".pyo") yield path def compact(paths: Iterable[str]) -> Set[str]: """Compact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.""" sep = os.path.sep short_paths: Set[str] = set() for path in sorted(paths, key=len): should_skip = any( path.startswith(shortpath.rstrip("*")) and path[len(shortpath.rstrip("*").rstrip(sep))] == sep for shortpath in short_paths ) if not should_skip: short_paths.add(path) return short_paths def compress_for_rename(paths: Iterable[str]) -> Set[str]: """Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. """ case_map = {os.path.normcase(p): p for p in paths} remaining = set(case_map) unchecked = sorted({os.path.split(p)[0] for p in case_map.values()}, key=len) wildcards: Set[str] = set() def norm_join(*a: str) -> str: return os.path.normcase(os.path.join(*a)) for root in unchecked: if any(os.path.normcase(root).startswith(w) for w in wildcards): # This directory has already been handled. continue all_files: Set[str] = set() all_subdirs: Set[str] = set() for dirname, subdirs, files in os.walk(root): all_subdirs.update(norm_join(root, dirname, d) for d in subdirs) all_files.update(norm_join(root, dirname, f) for f in files) # If all the files we found are in our remaining set of files to # remove, then remove them from the latter set and add a wildcard # for the directory. if not (all_files - remaining): remaining.difference_update(all_files) wildcards.add(root + os.sep) return set(map(case_map.__getitem__, remaining)) | wildcards def compress_for_output_listing(paths: Iterable[str]) -> Tuple[Set[str], Set[str]]: """Returns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are removed. The second set contains files that would have been skipped in the above folders. """ will_remove = set(paths) will_skip = set() # Determine folders and files folders = set() files = set() for path in will_remove: if path.endswith(".pyc"): continue if path.endswith("__init__.py") or ".dist-info" in path: folders.add(os.path.dirname(path)) files.add(path) # probably this one https://github.com/python/mypy/issues/390 _normcased_files = set(map(os.path.normcase, files)) # type: ignore folders = compact(folders) # This walks the tree using os.walk to not miss extra folders # that might get added. for folder in folders: for dirpath, _, dirfiles in os.walk(folder): for fname in dirfiles: if fname.endswith(".pyc"): continue file_ = os.path.join(dirpath, fname) if ( os.path.isfile(file_) and os.path.normcase(file_) not in _normcased_files ): # We are skipping this file. Add it to the set. will_skip.add(file_) will_remove = files | {os.path.join(folder, "*") for folder in folders} return will_remove, will_skip class StashedUninstallPathSet: """A set of file rename operations to stash files while tentatively uninstalling them.""" def __init__(self) -> None: # Mapping from source file root to [Adjacent]TempDirectory # for files under that directory. self._save_dirs: Dict[str, TempDirectory] = {} # (old path, new path) tuples for each move that may need # to be undone. self._moves: List[Tuple[str, str]] = [] def _get_directory_stash(self, path: str) -> str: """Stashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir.""" try: save_dir: TempDirectory = AdjacentTempDirectory(path) except OSError: save_dir = TempDirectory(kind="uninstall") self._save_dirs[os.path.normcase(path)] = save_dir return save_dir.path def _get_file_stash(self, path: str) -> str: """Stashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.""" path = os.path.normcase(path) head, old_head = os.path.dirname(path), None save_dir = None while head != old_head: try: save_dir = self._save_dirs[head] break except KeyError: pass head, old_head = os.path.dirname(head), head else: # Did not find any suitable root head = os.path.dirname(path) save_dir = TempDirectory(kind="uninstall") self._save_dirs[head] = save_dir relpath = os.path.relpath(path, head) if relpath and relpath != os.path.curdir: return os.path.join(save_dir.path, relpath) return save_dir.path def stash(self, path: str) -> str: """Stashes the directory or file and returns its new location. Handle symlinks as files to avoid modifying the symlink targets. """ path_is_dir = os.path.isdir(path) and not os.path.islink(path) if path_is_dir: new_path = self._get_directory_stash(path) else: new_path = self._get_file_stash(path) self._moves.append((path, new_path)) if path_is_dir and os.path.isdir(new_path): # If we're moving a directory, we need to # remove the destination first or else it will be # moved to inside the existing directory. # We just created new_path ourselves, so it will # be removable. os.rmdir(new_path) renames(path, new_path) return new_path def commit(self) -> None: """Commits the uninstall by removing stashed files.""" for _, save_dir in self._save_dirs.items(): save_dir.cleanup() self._moves = [] self._save_dirs = {} def rollback(self) -> None: """Undoes the uninstall by moving stashed files back.""" for p in self._moves: logger.info("Moving to %s\n from %s", *p) for new_path, path in self._moves: try: logger.debug("Replacing %s from %s", new_path, path) if os.path.isfile(new_path) or os.path.islink(new_path): os.unlink(new_path) elif os.path.isdir(new_path): rmtree(new_path) renames(path, new_path) except OSError as ex: logger.error("Failed to restore %s", new_path) logger.debug("Exception: %s", ex) self.commit() @property def can_rollback(self) -> bool: return bool(self._moves) class UninstallPathSet: """A set of file paths to be removed in the uninstallation of a requirement.""" def __init__(self, dist: Distribution) -> None: self.paths: Set[str] = set() self._refuse: Set[str] = set() self.pth: Dict[str, UninstallPthEntries] = {} self.dist = dist self._moved_paths = StashedUninstallPathSet() def _permitted(self, path: str) -> bool: """ Return True if the given path is one we are permitted to remove/modify, False otherwise. """ return is_local(path) def add(self, path: str) -> None: head, tail = os.path.split(path) # we normalize the head to resolve parent directory symlinks, but not # the tail, since we only want to uninstall symlinks, not their targets path = os.path.join(normalize_path(head), os.path.normcase(tail)) if not os.path.exists(path): return if self._permitted(path): self.paths.add(path) else: self._refuse.add(path) # __pycache__ files can show up after 'installed-files.txt' is created, # due to imports if os.path.splitext(path)[1] == ".py": self.add(cache_from_source(path)) def add_pth(self, pth_file: str, entry: str) -> None: pth_file = normalize_path(pth_file) if self._permitted(pth_file): if pth_file not in self.pth: self.pth[pth_file] = UninstallPthEntries(pth_file) self.pth[pth_file].add(entry) else: self._refuse.add(pth_file) def remove(self, auto_confirm: bool = False, verbose: bool = False) -> None: """Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).""" if not self.paths: logger.info( "Can't uninstall '%s'. No files were found to uninstall.", self.dist.project_name, ) return dist_name_version = self.dist.project_name + "-" + self.dist.version logger.info("Uninstalling %s:", dist_name_version) with indent_log(): if auto_confirm or self._allowed_to_proceed(verbose): moved = self._moved_paths for_rename = compress_for_rename(self.paths) for path in sorted(compact(for_rename)): moved.stash(path) logger.verbose("Removing file or directory %s", path) for pth in self.pth.values(): pth.remove() logger.info("Successfully uninstalled %s", dist_name_version) def _allowed_to_proceed(self, verbose: bool) -> bool: """Display which files would be deleted and prompt for confirmation""" def _display(msg: str, paths: Iterable[str]) -> None: if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(paths)): logger.info(path) if not verbose: will_remove, will_skip = compress_for_output_listing(self.paths) else: # In verbose mode, display all the files that are going to be # deleted. will_remove = set(self.paths) will_skip = set() _display("Would remove:", will_remove) _display("Would not remove (might be manually added):", will_skip) _display("Would not remove (outside of prefix):", self._refuse) if verbose: _display("Will actually move:", compress_for_rename(self.paths)) return ask("Proceed (Y/n)? ", ("y", "n", "")) != "n" def rollback(self) -> None: """Rollback the changes previously made by remove().""" if not self._moved_paths.can_rollback: logger.error( "Can't roll back %s; was not uninstalled", self.dist.project_name, ) return logger.info("Rolling back uninstall of %s", self.dist.project_name) self._moved_paths.rollback() for pth in self.pth.values(): pth.rollback() def commit(self) -> None: """Remove temporary save dir: rollback will no longer be possible.""" self._moved_paths.commit() @classmethod def from_dist(cls, dist: Distribution) -> "UninstallPathSet": dist_path = normalize_path(dist.location) if not dist_is_local(dist): logger.info( "Not uninstalling %s at %s, outside environment %s", dist.key, dist_path, sys.prefix, ) return cls(dist) if dist_path in { p for p in {sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib")} if p }: logger.info( "Not uninstalling %s at %s, as it is in the standard library.", dist.key, dist_path, ) return cls(dist) paths_to_remove = cls(dist) develop_egg_link = egg_link_path_from_location(dist.project_name) develop_egg_link_egg_info = "{}.egg-info".format( pkg_resources.to_filename(dist.project_name) ) egg_info_exists = dist.egg_info and os.path.exists(dist.egg_info) # Special case for distutils installed package distutils_egg_info = getattr(dist._provider, "path", None) # Uninstall cases order do matter as in the case of 2 installs of the # same package, pip needs to uninstall the currently detected version if ( egg_info_exists and dist.egg_info.endswith(".egg-info") and not dist.egg_info.endswith(develop_egg_link_egg_info) ): # if dist.egg_info.endswith(develop_egg_link_egg_info), we # are in fact in the develop_egg_link case paths_to_remove.add(dist.egg_info) if dist.has_metadata("installed-files.txt"): for installed_file in dist.get_metadata( "installed-files.txt" ).splitlines(): path = os.path.normpath(os.path.join(dist.egg_info, installed_file)) paths_to_remove.add(path) # FIXME: need a test for this elif block # occurs with --single-version-externally-managed/--record outside # of pip elif dist.has_metadata("top_level.txt"): if dist.has_metadata("namespace_packages.txt"): namespaces = dist.get_metadata("namespace_packages.txt") else: namespaces = [] for top_level_pkg in [ p for p in dist.get_metadata("top_level.txt").splitlines() if p and p not in namespaces ]: path = os.path.join(dist.location, top_level_pkg) paths_to_remove.add(path) paths_to_remove.add(path + ".py") paths_to_remove.add(path + ".pyc") paths_to_remove.add(path + ".pyo") elif distutils_egg_info: raise UninstallationError( "Cannot uninstall {!r}. It is a distutils installed project " "and thus we cannot accurately determine which files belong " "to it which would lead to only a partial uninstall.".format( dist.project_name, ) ) elif dist.location.endswith(".egg"): # package installed by easy_install # We cannot match on dist.egg_name because it can slightly vary # i.e. setuptools-0.6c11-py2.6.egg vs setuptools-0.6rc11-py2.6.egg paths_to_remove.add(dist.location) easy_install_egg = os.path.split(dist.location)[1] easy_install_pth = os.path.join( os.path.dirname(dist.location), "easy-install.pth" ) paths_to_remove.add_pth(easy_install_pth, "./" + easy_install_egg) elif egg_info_exists and dist.egg_info.endswith(".dist-info"): for path in uninstallation_paths(dist): paths_to_remove.add(path) elif develop_egg_link: # develop egg with open(develop_egg_link) as fh: link_pointer = os.path.normcase(fh.readline().strip()) assert ( link_pointer == dist.location ), "Egg-link {} does not match installed location of {} (at {})".format( link_pointer, dist.project_name, dist.location ) paths_to_remove.add(develop_egg_link) easy_install_pth = os.path.join( os.path.dirname(develop_egg_link), "easy-install.pth" ) paths_to_remove.add_pth(easy_install_pth, dist.location) else: logger.debug( "Not sure how to uninstall: %s - Check: %s", dist, dist.location, ) # find distutils scripts= scripts if dist.has_metadata("scripts") and dist.metadata_isdir("scripts"): for script in dist.metadata_listdir("scripts"): if dist_in_usersite(dist): bin_dir = get_bin_user() else: bin_dir = get_bin_prefix() paths_to_remove.add(os.path.join(bin_dir, script)) if WINDOWS: paths_to_remove.add(os.path.join(bin_dir, script) + ".bat") # find console_scripts _scripts_to_remove = [] console_scripts = dist.get_entry_map(group="console_scripts") for name in console_scripts.keys(): _scripts_to_remove.extend(_script_names(dist, name, False)) # find gui_scripts gui_scripts = dist.get_entry_map(group="gui_scripts") for name in gui_scripts.keys(): _scripts_to_remove.extend(_script_names(dist, name, True)) for s in _scripts_to_remove: paths_to_remove.add(s) return paths_to_remove class UninstallPthEntries: def __init__(self, pth_file: str) -> None: self.file = pth_file self.entries: Set[str] = set() self._saved_lines: Optional[List[bytes]] = None def add(self, entry: str) -> None: entry = os.path.normcase(entry) # On Windows, os.path.normcase converts the entry to use # backslashes. This is correct for entries that describe absolute # paths outside of site-packages, but all the others use forward # slashes. # os.path.splitdrive is used instead of os.path.isabs because isabs # treats non-absolute paths with drive letter markings like c:foo\bar # as absolute paths. It also does not recognize UNC paths if they don't # have more than "\\sever\share". Valid examples: "\\server\share\" or # "\\server\share\folder". if WINDOWS and not os.path.splitdrive(entry)[0]: entry = entry.replace("\\", "/") self.entries.add(entry) def remove(self) -> None: logger.verbose("Removing pth entries from %s:", self.file) # If the file doesn't exist, log a warning and return if not os.path.isfile(self.file): logger.warning("Cannot remove entries from nonexistent file %s", self.file) return with open(self.file, "rb") as fh: # windows uses '\r\n' with py3k, but uses '\n' with py2.x lines = fh.readlines() self._saved_lines = lines if any(b"\r\n" in line for line in lines): endline = "\r\n" else: endline = "\n" # handle missing trailing newline if lines and not lines[-1].endswith(endline.encode("utf-8")): lines[-1] = lines[-1] + endline.encode("utf-8") for entry in self.entries: try: logger.verbose("Removing entry: %s", entry) lines.remove((entry + endline).encode("utf-8")) except ValueError: pass with open(self.file, "wb") as fh: fh.writelines(lines) def rollback(self) -> bool: if self._saved_lines is None: logger.error("Cannot roll back changes to %s, none were made", self.file) return False logger.debug("Rolling %s back to previous state", self.file) with open(self.file, "wb") as fh: fh.writelines(self._saved_lines) return True PK]#Ġreq/req_set.pynu[import logging from collections import OrderedDict from typing import Dict, Iterable, List, Optional, Tuple from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import InstallationError from pip._internal.models.wheel import Wheel from pip._internal.req.req_install import InstallRequirement from pip._internal.utils import compatibility_tags logger = logging.getLogger(__name__) class RequirementSet: def __init__(self, check_supported_wheels: bool = True) -> None: """Create a RequirementSet.""" self.requirements: Dict[str, InstallRequirement] = OrderedDict() self.check_supported_wheels = check_supported_wheels self.unnamed_requirements: List[InstallRequirement] = [] def __str__(self) -> str: requirements = sorted( (req for req in self.requirements.values() if not req.comes_from), key=lambda req: canonicalize_name(req.name or ""), ) return " ".join(str(req.req) for req in requirements) def __repr__(self) -> str: requirements = sorted( self.requirements.values(), key=lambda req: canonicalize_name(req.name or ""), ) format_string = "<{classname} object; {count} requirement(s): {reqs}>" return format_string.format( classname=self.__class__.__name__, count=len(requirements), reqs=", ".join(str(req.req) for req in requirements), ) def add_unnamed_requirement(self, install_req: InstallRequirement) -> None: assert not install_req.name self.unnamed_requirements.append(install_req) def add_named_requirement(self, install_req: InstallRequirement) -> None: assert install_req.name project_name = canonicalize_name(install_req.name) self.requirements[project_name] = install_req def add_requirement( self, install_req: InstallRequirement, parent_req_name: Optional[str] = None, extras_requested: Optional[Iterable[str]] = None, ) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]]: """Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside the Requirements set. parent_req must already be added. Note that None implies that this is a user supplied requirement, vs an inferred one. :param extras_requested: an iterable of extras used to evaluate the environment markers. :return: Additional requirements to scan. That is either [] if the requirement is not applicable, or [install_req] if the requirement is applicable and has just been added. """ # If the markers do not match, ignore this requirement. if not install_req.match_markers(extras_requested): logger.info( "Ignoring %s: markers '%s' don't match your environment", install_req.name, install_req.markers, ) return [], None # If the wheel is not supported, raise an error. # Should check this after filtering out based on environment markers to # allow specifying different wheels based on the environment/OS, in a # single requirements file. if install_req.link and install_req.link.is_wheel: wheel = Wheel(install_req.link.filename) tags = compatibility_tags.get_supported() if self.check_supported_wheels and not wheel.supported(tags): raise InstallationError( "{} is not a supported wheel on this platform.".format( wheel.filename ) ) # This next bit is really a sanity check. assert ( not install_req.user_supplied or parent_req_name is None ), "a user supplied req shouldn't have a parent" # Unnamed requirements are scanned again and the requirement won't be # added as a dependency until after scanning. if not install_req.name: self.add_unnamed_requirement(install_req) return [install_req], None try: existing_req: Optional[InstallRequirement] = self.get_requirement( install_req.name ) except KeyError: existing_req = None has_conflicting_requirement = ( parent_req_name is None and existing_req and not existing_req.constraint and existing_req.extras == install_req.extras and existing_req.req and install_req.req and existing_req.req.specifier != install_req.req.specifier ) if has_conflicting_requirement: raise InstallationError( "Double requirement given: {} (already in {}, name={!r})".format( install_req, existing_req, install_req.name ) ) # When no existing requirement exists, add the requirement as a # dependency and it will be scanned again after. if not existing_req: self.add_named_requirement(install_req) # We'd want to rescan this requirement later return [install_req], install_req # Assume there's no need to scan, and that we've already # encountered this for scanning. if install_req.constraint or not existing_req.constraint: return [], existing_req does_not_satisfy_constraint = install_req.link and not ( existing_req.link and install_req.link.path == existing_req.link.path ) if does_not_satisfy_constraint: raise InstallationError( "Could not satisfy constraints for '{}': " "installation from path or url cannot be " "constrained to a version".format(install_req.name) ) # If we're now installing a constraint, mark the existing # object for real installation. existing_req.constraint = False # If we're now installing a user supplied requirement, # mark the existing object as such. if install_req.user_supplied: existing_req.user_supplied = True existing_req.extras = tuple( sorted(set(existing_req.extras) | set(install_req.extras)) ) logger.debug( "Setting %s extras to: %s", existing_req, existing_req.extras, ) # Return the existing requirement for addition to the parent and # scanning again. return [existing_req], existing_req def has_requirement(self, name: str) -> bool: project_name = canonicalize_name(name) return ( project_name in self.requirements and not self.requirements[project_name].constraint ) def get_requirement(self, name: str) -> InstallRequirement: project_name = canonicalize_name(name) if project_name in self.requirements: return self.requirements[project_name] raise KeyError(f"No project with the name {name!r}") @property def all_requirements(self) -> List[InstallRequirement]: return self.unnamed_requirements + list(self.requirements.values()) PK]' D Dreq/req_file.pynu[""" Requirements file parsing """ import optparse import os import re import shlex import urllib.parse from optparse import Values from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, ) from pip._internal.cli import cmdoptions from pip._internal.exceptions import InstallationError, RequirementsFileParseError from pip._internal.models.search_scope import SearchScope from pip._internal.network.session import PipSession from pip._internal.network.utils import raise_for_status from pip._internal.utils.encoding import auto_decode from pip._internal.utils.urls import get_url_scheme if TYPE_CHECKING: # NoReturn introduced in 3.6.2; imported only for type checking to maintain # pip compatibility with older patch versions of Python 3.6 from typing import NoReturn from pip._internal.index.package_finder import PackageFinder __all__ = ["parse_requirements"] ReqFileLines = Iterable[Tuple[int, str]] LineParser = Callable[[str], Tuple[str, Values]] SCHEME_RE = re.compile(r"^(http|https|file):", re.I) COMMENT_RE = re.compile(r"(^|\s+)#.*$") # Matches environment variable-style values in '${MY_VARIABLE_1}' with the # variable name consisting of only uppercase letters, digits or the '_' # (underscore). This follows the POSIX standard defined in IEEE Std 1003.1, # 2013 Edition. ENV_VAR_RE = re.compile(r"(?P\$\{(?P[A-Z0-9_]+)\})") SUPPORTED_OPTIONS: List[Callable[..., optparse.Option]] = [ cmdoptions.index_url, cmdoptions.extra_index_url, cmdoptions.no_index, cmdoptions.constraints, cmdoptions.requirements, cmdoptions.editable, cmdoptions.find_links, cmdoptions.no_binary, cmdoptions.only_binary, cmdoptions.prefer_binary, cmdoptions.require_hashes, cmdoptions.pre, cmdoptions.trusted_host, cmdoptions.use_new_feature, ] # options to be passed to requirements SUPPORTED_OPTIONS_REQ: List[Callable[..., optparse.Option]] = [ cmdoptions.install_options, cmdoptions.global_options, cmdoptions.hash, ] # the 'dest' string values SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ] class ParsedRequirement: def __init__( self, requirement: str, is_editable: bool, comes_from: str, constraint: bool, options: Optional[Dict[str, Any]] = None, line_source: Optional[str] = None, ) -> None: self.requirement = requirement self.is_editable = is_editable self.comes_from = comes_from self.options = options self.constraint = constraint self.line_source = line_source class ParsedLine: def __init__( self, filename: str, lineno: int, args: str, opts: Values, constraint: bool, ) -> None: self.filename = filename self.lineno = lineno self.opts = opts self.constraint = constraint if args: self.is_requirement = True self.is_editable = False self.requirement = args elif opts.editables: self.is_requirement = True self.is_editable = True # We don't support multiple -e on one line self.requirement = opts.editables[0] else: self.is_requirement = False def parse_requirements( filename: str, session: PipSession, finder: Optional["PackageFinder"] = None, options: Optional[optparse.Values] = None, constraint: bool = False, ) -> Iterator[ParsedRequirement]: """Parse a requirements file and yield ParsedRequirement instances. :param filename: Path or url of requirements file. :param session: PipSession instance. :param finder: Instance of pip.index.PackageFinder. :param options: cli options. :param constraint: If true, parsing a constraint file rather than requirements file. """ line_parser = get_line_parser(finder) parser = RequirementsFileParser(session, line_parser) for parsed_line in parser.parse(filename, constraint): parsed_req = handle_line( parsed_line, options=options, finder=finder, session=session ) if parsed_req is not None: yield parsed_req def preprocess(content: str) -> ReqFileLines: """Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file """ lines_enum: ReqFileLines = enumerate(content.splitlines(), start=1) lines_enum = join_lines(lines_enum) lines_enum = ignore_comments(lines_enum) lines_enum = expand_env_variables(lines_enum) return lines_enum def handle_requirement_line( line: ParsedLine, options: Optional[optparse.Values] = None, ) -> ParsedRequirement: # preserve for the nested code path line_comes_from = "{} {} (line {})".format( "-c" if line.constraint else "-r", line.filename, line.lineno, ) assert line.is_requirement if line.is_editable: # For editable requirements, we don't support per-requirement # options, so just return the parsed requirement. return ParsedRequirement( requirement=line.requirement, is_editable=line.is_editable, comes_from=line_comes_from, constraint=line.constraint, ) else: if options: # Disable wheels if the user has specified build options cmdoptions.check_install_build_global(options, line.opts) # get the options that apply to requirements req_options = {} for dest in SUPPORTED_OPTIONS_REQ_DEST: if dest in line.opts.__dict__ and line.opts.__dict__[dest]: req_options[dest] = line.opts.__dict__[dest] line_source = f"line {line.lineno} of {line.filename}" return ParsedRequirement( requirement=line.requirement, is_editable=line.is_editable, comes_from=line_comes_from, constraint=line.constraint, options=req_options, line_source=line_source, ) def handle_option_line( opts: Values, filename: str, lineno: int, finder: Optional["PackageFinder"] = None, options: Optional[optparse.Values] = None, session: Optional[PipSession] = None, ) -> None: if options: # percolate options upward if opts.require_hashes: options.require_hashes = opts.require_hashes if opts.features_enabled: options.features_enabled.extend( f for f in opts.features_enabled if f not in options.features_enabled ) # set finder options if finder: find_links = finder.find_links index_urls = finder.index_urls if opts.index_url: index_urls = [opts.index_url] if opts.no_index is True: index_urls = [] if opts.extra_index_urls: index_urls.extend(opts.extra_index_urls) if opts.find_links: # FIXME: it would be nice to keep track of the source # of the find_links: support a find-links local path # relative to a requirements file. value = opts.find_links[0] req_dir = os.path.dirname(os.path.abspath(filename)) relative_to_reqs_file = os.path.join(req_dir, value) if os.path.exists(relative_to_reqs_file): value = relative_to_reqs_file find_links.append(value) if session: # We need to update the auth urls in session session.update_index_urls(index_urls) search_scope = SearchScope( find_links=find_links, index_urls=index_urls, ) finder.search_scope = search_scope if opts.pre: finder.set_allow_all_prereleases() if opts.prefer_binary: finder.set_prefer_binary() if session: for host in opts.trusted_hosts or []: source = f"line {lineno} of {filename}" session.add_trusted_host(host, source=source) def handle_line( line: ParsedLine, options: Optional[optparse.Values] = None, finder: Optional["PackageFinder"] = None, session: Optional[PipSession] = None, ) -> Optional[ParsedRequirement]: """Handle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The session - updated by non-requirement lines. Returns a ParsedRequirement object if the line is a requirement line, otherwise returns None. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder. """ if line.is_requirement: parsed_req = handle_requirement_line(line, options) return parsed_req else: handle_option_line( line.opts, line.filename, line.lineno, finder, options, session, ) return None class RequirementsFileParser: def __init__( self, session: PipSession, line_parser: LineParser, ) -> None: self._session = session self._line_parser = line_parser def parse(self, filename: str, constraint: bool) -> Iterator[ParsedLine]: """Parse a given file, yielding parsed lines.""" yield from self._parse_and_recurse(filename, constraint) def _parse_and_recurse( self, filename: str, constraint: bool ) -> Iterator[ParsedLine]: for line in self._parse_file(filename, constraint): if not line.is_requirement and ( line.opts.requirements or line.opts.constraints ): # parse a nested requirements file if line.opts.requirements: req_path = line.opts.requirements[0] nested_constraint = False else: req_path = line.opts.constraints[0] nested_constraint = True # original file is over http if SCHEME_RE.search(filename): # do a url join so relative paths work req_path = urllib.parse.urljoin(filename, req_path) # original file and nested file are paths elif not SCHEME_RE.search(req_path): # do a join so relative paths work req_path = os.path.join( os.path.dirname(filename), req_path, ) yield from self._parse_and_recurse(req_path, nested_constraint) else: yield line def _parse_file(self, filename: str, constraint: bool) -> Iterator[ParsedLine]: _, content = get_file_content(filename, self._session) lines_enum = preprocess(content) for line_number, line in lines_enum: try: args_str, opts = self._line_parser(line) except OptionParsingError as e: # add offending line msg = f"Invalid requirement: {line}\n{e.msg}" raise RequirementsFileParseError(msg) yield ParsedLine( filename, line_number, args_str, opts, constraint, ) def get_line_parser(finder: Optional["PackageFinder"]) -> LineParser: def parse_line(line: str) -> Tuple[str, Values]: # Build new parser for each line since it accumulates appendable # options. parser = build_parser() defaults = parser.get_default_values() defaults.index_url = None if finder: defaults.format_control = finder.format_control args_str, options_str = break_args_options(line) opts, _ = parser.parse_args(shlex.split(options_str), defaults) return args_str, opts return parse_line def break_args_options(line: str) -> Tuple[str, str]: """Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. """ tokens = line.split(" ") args = [] options = tokens[:] for token in tokens: if token.startswith("-") or token.startswith("--"): break else: args.append(token) options.pop(0) return " ".join(args), " ".join(options) class OptionParsingError(Exception): def __init__(self, msg: str) -> None: self.msg = msg def build_parser() -> optparse.OptionParser: """ Return a parser for parsing requirement lines """ parser = optparse.OptionParser(add_help_option=False) option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ for option_factory in option_factories: option = option_factory() parser.add_option(option) # By default optparse sys.exits on parsing errors. We want to wrap # that in our own exception. def parser_exit(self: Any, msg: str) -> "NoReturn": raise OptionParsingError(msg) # NOTE: mypy disallows assigning to a method # https://github.com/python/mypy/issues/2427 parser.exit = parser_exit # type: ignore return parser def join_lines(lines_enum: ReqFileLines) -> ReqFileLines: """Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line. """ primary_line_number = None new_line: List[str] = [] for line_number, line in lines_enum: if not line.endswith("\\") or COMMENT_RE.match(line): if COMMENT_RE.match(line): # this ensures comments are always matched later line = " " + line if new_line: new_line.append(line) assert primary_line_number is not None yield primary_line_number, "".join(new_line) new_line = [] else: yield line_number, line else: if not new_line: primary_line_number = line_number new_line.append(line.strip("\\")) # last line contains \ if new_line: assert primary_line_number is not None yield primary_line_number, "".join(new_line) # TODO: handle space after '\'. def ignore_comments(lines_enum: ReqFileLines) -> ReqFileLines: """ Strips comments and filter empty lines. """ for line_number, line in lines_enum: line = COMMENT_RE.sub("", line) line = line.strip() if line: yield line_number, line def expand_env_variables(lines_enum: ReqFileLines) -> ReqFileLines: """Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. These points are the result of a discussion on the `github pull request #3514 `_. Valid characters in variable names follow the `POSIX standard `_ and are limited to uppercase letter, digits and the `_` (underscore). """ for line_number, line in lines_enum: for env_var, var_name in ENV_VAR_RE.findall(line): value = os.getenv(var_name) if not value: continue line = line.replace(env_var, value) yield line_number, line def get_file_content(url: str, session: PipSession) -> Tuple[str, str]: """Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance. """ scheme = get_url_scheme(url) # Pip has special support for file:// URLs (LocalFSAdapter). if scheme in ["http", "https", "file"]: resp = session.get(url) raise_for_status(resp) return resp.url, resp.text # Assume this is a bare path. try: with open(url, "rb") as f: content = auto_decode(f.read()) except OSError as exc: raise InstallationError(f"Could not open requirements file: {exc}") return url, content PK]t req/__init__.pynu[import collections import logging from typing import Iterator, List, Optional, Sequence, Tuple from pip._internal.utils.logging import indent_log from .req_file import parse_requirements from .req_install import InstallRequirement from .req_set import RequirementSet __all__ = [ "RequirementSet", "InstallRequirement", "parse_requirements", "install_given_reqs", ] logger = logging.getLogger(__name__) class InstallationResult: def __init__(self, name: str) -> None: self.name = name def __repr__(self) -> str: return f"InstallationResult(name={self.name!r})" def _validate_requirements( requirements: List[InstallRequirement], ) -> Iterator[Tuple[str, InstallRequirement]]: for req in requirements: assert req.name, f"invalid to-be-installed requirement: {req}" yield req.name, req def install_given_reqs( requirements: List[InstallRequirement], install_options: List[str], global_options: Sequence[str], root: Optional[str], home: Optional[str], prefix: Optional[str], warn_script_location: bool, use_user_site: bool, pycompile: bool, ) -> List[InstallationResult]: """ Install everything in the given list. (to be called after having downloaded and unpacked the packages) """ to_install = collections.OrderedDict(_validate_requirements(requirements)) if to_install: logger.info( "Installing collected packages: %s", ", ".join(to_install.keys()), ) installed = [] with indent_log(): for req_name, requirement in to_install.items(): if requirement.should_reinstall: logger.info("Attempting uninstall: %s", req_name) with indent_log(): uninstalled_pathset = requirement.uninstall(auto_confirm=True) else: uninstalled_pathset = None try: requirement.install( install_options, global_options, root=root, home=home, prefix=prefix, warn_script_location=warn_script_location, use_user_site=use_user_site, pycompile=pycompile, ) except Exception: # if install did not succeed, rollback previous uninstall if uninstalled_pathset and not requirement.install_succeeded: uninstalled_pathset.rollback() raise else: if uninstalled_pathset and requirement.install_succeeded: uninstalled_pathset.commit() installed.append(InstallationResult(req_name)) return installed PK]SJJreq/req_install.pynu[# The following comment should be removed at some point in the future. # mypy: strict-optional=False import functools import logging import os import shutil import sys import uuid import zipfile from typing import Any, Collection, Dict, Iterable, List, Optional, Sequence, Union from pip._vendor import pkg_resources from pip._vendor.packaging.markers import Marker from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import parse as parse_version from pip._vendor.pep517.wrappers import Pep517HookCaller from pip._vendor.pkg_resources import Distribution from pip._internal.build_env import BuildEnvironment, NoOpBuildEnvironment from pip._internal.exceptions import InstallationError from pip._internal.locations import get_scheme from pip._internal.models.link import Link from pip._internal.operations.build.metadata import generate_metadata from pip._internal.operations.build.metadata_editable import generate_editable_metadata from pip._internal.operations.build.metadata_legacy import ( generate_metadata as generate_metadata_legacy, ) from pip._internal.operations.install.editable_legacy import ( install_editable as install_editable_legacy, ) from pip._internal.operations.install.legacy import LegacyInstallFailure from pip._internal.operations.install.legacy import install as install_legacy from pip._internal.operations.install.wheel import install_wheel from pip._internal.pyproject import load_pyproject_toml, make_pyproject_path from pip._internal.req.req_uninstall import UninstallPathSet from pip._internal.utils.deprecation import deprecated from pip._internal.utils.direct_url_helpers import ( direct_url_for_editable, direct_url_from_link, ) from pip._internal.utils.hashes import Hashes from pip._internal.utils.misc import ( ask_path_exists, backup_dir, display_path, dist_in_install_path, dist_in_site_packages, dist_in_usersite, get_distribution, hide_url, redact_auth_from_url, ) from pip._internal.utils.packaging import get_metadata from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds from pip._internal.utils.virtualenv import running_under_virtualenv from pip._internal.vcs import vcs logger = logging.getLogger(__name__) def _get_dist(metadata_directory: str) -> Distribution: """Return a pkg_resources.Distribution for the provided metadata directory. """ dist_dir = metadata_directory.rstrip(os.sep) # Build a PathMetadata object, from path to metadata. :wink: base_dir, dist_dir_name = os.path.split(dist_dir) metadata = pkg_resources.PathMetadata(base_dir, dist_dir) # Determine the correct Distribution object type. if dist_dir.endswith(".egg-info"): dist_cls = pkg_resources.Distribution dist_name = os.path.splitext(dist_dir_name)[0] else: assert dist_dir.endswith(".dist-info") dist_cls = pkg_resources.DistInfoDistribution dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0] return dist_cls( base_dir, project_name=dist_name, metadata=metadata, ) class InstallRequirement: """ Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. """ def __init__( self, req: Optional[Requirement], comes_from: Optional[Union[str, "InstallRequirement"]], editable: bool = False, link: Optional[Link] = None, markers: Optional[Marker] = None, use_pep517: Optional[bool] = None, isolated: bool = False, install_options: Optional[List[str]] = None, global_options: Optional[List[str]] = None, hash_options: Optional[Dict[str, List[str]]] = None, constraint: bool = False, extras: Collection[str] = (), user_supplied: bool = False, permit_editable_wheels: bool = False, ) -> None: assert req is None or isinstance(req, Requirement), req self.req = req self.comes_from = comes_from self.constraint = constraint self.editable = editable self.permit_editable_wheels = permit_editable_wheels self.legacy_install_reason: Optional[int] = None # source_dir is the local directory where the linked requirement is # located, or unpacked. In case unpacking is needed, creating and # populating source_dir is done by the RequirementPreparer. Note this # is not necessarily the directory where pyproject.toml or setup.py is # located - that one is obtained via unpacked_source_directory. self.source_dir: Optional[str] = None if self.editable: assert link if link.is_file: self.source_dir = os.path.normpath(os.path.abspath(link.file_path)) if link is None and req and req.url: # PEP 508 URL requirement link = Link(req.url) self.link = self.original_link = link self.original_link_is_in_wheel_cache = False # Path to any downloaded or already-existing package. self.local_file_path: Optional[str] = None if self.link and self.link.is_file: self.local_file_path = self.link.file_path if extras: self.extras = extras elif req: self.extras = {pkg_resources.safe_extra(extra) for extra in req.extras} else: self.extras = set() if markers is None and req: markers = req.marker self.markers = markers # This holds the pkg_resources.Distribution object if this requirement # is already available: self.satisfied_by: Optional[Distribution] = None # Whether the installation process should try to uninstall an existing # distribution before installing this requirement. self.should_reinstall = False # Temporary build location self._temp_build_dir: Optional[TempDirectory] = None # Set to True after successful installation self.install_succeeded: Optional[bool] = None # Supplied options self.install_options = install_options if install_options else [] self.global_options = global_options if global_options else [] self.hash_options = hash_options if hash_options else {} # Set to True after successful preparation of this requirement self.prepared = False # User supplied requirement are explicitly requested for installation # by the user via CLI arguments or requirements files, as opposed to, # e.g. dependencies, extras or constraints. self.user_supplied = user_supplied self.isolated = isolated self.build_env: BuildEnvironment = NoOpBuildEnvironment() # For PEP 517, the directory where we request the project metadata # gets stored. We need this to pass to build_wheel, so the backend # can ensure that the wheel matches the metadata (see the PEP for # details). self.metadata_directory: Optional[str] = None # The static build requirements (from pyproject.toml) self.pyproject_requires: Optional[List[str]] = None # Build requirements that we will check are available self.requirements_to_check: List[str] = [] # The PEP 517 backend we should use to build the project self.pep517_backend: Optional[Pep517HookCaller] = None # Are we using PEP 517 for this requirement? # After pyproject.toml has been loaded, the only valid values are True # and False. Before loading, None is valid (meaning "use the default"). # Setting an explicit value before loading pyproject.toml is supported, # but after loading this flag should be treated as read only. self.use_pep517 = use_pep517 # This requirement needs more preparation before it can be built self.needs_more_preparation = False def __str__(self) -> str: if self.req: s = str(self.req) if self.link: s += " from {}".format(redact_auth_from_url(self.link.url)) elif self.link: s = redact_auth_from_url(self.link.url) else: s = "" if self.satisfied_by is not None: s += " in {}".format(display_path(self.satisfied_by.location)) if self.comes_from: if isinstance(self.comes_from, str): comes_from: Optional[str] = self.comes_from else: comes_from = self.comes_from.from_path() if comes_from: s += f" (from {comes_from})" return s def __repr__(self) -> str: return "<{} object: {} editable={!r}>".format( self.__class__.__name__, str(self), self.editable ) def format_debug(self) -> str: """An un-tested helper for getting state, for debugging.""" attributes = vars(self) names = sorted(attributes) state = ("{}={!r}".format(attr, attributes[attr]) for attr in sorted(names)) return "<{name} object: {{{state}}}>".format( name=self.__class__.__name__, state=", ".join(state), ) # Things that are valid for all kinds of requirements? @property def name(self) -> Optional[str]: if self.req is None: return None return pkg_resources.safe_name(self.req.name) @functools.lru_cache() # use cached_property in python 3.8+ def supports_pyproject_editable(self) -> bool: if not self.use_pep517: return False assert self.pep517_backend with self.build_env: runner = runner_with_spinner_message( "Checking if build backend supports build_editable" ) with self.pep517_backend.subprocess_runner(runner): return "build_editable" in self.pep517_backend._supported_features() @property def specifier(self) -> SpecifierSet: return self.req.specifier @property def is_pinned(self) -> bool: """Return whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. """ specifiers = self.specifier return len(specifiers) == 1 and next(iter(specifiers)).operator in {"==", "==="} def match_markers(self, extras_requested: Optional[Iterable[str]] = None) -> bool: if not extras_requested: # Provide an extra to safely evaluate the markers # without matching any extra extras_requested = ("",) if self.markers is not None: return any( self.markers.evaluate({"extra": extra}) for extra in extras_requested ) else: return True @property def has_hash_options(self) -> bool: """Return whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. """ return bool(self.hash_options) def hashes(self, trust_internet: bool = True) -> Hashes: """Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() """ good_hashes = self.hash_options.copy() link = self.link if trust_internet else self.original_link if link and link.hash: good_hashes.setdefault(link.hash_name, []).append(link.hash) return Hashes(good_hashes) def from_path(self) -> Optional[str]: """Format a nice indicator to show where this "comes from" """ if self.req is None: return None s = str(self.req) if self.comes_from: if isinstance(self.comes_from, str): comes_from = self.comes_from else: comes_from = self.comes_from.from_path() if comes_from: s += "->" + comes_from return s def ensure_build_location( self, build_dir: str, autodelete: bool, parallel_builds: bool ) -> str: assert build_dir is not None if self._temp_build_dir is not None: assert self._temp_build_dir.path return self._temp_build_dir.path if self.req is None: # Some systems have /tmp as a symlink which confuses custom # builds (such as numpy). Thus, we ensure that the real path # is returned. self._temp_build_dir = TempDirectory( kind=tempdir_kinds.REQ_BUILD, globally_managed=True ) return self._temp_build_dir.path # This is the only remaining place where we manually determine the path # for the temporary directory. It is only needed for editables where # it is the value of the --src option. # When parallel builds are enabled, add a UUID to the build directory # name so multiple builds do not interfere with each other. dir_name: str = canonicalize_name(self.name) if parallel_builds: dir_name = f"{dir_name}_{uuid.uuid4().hex}" # FIXME: Is there a better place to create the build_dir? (hg and bzr # need this) if not os.path.exists(build_dir): logger.debug("Creating directory %s", build_dir) os.makedirs(build_dir) actual_build_dir = os.path.join(build_dir, dir_name) # `None` indicates that we respect the globally-configured deletion # settings, which is what we actually want when auto-deleting. delete_arg = None if autodelete else False return TempDirectory( path=actual_build_dir, delete=delete_arg, kind=tempdir_kinds.REQ_BUILD, globally_managed=True, ).path def _set_requirement(self) -> None: """Set requirement after generating metadata.""" assert self.req is None assert self.metadata is not None assert self.source_dir is not None # Construct a Requirement object from the generated metadata if isinstance(parse_version(self.metadata["Version"]), Version): op = "==" else: op = "===" self.req = Requirement( "".join( [ self.metadata["Name"], op, self.metadata["Version"], ] ) ) def warn_on_mismatching_name(self) -> None: metadata_name = canonicalize_name(self.metadata["Name"]) if canonicalize_name(self.req.name) == metadata_name: # Everything is fine. return # If we're here, there's a mismatch. Log a warning about it. logger.warning( "Generating metadata for package %s " "produced metadata for project name %s. Fix your " "#egg=%s fragments.", self.name, metadata_name, self.name, ) self.req = Requirement(metadata_name) def check_if_exists(self, use_user_site: bool) -> None: """Find an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. """ if self.req is None: return existing_dist = get_distribution(self.req.name) if not existing_dist: return # pkg_resouces may contain a different copy of packaging.version from # pip in if the downstream distributor does a poor job debundling pip. # We avoid existing_dist.parsed_version and let SpecifierSet.contains # parses the version instead. existing_version = existing_dist.version version_compatible = ( existing_version is not None and self.req.specifier.contains(existing_version, prereleases=True) ) if not version_compatible: self.satisfied_by = None if use_user_site: if dist_in_usersite(existing_dist): self.should_reinstall = True elif running_under_virtualenv() and dist_in_site_packages( existing_dist ): raise InstallationError( "Will not install to the user site because it will " "lack sys.path precedence to {} in {}".format( existing_dist.project_name, existing_dist.location ) ) elif dist_in_install_path(existing_dist): self.should_reinstall = True else: if self.editable: self.should_reinstall = True # when installing editables, nothing pre-existing should ever # satisfy self.satisfied_by = None else: self.satisfied_by = existing_dist # Things valid for wheels @property def is_wheel(self) -> bool: if not self.link: return False return self.link.is_wheel # Things valid for sdists @property def unpacked_source_directory(self) -> str: return os.path.join( self.source_dir, self.link and self.link.subdirectory_fragment or "" ) @property def setup_py_path(self) -> str: assert self.source_dir, f"No source dir for {self}" setup_py = os.path.join(self.unpacked_source_directory, "setup.py") return setup_py @property def setup_cfg_path(self) -> str: assert self.source_dir, f"No source dir for {self}" setup_cfg = os.path.join(self.unpacked_source_directory, "setup.cfg") return setup_cfg @property def pyproject_toml_path(self) -> str: assert self.source_dir, f"No source dir for {self}" return make_pyproject_path(self.unpacked_source_directory) def load_pyproject_toml(self) -> None: """Load the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we should follow the PEP 517 or legacy (setup.py) code path. """ pyproject_toml_data = load_pyproject_toml( self.use_pep517, self.pyproject_toml_path, self.setup_py_path, str(self) ) if pyproject_toml_data is None: self.use_pep517 = False return self.use_pep517 = True requires, backend, check, backend_path = pyproject_toml_data self.requirements_to_check = check self.pyproject_requires = requires self.pep517_backend = Pep517HookCaller( self.unpacked_source_directory, backend, backend_path=backend_path, ) def isolated_editable_sanity_check(self) -> None: """Check that an editable requirement if valid for use with PEP 517/518. This verifies that an editable that has a pyproject.toml either supports PEP 660 or as a setup.py or a setup.cfg """ if ( self.editable and self.use_pep517 and not self.supports_pyproject_editable() and not os.path.isfile(self.setup_py_path) and not os.path.isfile(self.setup_cfg_path) ): raise InstallationError( f"Project {self} has a 'pyproject.toml' and its build " f"backend is missing the 'build_editable' hook. Since it does not " f"have a 'setup.py' nor a 'setup.cfg', " f"it cannot be installed in editable mode. " f"Consider using a build backend that supports PEP 660." ) def prepare_metadata(self) -> None: """Ensure that project metadata is available. Under PEP 517 and PEP 660, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. """ assert self.source_dir if self.use_pep517: assert self.pep517_backend is not None if ( self.editable and self.permit_editable_wheels and self.supports_pyproject_editable() ): self.metadata_directory = generate_editable_metadata( build_env=self.build_env, backend=self.pep517_backend, ) else: self.metadata_directory = generate_metadata( build_env=self.build_env, backend=self.pep517_backend, ) else: self.metadata_directory = generate_metadata_legacy( build_env=self.build_env, setup_py_path=self.setup_py_path, source_dir=self.unpacked_source_directory, isolated=self.isolated, details=self.name or f"from {self.link}", ) # Act on the newly generated metadata, based on the name and version. if not self.name: self._set_requirement() else: self.warn_on_mismatching_name() self.assert_source_matches_version() @property def metadata(self) -> Any: if not hasattr(self, "_metadata"): self._metadata = get_metadata(self.get_dist()) return self._metadata def get_dist(self) -> Distribution: return _get_dist(self.metadata_directory) def assert_source_matches_version(self) -> None: assert self.source_dir version = self.metadata["version"] if self.req.specifier and version not in self.req.specifier: logger.warning( "Requested %s, but installing version %s", self, version, ) else: logger.debug( "Source in %s has version %s, which satisfies requirement %s", display_path(self.source_dir), version, self, ) # For both source distributions and editables def ensure_has_source_dir( self, parent_dir: str, autodelete: bool = False, parallel_builds: bool = False, ) -> None: """Ensure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir """ if self.source_dir is None: self.source_dir = self.ensure_build_location( parent_dir, autodelete=autodelete, parallel_builds=parallel_builds, ) # For editable installations def update_editable(self) -> None: if not self.link: logger.debug( "Cannot update repository at %s; repository location is unknown", self.source_dir, ) return assert self.editable assert self.source_dir if self.link.scheme == "file": # Static paths don't get updated return vcs_backend = vcs.get_backend_for_scheme(self.link.scheme) # Editable requirements are validated in Requirement constructors. # So here, if it's neither a path nor a valid VCS URL, it's a bug. assert vcs_backend, f"Unsupported VCS URL {self.link.url}" hidden_url = hide_url(self.link.url) vcs_backend.obtain(self.source_dir, url=hidden_url) # Top-level Actions def uninstall( self, auto_confirm: bool = False, verbose: bool = False ) -> Optional[UninstallPathSet]: """ Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. """ assert self.req dist = get_distribution(self.req.name) if not dist: logger.warning("Skipping %s as it is not installed.", self.name) return None logger.info("Found existing installation: %s", dist) uninstalled_pathset = UninstallPathSet.from_dist(dist) uninstalled_pathset.remove(auto_confirm, verbose) return uninstalled_pathset def _get_archive_name(self, path: str, parentdir: str, rootdir: str) -> str: def _clean_zip_name(name: str, prefix: str) -> str: assert name.startswith( prefix + os.path.sep ), f"name {name!r} doesn't start with prefix {prefix!r}" name = name[len(prefix) + 1 :] name = name.replace(os.path.sep, "/") return name path = os.path.join(parentdir, path) name = _clean_zip_name(path, rootdir) return self.name + "/" + name def archive(self, build_dir: Optional[str]) -> None: """Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. """ assert self.source_dir if build_dir is None: return create_archive = True archive_name = "{}-{}.zip".format(self.name, self.metadata["version"]) archive_path = os.path.join(build_dir, archive_name) if os.path.exists(archive_path): response = ask_path_exists( "The file {} exists. (i)gnore, (w)ipe, " "(b)ackup, (a)bort ".format(display_path(archive_path)), ("i", "w", "b", "a"), ) if response == "i": create_archive = False elif response == "w": logger.warning("Deleting %s", display_path(archive_path)) os.remove(archive_path) elif response == "b": dest_file = backup_dir(archive_path) logger.warning( "Backing up %s to %s", display_path(archive_path), display_path(dest_file), ) shutil.move(archive_path, dest_file) elif response == "a": sys.exit(-1) if not create_archive: return zip_output = zipfile.ZipFile( archive_path, "w", zipfile.ZIP_DEFLATED, allowZip64=True, ) with zip_output: dir = os.path.normcase(os.path.abspath(self.unpacked_source_directory)) for dirpath, dirnames, filenames in os.walk(dir): for dirname in dirnames: dir_arcname = self._get_archive_name( dirname, parentdir=dirpath, rootdir=dir, ) zipdir = zipfile.ZipInfo(dir_arcname + "/") zipdir.external_attr = 0x1ED << 16 # 0o755 zip_output.writestr(zipdir, "") for filename in filenames: file_arcname = self._get_archive_name( filename, parentdir=dirpath, rootdir=dir, ) filename = os.path.join(dirpath, filename) zip_output.write(filename, file_arcname) logger.info("Saved %s", display_path(archive_path)) def install( self, install_options: List[str], global_options: Optional[Sequence[str]] = None, root: Optional[str] = None, home: Optional[str] = None, prefix: Optional[str] = None, warn_script_location: bool = True, use_user_site: bool = False, pycompile: bool = True, ) -> None: scheme = get_scheme( self.name, user=use_user_site, home=home, root=root, isolated=self.isolated, prefix=prefix, ) global_options = global_options if global_options is not None else [] if self.editable and not self.is_wheel: install_editable_legacy( install_options, global_options, prefix=prefix, home=home, use_user_site=use_user_site, name=self.name, setup_py_path=self.setup_py_path, isolated=self.isolated, build_env=self.build_env, unpacked_source_directory=self.unpacked_source_directory, ) self.install_succeeded = True return if self.is_wheel: assert self.local_file_path direct_url = None if self.editable: direct_url = direct_url_for_editable(self.unpacked_source_directory) elif self.original_link: direct_url = direct_url_from_link( self.original_link, self.source_dir, self.original_link_is_in_wheel_cache, ) install_wheel( self.name, self.local_file_path, scheme=scheme, req_description=str(self.req), pycompile=pycompile, warn_script_location=warn_script_location, direct_url=direct_url, requested=self.user_supplied, ) self.install_succeeded = True return # TODO: Why don't we do this for editable installs? # Extend the list of global and install options passed on to # the setup.py call with the ones from the requirements file. # Options specified in requirements file override those # specified on the command line, since the last option given # to setup.py is the one that is used. global_options = list(global_options) + self.global_options install_options = list(install_options) + self.install_options try: success = install_legacy( install_options=install_options, global_options=global_options, root=root, home=home, prefix=prefix, use_user_site=use_user_site, pycompile=pycompile, scheme=scheme, setup_py_path=self.setup_py_path, isolated=self.isolated, req_name=self.name, build_env=self.build_env, unpacked_source_directory=self.unpacked_source_directory, req_description=str(self.req), ) except LegacyInstallFailure as exc: self.install_succeeded = False raise exc.__cause__ except Exception: self.install_succeeded = True raise self.install_succeeded = success if success and self.legacy_install_reason == 8368: deprecated( reason=( "{} was installed using the legacy 'setup.py install' " "method, because a wheel could not be built for it.".format( self.name ) ), replacement="to fix the wheel build issue reported above", gone_in=None, issue=8368, ) def check_invalid_constraint_type(req: InstallRequirement) -> str: # Check for unsupported forms problem = "" if not req.name: problem = "Unnamed requirements are not allowed as constraints" elif req.editable: problem = "Editable requirements are not allowed as constraints" elif req.extras: problem = "Constraints cannot have extras" if problem: deprecated( reason=( "Constraints are only allowed to take the form of a package " "name and a version specifier. Other forms were originally " "permitted as an accident of the implementation, but were " "undocumented. The new implementation of the resolver no " "longer supports these forms." ), replacement="replacing the constraint with a requirement", # No plan yet for when the new resolver becomes default gone_in=None, issue=8210, ) return problem PK]ecu˵;;req/constructors.pynu["""Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used elsewhere within pip to create instances of InstallRequirement. """ import logging import os import re from typing import Any, Dict, Optional, Set, Tuple, Union from pip._vendor.packaging.markers import Marker from pip._vendor.packaging.requirements import InvalidRequirement, Requirement from pip._vendor.packaging.specifiers import Specifier from pip._vendor.pkg_resources import RequirementParseError, parse_requirements from pip._internal.exceptions import InstallationError from pip._internal.models.index import PyPI, TestPyPI from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.req.req_file import ParsedRequirement from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.filetypes import is_archive_file from pip._internal.utils.misc import is_installable_dir from pip._internal.utils.packaging import get_requirement from pip._internal.utils.urls import path_to_url from pip._internal.vcs import is_url, vcs __all__ = [ "install_req_from_editable", "install_req_from_line", "parse_editable", ] logger = logging.getLogger(__name__) operators = Specifier._operators.keys() def _strip_extras(path: str) -> Tuple[str, Optional[str]]: m = re.match(r"^(.+)(\[[^\]]+\])$", path) extras = None if m: path_no_extras = m.group(1) extras = m.group(2) else: path_no_extras = path return path_no_extras, extras def convert_extras(extras: Optional[str]) -> Set[str]: if not extras: return set() return get_requirement("placeholder" + extras.lower()).extras def parse_editable(editable_req: str) -> Tuple[Optional[str], str, Set[str]]: """Parses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir .[some_extra] """ url = editable_req # If a file path is specified with extras, strip off the extras. url_no_extras, extras = _strip_extras(url) if os.path.isdir(url_no_extras): # Treating it as code that has already been checked out url_no_extras = path_to_url(url_no_extras) if url_no_extras.lower().startswith("file:"): package_name = Link(url_no_extras).egg_fragment if extras: return ( package_name, url_no_extras, get_requirement("placeholder" + extras.lower()).extras, ) else: return package_name, url_no_extras, set() for version_control in vcs: if url.lower().startswith(f"{version_control}:"): url = f"{version_control}+{url}" break link = Link(url) if not link.is_vcs: backends = ", ".join(vcs.all_schemes) raise InstallationError( f"{editable_req} is not a valid editable requirement. " f"It should either be a path to a local project or a VCS URL " f"(beginning with {backends})." ) package_name = link.egg_fragment if not package_name: raise InstallationError( "Could not detect requirement name for '{}', please specify one " "with #egg=your_package_name".format(editable_req) ) return package_name, url, set() def deduce_helpful_msg(req: str) -> str: """Returns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path """ msg = "" if os.path.exists(req): msg = " The path does exist. " # Try to parse and check if it is a requirements file. try: with open(req) as fp: # parse first line only next(parse_requirements(fp.read())) msg += ( "The argument you provided " "({}) appears to be a" " requirements file. If that is the" " case, use the '-r' flag to install" " the packages specified within it." ).format(req) except RequirementParseError: logger.debug("Cannot parse '%s' as requirements file", req, exc_info=True) else: msg += f" File '{req}' does not exist." return msg class RequirementParts: def __init__( self, requirement: Optional[Requirement], link: Optional[Link], markers: Optional[Marker], extras: Set[str], ): self.requirement = requirement self.link = link self.markers = markers self.extras = extras def parse_req_from_editable(editable_req: str) -> RequirementParts: name, url, extras_override = parse_editable(editable_req) if name is not None: try: req: Optional[Requirement] = Requirement(name) except InvalidRequirement: raise InstallationError(f"Invalid requirement: '{name}'") else: req = None link = Link(url) return RequirementParts(req, link, None, extras_override) # ---- The actual constructors follow ---- def install_req_from_editable( editable_req: str, comes_from: Optional[Union[InstallRequirement, str]] = None, use_pep517: Optional[bool] = None, isolated: bool = False, options: Optional[Dict[str, Any]] = None, constraint: bool = False, user_supplied: bool = False, permit_editable_wheels: bool = False, ) -> InstallRequirement: parts = parse_req_from_editable(editable_req) return InstallRequirement( parts.requirement, comes_from=comes_from, user_supplied=user_supplied, editable=True, permit_editable_wheels=permit_editable_wheels, link=parts.link, constraint=constraint, use_pep517=use_pep517, isolated=isolated, install_options=options.get("install_options", []) if options else [], global_options=options.get("global_options", []) if options else [], hash_options=options.get("hashes", {}) if options else {}, extras=parts.extras, ) def _looks_like_path(name: str) -> bool: """Checks whether the string "looks like" a path on the filesystem. This does not check whether the target actually exists, only judge from the appearance. Returns true if any of the following conditions is true: * a path separator is found (either os.path.sep or os.path.altsep); * a dot is found (which represents the current directory). """ if os.path.sep in name: return True if os.path.altsep is not None and os.path.altsep in name: return True if name.startswith("."): return True return False def _get_url_from_path(path: str, name: str) -> Optional[str]: """ First, it checks whether a provided path is an installable directory. If it is, returns the path. If false, check if the path is an archive file (such as a .whl). The function checks if the path is a file. If false, if the path has an @, it will treat it as a PEP 440 URL requirement and return the path. """ if _looks_like_path(name) and os.path.isdir(path): if is_installable_dir(path): return path_to_url(path) # TODO: The is_installable_dir test here might not be necessary # now that it is done in load_pyproject_toml too. raise InstallationError( f"Directory {name!r} is not installable. Neither 'setup.py' " "nor 'pyproject.toml' found." ) if not is_archive_file(path): return None if os.path.isfile(path): return path_to_url(path) urlreq_parts = name.split("@", 1) if len(urlreq_parts) >= 2 and not _looks_like_path(urlreq_parts[0]): # If the path contains '@' and the part before it does not look # like a path, try to treat it as a PEP 440 URL req instead. return None logger.warning( "Requirement %r looks like a filename, but the file does not exist", name, ) return path_to_url(path) def parse_req_from_line(name: str, line_source: Optional[str]) -> RequirementParts: if is_url(name): marker_sep = "; " else: marker_sep = ";" if marker_sep in name: name, markers_as_string = name.split(marker_sep, 1) markers_as_string = markers_as_string.strip() if not markers_as_string: markers = None else: markers = Marker(markers_as_string) else: markers = None name = name.strip() req_as_string = None path = os.path.normpath(os.path.abspath(name)) link = None extras_as_string = None if is_url(name): link = Link(name) else: p, extras_as_string = _strip_extras(path) url = _get_url_from_path(p, name) if url is not None: link = Link(url) # it's a local file, dir, or url if link: # Handle relative file URLs if link.scheme == "file" and re.search(r"\.\./", link.url): link = Link(path_to_url(os.path.normpath(os.path.abspath(link.path)))) # wheel file if link.is_wheel: wheel = Wheel(link.filename) # can raise InvalidWheelFilename req_as_string = f"{wheel.name}=={wheel.version}" else: # set the req to the egg fragment. when it's not there, this # will become an 'unnamed' requirement req_as_string = link.egg_fragment # a requirement specifier else: req_as_string = name extras = convert_extras(extras_as_string) def with_source(text: str) -> str: if not line_source: return text return f"{text} (from {line_source})" def _parse_req_string(req_as_string: str) -> Requirement: try: req = get_requirement(req_as_string) except InvalidRequirement: if os.path.sep in req_as_string: add_msg = "It looks like a path." add_msg += deduce_helpful_msg(req_as_string) elif "=" in req_as_string and not any( op in req_as_string for op in operators ): add_msg = "= is not a valid operator. Did you mean == ?" else: add_msg = "" msg = with_source(f"Invalid requirement: {req_as_string!r}") if add_msg: msg += f"\nHint: {add_msg}" raise InstallationError(msg) else: # Deprecate extras after specifiers: "name>=1.0[extras]" # This currently works by accident because _strip_extras() parses # any extras in the end of the string and those are saved in # RequirementParts for spec in req.specifier: spec_str = str(spec) if spec_str.endswith("]"): msg = f"Extras after version '{spec_str}'." raise InstallationError(msg) return req if req_as_string is not None: req: Optional[Requirement] = _parse_req_string(req_as_string) else: req = None return RequirementParts(req, link, markers, extras) def install_req_from_line( name: str, comes_from: Optional[Union[str, InstallRequirement]] = None, use_pep517: Optional[bool] = None, isolated: bool = False, options: Optional[Dict[str, Any]] = None, constraint: bool = False, line_source: Optional[str] = None, user_supplied: bool = False, ) -> InstallRequirement: """Creates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. :param line_source: An optional string describing where the line is from, for logging purposes in case of an error. """ parts = parse_req_from_line(name, line_source) return InstallRequirement( parts.requirement, comes_from, link=parts.link, markers=parts.markers, use_pep517=use_pep517, isolated=isolated, install_options=options.get("install_options", []) if options else [], global_options=options.get("global_options", []) if options else [], hash_options=options.get("hashes", {}) if options else {}, constraint=constraint, extras=parts.extras, user_supplied=user_supplied, ) def install_req_from_req_string( req_string: str, comes_from: Optional[InstallRequirement] = None, isolated: bool = False, use_pep517: Optional[bool] = None, user_supplied: bool = False, ) -> InstallRequirement: try: req = get_requirement(req_string) except InvalidRequirement: raise InstallationError(f"Invalid requirement: '{req_string}'") domains_not_allowed = [ PyPI.file_storage_domain, TestPyPI.file_storage_domain, ] if ( req.url and comes_from and comes_from.link and comes_from.link.netloc in domains_not_allowed ): # Explicitly disallow pypi packages that depend on external urls raise InstallationError( "Packages installed from PyPI cannot depend on packages " "which are not also hosted on PyPI.\n" "{} depends on {} ".format(comes_from.name, req) ) return InstallRequirement( req, comes_from, isolated=isolated, use_pep517=use_pep517, user_supplied=user_supplied, ) def install_req_from_parsed_requirement( parsed_req: ParsedRequirement, isolated: bool = False, use_pep517: Optional[bool] = None, user_supplied: bool = False, ) -> InstallRequirement: if parsed_req.is_editable: req = install_req_from_editable( parsed_req.requirement, comes_from=parsed_req.comes_from, use_pep517=use_pep517, constraint=parsed_req.constraint, isolated=isolated, user_supplied=user_supplied, ) else: req = install_req_from_line( parsed_req.requirement, comes_from=parsed_req.comes_from, use_pep517=use_pep517, isolated=isolated, options=parsed_req.options, constraint=parsed_req.constraint, line_source=parsed_req.line_source, user_supplied=user_supplied, ) return req def install_req_from_link_and_ireq( link: Link, ireq: InstallRequirement ) -> InstallRequirement: return InstallRequirement( req=ireq.req, comes_from=ireq.comes_from, editable=ireq.editable, link=link, markers=ireq.markers, use_pep517=ireq.use_pep517, isolated=ireq.isolated, install_options=ireq.install_options, global_options=ireq.global_options, hash_options=ireq.hash_options, ) PK]yfl11 exceptions.pynu["""Exceptions used throughout package""" import configparser from itertools import chain, groupby, repeat from typing import TYPE_CHECKING, Dict, List, Optional, Union from pip._vendor.pkg_resources import Distribution from pip._vendor.requests.models import Request, Response if TYPE_CHECKING: from hashlib import _Hash from pip._internal.metadata import BaseDistribution from pip._internal.req.req_install import InstallRequirement class PipError(Exception): """Base pip exception""" class ConfigurationError(PipError): """General exception in configuration""" class InstallationError(PipError): """General exception during installation""" class UninstallationError(PipError): """General exception during uninstallation""" class NoneMetadataError(PipError): """ Raised when accessing "METADATA" or "PKG-INFO" metadata for a pip._vendor.pkg_resources.Distribution object and `dist.has_metadata('METADATA')` returns True but `dist.get_metadata('METADATA')` returns None (and similarly for "PKG-INFO"). """ def __init__( self, dist: Union[Distribution, "BaseDistribution"], metadata_name: str, ) -> None: """ :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). """ self.dist = dist self.metadata_name = metadata_name def __str__(self) -> str: # Use `dist` in the error message because its stringification # includes more information, like the version and location. return "None {} metadata found for distribution: {}".format( self.metadata_name, self.dist, ) class UserInstallationInvalid(InstallationError): """A --user install is requested on an environment without user site.""" def __str__(self) -> str: return "User base directory is not specified" class InvalidSchemeCombination(InstallationError): def __str__(self) -> str: before = ", ".join(str(a) for a in self.args[:-1]) return f"Cannot set {before} and {self.args[-1]} together" class DistributionNotFound(InstallationError): """Raised when a distribution cannot be found to satisfy a requirement""" class RequirementsFileParseError(InstallationError): """Raised when a general error occurs parsing a requirements file line.""" class BestVersionAlreadyInstalled(PipError): """Raised when the most up-to-date version of a package is already installed.""" class BadCommand(PipError): """Raised when virtualenv or a command is not found""" class CommandError(PipError): """Raised when there is an error in command-line arguments""" class PreviousBuildDirError(PipError): """Raised when there's a previous conflicting build directory""" class NetworkConnectionError(PipError): """HTTP connection error""" def __init__( self, error_msg: str, response: Response = None, request: Request = None ) -> None: """ Initialize NetworkConnectionError with `request` and `response` objects. """ self.response = response self.request = request self.error_msg = error_msg if ( self.response is not None and not self.request and hasattr(response, "request") ): self.request = self.response.request super().__init__(error_msg, response, request) def __str__(self) -> str: return str(self.error_msg) class InvalidWheelFilename(InstallationError): """Invalid wheel filename.""" class UnsupportedWheel(InstallationError): """Unsupported wheel.""" class MetadataInconsistent(InstallationError): """Built metadata contains inconsistent information. This is raised when the metadata contains values (e.g. name and version) that do not match the information previously obtained from sdist filename or user-supplied ``#egg=`` value. """ def __init__( self, ireq: "InstallRequirement", field: str, f_val: str, m_val: str ) -> None: self.ireq = ireq self.field = field self.f_val = f_val self.m_val = m_val def __str__(self) -> str: template = ( "Requested {} has inconsistent {}: " "filename has {!r}, but metadata has {!r}" ) return template.format(self.ireq, self.field, self.f_val, self.m_val) class InstallationSubprocessError(InstallationError): """A subprocess call failed during installation.""" def __init__(self, returncode: int, description: str) -> None: self.returncode = returncode self.description = description def __str__(self) -> str: return ( "Command errored out with exit status {}: {} " "Check the logs for full command output." ).format(self.returncode, self.description) class HashErrors(InstallationError): """Multiple HashError instances rolled into one for reporting""" def __init__(self) -> None: self.errors: List["HashError"] = [] def append(self, error: "HashError") -> None: self.errors.append(error) def __str__(self) -> str: lines = [] self.errors.sort(key=lambda e: e.order) for cls, errors_of_cls in groupby(self.errors, lambda e: e.__class__): lines.append(cls.head) lines.extend(e.body() for e in errors_of_cls) if lines: return "\n".join(lines) return "" def __bool__(self) -> bool: return bool(self.errors) class HashError(InstallationError): """ A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. """ req: Optional["InstallRequirement"] = None head = "" order: int = -1 def body(self) -> str: """Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with its link already populated by the resolver's _populate_link(). """ return f" {self._requirement_name()}" def __str__(self) -> str: return f"{self.head}\n{self.body()}" def _requirement_name(self) -> str: """Return a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers """ return str(self.req) if self.req else "unknown package" class VcsHashUnsupported(HashError): """A hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.""" order = 0 head = ( "Can't verify hashes for these requirements because we don't " "have a way to hash version control repositories:" ) class DirectoryUrlHashUnsupported(HashError): """A hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.""" order = 1 head = ( "Can't verify hashes for these file:// requirements because they " "point to directories:" ) class HashMissing(HashError): """A hash was needed for a requirement but is absent.""" order = 2 head = ( "Hashes are required in --require-hashes mode, but they are " "missing from some requirements. Here is a list of those " "requirements along with the hashes their downloaded archives " "actually had. Add lines like these to your requirements files to " "prevent tampering. (If you did not enable --require-hashes " "manually, note that it turns on automatically when any package " "has a hash.)" ) def __init__(self, gotten_hash: str) -> None: """ :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded """ self.gotten_hash = gotten_hash def body(self) -> str: # Dodge circular import. from pip._internal.utils.hashes import FAVORITE_HASH package = None if self.req: # In the case of URL-based requirements, display the original URL # seen in the requirements file rather than the package name, # so the output can be directly copied into the requirements file. package = ( self.req.original_link if self.req.original_link # In case someone feeds something downright stupid # to InstallRequirement's constructor. else getattr(self.req, "req", None) ) return " {} --hash={}:{}".format( package or "unknown package", FAVORITE_HASH, self.gotten_hash ) class HashUnpinned(HashError): """A requirement had a hash specified but was not pinned to a specific version.""" order = 3 head = ( "In --require-hashes mode, all requirements must have their " "versions pinned with ==. These do not:" ) class HashMismatch(HashError): """ Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. """ order = 4 head = ( "THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS " "FILE. If you have updated the package versions, please update " "the hashes. Otherwise, examine the package contents carefully; " "someone may have tampered with them." ) def __init__(self, allowed: Dict[str, List[str]], gots: Dict[str, "_Hash"]) -> None: """ :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion """ self.allowed = allowed self.gots = gots def body(self) -> str: return " {}:\n{}".format(self._requirement_name(), self._hash_comparison()) def _hash_comparison(self) -> str: """ Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef """ def hash_then_or(hash_name: str) -> "chain[str]": # For now, all the decent hashes have 6-char names, so we can get # away with hard-coding space literals. return chain([hash_name], repeat(" or")) lines: List[str] = [] for hash_name, expecteds in self.allowed.items(): prefix = hash_then_or(hash_name) lines.extend( (" Expected {} {}".format(next(prefix), e)) for e in expecteds ) lines.append( " Got {}\n".format(self.gots[hash_name].hexdigest()) ) return "\n".join(lines) class UnsupportedPythonVersion(InstallationError): """Unsupported python version according to Requires-Python package metadata.""" class ConfigurationFileCouldNotBeLoaded(ConfigurationError): """When there are errors while loading a configuration file""" def __init__( self, reason: str = "could not be loaded", fname: Optional[str] = None, error: Optional[configparser.Error] = None, ) -> None: super().__init__(error) self.reason = reason self.fname = fname self.error = error def __str__(self) -> str: if self.fname is not None: message_part = f" in {self.fname}." else: assert self.error is not None message_part = f".\n{self.error}\n" return f"Configuration file {self.reason}{message_part}" PK]}t&& locations.pynu["""Locations where we look for configs, install stuff, etc""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False # mypy: disallow-untyped-defs=False from __future__ import absolute_import import os import os.path import platform import site import sys import sysconfig from distutils import sysconfig as distutils_sysconfig from distutils.command.install import SCHEME_KEYS # type: ignore from pip._internal.utils import appdirs from pip._internal.utils.compat import WINDOWS from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.utils.virtualenv import running_under_virtualenv if MYPY_CHECK_RUNNING: from typing import Any, Union, Dict, List, Optional # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") def get_major_minor_version(): # type: () -> str """ Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". """ return '{}.{}'.format(*sys.version_info) def get_src_prefix(): if running_under_virtualenv(): src_prefix = os.path.join(sys.prefix, 'src') else: # FIXME: keep src in cwd for now (it is not a temporary folder) try: src_prefix = os.path.join(os.getcwd(), 'src') except OSError: # In case the current working directory has been renamed or deleted sys.exit( "The folder you are executing pip from can no longer be found." ) # under macOS + virtualenv sys.prefix is not properly resolved # it is something like /path/to/python/bin/.. return os.path.abspath(src_prefix) # FIXME doesn't account for venv linked to global site-packages site_packages = sysconfig.get_path("purelib") # type: Optional[str] # This is because of a bug in PyPy's sysconfig module, see # https://bitbucket.org/pypy/pypy/issues/2506/sysconfig-returns-incorrect-paths # for more information. if platform.python_implementation().lower() == "pypy": site_packages = distutils_sysconfig.get_python_lib() try: # Use getusersitepackages if this is present, as it ensures that the # value is initialised properly. user_site = site.getusersitepackages() except AttributeError: user_site = site.USER_SITE if WINDOWS: bin_py = os.path.join(sys.prefix, 'Scripts') bin_user = os.path.join(user_site, 'Scripts') # buildout uses 'bin' on Windows too? if not os.path.exists(bin_py): bin_py = os.path.join(sys.prefix, 'bin') bin_user = os.path.join(user_site, 'bin') else: bin_py = os.path.join(sys.prefix, 'bin') bin_user = os.path.join(user_site, 'bin') # Forcing to use /usr/local/bin for standard macOS framework installs # Also log to ~/Library/Logs/ for use with the Console.app log viewer if sys.platform[:6] == 'darwin' and sys.prefix[:16] == '/System/Library/': bin_py = '/usr/local/bin' def distutils_scheme(dist_name, user=False, home=None, root=None, isolated=False, prefix=None): # type:(str, bool, str, str, bool, str) -> dict """ Return a distutils install scheme """ from distutils.dist import Distribution scheme = {} if isolated: extra_dist_args = {"script_args": ["--no-user-cfg"]} else: extra_dist_args = {} dist_args = {'name': dist_name} # type: Dict[str, Union[str, List[str]]] dist_args.update(extra_dist_args) d = Distribution(dist_args) # Ignoring, typeshed issue reported python/typeshed/issues/2567 d.parse_config_files() # NOTE: Ignoring type since mypy can't find attributes on 'Command' i = d.get_command_obj('install', create=True) # type: Any assert i is not None # NOTE: setting user or home has the side-effect of creating the home dir # or user base for installations during finalize_options() # ideally, we'd prefer a scheme class that has no side-effects. assert not (user and prefix), "user={} prefix={}".format(user, prefix) assert not (home and prefix), "home={} prefix={}".format(home, prefix) i.user = user or i.user if user or home: i.prefix = "" i.prefix = prefix or i.prefix i.home = home or i.home i.root = root or i.root i.finalize_options() for key in SCHEME_KEYS: scheme[key] = getattr(i, 'install_' + key) # install_lib specified in setup.cfg should install *everything* # into there (i.e. it takes precedence over both purelib and # platlib). Note, i.install_lib is *always* set after # finalize_options(); we only want to override here if the user # has explicitly requested it hence going back to the config # Ignoring, typeshed issue reported python/typeshed/issues/2567 if 'install_lib' in d.get_option_dict('install'): # type: ignore scheme.update(dict(purelib=i.install_lib, platlib=i.install_lib)) if running_under_virtualenv(): scheme['headers'] = os.path.join( sys.prefix, 'include', 'site', 'python{}'.format(get_major_minor_version()), dist_name, ) if root is not None: path_no_drive = os.path.splitdrive( os.path.abspath(scheme["headers"]))[1] scheme["headers"] = os.path.join( root, path_no_drive[1:], ) return scheme PK]'TTmain.pynu[from typing import List, Optional def main(args: Optional[List[str]] = None) -> int: """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args) PK] |HHwheel.pynu[""" Support for installing and building the "wheel" binary package format. """ # The following comment should be removed at some point in the future. # mypy: strict-optional=False # mypy: disallow-untyped-defs=False from __future__ import absolute_import import collections import compileall import csv import hashlib import logging import os.path import re import shutil import stat import sys import warnings from base64 import urlsafe_b64encode from email.parser import Parser from pip._vendor import pkg_resources from pip._vendor.distlib.scripts import ScriptMaker from pip._vendor.distlib.util import get_export_entry from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.six import StringIO from pip._internal import pep425tags from pip._internal.exceptions import ( InstallationError, InvalidWheelFilename, UnsupportedWheel, ) from pip._internal.locations import distutils_scheme, get_major_minor_version from pip._internal.models.link import Link from pip._internal.utils.logging import indent_log from pip._internal.utils.marker_files import has_delete_marker_file from pip._internal.utils.misc import captured_stdout, ensure_dir, read_chunks from pip._internal.utils.setuptools_build import make_setuptools_shim_args from pip._internal.utils.subprocess import ( LOG_DIVIDER, call_subprocess, format_command_args, runner_with_spinner_message, ) from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.utils.ui import open_spinner from pip._internal.utils.unpacking import unpack_file from pip._internal.utils.urls import path_to_url if MYPY_CHECK_RUNNING: from typing import ( Dict, List, Optional, Sequence, Mapping, Tuple, IO, Text, Any, Iterable, Callable, Set, ) from pip._vendor.packaging.requirements import Requirement from pip._internal.req.req_install import InstallRequirement from pip._internal.operations.prepare import ( RequirementPreparer ) from pip._internal.cache import WheelCache from pip._internal.pep425tags import Pep425Tag InstalledCSVRow = Tuple[str, ...] BinaryAllowedPredicate = Callable[[InstallRequirement], bool] VERSION_COMPATIBLE = (1, 0) logger = logging.getLogger(__name__) def normpath(src, p): return os.path.relpath(src, p).replace(os.path.sep, '/') def hash_file(path, blocksize=1 << 20): # type: (str, int) -> Tuple[Any, int] """Return (hash, length) for path using hashlib.sha256()""" h = hashlib.sha256() length = 0 with open(path, 'rb') as f: for block in read_chunks(f, size=blocksize): length += len(block) h.update(block) return (h, length) # type: ignore def rehash(path, blocksize=1 << 20): # type: (str, int) -> Tuple[str, str] """Return (encoded_digest, length) for path using hashlib.sha256()""" h, length = hash_file(path, blocksize) digest = 'sha256=' + urlsafe_b64encode( h.digest() ).decode('latin1').rstrip('=') # unicode/str python2 issues return (digest, str(length)) # type: ignore def open_for_csv(name, mode): # type: (str, Text) -> IO if sys.version_info[0] < 3: nl = {} # type: Dict[str, Any] bin = 'b' else: nl = {'newline': ''} # type: Dict[str, Any] bin = '' return open(name, mode + bin, **nl) def replace_python_tag(wheelname, new_tag): # type: (str, str) -> str """Replace the Python tag in a wheel file name with a new value. """ parts = wheelname.split('-') parts[-3] = new_tag return '-'.join(parts) def fix_script(path): # type: (str) -> Optional[bool] """Replace #!python with #!/path/to/python Return True if file was changed.""" # XXX RECORD hashes will need to be updated if os.path.isfile(path): with open(path, 'rb') as script: firstline = script.readline() if not firstline.startswith(b'#!python'): return False exename = sys.executable.encode(sys.getfilesystemencoding()) firstline = b'#!' + exename + os.linesep.encode("ascii") rest = script.read() with open(path, 'wb') as script: script.write(firstline) script.write(rest) return True return None dist_info_re = re.compile(r"""^(?P(?P.+?)(-(?P.+?))?) \.dist-info$""", re.VERBOSE) def root_is_purelib(name, wheeldir): # type: (str, str) -> bool """ Return True if the extracted wheel in wheeldir should go into purelib. """ name_folded = name.replace("-", "_") for item in os.listdir(wheeldir): match = dist_info_re.match(item) if match and match.group('name') == name_folded: with open(os.path.join(wheeldir, item, 'WHEEL')) as wheel: for line in wheel: line = line.lower().rstrip() if line == "root-is-purelib: true": return True return False def get_entrypoints(filename): # type: (str) -> Tuple[Dict[str, str], Dict[str, str]] if not os.path.exists(filename): return {}, {} # This is done because you can pass a string to entry_points wrappers which # means that they may or may not be valid INI files. The attempt here is to # strip leading and trailing whitespace in order to make them valid INI # files. with open(filename) as fp: data = StringIO() for line in fp: data.write(line.strip()) data.write("\n") data.seek(0) # get the entry points and then the script names entry_points = pkg_resources.EntryPoint.parse_map(data) console = entry_points.get('console_scripts', {}) gui = entry_points.get('gui_scripts', {}) def _split_ep(s): """get the string representation of EntryPoint, remove space and split on '='""" return str(s).replace(" ", "").split("=") # convert the EntryPoint objects into strings with module:function console = dict(_split_ep(v) for v in console.values()) gui = dict(_split_ep(v) for v in gui.values()) return console, gui def message_about_scripts_not_on_PATH(scripts): # type: (Sequence[str]) -> Optional[str] """Determine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. """ if not scripts: return None # Group scripts by the path they were installed in grouped_by_dir = collections.defaultdict(set) # type: Dict[str, Set[str]] for destfile in scripts: parent_dir = os.path.dirname(destfile) script_name = os.path.basename(destfile) grouped_by_dir[parent_dir].add(script_name) # We don't want to warn for directories that are on PATH. not_warn_dirs = [ os.path.normcase(i).rstrip(os.sep) for i in os.environ.get("PATH", "").split(os.pathsep) ] # If an executable sits with sys.executable, we don't warn for it. # This covers the case of venv invocations without activating the venv. not_warn_dirs.append(os.path.normcase(os.path.dirname(sys.executable))) warn_for = { parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items() if os.path.normcase(parent_dir) not in not_warn_dirs } # type: Dict[str, Set[str]] if not warn_for: return None # Format a message msg_lines = [] for parent_dir, dir_scripts in warn_for.items(): sorted_scripts = sorted(dir_scripts) # type: List[str] if len(sorted_scripts) == 1: start_text = "script {} is".format(sorted_scripts[0]) else: start_text = "scripts {} are".format( ", ".join(sorted_scripts[:-1]) + " and " + sorted_scripts[-1] ) msg_lines.append( "The {} installed in '{}' which is not on PATH." .format(start_text, parent_dir) ) last_line_fmt = ( "Consider adding {} to PATH or, if you prefer " "to suppress this warning, use --no-warn-script-location." ) if len(msg_lines) == 1: msg_lines.append(last_line_fmt.format("this directory")) else: msg_lines.append(last_line_fmt.format("these directories")) # Returns the formatted multiline message return "\n".join(msg_lines) def sorted_outrows(outrows): # type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow] """ Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. """ # Normally, there should only be one row per path, in which case the # second and third elements don't come into play when sorting. # However, in cases in the wild where a path might happen to occur twice, # we don't want the sort operation to trigger an error (but still want # determinism). Since the third element can be an int or string, we # coerce each element to a string to avoid a TypeError in this case. # For additional background, see-- # https://github.com/pypa/pip/issues/5868 return sorted(outrows, key=lambda row: tuple(str(x) for x in row)) def get_csv_rows_for_installed( old_csv_rows, # type: Iterable[List[str]] installed, # type: Dict[str, str] changed, # type: set generated, # type: List[str] lib_dir, # type: str ): # type: (...) -> List[InstalledCSVRow] """ :param installed: A map from archive RECORD path to installation RECORD path. """ installed_rows = [] # type: List[InstalledCSVRow] for row in old_csv_rows: if len(row) > 3: logger.warning( 'RECORD line has more than three elements: {}'.format(row) ) # Make a copy because we are mutating the row. row = list(row) old_path = row[0] new_path = installed.pop(old_path, old_path) row[0] = new_path if new_path in changed: digest, length = rehash(new_path) row[1] = digest row[2] = length installed_rows.append(tuple(row)) for f in generated: digest, length = rehash(f) installed_rows.append((normpath(f, lib_dir), digest, str(length))) for f in installed: installed_rows.append((installed[f], '', '')) return installed_rows class MissingCallableSuffix(Exception): pass def _raise_for_invalid_entrypoint(specification): entry = get_export_entry(specification) if entry is not None and entry.suffix is None: raise MissingCallableSuffix(str(entry)) class PipScriptMaker(ScriptMaker): def make(self, specification, options=None): _raise_for_invalid_entrypoint(specification) return super(PipScriptMaker, self).make(specification, options) def move_wheel_files( name, # type: str req, # type: Requirement wheeldir, # type: str user=False, # type: bool home=None, # type: Optional[str] root=None, # type: Optional[str] pycompile=True, # type: bool scheme=None, # type: Optional[Mapping[str, str]] isolated=False, # type: bool prefix=None, # type: Optional[str] warn_script_location=True # type: bool ): # type: (...) -> None """Install a wheel""" # TODO: Investigate and break this up. # TODO: Look into moving this into a dedicated class for representing an # installation. if not scheme: scheme = distutils_scheme( name, user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) if root_is_purelib(name, wheeldir): lib_dir = scheme['purelib'] else: lib_dir = scheme['platlib'] info_dir = [] # type: List[str] data_dirs = [] source = wheeldir.rstrip(os.path.sep) + os.path.sep # Record details of the files moved # installed = files copied from the wheel to the destination # changed = files changed while installing (scripts #! line typically) # generated = files newly generated during the install (script wrappers) installed = {} # type: Dict[str, str] changed = set() generated = [] # type: List[str] # Compile all of the pyc files that we're going to be installing if pycompile: with captured_stdout() as stdout: with warnings.catch_warnings(): warnings.filterwarnings('ignore') compileall.compile_dir(source, force=True, quiet=True) logger.debug(stdout.getvalue()) def record_installed(srcfile, destfile, modified=False): """Map archive RECORD paths to installation RECORD paths.""" oldpath = normpath(srcfile, wheeldir) newpath = normpath(destfile, lib_dir) installed[oldpath] = newpath if modified: changed.add(destfile) def clobber(source, dest, is_base, fixer=None, filter=None): ensure_dir(dest) # common for the 'include' path for dir, subdirs, files in os.walk(source): basedir = dir[len(source):].lstrip(os.path.sep) destdir = os.path.join(dest, basedir) if is_base and basedir.split(os.path.sep, 1)[0].endswith('.data'): continue for s in subdirs: destsubdir = os.path.join(dest, basedir, s) if is_base and basedir == '' and destsubdir.endswith('.data'): data_dirs.append(s) continue elif (is_base and s.endswith('.dist-info') and canonicalize_name(s).startswith( canonicalize_name(req.name))): assert not info_dir, ('Multiple .dist-info directories: ' + destsubdir + ', ' + ', '.join(info_dir)) info_dir.append(destsubdir) for f in files: # Skip unwanted files if filter and filter(f): continue srcfile = os.path.join(dir, f) destfile = os.path.join(dest, basedir, f) # directory creation is lazy and after the file filtering above # to ensure we don't install empty dirs; empty dirs can't be # uninstalled. ensure_dir(destdir) # copyfile (called below) truncates the destination if it # exists and then writes the new contents. This is fine in most # cases, but can cause a segfault if pip has loaded a shared # object (e.g. from pyopenssl through its vendored urllib3) # Since the shared object is mmap'd an attempt to call a # symbol in it will then cause a segfault. Unlinking the file # allows writing of new contents while allowing the process to # continue to use the old copy. if os.path.exists(destfile): os.unlink(destfile) # We use copyfile (not move, copy, or copy2) to be extra sure # that we are not moving directories over (copyfile fails for # directories) as well as to ensure that we are not copying # over any metadata because we want more control over what # metadata we actually copy over. shutil.copyfile(srcfile, destfile) # Copy over the metadata for the file, currently this only # includes the atime and mtime. st = os.stat(srcfile) if hasattr(os, "utime"): os.utime(destfile, (st.st_atime, st.st_mtime)) # If our file is executable, then make our destination file # executable. if os.access(srcfile, os.X_OK): st = os.stat(srcfile) permissions = ( st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH ) os.chmod(destfile, permissions) changed = False if fixer: changed = fixer(destfile) record_installed(srcfile, destfile, changed) clobber(source, lib_dir, True) assert info_dir, "%s .dist-info directory not found" % req # Get the defined entry points ep_file = os.path.join(info_dir[0], 'entry_points.txt') console, gui = get_entrypoints(ep_file) def is_entrypoint_wrapper(name): # EP, EP.exe and EP-script.py are scripts generated for # entry point EP by setuptools if name.lower().endswith('.exe'): matchname = name[:-4] elif name.lower().endswith('-script.py'): matchname = name[:-10] elif name.lower().endswith(".pya"): matchname = name[:-4] else: matchname = name # Ignore setuptools-generated scripts return (matchname in console or matchname in gui) for datadir in data_dirs: fixer = None filter = None for subdir in os.listdir(os.path.join(wheeldir, datadir)): fixer = None if subdir == 'scripts': fixer = fix_script filter = is_entrypoint_wrapper source = os.path.join(wheeldir, datadir, subdir) dest = scheme[subdir] clobber(source, dest, False, fixer=fixer, filter=filter) maker = PipScriptMaker(None, scheme['scripts']) # Ensure old scripts are overwritten. # See https://github.com/pypa/pip/issues/1800 maker.clobber = True # Ensure we don't generate any variants for scripts because this is almost # never what somebody wants. # See https://bitbucket.org/pypa/distlib/issue/35/ maker.variants = {''} # This is required because otherwise distlib creates scripts that are not # executable. # See https://bitbucket.org/pypa/distlib/issue/32/ maker.set_mode = True scripts_to_generate = [] # Special case pip and setuptools to generate versioned wrappers # # The issue is that some projects (specifically, pip and setuptools) use # code in setup.py to create "versioned" entry points - pip2.7 on Python # 2.7, pip3.3 on Python 3.3, etc. But these entry points are baked into # the wheel metadata at build time, and so if the wheel is installed with # a *different* version of Python the entry points will be wrong. The # correct fix for this is to enhance the metadata to be able to describe # such versioned entry points, but that won't happen till Metadata 2.0 is # available. # In the meantime, projects using versioned entry points will either have # incorrect versioned entry points, or they will not be able to distribute # "universal" wheels (i.e., they will need a wheel per Python version). # # Because setuptools and pip are bundled with _ensurepip and virtualenv, # we need to use universal wheels. So, as a stopgap until Metadata 2.0, we # override the versioned entry points in the wheel and generate the # correct ones. This code is purely a short-term measure until Metadata 2.0 # is available. # # To add the level of hack in this section of code, in order to support # ensurepip this code will look for an ``ENSUREPIP_OPTIONS`` environment # variable which will control which version scripts get installed. # # ENSUREPIP_OPTIONS=altinstall # - Only pipX.Y and easy_install-X.Y will be generated and installed # ENSUREPIP_OPTIONS=install # - pipX.Y, pipX, easy_install-X.Y will be generated and installed. Note # that this option is technically if ENSUREPIP_OPTIONS is set and is # not altinstall # DEFAULT # - The default behavior is to install pip, pipX, pipX.Y, easy_install # and easy_install-X.Y. pip_script = console.pop('pip', None) if pip_script: if "ENSUREPIP_OPTIONS" not in os.environ: scripts_to_generate.append('pip = ' + pip_script) if os.environ.get("ENSUREPIP_OPTIONS", "") != "altinstall": scripts_to_generate.append( 'pip%s = %s' % (sys.version_info[0], pip_script) ) scripts_to_generate.append( 'pip%s = %s' % (get_major_minor_version(), pip_script) ) # Delete any other versioned pip entry points pip_ep = [k for k in console if re.match(r'pip(\d(\.\d)?)?$', k)] for k in pip_ep: del console[k] easy_install_script = console.pop('easy_install', None) if easy_install_script: if "ENSUREPIP_OPTIONS" not in os.environ: scripts_to_generate.append( 'easy_install = ' + easy_install_script ) scripts_to_generate.append( 'easy_install-%s = %s' % ( get_major_minor_version(), easy_install_script ) ) # Delete any other versioned easy_install entry points easy_install_ep = [ k for k in console if re.match(r'easy_install(-\d\.\d)?$', k) ] for k in easy_install_ep: del console[k] # Generate the console and GUI entry points specified in the wheel scripts_to_generate.extend( '%s = %s' % kv for kv in console.items() ) gui_scripts_to_generate = [ '%s = %s' % kv for kv in gui.items() ] generated_console_scripts = [] # type: List[str] try: generated_console_scripts = maker.make_multiple(scripts_to_generate) generated.extend(generated_console_scripts) generated.extend( maker.make_multiple(gui_scripts_to_generate, {'gui': True}) ) except MissingCallableSuffix as e: entry = e.args[0] raise InstallationError( "Invalid script entry point: {} for req: {} - A callable " "suffix is required. Cf https://packaging.python.org/en/" "latest/distributing.html#console-scripts for more " "information.".format(entry, req) ) if warn_script_location: msg = message_about_scripts_not_on_PATH(generated_console_scripts) if msg is not None: logger.warning(msg) # Record pip as the installer installer = os.path.join(info_dir[0], 'INSTALLER') temp_installer = os.path.join(info_dir[0], 'INSTALLER.pip') with open(temp_installer, 'wb') as installer_file: installer_file.write(b'pip\n') shutil.move(temp_installer, installer) generated.append(installer) # Record details of all files installed record = os.path.join(info_dir[0], 'RECORD') temp_record = os.path.join(info_dir[0], 'RECORD.pip') with open_for_csv(record, 'r') as record_in: with open_for_csv(temp_record, 'w+') as record_out: reader = csv.reader(record_in) outrows = get_csv_rows_for_installed( reader, installed=installed, changed=changed, generated=generated, lib_dir=lib_dir, ) writer = csv.writer(record_out) # Sort to simplify testing. for row in sorted_outrows(outrows): writer.writerow(row) shutil.move(temp_record, record) def wheel_version(source_dir): # type: (Optional[str]) -> Optional[Tuple[int, ...]] """ Return the Wheel-Version of an extracted wheel, if possible. Otherwise, return None if we couldn't parse / extract it. """ try: dist = [d for d in pkg_resources.find_on_path(None, source_dir)][0] wheel_data = dist.get_metadata('WHEEL') wheel_data = Parser().parsestr(wheel_data) version = wheel_data['Wheel-Version'].strip() version = tuple(map(int, version.split('.'))) return version except Exception: return None def check_compatibility(version, name): # type: (Optional[Tuple[int, ...]], str) -> None """ Raises errors or warns if called with an incompatible Wheel-Version. Pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given """ if not version: raise UnsupportedWheel( "%s is in an unsupported or invalid wheel" % name ) if version[0] > VERSION_COMPATIBLE[0]: raise UnsupportedWheel( "%s's Wheel-Version (%s) is not compatible with this version " "of pip" % (name, '.'.join(map(str, version))) ) elif version > VERSION_COMPATIBLE: logger.warning( 'Installing from a newer Wheel-Version (%s)', '.'.join(map(str, version)), ) def format_tag(file_tag): # type: (Tuple[str, ...]) -> str """ Format three tags in the form "--". :param file_tag: A 3-tuple of tags (python_tag, abi_tag, platform_tag). """ return '-'.join(file_tag) class Wheel(object): """A wheel file""" # TODO: Maybe move the class into the models sub-package # TODO: Maybe move the install code into this class wheel_file_re = re.compile( r"""^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$""", re.VERBOSE ) def __init__(self, filename): # type: (str) -> None """ :raises InvalidWheelFilename: when the filename is invalid for a wheel """ wheel_info = self.wheel_file_re.match(filename) if not wheel_info: raise InvalidWheelFilename( "%s is not a valid wheel filename." % filename ) self.filename = filename self.name = wheel_info.group('name').replace('_', '-') # we'll assume "_" means "-" due to wheel naming scheme # (https://github.com/pypa/pip/issues/1150) self.version = wheel_info.group('ver').replace('_', '-') self.build_tag = wheel_info.group('build') self.pyversions = wheel_info.group('pyver').split('.') self.abis = wheel_info.group('abi').split('.') self.plats = wheel_info.group('plat').split('.') # All the tag combinations from this file self.file_tags = { (x, y, z) for x in self.pyversions for y in self.abis for z in self.plats } def get_formatted_file_tags(self): # type: () -> List[str] """ Return the wheel's tags as a sorted list of strings. """ return sorted(format_tag(tag) for tag in self.file_tags) def support_index_min(self, tags): # type: (List[Pep425Tag]) -> int """ Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. """ return min(tags.index(tag) for tag in self.file_tags if tag in tags) def supported(self, tags): # type: (List[Pep425Tag]) -> bool """ Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. """ return not self.file_tags.isdisjoint(tags) def _contains_egg_info( s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)): """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s)) def should_use_ephemeral_cache( req, # type: InstallRequirement should_unpack, # type: bool cache_available, # type: bool check_binary_allowed, # type: BinaryAllowedPredicate ): # type: (...) -> Optional[bool] """ Return whether to build an InstallRequirement object using the ephemeral cache. :param cache_available: whether a cache directory is available for the should_unpack=True case. :return: True or False to build the requirement with ephem_cache=True or False, respectively; or None not to build the requirement. """ if req.constraint: # never build requirements that are merely constraints return None if req.is_wheel: if not should_unpack: logger.info( 'Skipping %s, due to already being wheel.', req.name, ) return None if not should_unpack: # i.e. pip wheel, not pip install; # return False, knowing that the caller will never cache # in this case anyway, so this return merely means "build it". # TODO improve this behavior return False if req.editable or not req.source_dir: return None if not check_binary_allowed(req): logger.info( "Skipping wheel build for %s, due to binaries " "being disabled for it.", req.name, ) return None if req.link and req.link.is_vcs: # VCS checkout. Build wheel just for this run. return True link = req.link base, ext = link.splitext() if cache_available and _contains_egg_info(base): return False # Otherwise, build the wheel just for this run using the ephemeral # cache since we are either in the case of e.g. a local directory, or # no cache directory is available to use. return True def format_command_result( command_args, # type: List[str] command_output, # type: str ): # type: (...) -> str """ Format command information for logging. """ command_desc = format_command_args(command_args) text = 'Command arguments: {}\n'.format(command_desc) if not command_output: text += 'Command output: None' elif logger.getEffectiveLevel() > logging.DEBUG: text += 'Command output: [use --verbose to show]' else: if not command_output.endswith('\n'): command_output += '\n' text += 'Command output:\n{}{}'.format(command_output, LOG_DIVIDER) return text def get_legacy_build_wheel_path( names, # type: List[str] temp_dir, # type: str req, # type: InstallRequirement command_args, # type: List[str] command_output, # type: str ): # type: (...) -> Optional[str] """ Return the path to the wheel in the temporary build directory. """ # Sort for determinism. names = sorted(names) if not names: msg = ( 'Legacy build of wheel for {!r} created no files.\n' ).format(req.name) msg += format_command_result(command_args, command_output) logger.warning(msg) return None if len(names) > 1: msg = ( 'Legacy build of wheel for {!r} created more than one file.\n' 'Filenames (choosing first): {}\n' ).format(req.name, names) msg += format_command_result(command_args, command_output) logger.warning(msg) return os.path.join(temp_dir, names[0]) def _always_true(_): return True class WheelBuilder(object): """Build wheels from a RequirementSet.""" def __init__( self, preparer, # type: RequirementPreparer wheel_cache, # type: WheelCache build_options=None, # type: Optional[List[str]] global_options=None, # type: Optional[List[str]] check_binary_allowed=None, # type: Optional[BinaryAllowedPredicate] no_clean=False # type: bool ): # type: (...) -> None if check_binary_allowed is None: # Binaries allowed by default. check_binary_allowed = _always_true self.preparer = preparer self.wheel_cache = wheel_cache self._wheel_dir = preparer.wheel_download_dir self.build_options = build_options or [] self.global_options = global_options or [] self.check_binary_allowed = check_binary_allowed self.no_clean = no_clean def _build_one(self, req, output_dir, python_tag=None): """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ # Install build deps into temporary directory (PEP 518) with req.build_env: return self._build_one_inside_env(req, output_dir, python_tag=python_tag) def _build_one_inside_env(self, req, output_dir, python_tag=None): with TempDirectory(kind="wheel") as temp_dir: if req.use_pep517: builder = self._build_one_pep517 else: builder = self._build_one_legacy wheel_path = builder(req, temp_dir.path, python_tag=python_tag) if wheel_path is not None: wheel_name = os.path.basename(wheel_path) dest_path = os.path.join(output_dir, wheel_name) try: wheel_hash, length = hash_file(wheel_path) shutil.move(wheel_path, dest_path) logger.info('Created wheel for %s: ' 'filename=%s size=%d sha256=%s', req.name, wheel_name, length, wheel_hash.hexdigest()) logger.info('Stored in directory: %s', output_dir) return dest_path except Exception: pass # Ignore return, we can't do anything else useful. self._clean_one(req) return None def _base_setup_args(self, req): # NOTE: Eventually, we'd want to also -S to the flags here, when we're # isolating. Currently, it breaks Python in virtualenvs, because it # relies on site.py to find parts of the standard library outside the # virtualenv. return make_setuptools_shim_args( req.setup_py_path, global_options=self.global_options, unbuffered_output=True ) def _build_one_pep517(self, req, tempd, python_tag=None): """Build one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert req.metadata_directory is not None if self.build_options: # PEP 517 does not support --build-options logger.error('Cannot build wheel for %s using PEP 517 when ' '--build-options is present' % (req.name,)) return None try: logger.debug('Destination directory: %s', tempd) runner = runner_with_spinner_message( 'Building wheel for {} (PEP 517)'.format(req.name) ) backend = req.pep517_backend with backend.subprocess_runner(runner): wheel_name = backend.build_wheel( tempd, metadata_directory=req.metadata_directory, ) if python_tag: # General PEP 517 backends don't necessarily support # a "--python-tag" option, so we rename the wheel # file directly. new_name = replace_python_tag(wheel_name, python_tag) os.rename( os.path.join(tempd, wheel_name), os.path.join(tempd, new_name) ) # Reassign to simplify the return at the end of function wheel_name = new_name except Exception: logger.error('Failed building wheel for %s', req.name) return None return os.path.join(tempd, wheel_name) def _build_one_legacy(self, req, tempd, python_tag=None): """Build one InstallRequirement using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. """ base_args = self._base_setup_args(req) spin_message = 'Building wheel for %s (setup.py)' % (req.name,) with open_spinner(spin_message) as spinner: logger.debug('Destination directory: %s', tempd) wheel_args = base_args + ['bdist_wheel', '-d', tempd] \ + self.build_options if python_tag is not None: wheel_args += ["--python-tag", python_tag] try: output = call_subprocess( wheel_args, cwd=req.unpacked_source_directory, spinner=spinner, ) except Exception: spinner.finish("error") logger.error('Failed building wheel for %s', req.name) return None names = os.listdir(tempd) wheel_path = get_legacy_build_wheel_path( names=names, temp_dir=tempd, req=req, command_args=wheel_args, command_output=output, ) return wheel_path def _clean_one(self, req): base_args = self._base_setup_args(req) logger.info('Running setup.py clean for %s', req.name) clean_args = base_args + ['clean', '--all'] try: call_subprocess(clean_args, cwd=req.source_dir) return True except Exception: logger.error('Failed cleaning build dir for %s', req.name) return False def build( self, requirements, # type: Iterable[InstallRequirement] should_unpack=False # type: bool ): # type: (...) -> List[InstallRequirement] """Build wheels. :param should_unpack: If True, after building the wheel, unpack it and replace the sdist with the unpacked version in preparation for installation. :return: True if all the wheels built correctly. """ # pip install uses should_unpack=True. # pip install never provides a _wheel_dir. # pip wheel uses should_unpack=False. # pip wheel always provides a _wheel_dir (via the preparer). assert ( (should_unpack and not self._wheel_dir) or (not should_unpack and self._wheel_dir) ) buildset = [] cache_available = bool(self.wheel_cache.cache_dir) for req in requirements: ephem_cache = should_use_ephemeral_cache( req, should_unpack=should_unpack, cache_available=cache_available, check_binary_allowed=self.check_binary_allowed, ) if ephem_cache is None: continue # Determine where the wheel should go. if should_unpack: if ephem_cache: output_dir = self.wheel_cache.get_ephem_path_for_link( req.link ) else: output_dir = self.wheel_cache.get_path_for_link(req.link) else: output_dir = self._wheel_dir buildset.append((req, output_dir)) if not buildset: return [] # TODO by @pradyunsg # Should break up this method into 2 separate methods. # Build the wheels. logger.info( 'Building wheels for collected packages: %s', ', '.join([req.name for (req, _) in buildset]), ) python_tag = None if should_unpack: python_tag = pep425tags.implementation_tag with indent_log(): build_success, build_failure = [], [] for req, output_dir in buildset: try: ensure_dir(output_dir) except OSError as e: logger.warning( "Building wheel for %s failed: %s", req.name, e, ) build_failure.append(req) continue wheel_file = self._build_one( req, output_dir, python_tag=python_tag, ) if wheel_file: build_success.append(req) if should_unpack: # XXX: This is mildly duplicative with prepare_files, # but not close enough to pull out to a single common # method. # The code below assumes temporary source dirs - # prevent it doing bad things. if ( req.source_dir and not has_delete_marker_file(req.source_dir) ): raise AssertionError( "bad source dir - missing marker") # Delete the source we built the wheel from req.remove_temporary_source() # set the build directory again - name is known from # the work prepare_files did. req.source_dir = req.ensure_build_location( self.preparer.build_dir ) # Update the link for this. req.link = Link(path_to_url(wheel_file)) assert req.link.is_wheel # extract the wheel into the dir unpack_file(req.link.file_path, req.source_dir) else: build_failure.append(req) # notify success/failure if build_success: logger.info( 'Successfully built %s', ' '.join([req.name for req in build_success]), ) if build_failure: logger.info( 'Failed to build %s', ' '.join([req.name for req in build_failure]), ) # Return a list of requirements that failed to build return build_failure PK]TT3distributions/__pycache__/base.cpython-38.opt-1.pycnu[U .eT@s2ddlZddlmZeejGdddeZdS)N) add_metaclasscs<eZdZdZfddZejddZejddZZ S)AbstractDistributiona 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. cstt|||_dSN)superr__init__req)selfr __class__D/usr/lib/python3.8/site-packages/pip/_internal/distributions/base.pyrszAbstractDistribution.__init__cCs tdSrNotImplementedError)rr r r get_pkg_resources_distributionsz3AbstractDistribution.get_pkg_resources_distributioncCs tdSrr )rfinderZbuild_isolationr r r prepare_distribution_metadata"sz2AbstractDistribution.prepare_distribution_metadata) __name__ __module__ __qualname____doc__rabcabstractmethodrr __classcell__r r r r r s   r)rZpip._vendor.sixrABCMetaobjectrr r r r s PK]q.distributions/__pycache__/wheel.cpython-38.pycnu[U ʗRe@sLddlmZddlmZddlmZddlmZmZm Z GdddeZ dS))canonicalize_name)AbstractDistribution) PackageFinder)BaseDistributionFilesystemWheelget_wheel_distributionc@s2eZdZdZedddZeeeddddZdS) WheelDistributionzqRepresents a wheel distribution. This does not need any preparation as wheels can be directly unpacked. )returncCs>|jjstd|jjs tdt|jj}t|t|jjS)zLoads the metadata from the wheel file into memory and returns a Distribution that uses it, not relying on the wheel file or requirement. z*Set as part of preparation during downloadzWheels are never unnamed)reqlocal_file_pathAssertionErrornamerrr)selfwheelr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/distributions/wheel.pyget_metadata_distributions z+WheelDistribution.get_metadata_distributionN)finderbuild_isolationcheck_build_depsr cCsdS)Nr)rrrrrrrprepare_distribution_metadatasz/WheelDistribution.prepare_distribution_metadata) __name__ __module__ __qualname____doc__rrrboolrrrrrr s rN) pip._vendor.packaging.utilsr pip._internal.distributions.baser"pip._internal.index.package_finderrpip._internal.metadatarrrrrrrrs   PK]¹4distributions/__pycache__/wheel.cpython-38.opt-1.pycnu[U .eh@s,ddlmZddlmZGdddeZdS)) pkg_resources)AbstractDistributionc@s eZdZdZddZddZdS)WheelDistributionzqRepresents a wheel distribution. This does not need any preparation as wheels can be directly unpacked. cCstt|jjdS)Nr)listrfind_distributionsZreqZ source_dir)selfrE/usr/lib/python3.8/site-packages/pip/_internal/distributions/wheel.pyget_pkg_resources_distributions z0WheelDistribution.get_pkg_resources_distributioncCsdS)Nr)rfinderZbuild_isolationrrr prepare_distribution_metadatasz/WheelDistribution.prepare_distribution_metadataN)__name__ __module__ __qualname____doc__r r rrrr r srN)Z pip._vendorrZ pip._internal.distributions.baserrrrrr s  PK]r  2distributions/__pycache__/installed.cpython-38.pycnu[U ʗRe@s8ddlmZddlmZddlmZGdddeZdS))AbstractDistribution) PackageFinder)BaseDistributionc@s2eZdZdZedddZeeeddddZdS) InstalledDistributionzRepresents an installed package. This does not need any preparation as the required information has already been computed. )returncCs|jjdk std|jjS)Nznot actually installed)req satisfied_byAssertionError)selfr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/distributions/installed.pyget_metadata_distribution sz/InstalledDistribution.get_metadata_distributionN)finderbuild_isolationcheck_build_depsrcCsdS)Nr )r rrrr r r prepare_distribution_metadatasz3InstalledDistribution.prepare_distribution_metadata) __name__ __module__ __qualname____doc__rr rboolrr r r r rsrN) pip._internal.distributions.baser"pip._internal.index.package_finderrpip._internal.metadatarrr r r r s   PK]FBB1distributions/__pycache__/__init__.cpython-38.pycnu[U ʗReZ@sDddlmZddlmZddlmZddlmZeedddZdS) )AbstractDistribution)SourceDistribution)WheelDistribution)InstallRequirement) install_reqreturncCs$|jrt|S|jrt|St|S)z7Returns a Distribution for the given InstallRequirement)editableris_wheelr)rr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/distributions/__init__.py)make_distribution_for_install_requirements r N) pip._internal.distributions.baser!pip._internal.distributions.sdistr!pip._internal.distributions.wheelrZpip._internal.req.req_installrr r r r r s    PK].8distributions/__pycache__/installed.cpython-38.opt-1.pycnu[U .e@s ddlmZGdddeZdS))AbstractDistributionc@s eZdZdZddZddZdS)InstalledDistributionzRepresents an installed package. This does not need any preparation as the required information has already been computed. cCs|jjSN)ZreqZ satisfied_by)selfrI/usr/lib/python3.8/site-packages/pip/_internal/distributions/installed.pyget_pkg_resources_distributionsz4InstalledDistribution.get_pkg_resources_distributioncCsdSrr)rfinderZbuild_isolationrrrprepare_distribution_metadatasz3InstalledDistribution.prepare_distribution_metadataN)__name__ __module__ __qualname____doc__rr rrrrrsrN)Z pip._internal.distributions.baserrrrrrs PK]Ą^-distributions/__pycache__/base.cpython-38.pycnu[U ʗRe@sDddlZddlmZddlmZddlmZGdddejdZdS)N) PackageFinder)BaseDistribution)InstallRequirementcsVeZdZdZeddfdd ZejedddZ eje e e dd d d Z Z S) AbstractDistributiona 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. N)reqreturncst||_dSN)super__init__r)selfr __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/distributions/base.pyr s zAbstractDistribution.__init__)rcCs tdSrNotImplementedError)r rrrget_metadata_distributionsz.AbstractDistribution.get_metadata_distribution)finderbuild_isolationcheck_build_depsrcCs tdSrr)r rrrrrrprepare_distribution_metadata sz2AbstractDistribution.prepare_distribution_metadata)__name__ __module__ __qualname____doc__rr abcabstractmethodrrrboolr __classcell__rrr rrsr) metaclass) r"pip._internal.index.package_finderrZpip._internal.metadata.baserpip._internal.reqrABCMetarrrrrs   PK]447distributions/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e@sLddlmZddlmZddlmZer@ddlmZddlm Z ddZ dS) )SourceDistribution)WheelDistribution)MYPY_CHECK_RUNNING)AbstractDistribution)InstallRequirementcCs$|jrt|S|jrt|St|S)zs     PK]ޜޞ 6distributions/source/__pycache__/legacy.cpython-38.pycnu[U .ee@sVddlZddlmZddlmZddlmZddlmZe e Z GdddeZ dS)N)BuildEnvironment)AbstractDistribution)InstallationError)runner_with_spinner_messagec@s(eZdZdZddZddZddZdS) SourceDistributionaRepresents 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`. NOTE from @pradyunsg (14 June 2019) I expect SourceDistribution class will need to be split into `legacy_source` (setup.py based) and `source` (PEP 517 based) when we start bringing logic for preparation out of InstallRequirement into this class. cCs |jSN)reqZget_dist)selfr M/usr/lib/python3.8/site-packages/pip/_internal/distributions/source/legacy.pyget_pkg_resources_distributionsz1SourceDistribution.get_pkg_resources_distributioncCs<|j|jjo|}|r$|||j|jdSr)rZload_pyproject_tomlZ use_pep517_setup_isolationZprepare_metadataZassert_source_matches_version)r finderZbuild_isolationZshould_isolater r r prepare_distribution_metadatas     z0SourceDistribution.prepare_distribution_metadatac sfdd}tj_jj|jjddjjjj\}rT|d|rtdjtdd t t t |jj4t d }jj}|||}W5QRXW5QRXjj|\}r|d jj||d d dS) Ncs6d}|jj|dddtDd}t|dS)NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}.z, css|]\}}d||fVqdS)z%s is incompatible with %sNr ).0Z installedZwantedr r r 3szPSourceDistribution._setup_isolation.._raise_conflicts..)Z requirementconflicting_with description)formatrjoinsortedr)rZconflicting_reqs format_stringZ error_messageZ conflictingr r r _raise_conflicts+s z=SourceDistribution._setup_isolation.._raise_conflictsZoverlayzInstalling build dependenciesz"PEP 517/518 supported requirementsz4Missing build requirements in pyproject.toml for %s.z`The project does not specify a build backend, and pip cannot fall back to setuptools without %s.z and z#Getting requirements to build wheelzthe backend dependenciesZnormalzInstalling backend dependencies)rrZ build_envZinstall_requirementsZpyproject_requiresZcheck_requirementsZrequirements_to_checkloggerZwarningrmapreprrrZpep517_backendZsubprocess_runnerZget_requires_for_build_wheel)r rrZmissingZrunnerZbackendZreqsr rr r *sP    z#SourceDistribution._setup_isolationN)__name__ __module__ __qualname____doc__r rr r r r r rs  r) ZloggingZpip._internal.build_envrZ pip._internal.distributions.baserZpip._internal.exceptionsrZpip._internal.utils.subprocessrZ getLoggerrrrr r r r s      PK]re8distributions/source/__pycache__/__init__.cpython-38.pycnu[U .e@sdS)NrrrO/usr/lib/python3.8/site-packages/pip/_internal/distributions/source/__init__.pyPK]ޜޞ <distributions/source/__pycache__/legacy.cpython-38.opt-1.pycnu[U .ee@sVddlZddlmZddlmZddlmZddlmZe e Z GdddeZ dS)N)BuildEnvironment)AbstractDistribution)InstallationError)runner_with_spinner_messagec@s(eZdZdZddZddZddZdS) SourceDistributionaRepresents 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`. NOTE from @pradyunsg (14 June 2019) I expect SourceDistribution class will need to be split into `legacy_source` (setup.py based) and `source` (PEP 517 based) when we start bringing logic for preparation out of InstallRequirement into this class. cCs |jSN)reqZget_dist)selfr M/usr/lib/python3.8/site-packages/pip/_internal/distributions/source/legacy.pyget_pkg_resources_distributionsz1SourceDistribution.get_pkg_resources_distributioncCs<|j|jjo|}|r$|||j|jdSr)rZload_pyproject_tomlZ use_pep517_setup_isolationZprepare_metadataZassert_source_matches_version)r finderZbuild_isolationZshould_isolater r r prepare_distribution_metadatas     z0SourceDistribution.prepare_distribution_metadatac sfdd}tj_jj|jjddjjjj\}rT|d|rtdjtdd t t t |jj4t d }jj}|||}W5QRXW5QRXjj|\}r|d jj||d d dS) Ncs6d}|jj|dddtDd}t|dS)NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}.z, css|]\}}d||fVqdS)z%s is incompatible with %sNr ).0Z installedZwantedr r r 3szPSourceDistribution._setup_isolation.._raise_conflicts..)Z requirementconflicting_with description)formatrjoinsortedr)rZconflicting_reqs format_stringZ error_messageZ conflictingr r r _raise_conflicts+s z=SourceDistribution._setup_isolation.._raise_conflictsZoverlayzInstalling build dependenciesz"PEP 517/518 supported requirementsz4Missing build requirements in pyproject.toml for %s.z`The project does not specify a build backend, and pip cannot fall back to setuptools without %s.z and z#Getting requirements to build wheelzthe backend dependenciesZnormalzInstalling backend dependencies)rrZ build_envZinstall_requirementsZpyproject_requiresZcheck_requirementsZrequirements_to_checkloggerZwarningrmapreprrrZpep517_backendZsubprocess_runnerZget_requires_for_build_wheel)r rrZmissingZrunnerZbackendZreqsr rr r *sP    z#SourceDistribution._setup_isolationN)__name__ __module__ __qualname____doc__r rr r r r r rs  r) ZloggingZpip._internal.build_envrZ pip._internal.distributions.baserZpip._internal.exceptionsrZpip._internal.utils.subprocessrZ getLoggerrrrr r r r s      PK]re>distributions/source/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e@sdS)NrrrO/usr/lib/python3.8/site-packages/pip/_internal/distributions/source/__init__.pyPK]eedistributions/source/legacy.pynu[# The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False import logging from pip._internal.build_env import BuildEnvironment from pip._internal.distributions.base import AbstractDistribution from pip._internal.exceptions import InstallationError 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`. NOTE from @pradyunsg (14 June 2019) I expect SourceDistribution class will need to be split into `legacy_source` (setup.py based) and `source` (PEP 517 based) when we start bringing logic for preparation out of InstallRequirement into this class. """ def get_pkg_resources_distribution(self): return self.req.get_dist() def prepare_distribution_metadata(self, finder, build_isolation): # Prepare for building. We need to: # 1. Load pyproject.toml (if it exists) # 2. Set up the build environment self.req.load_pyproject_toml() should_isolate = self.req.use_pep517 and build_isolation if should_isolate: self._setup_isolation(finder) self.req.prepare_metadata() self.req.assert_source_matches_version() def _setup_isolation(self, finder): def _raise_conflicts(conflicting_with, conflicting_reqs): 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( '%s is incompatible with %s' % (installed, wanted) for installed, wanted in sorted(conflicting) ) ) raise InstallationError(error_message) # Isolate in a BuildEnvironment and install the build-time # requirements. self.req.build_env = BuildEnvironment() self.req.build_env.install_requirements( finder, self.req.pyproject_requires, 'overlay', "Installing build dependencies" ) conflicting, missing = self.req.build_env.check_requirements( self.req.requirements_to_check ) if conflicting: _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))) ) # 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. with self.req.build_env: runner = runner_with_spinner_message( "Getting requirements to build wheel" ) backend = self.req.pep517_backend with backend.subprocess_runner(runner): reqs = backend.get_requires_for_build_wheel() conflicting, missing = self.req.build_env.check_requirements(reqs) if conflicting: _raise_conflicts("the backend dependencies", conflicting) self.req.build_env.install_requirements( finder, missing, 'normal', "Installing backend dependencies" ) PK] distributions/source/__init__.pynu[PK]Ph[[distributions/wheel.pynu[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 ) -> None: pass PK]h distributions/base.pynu[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 ) -> None: raise NotImplementedError() PK]rdistributions/installed.pynu[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: from pip._internal.metadata.pkg_resources import Distribution as _Dist assert self.req.satisfied_by is not None, "not actually installed" return _Dist(self.req.satisfied_by) def prepare_distribution_metadata( self, finder: PackageFinder, build_isolation: bool ) -> None: pass PK]u .ZZdistributions/__init__.pynu[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) PK];Ւ// pyproject.pynu[import os from collections import namedtuple from typing import Any, List, Optional from pip._vendor import tomli from pip._vendor.packaging.requirements import InvalidRequirement, Requirement from pip._internal.exceptions import InstallationError def _is_list_of_str(obj: Any) -> bool: return isinstance(obj, list) and all(isinstance(item, str) for item in obj) def make_pyproject_path(unpacked_source_directory: str) -> str: return os.path.join(unpacked_source_directory, "pyproject.toml") BuildSystemDetails = namedtuple( "BuildSystemDetails", ["requires", "backend", "check", "backend_path"] ) def load_pyproject_toml( use_pep517: Optional[bool], pyproject_toml: str, setup_py: str, req_name: str ) -> Optional[BuildSystemDetails]: """Load the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing? None means the user hasn't explicitly specified. pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file req_name - The name of the requirement we're processing (for error reporting) Returns: None if we should use the legacy code path, otherwise a tuple ( requirements from pyproject.toml, name of PEP 517 backend, requirements we should check are installed after setting up the build environment directory paths to import the backend from (backend-path), relative to the project root. ) """ has_pyproject = os.path.isfile(pyproject_toml) has_setup = os.path.isfile(setup_py) if not has_pyproject and not has_setup: raise InstallationError( f"{req_name} does not appear to be a Python project: " f"neither 'setup.py' nor 'pyproject.toml' found." ) if has_pyproject: with open(pyproject_toml, encoding="utf-8") as f: pp_toml = tomli.load(f) build_system = pp_toml.get("build-system") else: build_system = None # The following cases must use PEP 517 # We check for use_pep517 being non-None and falsey because that means # the user explicitly requested --no-use-pep517. The value 0 as # opposed to False can occur when the value is provided via an # environment variable or config file option (due to the quirk of # strtobool() returning an integer in pip's configuration code). if has_pyproject and not has_setup: if use_pep517 is not None and not use_pep517: raise InstallationError( "Disabling PEP 517 processing is invalid: " "project does not have a setup.py" ) use_pep517 = True elif build_system and "build-backend" in build_system: if use_pep517 is not None and not use_pep517: raise InstallationError( "Disabling PEP 517 processing is invalid: " "project specifies a build backend of {} " "in pyproject.toml".format(build_system["build-backend"]) ) use_pep517 = True # If we haven't worked out whether to use PEP 517 yet, # and the user hasn't explicitly stated a preference, # we do so if the project has a pyproject.toml file. elif use_pep517 is None: use_pep517 = has_pyproject # At this point, we know whether we're going to use PEP 517. assert use_pep517 is not None # If we're using the legacy code path, there is nothing further # for us to do here. if not use_pep517: return None if build_system is None: # Either the user has a pyproject.toml with no build-system # section, or the user has no pyproject.toml, but has opted in # explicitly via --use-pep517. # In the absence of any explicit backend specification, we # assume the setuptools backend that most closely emulates the # traditional direct setup.py execution, and require wheel and # a version of setuptools that supports that backend. build_system = { "requires": ["setuptools>=40.8.0", "wheel"], "build-backend": "setuptools.build_meta:__legacy__", } # If we're using PEP 517, we have build system information (either # from pyproject.toml, or defaulted by the code above). # Note that at this point, we do not know if the user has actually # specified a backend, though. assert build_system is not None # Ensure that the build-system section in pyproject.toml conforms # to PEP 518. error_template = ( "{package} has a pyproject.toml file that does not comply " "with PEP 518: {reason}" ) # Specifying the build-system table but not the requires key is invalid if "requires" not in build_system: raise InstallationError( error_template.format( package=req_name, reason=( "it has a 'build-system' table but not " "'build-system.requires' which is mandatory in the table" ), ) ) # Error out if requires is not a list of strings requires = build_system["requires"] if not _is_list_of_str(requires): raise InstallationError( error_template.format( package=req_name, reason="'build-system.requires' is not a list of strings.", ) ) # Each requirement must be valid as per PEP 508 for requirement in requires: try: Requirement(requirement) except InvalidRequirement: raise InstallationError( error_template.format( package=req_name, reason=( "'build-system.requires' contains an invalid " "requirement: {!r}".format(requirement) ), ) ) backend = build_system.get("build-backend") backend_path = build_system.get("backend-path", []) check: List[str] = [] if backend is None: # If the user didn't specify a backend, we assume they want to use # the setuptools backend. But we can't be sure they have included # a version of setuptools which supplies the backend, or wheel # (which is needed by the backend) in their requirements. So we # make a note to check that those requirements are present once # we have set up the environment. # This is quite a lot of work to check for a very specific case. But # the problem is, that case is potentially quite common - projects that # adopted PEP 518 early for the ability to specify requirements to # execute setup.py, but never considered needing to mention the build # tools themselves. The original PEP 518 code had a similar check (but # implemented in a different way). backend = "setuptools.build_meta:__legacy__" check = ["setuptools>=40.8.0", "wheel"] return BuildSystemDetails(requires, backend, check, backend_path) PK]d66-operations/__pycache__/prepare.cpython-38.pycnu[U ʗReY @sDdZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZddlmZdd lmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$ddl%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0ddl1m2Z2m3Z3ddl4m5Z5ddl6m7Z7m8Z8m9Z9m:Z:ddl;mZ>ddl?m@Z@eAeBZCe-e+eeDeDedddZEeeFeGddddZHGdd d ZId.ee$e eFe e2eId!d"d#ZJd/ee eFe e2eId$d%d&ZKd0eeFe$eGe eFe e2e eId'd(d)ZLeeFe e2e eFd$d*d+ZMGd,d-d-ZNdS)1z)Prepares a distribution for installation N)DictIterableListOptional)canonicalize_name))make_distribution_for_install_requirement)InstalledDistribution)DirectoryUrlHashUnsupported HashMismatch HashUnpinnedInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorVcsHashUnsupported) PackageFinder)BaseDistribution) ArchiveInfo)Link)Wheel)BatchDownloader Downloader)HTTPRangeRequestUnsupporteddist_from_wheel_url) PipSession) BuildTracker)InstallRequirement)direct_url_for_editabledirect_url_from_link)Hashes MissingHashes) indent_log) display_path hash_filehide_urlis_installable_dir) TempDirectory) unpack_file)vcs)req build_trackerfinderbuild_isolationcheck_build_depsreturnc Cs4t|}||||||W5QRX|S)z(Prepare a distribution for installation.)rtrackprepare_distribution_metadataget_metadata_distribution)r(r)r*r+r, abstract_distr2/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/prepare.py_get_prepared_distribution:s r4)linklocation verbosityr-cCs2t|j}|dk st|j|t|j|ddS)N)urlr7)r'get_backend_for_schemeschemeAssertionErrorunpackr#r8)r5r6r7 vcs_backendr2r2r3unpack_vcs_linkJs  r>c@s"eZdZeeeddddZdS)FileN)path content_typer-cCs*||_|dkr t|d|_n||_dS)Nr)r@ mimetypes guess_typerA)selfr@rAr2r2r3__init__Qsz File.__init__)__name__ __module__ __qualname__strrrEr2r2r2r3r?Psr?)r5download download_dirhashesr-cCsVtddd}d}|r t|||}|r.|}d}n|||j\}}|rL||t||S)Nr<Tkindglobally_managed)r%_check_download_dirr@check_against_pathr?)r5rJrKrLtemp_diralready_downloaded_path from_pathrAr2r2r3 get_http_urlYs   rU)r5rKrLr-cCs<d}|rt|||}|r|}n|j}|r2||t|dS)z'Get file and optionally check its hash.N)rP file_pathrQr?)r5rKrLrSrTr2r2r3 get_file_urlqs  rW)r5r6rJr7rKrLr-cCsd|jrt|||ddS|r$t|jr:t|||d}nt||||d}|js`t|j ||j |S)a_Unpack link into location, downloading if required. :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. )r7N)rL) is_vcsr>is_existing_dirr;is_filerWrUis_wheelr&r@rA)r5r6rJr7rKrLfiler2r2r3 unpack_urls  r]cCsptj||j}tj|s dStd||rlz||Wn,tk rjt d|t |YdSX|S)zCheck download_dir for previously downloaded file with correct hash If a correct file is found return its path else None NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.) osr@joinfilenameexistsloggerinforQr warningunlink)r5rKrL download_pathr2r2r3rPs   rPcseZdZdZeeeeeeeeee eeee ddfdd Z e ddddZ e edd d d Ze edd d ZeeedddZd#ee eddddZd$e eed ddZd%ee eddddZe eed ddZe ddddZe edddZe eed d!d"ZZS)&RequirementPreparerzPrepares a RequirementN) build_dirrKsrc_dirr+r,r)session progress_barr*require_hashes use_user_site lazy_wheelr7r-cszt||_||_||_||_t|||_t|||_ | |_ ||_ ||_ ||_ | |_| |_| |_| |_i|_d|_dS)N)ro)superrErirhr)_sessionr _downloadr_batch_downloadr*rKr+r,rlrmuse_lazy_wheelr7 _downloaded_previous_requirement_header)rDrhrKrir+r,r)rjrkr*rlrmrnr7 __class__r2r3rEs"   zRequirementPreparer.__init__)r(r-c Cs|jjr$|js$d}tt|jj}nd}t|jp2|}||f|jkrZ||f|_t |||jrt t d|jj W5QRXdS)z3Provide context for the requirement being prepared.z Processing %sz Collecting %szUsing cached %sN) r5rZoriginal_link_is_in_wheel_cacherIr!rVr(rvrbrcr r`)rDr(message informationr2r2r3_log_preparing_links  z'RequirementPreparer._log_preparing_link)r(parallel_buildsr-cCsd|jjr dS|jdkst|jr2|jj|_dS|j|jd|dt|jr`t d ||jdS)z1Ensure source_dir of a linked InstallRequirement.NT) autodeleter}zpip can't proceed with requirements '{}' due to apre-existing build directory ({}). This is likely due to a previous installation that failed . pip is being responsible and not assuming it can delete this. Please delete it and try again.) r5r[ source_dirr;rYrVensure_has_source_dirrhr$rformat)rDr(r}r2r2r3_ensure_link_req_src_dirs$   z,RequirementPreparer._ensure_link_req_src_dircCsX|js|jddS|jjr t|jr0t|jdkrF|jsFt |jddpVt S)NT)trust_internetF) rlrLr5rXrrYr original_link is_pinnedr r)rDr(r2r2r3_get_linked_req_hashes=s  z*RequirementPreparer._get_linked_req_hashes)r5r-cCs|js dS|jrtddS|js*|js:td|dSt|j}t|j }t d||j |j ddd}zt|||jWStk rtd|YdSXdS) z-Fetch metadata using lazy wheel, if possible.Nz3Lazy wheel is not used as hash checking is requiredz>Lazy wheel is not used as %r does not points to a remote wheelz+Obtaining dependency information from %s %s#rz"%s does not support range requests)rtrlrbdebugrZr[rr`rnamercversionr8splitrrqr)rDr5wheelrr8r2r2r3 _fetch_metadata_using_lazy_wheel]s0     z4RequirementPreparer._fetch_metadata_using_lazy_wheelF)partially_downloaded_reqsr}r-c Cstdddj}i}|D]}|js$t|||j<q|||}|D](\}\}} td||||}||_qD|D]}| ||qrdS)z>Download any requirements which were only fetched by metadata.r<TrMzDownloading link %s to %sN) r%r@r5r;rskeysrbrlocal_file_path_prepare_linked_requirement) rDrr}rRlinks_to_fully_downloadr(batch_downloadr5filepath_r2r2r3_complete_partial_requirements|s  z2RequirementPreparer._complete_partial_requirementsc Cs|js t|j}||td}|jdk rP|jrP||}t|j|j|}|dk rh||j|jj <n(| |}|dk rd|_ |W5QRS| ||W5QRSQRXdS)z3Prepare a requirement to be obtained from req.link.NT) r5r;r|r rKr[rrPrur8rneeds_more_preparationr)rDr(r}r5rVrL wheel_distr2r2r3prepare_linked_requirements    z.RequirementPreparer.prepare_linked_requirement)reqsr}r-cCsdd|D}|D]L}|jdk r|jjr||}t|j|j|}|dk r||j|jj<d|_qg}|D]"}|jr~||qh| ||qh|j ||ddS)z,Prepare linked requirements more, if needed.cSsg|]}|jr|qSr2)r).0r(r2r2r3 szHRequirementPreparer.prepare_linked_requirements_more..NF)r}) rKr5r[rrPrur8rappendrr)rDrr}r(rLrVrr2r2r3 prepare_linked_requirements_mores"  z4RequirementPreparer.prepare_linked_requirements_morec CsN|js t|j}|||||}|r4d}n|j|jkrzt||j|j |j |j |}Wqt k r}zt d|||W5d}~XYqXn&|j|j}|r||t|dd}|jdkr$|jrtt||j|_t|jjtr$|jjjs$|r$t|jd}d||jj_|r2|j|_t||j|j|j|j } | S)NzDCould not install requirement {} because of HTTP error {} for URL {})rArzsha256=)!r5r;rrrYr8rur]rrrr7rKr r rrQr? download_infoeditabler isinstancercrhashr"r@ hexdigestrr4r)r*r+r,) rDr(r}r5rL local_fileexcrVrdistr2r2r3rsb          z/RequirementPreparer._prepare_linked_requirementcCs|jdk st|jdk st|j}|js6|rF|jrF||jdS|r^td|dS|j dkrldSt j |j|j }t j |st|j |t|}td|dS)NzENot copying link to destination directory since it is a directory: %szSaved %s)rKr;r5rXrYrarchiverbrrr^r@r_r`rashutilcopyr!rc)rDr(r5download_locationrfr2r2r3save_linked_requirements&   z+RequirementPreparer.save_linked_requirementc Cs|jstdtd|th|jr6td|||j | |j sTtt |j |_t||j|j|j|j}||jW5QRX|S)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablez Obtaining %szoThe editable requirement {} cannot be installed when requiring hashes, because there is no single file to hash.)rr;rbrcr rlr rrriupdate_editablerrunpacked_source_directoryrr4r)r*r+r,check_if_existsrm)rDr(rr2r2r3prepare_editable_requirement/s,    z0RequirementPreparer.prepare_editable_requirement)r( skip_reasonr-c Cst|jstd|dk s&td|jtd|||jjt*|jrRtdt | W5QRSQRXdS)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNzAdid not get skip reason skipped but req.satisfied_by is set to {}zRequirement %s: %s (%s)zSince it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.) satisfied_byr;rrbrcrr rlrrr0)rDr(rr2r2r3prepare_installed_requirementPs$ z1RequirementPreparer.prepare_installed_requirement)F)F)F)rFrGrH__doc__rIrboolrrrintrErr|rrrrrrrrrrrrrr __classcell__r2r2rwr3rgsn6 %" " !   ? #rg)NN)NN)NN)OrloggingrBr^rtypingrrrrpip._vendor.packaging.utilsrpip._internal.distributionsr%pip._internal.distributions.installedrpip._internal.exceptionsr r r r r rr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.direct_urlrpip._internal.models.linkrpip._internal.models.wheelrpip._internal.network.downloadrr pip._internal.network.lazy_wheelrrpip._internal.network.sessionr,pip._internal.operations.build.build_trackerrZpip._internal.req.req_installr&pip._internal.utils.direct_url_helpersrrpip._internal.utils.hashesrrpip._internal.utils.loggingr pip._internal.utils.miscr!r"r#r$pip._internal.utils.temp_dirr%pip._internal.utils.unpackingr&pip._internal.vcsr' getLoggerrFrbrr4rIrr>r?rUrWr]rPrgr2r2r2r3s   $                  , PK]w337operations/__pycache__/generate_metadata.cpython-38.pycnu[U .e[@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZe r|dd lmZmZdd lmZeeZd d Zd dZddZddZdS)z4Metadata generation logic for source distributions. N)InstallationError) ensure_dir)make_setuptools_shim_args)call_subprocess)MYPY_CHECK_RUNNING)vcs)CallableList)InstallRequirementcCs|js tStS)aReturn a callable metadata generator for this InstallRequirement. A metadata generator takes an InstallRequirement (install_req) as an input, generates metadata via the appropriate process for that install_req and returns the generated metadata directory. )Z use_pep517_generate_metadata_legacy_generate_metadata install_reqrN/usr/lib/python3.8/site-packages/pip/_internal/operations/generate_metadata.pyget_metadata_generatorsrcsddfdd}dd}|}|r.||}ntj|d}t|}|sVtd|t|d krn|j|d tj||d S) zEFind an .egg-info in `source_directory`, based on `is_editable`. cSs0tjtj|ddp.tjtj|ddS)NbinpythonZScriptsz Python.exe)ospathlexistsjoinexists)rrrrlooks_like_virtual_env(sz._find_egg_info..looks_like_virtual_envcsg}t|D]\}}tjD]}||kr||qt|D]<}tj|r`||q>|dksp|dkr>||q>|fdd|Dqdd|DS)NZtestZtestsc3s|]}tj|VqdSN)rrr).0dir_rootrr ?szC_find_egg_info..locate_editable_egg_info..cSsg|]}|dr|qS)z .egg-info)endswith)rfrrr @s zD_find_egg_info..locate_editable_egg_info..) rwalkrZdirnamesremovelistrrextend)baseZ candidatesdirsfilesrrrrlocate_editable_egg_info/s     z0_find_egg_info..locate_editable_egg_infocSs(|tjjtjjr"|tjjp$dS)Nr)countrrsepaltsep)rrrrdepth_of_directoryBs z*_find_egg_info..depth_of_directory pip-egg-infoz!Files/directories not found in %s)keyr)rrrlistdirrlensort)Zsource_directoryZ is_editabler+r/r' filenamesrr*r_find_egg_info#s     r7c Cs|jpd|j}td|j|t|j}|jr<|dg7}g}|jsft j |j d}d|g}t ||j t|dg||j ddW5QRXt|j |jS) Nzfrom {}z2Running setup.py (path:%s) egg_info for package %sz --no-user-cfgr0z --egg-baseZegg_infozpython setup.py egg_info)cwdZ command_desc)nameformatlinkloggerdebugZ setup_py_pathrisolatedZeditablerrrZunpacked_source_directoryrZ build_envrr7)rZreq_details_strZbase_cmdZegg_base_optionZ egg_info_dirrrrr ^s6   r cCs|Sr)Zprepare_pep517_metadatar rrrr sr )__doc__ZloggingrZpip._internal.exceptionsrZpip._internal.utils.miscrZ$pip._internal.utils.setuptools_buildrZpip._internal.utils.subprocessrZpip._internal.utils.typingrZpip._internal.vcsrtypingrr Zpip._internal.req.req_installr Z getLogger__name__r<rr7r r rrrrs         ;(PK],+operations/__pycache__/check.cpython-38.pycnu[U ʗRe@sxdZddlZddlmZmZmZmZmZmZm Z ddl m Z ddl m Z mZddlmZddlmZddlmZdd lmZeeZGd d d eZee efZe e e fZe e ee fZee eefZee eefZe eefZ e ee fZ!e ee"fd d dZ#deeee$ge"fe dddZ%eee!dddZ&eeeee dddZ'ee eee dddZ(dS)z'Validation of dependencies of packages N)CallableDictList NamedTupleOptionalSetTuple) Requirement)NormalizedNamecanonicalize_name))make_distribution_for_install_requirement)get_default_environment)DistributionVersion)InstallRequirementc@s"eZdZUeed<eeed<dS)PackageDetailsversion dependenciesN)__name__ __module__ __qualname__r__annotations__rr rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/check.pyrs r)returnc Csi}d}t}|jdddD]d}|j}z t|}t|j|||<Wqttfk r~}zt d||d}W5d}~XYqXq||fS)z3Converts a list of distributions into a PackageSet.Fr) local_onlyskipz%Error parsing requirements for %s: %sTN) r iter_installed_distributionscanonical_namelistiter_dependenciesrrOSError ValueErrorloggerwarning) package_setproblemsenvdistnamererrr!create_package_set_from_installed"s r*)r$ should_ignorerc Csi}i}|D]\}}t}t}|r2||r2q|jD]l}t|j} | |krzd} |jdk rf|j} | r8|| |fq8|| j} |j j | dds8|| | |fq8|rt |t d||<|rt |t d||<q||fS)zCheck if a package set is consistent If should_ignore is passed, it should be a callable that takes a package name and returns a boolean. TN) prereleases)key) itemssetrr r(markerevaluateaddr specifiercontainssortedstr) r$r+missing conflicting package_namepackage_detail missing_depsconflicting_depsreqr(missedrrrrcheck_package_set3s0       r?) to_installrcs6t\}}t||}t|||t|fdddfS)zeFor checking if the dependency graph would be consistent after installing given requirements cs|kSNr)r( whitelistrroz)check_install_conflicts..)r+)r*_simulate_installation_of_create_whitelistr?)r@r$_would_be_installedrrBrcheck_install_conflicts`s    rJ)r@r$rcCsLt}|D]<}t|}|}|j}t|jt|||<||q |S)z=Computes the version of packages after installing to_install.) r/r get_metadata_distributionrrrrrr2)r@r$ installedinst_req abstract_distr'r(rrrrFts rF)rIr$rcCsLt|}|D]:}||krq ||jD] }t|j|kr$||q q$q |SrA)r/rr r(r2)rIr$packages_affectedr9r=rrrrGs rG)N))__doc__loggingtypingrrrrrrr"pip._vendor.packaging.requirementsr pip._vendor.packaging.utilsr r pip._internal.distributionsr pip._internal.metadatar Zpip._internal.metadata.baserZpip._internal.req.req_installr getLoggerrr"r PackageSetMissing Conflicting MissingDictConflictingDict CheckResultConflictDetailsboolr*r6r?rJrFrGrrrrsB$           - PK]OfHH1operations/__pycache__/check.cpython-38.opt-1.pycnu[U .e@s dZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z eeZe rdd lmZdd lmZmZmZmZmZmZmZeed fZeeefZeeeefZeeeefZeeeefZ eee fZ!ed d d gZ"ddZ#dddZ$ddZ%ddZ&ddZ'dS)z'Validation of dependencies of packages N) namedtuple)canonicalize_name)RequirementParseError))make_distribution_for_install_requirement)get_installed_distributions)MYPY_CHECK_RUNNING)InstallRequirement)AnyCallableDictOptionalSetTupleListPackageDetailsversionrequiresc Ks|ikrddd}i}d}tf|D]\}t|j}zt|j|||<Wq$tk r~}ztd||d}W5d}~XYq$Xq$||fS)z8Converts a list of distributions into a PackageSet. F)Z local_onlyskipz%Error parsing requirements for %s: %sTN) rr project_namerrrrloggingZwarning)kwargs package_setZproblemsdistnameerrB/usr/lib/python3.8/site-packages/pip/_internal/operations/check.py!create_package_set_from_installed(s  rc Cs|dkrdd}i}i}|D]}t}t}||r6q||jD]l}t|j}||krd} |jdk rn|j} | r@|||fq@||j} |jj | dds@||| |fq@|rt |t d||<|rt |t d||<q||fS)zCheck if a package set is consistent If should_ignore is passed, it should be a callable that takes a package name and returns a boolean. NcSsdS)NFrrrrr should_ignoreEsz(check_package_set..should_ignoreT)Z prereleases)key) setrrrZmarkerZevaluateaddrZ specifiercontainssortedstr) rrZmissingZ conflicting package_nameZ missing_depsZconflicting_depsreqrZmissedrrrrcheck_package_set=s4    r(cs6t\}}t||}t|||t|fdddfS)zeFor checking if the dependency graph would be consistent after installing given requirements cs|kSNrrZ whitelistrr|z)check_install_conflicts..)r)r_simulate_installation_of_create_whitelistr() to_installr_would_be_installedrr*rcheck_install_conflictsls    r2cCsLt}|D]<}t|}|}t|j}t|j|||<||q |S)zBComputes the version of packages after installing to_install. ) r!rZget_pkg_resources_distributionrr rrrr")r/rZ installedZinst_reqZ abstract_distrrrrrr-s  r-cCsLt|}|D]:}||krq ||jD] }t|j|kr$||q q$q |Sr))r!rrrr")r1rZpackages_affectedr&r'rrrr.s r.)N)(__doc__r collectionsrZpip._vendor.packaging.utilsrZpip._vendor.pkg_resourcesrZpip._internal.distributionsrZpip._internal.utils.miscrZpip._internal.utils.typingrZ getLogger__name__ZloggerZpip._internal.req.req_installrtypingr r r r r rrr%Z PackageSetZMissingZ ConflictingZ MissingDictZConflictingDictZ CheckResultrrr(r2r-r.rrrrs.        $    /PK].!bb2operations/__pycache__/freeze.cpython-38.opt-1.pycnu[U .eb& @s4ddlmZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZddlmZmZddlmZdd lmZmZdd lmZerdd lmZmZmZmZmZmZm Z m!Z!m"Z"dd l#m$Z$dd l m%Z%m&Z&e ee"e'e&fe(ee'fZ)e*e+Z,dddZ-ddZ.Gddde/Z0dS))absolute_importN)six)canonicalize_name)RequirementParseError) BadCommandInstallationError)install_req_from_editableinstall_req_from_line) COMMENT_RE)dist_is_editableget_installed_distributions)MYPY_CHECK_RUNNING) IteratorOptionalList ContainerSetDictTupleIterableUnion) WheelCache) Distribution RequirementFc  cs|pg}d} |rt|j} |D]} d| Vq i} t|d||dD]b} zt| }Wn8tk r}ztd| |WYqDW5d}~XYnX|r|j rqD|| |j <qD|rt }t t}|D]}t|}|D]r}|r|ds| r| |s|dr6|}||kr|||Vq|dsN|dr|drl|d d}n|tddd }t|||d }nttd |||d }|j std ||tdq|j | kr ||j std|td ||j n||j |qt| |j V| |j =||j |qW5QRXqt|D]4\}}t|dkrdtd|dt t |qddVt | !dddD]$}t"|j | krt|VqdS)Nz-f %sr) local_onlyskip user_onlypathsz6Could not generate requirement for distribution %r: %s#) z-rz --requirementz-Zz--always-unzipz-fz --find-linksz-iz --index-urlz--prez--trusted-hostz--process-dependency-linksz--extra-index-urlz-ez --editable=)isolated wheel_cachezWSkipping line in requirement file [%s] because it's not clear what it would install: %sz9 (add #egg=PackageName to the URL to avoid this warning)zBRequirement file [%s] contains %s, but package %r is not installedz+Requirement %s included multiple times [%s]z, z7## The following requirements were added by pip freeze:cSs |jSN)namelower)xrrC/usr/lib/python3.8/site-packages/pip/_internal/operations/freeze.pyzfreeze..)key)#recompilesearchr FrozenRequirement from_distrloggerwarningeditabler'set collections defaultdictlistopenstrip startswithrstripaddlenlstriprr r subinfoappendstrrZ iteritemsjoinsortedvaluesr)Z requirementZ find_linksrrrZ skip_regexr"r#Zexclude_editablerZ skip_matchlinkZ installationsdistreqexcZemitted_optionsZ req_filesZ req_file_pathZreq_filelineZline_reqr'filesZ installationrrr*freeze+s                  rNc CsNt|sddgfStjtj|j}ddlm}m}| |}|dkrv| }t d||d |g}|d|fSz|||j}Wn|k r| }d t|j|g}|d|fYStk rt d ||jddgfYStk r}zt d |W5d}~XYnX|dk r2|dgfSt d |d g}dd|fS) zk Compute and return values (req, editable, comments) for use in FrozenRequirement.from_dist(). NFr)vcsRemoteNotFoundErrorz1No VCS found for editable requirement "%s" in: %rz/# Editable install with no version control ({})Tz)# Editable {} install with no remote ({})zPcannot determine version of editable source in %s (%s command not found in path)zYError when trying to get requirement for VCS system %s, falling back to uneditable formatz-Could not determine repository location of %sz-## !! Could not determine repository location)r ospathnormcaseabspathlocationZpip._internal.vcsrOrPZget_backend_for_diras_requirementr3debugformatZget_src_requirement project_nametype__name__rr4r'r)rIrUrOrPZ vcs_backendrJcommentsrKrrr*get_requirement_infosZ     r]c@s*eZdZd ddZeddZddZdS) r1rcCs||_||_||_||_dSr&)r'rJr5r\)selfr'rJr5r\rrr*__init__szFrozenRequirement.__init__cCs0t|\}}}|dkr|}||j|||dS)N)r\)r]rVrY)clsrIrJr5r\rrr*r2szFrozenRequirement.from_distcCs2|j}|jrd|}dt|jt|gdS)Nz-e %s )rJr5rEr9r\rD)r^rJrrr*__str__szFrozenRequirement.__str__N)r)r[ __module__ __qualname__r_ classmethodr2rbrrrr*r1s  r1) NNNNNNFNFr)1Z __future__rr7ZloggingrQr.Z pip._vendorrZpip._vendor.packaging.utilsrZpip._vendor.pkg_resourcesrZpip._internal.exceptionsrrZpip._internal.req.constructorsrr Zpip._internal.req.req_filer Zpip._internal.utils.miscr r Zpip._internal.utils.typingr typingrrrrrrrrrZpip._internal.cacherrrrDboolZRequirementInfoZ getLoggerr[r3rNr]objectr1rrrr*s@      ,   >PK].operations/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdS)Nrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/__init__.pyPK]w33=operations/__pycache__/generate_metadata.cpython-38.opt-1.pycnu[U .e[@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZe r|dd lmZmZdd lmZeeZd d Zd dZddZddZdS)z4Metadata generation logic for source distributions. N)InstallationError) ensure_dir)make_setuptools_shim_args)call_subprocess)MYPY_CHECK_RUNNING)vcs)CallableList)InstallRequirementcCs|js tStS)aReturn a callable metadata generator for this InstallRequirement. A metadata generator takes an InstallRequirement (install_req) as an input, generates metadata via the appropriate process for that install_req and returns the generated metadata directory. )Z use_pep517_generate_metadata_legacy_generate_metadata install_reqrN/usr/lib/python3.8/site-packages/pip/_internal/operations/generate_metadata.pyget_metadata_generatorsrcsddfdd}dd}|}|r.||}ntj|d}t|}|sVtd|t|d krn|j|d tj||d S) zEFind an .egg-info in `source_directory`, based on `is_editable`. cSs0tjtj|ddp.tjtj|ddS)NbinpythonZScriptsz Python.exe)ospathlexistsjoinexists)rrrrlooks_like_virtual_env(sz._find_egg_info..looks_like_virtual_envcsg}t|D]\}}tjD]}||kr||qt|D]<}tj|r`||q>|dksp|dkr>||q>|fdd|Dqdd|DS)NZtestZtestsc3s|]}tj|VqdSN)rrr).0dir_rootrr ?szC_find_egg_info..locate_editable_egg_info..cSsg|]}|dr|qS)z .egg-info)endswith)rfrrr @s zD_find_egg_info..locate_editable_egg_info..) rwalkrZdirnamesremovelistrrextend)baseZ candidatesdirsfilesrrrrlocate_editable_egg_info/s     z0_find_egg_info..locate_editable_egg_infocSs(|tjjtjjr"|tjjp$dS)Nr)countrrsepaltsep)rrrrdepth_of_directoryBs z*_find_egg_info..depth_of_directory pip-egg-infoz!Files/directories not found in %s)keyr)rrrlistdirrlensort)Zsource_directoryZ is_editabler+r/r' filenamesrr*r_find_egg_info#s     r7c Cs|jpd|j}td|j|t|j}|jr<|dg7}g}|jsft j |j d}d|g}t ||j t|dg||j ddW5QRXt|j |jS) Nzfrom {}z2Running setup.py (path:%s) egg_info for package %sz --no-user-cfgr0z --egg-baseZegg_infozpython setup.py egg_info)cwdZ command_desc)nameformatlinkloggerdebugZ setup_py_pathrisolatedZeditablerrrZunpacked_source_directoryrZ build_envrr7)rZreq_details_strZbase_cmdZegg_base_optionZ egg_info_dirrrrr ^s6   r cCs|Sr)Zprepare_pep517_metadatar rrrr sr )__doc__ZloggingrZpip._internal.exceptionsrZpip._internal.utils.miscrZ$pip._internal.utils.setuptools_buildrZpip._internal.utils.subprocessrZpip._internal.utils.typingrZpip._internal.vcsrtypingrr Zpip._internal.req.req_installr Z getLogger__name__r<rr7r r rrrrs         ;(PK]PHD5**,operations/__pycache__/freeze.cpython-38.pycnu[U ʗRe8& @s(ddlZddlZddlZddlmZmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZmZddlmZmZddlmZmZddlmZdd lmZeeZGd d d e Z de ee!e"e"e ee!e"e"ee!ee!ddfdddZ#ee!dddZ$ee dddZ%GdddZ&dS)N) ContainerDict GeneratorIterableList NamedTupleOptionalSet)canonicalize_name)Version) BadCommandInstallationError)BaseDistributionget_environment)install_req_from_editableinstall_req_from_line) COMMENT_RE)%direct_url_as_pep440_direct_referencec@s"eZdZUeed<eeed<dS) _EditableInfo requirementcommentsN)__name__ __module__ __qualname__str__annotations__rrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/freeze.pyrs rFr)r local_only user_onlypathsisolatedexclude_editableskipreturnc csXi}t|j|d|d}|D]$} t| } |r6| jr6q| || j<q|rt} tt } |D]z} t | f}|D]X}| r| ds| dr| }|| krr| ||Vqr| ds| dr| dr|dd }n|tdd d}t||d }nttd | |d }|jsRtd | | td qrt|j}||kr| |jstd | td | |jn| |j| qrt|| V||=| |j| qrW5QRXq\| D]4\}}t|dkrtd|dtt|qdVt|dddD] }|j|kr2t| Vq2dS)Nr)rr#r#) z-rz --requirementz-fz --find-linksz-iz --index-urlz--prez--trusted-hostz--process-dependency-linksz--extra-index-urlz --use-featurez-ez --editable=)r!zWSkipping line in requirement file [%s] because it's not clear what it would install: %sz9 (add #egg=PackageName to the URL to avoid this warning)zBRequirement file [%s] contains %s, but package %r is not installedz+Requirement %s included multiple times [%s]z, z7## The following requirements were added by pip freeze:cSs |jSN)namelower)xrrrzfreeze..)key) riter_installed_distributionsFrozenRequirement from_disteditablecanonical_nameset collections defaultdictlistopenstrip startswithrstripaddlenlstriprrrsubr+loggerinfor warningappendritemsjoinsortedvalues)rrrr r!r"r#Z installationsdistsdistreqZemitted_optionsZ req_filesZ req_file_pathreq_filelineZline_reqZline_req_canonical_namer+filesZ installationrrrfreezes               rPrKr$cCs0t|jtr|jd|jS|jd|jS)Nz==z===) isinstanceversionr raw_name)rKrrr_format_as_name_versions rUc Cs|j}|sttjtj|}ddlm}m}m }| |}|dkrtt |}t d||t|d|dgdSt|j}z|||j} Wn|k rt |}t|d|d |dgdYS|k r} z8t |}t|d|d |d d | jd gdWYSd} ~ XYnltk rNt d||jt|gdYStk r|} zt d| W5d} ~ XYnXt| gdSt d|t|dgdS)za Compute and return values (req, comments) for use in FrozenRequirement.from_dist(). r)RemoteNotFoundErrorRemoteNotValidErrorvcsNz1No VCS found for editable requirement "%s" in: %rz,# Editable install with no version control ())rrz # Editable z install with no remote (z install (z4) with either a deleted local remote or invalid URI:z# ''zPcannot determine version of editable source in %s (%s command not found in path)z6Error when trying to get requirement for VCS system %sz-Could not determine repository location of %sz-## !! Could not determine repository location)editable_project_locationAssertionErrorospathnormcaseabspathpip._internal.vcsrVrWrXget_backend_for_dirrUrBdebugrtyperget_src_requirementrTurlr rDr+r ) rKr[locationrVrWrX vcs_backenddisplayZvcs_namerLexexcrrr_get_editable_infos`       rlc@sJeZdZd eeeeeddddZeeddddZ ed d d Z dS) r2rN)r+rLr4rr$cCs&||_t||_||_||_||_dSr*)r+r r5rLr4r)selfr+rLr4rrrr__init__s  zFrozenRequirement.__init__rQcCsN|j}|rt|\}}n$g}|j}|r4t||j}nt|}||j|||dS)N)r)r4rl direct_urlrrTrU)clsrKr4rLrrorrrr3szFrozenRequirement.from_dist)r$cCs4|j}|jrd|}dt|jt|gdS)Nz-e  )rLr4rGr9rr)rmrLrrr__str__s zFrozenRequirement.__str__)r) rrrrboolrrn classmethodrr3rrrrrrr2s r2)NFFNFFr)'r7loggingr]typingrrrrrrrr pip._vendor.packaging.utilsr Zpip._vendor.packaging.versionr pip._internal.exceptionsr r pip._internal.metadatarrpip._internal.req.constructorsrrZpip._internal.req.req_filer&pip._internal.utils.direct_url_helpersr getLoggerrrBrrrsrPrUrlr2rrrrs@(        yBPK]/4operations/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e@sdS)NrrrE/usr/lib/python3.8/site-packages/pip/_internal/operations/__init__.pyPK]aSZ3operations/__pycache__/prepare.cpython-38.opt-1.pycnu[U .e,@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z mZmZmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZerddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(e)e*Z+ddZ,Gddde-Z.dS)z)Prepares a distribution for installation N)requests))make_distribution_for_install_requirement)InstalledDistribution) unpack_url)DirectoryUrlHashUnsupported HashUnpinnedInstallationErrorPreviousBuildDirErrorVcsHashUnsupported) expanduser) MissingHashes) indent_log)write_delete_marker_file) display_pathnormalize_path)MYPY_CHECK_RUNNING)Optional)AbstractDistribution) PackageFinder) PipSession)InstallRequirement)RequirementTrackerc Cs.t|}|||||W5QRX|S)z-Prepare a distribution for installation. )rZtrackZprepare_distribution_metadata)req req_trackerfinderbuild_isolation abstract_distrD/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py_get_prepared_distribution,s rcsDeZdZdZfddZeddZddZdd Zd d Z Z S) RequirementPreparerzPrepares a Requirement csTtt|||_||_||_|r,t|}||_|r>t|}||_ ||_ ||_ dS)N) superr __init__src_dir build_dirrr download_dirrwheel_download_dir progress_barr)selfr$r%r#r&r'rr __class__rrr"9s zRequirementPreparer.__init__cCs<|js dStj|jrdStdtdt|jdS)NFTz!Could not find download directoryz0Could not find or access download directory '%s')r%ospathexistsloggercriticalrr)r(rrr_download_should_saveas z)RequirementPreparer._download_should_savec Cs|j}|jdkr(|j}tdt|ntd|jp6|tb||j t j t j |jdrztd||jf|r|jrtn|rt|js|jst|j| d}|r|st}|j}|jr|jr|j}zt||j||||jdWnFtjk rB} z$t d|| t!d || |fW5d } ~ XYnX|jr^|rXd } nd } nd } | rrt"|jt#||j$||j%} |j&r|jr|'|jW5QRX| S) zCPrepare a requirement that would be obtained from req.link filez Processing %sz Collecting %szsetup.pyzpip can't proceed with requirements '%s' due to a pre-existing build directory (%s). This is likely due to a previous installation that failed. pip is being responsible and not assuming it can delete this. Please delete it and try again.)Ztrust_internet)sessionhashesr'z4Could not install requirement %s because of error %szDCould not install requirement %s because of HTTP error %s for URL %sNTF)(linkZschemeZ file_pathr.inforrr ensure_has_source_dirr$r+r,r-joinZ source_dirr Zis_vcsr Zis_existing_dirrZ original_linkZ is_pinnedrr3r r%Zis_wheelr&rr'rZ HTTPErrorr/rrrrrr0archive) r(rr2rrequire_hashesr4r,r3r%excZautodelete_unpackedrrrrprepare_linked_requirementos~         z.RequirementPreparer.prepare_linked_requirementc Csztd|t^|r$td|||j||j t||j ||j }|jrb| |j | |W5QRX|S)z(Prepare an editable requirement z Obtaining %szoThe editable requirement %s cannot be installed when requiring hashes, because there is no single file to hash.)r.r5r rr6r#Zupdate_editabler0rrrr8r%Zcheck_if_exists)r(rr9Z use_user_siterrrrrprepare_editable_requirements(   z0RequirementPreparer.prepare_editable_requirementc Cs@td|||jjt|r*tdt|}W5QRX|S)z1Prepare an already-installed requirement zRequirement %s: %s (%s)zSince it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.)r.r5Z satisfied_byversionr debugr)r(rr9Z skip_reasonrrrrprepare_installed_requirement sz1RequirementPreparer.prepare_installed_requirement) __name__ __module__ __qualname____doc__r"propertyr0r;r<r? __classcell__rrr)rr 5s ( z"r )/rCZloggingr+Z pip._vendorrZpip._internal.distributionsrZ%pip._internal.distributions.installedrZpip._internal.downloadrZpip._internal.exceptionsrrrr r Zpip._internal.utils.compatr Zpip._internal.utils.hashesr Zpip._internal.utils.loggingr Z pip._internal.utils.marker_filesrZpip._internal.utils.miscrrZpip._internal.utils.typingrtypingrrZpip._internal.indexrZpip._internal.network.sessionrZpip._internal.req.req_installrZpip._internal.req.req_trackerrZ getLoggerr@r.robjectr rrrrs.                 PK]:e]]operations/prepare.pynu["""Prepares a distribution for installation """ # The following comment should be removed at some point in the future. # mypy: strict-optional=False import logging import mimetypes import os import shutil from typing import Dict, Iterable, List, Optional from pip._vendor.packaging.utils import canonicalize_name from pip._internal.distributions import make_distribution_for_install_requirement from pip._internal.distributions.installed import InstalledDistribution from pip._internal.exceptions import ( DirectoryUrlHashUnsupported, HashMismatch, HashUnpinned, InstallationError, NetworkConnectionError, PreviousBuildDirError, VcsHashUnsupported, ) from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import BaseDistribution from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.network.download import BatchDownloader, Downloader from pip._internal.network.lazy_wheel import ( HTTPRangeRequestUnsupported, dist_from_wheel_url, ) from pip._internal.network.session import PipSession from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_tracker import RequirementTracker from pip._internal.utils.filesystem import copy2_fixed from pip._internal.utils.hashes import Hashes, MissingHashes from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import display_path, hide_url, is_installable_dir, rmtree from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.unpacking import unpack_file from pip._internal.vcs import vcs logger = logging.getLogger(__name__) def _get_prepared_distribution( req: InstallRequirement, req_tracker: RequirementTracker, finder: PackageFinder, build_isolation: bool, ) -> BaseDistribution: """Prepare a distribution for installation.""" abstract_dist = make_distribution_for_install_requirement(req) with req_tracker.track(req): abstract_dist.prepare_distribution_metadata(finder, build_isolation) return abstract_dist.get_metadata_distribution() def unpack_vcs_link(link: Link, location: str) -> None: vcs_backend = vcs.get_backend_for_scheme(link.scheme) assert vcs_backend is not None vcs_backend.unpack(location, url=hide_url(link.url)) class File: def __init__(self, path: str, content_type: Optional[str]) -> None: self.path = path if content_type is None: self.content_type = mimetypes.guess_type(path)[0] else: self.content_type = content_type def get_http_url( link: Link, download: Downloader, download_dir: Optional[str] = None, hashes: Optional[Hashes] = None, ) -> File: temp_dir = TempDirectory(kind="unpack", globally_managed=True) # If a download dir is specified, is the file already downloaded there? already_downloaded_path = None if download_dir: already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path content_type = None else: # let's download to a tmp dir from_path, content_type = download(link, temp_dir.path) if hashes: hashes.check_against_path(from_path) return File(from_path, content_type) def _copy2_ignoring_special_files(src: str, dest: str) -> None: """Copying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. """ try: copy2_fixed(src, dest) except shutil.SpecialFileError as e: # SpecialFileError may be raised due to either the source or # destination. If the destination was the cause then we would actually # care, but since the destination directory is deleted prior to # copy we ignore all of them assuming it is caused by the source. logger.warning( "Ignoring special file error '%s' encountered copying %s to %s.", str(e), src, dest, ) def _copy_source_tree(source: str, target: str) -> None: target_abspath = os.path.abspath(target) target_basename = os.path.basename(target_abspath) target_dirname = os.path.dirname(target_abspath) def ignore(d: str, names: List[str]) -> List[str]: skipped: List[str] = [] if d == source: # Pulling in those directories can potentially be very slow, # exclude the following directories if they appear in the top # level dir (and only it). # See discussion at https://github.com/pypa/pip/pull/6770 skipped += [".tox", ".nox"] if os.path.abspath(d) == target_dirname: # Prevent an infinite recursion if the target is in source. # This can happen when TMPDIR is set to ${PWD}/... # and we copy PWD to TMPDIR. skipped += [target_basename] return skipped shutil.copytree( source, target, ignore=ignore, symlinks=True, copy_function=_copy2_ignoring_special_files, ) def get_file_url( link: Link, download_dir: Optional[str] = None, hashes: Optional[Hashes] = None ) -> File: """Get file and optionally check its hash.""" # If a download dir is specified, is the file already there and valid? already_downloaded_path = None if download_dir: already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path else: from_path = link.file_path # If --require-hashes is off, `hashes` is either empty, the # link's embedded hash, or MissingHashes; it is required to # match. If --require-hashes is on, we are satisfied by any # hash in `hashes` matching: a URL-based or an option-based # one; no internet-sourced hash will be in `hashes`. if hashes: hashes.check_against_path(from_path) return File(from_path, None) def unpack_url( link: Link, location: str, download: Downloader, download_dir: Optional[str] = None, hashes: Optional[Hashes] = None, ) -> Optional[File]: """Unpack link into location, downloading if required. :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. """ # non-editable vcs urls if link.is_vcs: unpack_vcs_link(link, location) return None # Once out-of-tree-builds are no longer supported, could potentially # replace the below condition with `assert not link.is_existing_dir` # - unpack_url does not need to be called for in-tree-builds. # # As further cleanup, _copy_source_tree and accompanying tests can # be removed. # # TODO when use-deprecated=out-of-tree-build is removed if link.is_existing_dir(): if os.path.isdir(location): rmtree(location) _copy_source_tree(link.file_path, location) return None # file urls if link.is_file: file = get_file_url(link, download_dir, hashes=hashes) # http urls else: file = get_http_url( link, download, download_dir, hashes=hashes, ) # unpack the archive to the build dir location. even when only downloading # archives, they have to be unpacked to parse dependencies, except wheels if not link.is_wheel: unpack_file(file.path, location, file.content_type) return file def _check_download_dir( link: Link, download_dir: str, hashes: Optional[Hashes] ) -> Optional[str]: """Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None """ download_path = os.path.join(download_dir, link.filename) if not os.path.exists(download_path): return None # If already downloaded, does its hash match? logger.info("File was already downloaded %s", download_path) if hashes: try: hashes.check_against_path(download_path) except HashMismatch: logger.warning( "Previously-downloaded file %s has bad hash. Re-downloading.", download_path, ) os.unlink(download_path) return None return download_path class RequirementPreparer: """Prepares a Requirement""" def __init__( self, build_dir: str, download_dir: Optional[str], src_dir: str, build_isolation: bool, req_tracker: RequirementTracker, session: PipSession, progress_bar: str, finder: PackageFinder, require_hashes: bool, use_user_site: bool, lazy_wheel: bool, in_tree_build: bool, ) -> None: super().__init__() self.src_dir = src_dir self.build_dir = build_dir self.req_tracker = req_tracker self._session = session self._download = Downloader(session, progress_bar) self._batch_download = BatchDownloader(session, progress_bar) self.finder = finder # Where still-packed archives should be written to. If None, they are # not saved, and are deleted immediately after unpacking. self.download_dir = download_dir # Is build isolation allowed? self.build_isolation = build_isolation # Should hash-checking be required? self.require_hashes = require_hashes # Should install in user site-packages? self.use_user_site = use_user_site # Should wheels be downloaded lazily? self.use_lazy_wheel = lazy_wheel # Should in-tree builds be used for local paths? self.in_tree_build = in_tree_build # Memoized downloaded files, as mapping of url: path. self._downloaded: Dict[str, str] = {} # Previous "header" printed for a link-based InstallRequirement self._previous_requirement_header = ("", "") def _log_preparing_link(self, req: InstallRequirement) -> None: """Provide context for the requirement being prepared.""" if req.link.is_file and not req.original_link_is_in_wheel_cache: message = "Processing %s" information = str(display_path(req.link.file_path)) else: message = "Collecting %s" information = str(req.req or req) if (message, information) != self._previous_requirement_header: self._previous_requirement_header = (message, information) logger.info(message, information) if req.original_link_is_in_wheel_cache: with indent_log(): logger.info("Using cached %s", req.link.filename) def _ensure_link_req_src_dir( self, req: InstallRequirement, parallel_builds: bool ) -> None: """Ensure source_dir of a linked InstallRequirement.""" # Since source_dir is only set for editable requirements. if req.link.is_wheel: # We don't need to unpack wheels, so no need for a source # directory. return assert req.source_dir is None if req.link.is_existing_dir() and self.in_tree_build: # build local directories in-tree req.source_dir = req.link.file_path return # We always delete unpacked sdists after pip runs. req.ensure_has_source_dir( self.build_dir, autodelete=True, parallel_builds=parallel_builds, ) # If a checkout exists, it's unwise to keep going. version # inconsistencies are logged later, but do not fail the # installation. # FIXME: this won't upgrade when there's an existing # package unpacked in `req.source_dir` # TODO: this check is now probably dead code if is_installable_dir(req.source_dir): raise PreviousBuildDirError( "pip can't proceed with requirements '{}' due to a" "pre-existing build directory ({}). This is likely " "due to a previous installation that failed . pip is " "being responsible and not assuming it can delete this. " "Please delete it and try again.".format(req, req.source_dir) ) def _get_linked_req_hashes(self, req: InstallRequirement) -> Hashes: # By the time this is called, the requirement's link should have # been checked so we can tell what kind of requirements req is # and raise some more informative errors than otherwise. # (For example, we can raise VcsHashUnsupported for a VCS URL # rather than HashMissing.) if not self.require_hashes: return req.hashes(trust_internet=True) # We could check these first 2 conditions inside unpack_url # and save repetition of conditions, but then we would # report less-useful error messages for unhashable # requirements, complaining that there's no hash provided. if req.link.is_vcs: raise VcsHashUnsupported() if req.link.is_existing_dir(): raise DirectoryUrlHashUnsupported() # Unpinned packages are asking for trouble when a new version # is uploaded. This isn't a security check, but it saves users # a surprising hash mismatch in the future. # file:/// URLs aren't pinnable, so don't complain about them # not being pinned. if req.original_link is None and not req.is_pinned: raise HashUnpinned() # If known-good hashes are missing for this requirement, # shim it with a facade object that will provoke hash # computation and then raise a HashMissing exception # showing the user what the hash should be. return req.hashes(trust_internet=False) or MissingHashes() def _fetch_metadata_using_lazy_wheel( self, link: Link, ) -> Optional[BaseDistribution]: """Fetch metadata using lazy wheel, if possible.""" if not self.use_lazy_wheel: return None if self.require_hashes: logger.debug("Lazy wheel is not used as hash checking is required") return None if link.is_file or not link.is_wheel: logger.debug( "Lazy wheel is not used as %r does not points to a remote wheel", link, ) return None wheel = Wheel(link.filename) name = canonicalize_name(wheel.name) logger.info( "Obtaining dependency information from %s %s", name, wheel.version, ) url = link.url.split("#", 1)[0] try: return dist_from_wheel_url(name, url, self._session) except HTTPRangeRequestUnsupported: logger.debug("%s does not support range requests", url) return None def _complete_partial_requirements( self, partially_downloaded_reqs: Iterable[InstallRequirement], parallel_builds: bool = False, ) -> None: """Download any requirements which were only fetched by metadata.""" # Download to a temporary directory. These will be copied over as # needed for downstream 'download', 'wheel', and 'install' commands. temp_dir = TempDirectory(kind="unpack", globally_managed=True).path # Map each link to the requirement that owns it. This allows us to set # `req.local_file_path` on the appropriate requirement after passing # all the links at once into BatchDownloader. links_to_fully_download: Dict[Link, InstallRequirement] = {} for req in partially_downloaded_reqs: assert req.link links_to_fully_download[req.link] = req batch_download = self._batch_download( links_to_fully_download.keys(), temp_dir, ) for link, (filepath, _) in batch_download: logger.debug("Downloading link %s to %s", link, filepath) req = links_to_fully_download[link] req.local_file_path = filepath # This step is necessary to ensure all lazy wheels are processed # successfully by the 'download', 'wheel', and 'install' commands. for req in partially_downloaded_reqs: self._prepare_linked_requirement(req, parallel_builds) def prepare_linked_requirement( self, req: InstallRequirement, parallel_builds: bool = False ) -> BaseDistribution: """Prepare a requirement to be obtained from req.link.""" assert req.link link = req.link self._log_preparing_link(req) with indent_log(): # Check if the relevant file is already available # in the download directory file_path = None if self.download_dir is not None and link.is_wheel: hashes = self._get_linked_req_hashes(req) file_path = _check_download_dir(req.link, self.download_dir, hashes) if file_path is not None: # The file is already available, so mark it as downloaded self._downloaded[req.link.url] = file_path else: # The file is not available, attempt to fetch only metadata wheel_dist = self._fetch_metadata_using_lazy_wheel(link) if wheel_dist is not None: req.needs_more_preparation = True return wheel_dist # None of the optimizations worked, fully prepare the requirement return self._prepare_linked_requirement(req, parallel_builds) def prepare_linked_requirements_more( self, reqs: Iterable[InstallRequirement], parallel_builds: bool = False ) -> None: """Prepare linked requirements more, if needed.""" reqs = [req for req in reqs if req.needs_more_preparation] for req in reqs: # Determine if any of these requirements were already downloaded. if self.download_dir is not None and req.link.is_wheel: hashes = self._get_linked_req_hashes(req) file_path = _check_download_dir(req.link, self.download_dir, hashes) if file_path is not None: self._downloaded[req.link.url] = file_path req.needs_more_preparation = False # Prepare requirements we found were already downloaded for some # reason. The other downloads will be completed separately. partially_downloaded_reqs: List[InstallRequirement] = [] for req in reqs: if req.needs_more_preparation: partially_downloaded_reqs.append(req) else: self._prepare_linked_requirement(req, parallel_builds) # TODO: separate this part out from RequirementPreparer when the v1 # resolver can be removed! self._complete_partial_requirements( partially_downloaded_reqs, parallel_builds=parallel_builds, ) def _prepare_linked_requirement( self, req: InstallRequirement, parallel_builds: bool ) -> BaseDistribution: assert req.link link = req.link self._ensure_link_req_src_dir(req, parallel_builds) hashes = self._get_linked_req_hashes(req) if link.is_existing_dir() and self.in_tree_build: local_file = None elif link.url not in self._downloaded: try: local_file = unpack_url( link, req.source_dir, self._download, self.download_dir, hashes ) except NetworkConnectionError as exc: raise InstallationError( "Could not install requirement {} because of HTTP " "error {} for URL {}".format(req, exc, link) ) else: file_path = self._downloaded[link.url] if hashes: hashes.check_against_path(file_path) local_file = File(file_path, content_type=None) # For use in later processing, # preserve the file path on the requirement. if local_file: req.local_file_path = local_file.path dist = _get_prepared_distribution( req, self.req_tracker, self.finder, self.build_isolation, ) return dist def save_linked_requirement(self, req: InstallRequirement) -> None: assert self.download_dir is not None assert req.link is not None link = req.link if link.is_vcs or (link.is_existing_dir() and req.editable): # Make a .zip of the source_dir we already created. req.archive(self.download_dir) return if link.is_existing_dir(): logger.debug( "Not copying link to destination directory " "since it is a directory: %s", link, ) return if req.local_file_path is None: # No distribution was downloaded for this requirement. return download_location = os.path.join(self.download_dir, link.filename) if not os.path.exists(download_location): shutil.copy(req.local_file_path, download_location) download_path = display_path(download_location) logger.info("Saved %s", download_path) def prepare_editable_requirement( self, req: InstallRequirement, ) -> BaseDistribution: """Prepare an editable requirement.""" assert req.editable, "cannot prepare a non-editable req as editable" logger.info("Obtaining %s", req) with indent_log(): if self.require_hashes: raise InstallationError( "The editable requirement {} cannot be installed when " "requiring hashes, because there is no single file to " "hash.".format(req) ) req.ensure_has_source_dir(self.src_dir) req.update_editable() dist = _get_prepared_distribution( req, self.req_tracker, self.finder, self.build_isolation, ) req.check_if_exists(self.use_user_site) return dist def prepare_installed_requirement( self, req: InstallRequirement, skip_reason: str, ) -> BaseDistribution: """Prepare an already-installed requirement.""" assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason is not None, ( "did not get skip reason skipped but req.satisfied_by " "is set to {}".format(req.satisfied_by) ) logger.info( "Requirement %s: %s (%s)", skip_reason, req, req.satisfied_by.version ) with indent_log(): if self.require_hashes: logger.debug( "Since it is already installed, we are trusting this " "package without checking its hash. To ensure a " "completely repeatable environment, install into an " "empty virtualenv." ) return InstalledDistribution(req).get_metadata_distribution() PK]ͯoperations/check.pynu["""Validation of dependencies of packages """ import logging from typing import Callable, Dict, List, NamedTuple, Optional, Set, Tuple from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.distributions import make_distribution_for_install_requirement from pip._internal.metadata import get_default_environment from pip._internal.metadata.base import DistributionVersion from pip._internal.req.req_install import InstallRequirement logger = logging.getLogger(__name__) class PackageDetails(NamedTuple): version: DistributionVersion dependencies: List[Requirement] # Shorthands PackageSet = Dict[NormalizedName, PackageDetails] Missing = Tuple[NormalizedName, Requirement] Conflicting = Tuple[NormalizedName, DistributionVersion, Requirement] MissingDict = Dict[NormalizedName, List[Missing]] ConflictingDict = Dict[NormalizedName, List[Conflicting]] CheckResult = Tuple[MissingDict, ConflictingDict] ConflictDetails = Tuple[PackageSet, CheckResult] def create_package_set_from_installed() -> Tuple[PackageSet, bool]: """Converts a list of distributions into a PackageSet.""" package_set = {} problems = False env = get_default_environment() for dist in env.iter_installed_distributions(local_only=False, skip=()): name = dist.canonical_name try: dependencies = list(dist.iter_dependencies()) package_set[name] = PackageDetails(dist.version, dependencies) except (OSError, ValueError) as e: # Don't crash on unreadable or broken metadata. logger.warning("Error parsing requirements for %s: %s", name, e) problems = True return package_set, problems def check_package_set( package_set: PackageSet, should_ignore: Optional[Callable[[str], bool]] = None ) -> CheckResult: """Check if a package set is consistent If should_ignore is passed, it should be a callable that takes a package name and returns a boolean. """ missing = {} conflicting = {} for package_name, package_detail in package_set.items(): # Info about dependencies of package_name missing_deps: Set[Missing] = set() conflicting_deps: Set[Conflicting] = set() if should_ignore and should_ignore(package_name): continue for req in package_detail.dependencies: name = canonicalize_name(req.name) # Check if it's missing if name not in package_set: missed = True if req.marker is not None: missed = req.marker.evaluate() if missed: missing_deps.add((name, req)) continue # Check if there's a conflict version = package_set[name].version if not req.specifier.contains(version, prereleases=True): conflicting_deps.add((name, version, req)) if missing_deps: missing[package_name] = sorted(missing_deps, key=str) if conflicting_deps: conflicting[package_name] = sorted(conflicting_deps, key=str) return missing, conflicting def check_install_conflicts(to_install: List[InstallRequirement]) -> ConflictDetails: """For checking if the dependency graph would be consistent after \ installing given requirements """ # Start from the current state package_set, _ = create_package_set_from_installed() # Install packages would_be_installed = _simulate_installation_of(to_install, package_set) # Only warn about directly-dependent packages; create a whitelist of them whitelist = _create_whitelist(would_be_installed, package_set) return ( package_set, check_package_set( package_set, should_ignore=lambda name: name not in whitelist ), ) def _simulate_installation_of( to_install: List[InstallRequirement], package_set: PackageSet ) -> Set[NormalizedName]: """Computes the version of packages after installing to_install.""" # Keep track of packages that were installed installed = set() # Modify it as installing requirement_set would (assuming no errors) for inst_req in to_install: abstract_dist = make_distribution_for_install_requirement(inst_req) dist = abstract_dist.get_metadata_distribution() name = dist.canonical_name package_set[name] = PackageDetails(dist.version, list(dist.iter_dependencies())) installed.add(name) return installed def _create_whitelist( would_be_installed: Set[NormalizedName], package_set: PackageSet ) -> Set[NormalizedName]: packages_affected = set(would_be_installed) for package_name in package_set: if package_name in packages_affected: continue for req in package_set[package_name].dependencies: if canonicalize_name(req.name) in packages_affected: packages_affected.add(package_name) break return packages_affected PK]ľ *&*&operations/freeze.pynu[import collections import logging import os from typing import Container, Dict, Iterable, Iterator, List, NamedTuple, Optional, Set from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import Version from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.metadata import BaseDistribution, get_environment from pip._internal.req.constructors import ( install_req_from_editable, install_req_from_line, ) from pip._internal.req.req_file import COMMENT_RE from pip._internal.utils.direct_url_helpers import direct_url_as_pep440_direct_reference logger = logging.getLogger(__name__) class _EditableInfo(NamedTuple): requirement: str comments: List[str] def freeze( requirement: Optional[List[str]] = None, local_only: bool = False, user_only: bool = False, paths: Optional[List[str]] = None, isolated: bool = False, exclude_editable: bool = False, skip: Container[str] = (), ) -> Iterator[str]: installations: Dict[str, FrozenRequirement] = {} dists = get_environment(paths).iter_installed_distributions( local_only=local_only, skip=(), user_only=user_only, ) for dist in dists: req = FrozenRequirement.from_dist(dist) if exclude_editable and req.editable: continue installations[req.canonical_name] = req if requirement: # the options that don't get turned into an InstallRequirement # should only be emitted once, even if the same option is in multiple # requirements files, so we need to keep track of what has been emitted # so that we don't emit it again if it's seen again emitted_options: Set[str] = set() # keep track of which files a requirement is in so that we can # give an accurate warning if a requirement appears multiple times. req_files: Dict[str, List[str]] = collections.defaultdict(list) for req_file_path in requirement: with open(req_file_path) as req_file: for line in req_file: if ( not line.strip() or line.strip().startswith("#") or line.startswith( ( "-r", "--requirement", "-f", "--find-links", "-i", "--index-url", "--pre", "--trusted-host", "--process-dependency-links", "--extra-index-url", "--use-feature", ) ) ): line = line.rstrip() if line not in emitted_options: emitted_options.add(line) yield line continue if line.startswith("-e") or line.startswith("--editable"): if line.startswith("-e"): line = line[2:].strip() else: line = line[len("--editable") :].strip().lstrip("=") line_req = install_req_from_editable( line, isolated=isolated, ) else: line_req = install_req_from_line( COMMENT_RE.sub("", line).strip(), isolated=isolated, ) if not line_req.name: logger.info( "Skipping line in requirement file [%s] because " "it's not clear what it would install: %s", req_file_path, line.strip(), ) logger.info( " (add #egg=PackageName to the URL to avoid" " this warning)" ) else: line_req_canonical_name = canonicalize_name(line_req.name) if line_req_canonical_name not in installations: # either it's not installed, or it is installed # but has been processed already if not req_files[line_req.name]: logger.warning( "Requirement file [%s] contains %s, but " "package %r is not installed", req_file_path, COMMENT_RE.sub("", line).strip(), line_req.name, ) else: req_files[line_req.name].append(req_file_path) else: yield str(installations[line_req_canonical_name]).rstrip() del installations[line_req_canonical_name] req_files[line_req.name].append(req_file_path) # Warn about requirements that were included multiple times (in a # single requirements file or in different requirements files). for name, files in req_files.items(): if len(files) > 1: logger.warning( "Requirement %s included multiple times [%s]", name, ", ".join(sorted(set(files))), ) yield ("## The following requirements were added by pip freeze:") for installation in sorted(installations.values(), key=lambda x: x.name.lower()): if installation.canonical_name not in skip: yield str(installation).rstrip() def _format_as_name_version(dist: BaseDistribution) -> str: if isinstance(dist.version, Version): return f"{dist.raw_name}=={dist.version}" return f"{dist.raw_name}==={dist.version}" def _get_editable_info(dist: BaseDistribution) -> _EditableInfo: """ Compute and return values (req, comments) for use in FrozenRequirement.from_dist(). """ editable_project_location = dist.editable_project_location assert editable_project_location location = os.path.normcase(os.path.abspath(editable_project_location)) from pip._internal.vcs import RemoteNotFoundError, RemoteNotValidError, vcs vcs_backend = vcs.get_backend_for_dir(location) if vcs_backend is None: display = _format_as_name_version(dist) logger.debug( 'No VCS found for editable requirement "%s" in: %r', display, location, ) return _EditableInfo( requirement=location, comments=[f"# Editable install with no version control ({display})"], ) vcs_name = type(vcs_backend).__name__ try: req = vcs_backend.get_src_requirement(location, dist.raw_name) except RemoteNotFoundError: display = _format_as_name_version(dist) return _EditableInfo( requirement=location, comments=[f"# Editable {vcs_name} install with no remote ({display})"], ) except RemoteNotValidError as ex: display = _format_as_name_version(dist) return _EditableInfo( requirement=location, comments=[ f"# Editable {vcs_name} install ({display}) with either a deleted " f"local remote or invalid URI:", f"# '{ex.url}'", ], ) except BadCommand: logger.warning( "cannot determine version of editable source in %s " "(%s command not found in path)", location, vcs_backend.name, ) return _EditableInfo(requirement=location, comments=[]) except InstallationError as exc: logger.warning("Error when trying to get requirement for VCS system %s", exc) else: return _EditableInfo(requirement=req, comments=[]) logger.warning("Could not determine repository location of %s", location) return _EditableInfo( requirement=location, comments=["## !! Could not determine repository location"], ) class FrozenRequirement: def __init__( self, name: str, req: str, editable: bool, comments: Iterable[str] = (), ) -> None: self.name = name self.canonical_name = canonicalize_name(name) self.req = req self.editable = editable self.comments = comments @classmethod def from_dist(cls, dist: BaseDistribution) -> "FrozenRequirement": editable = dist.editable if editable: req, comments = _get_editable_info(dist) else: comments = [] direct_url = dist.direct_url if direct_url: # if PEP 610 metadata is present, use it req = direct_url_as_pep440_direct_reference(direct_url, dist.raw_name) else: # name==version requirement req = _format_as_name_version(dist) return cls(dist.raw_name, req, editable, comments=comments) def __str__(self) -> str: req = self.req if self.editable: req = f"-e {req}" return "\n".join(list(self.comments) + [str(req)]) + "\n" PK]operations/__init__.pynu[PK]j׿[[operations/generate_metadata.pynu["""Metadata generation logic for source distributions. """ import logging import os from pip._internal.exceptions import InstallationError from pip._internal.utils.misc import ensure_dir from pip._internal.utils.setuptools_build import make_setuptools_shim_args from pip._internal.utils.subprocess import call_subprocess from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.vcs import vcs if MYPY_CHECK_RUNNING: from typing import Callable, List from pip._internal.req.req_install import InstallRequirement logger = logging.getLogger(__name__) def get_metadata_generator(install_req): # type: (InstallRequirement) -> Callable[[InstallRequirement], str] """Return a callable metadata generator for this InstallRequirement. A metadata generator takes an InstallRequirement (install_req) as an input, generates metadata via the appropriate process for that install_req and returns the generated metadata directory. """ if not install_req.use_pep517: return _generate_metadata_legacy return _generate_metadata def _find_egg_info(source_directory, is_editable): # type: (str, bool) -> str """Find an .egg-info in `source_directory`, based on `is_editable`. """ def looks_like_virtual_env(path): # type: (str) -> bool return ( os.path.lexists(os.path.join(path, 'bin', 'python')) or os.path.exists(os.path.join(path, 'Scripts', 'Python.exe')) ) def locate_editable_egg_info(base): # type: (str) -> List[str] candidates = [] # type: List[str] for root, dirs, files in os.walk(base): for dir_ in vcs.dirnames: if dir_ in dirs: dirs.remove(dir_) # Iterate over a copy of ``dirs``, since mutating # a list while iterating over it can cause trouble. # (See https://github.com/pypa/pip/pull/462.) for dir_ in list(dirs): if looks_like_virtual_env(os.path.join(root, dir_)): dirs.remove(dir_) # Also don't search through tests elif dir_ == 'test' or dir_ == 'tests': dirs.remove(dir_) candidates.extend(os.path.join(root, dir_) for dir_ in dirs) return [f for f in candidates if f.endswith('.egg-info')] def depth_of_directory(dir_): # type: (str) -> int return ( dir_.count(os.path.sep) + (os.path.altsep and dir_.count(os.path.altsep) or 0) ) base = source_directory if is_editable: filenames = locate_editable_egg_info(base) else: base = os.path.join(base, 'pip-egg-info') filenames = os.listdir(base) if not filenames: raise InstallationError( "Files/directories not found in %s" % base ) # If we have more than one match, we pick the toplevel one. This # can easily be the case if there is a dist folder which contains # an extracted tarball for testing purposes. if len(filenames) > 1: filenames.sort(key=depth_of_directory) return os.path.join(base, filenames[0]) def _generate_metadata_legacy(install_req): # type: (InstallRequirement) -> str req_details_str = install_req.name or "from {}".format(install_req.link) logger.debug( 'Running setup.py (path:%s) egg_info for package %s', install_req.setup_py_path, req_details_str, ) # Compose arguments for subprocess call base_cmd = make_setuptools_shim_args(install_req.setup_py_path) if install_req.isolated: base_cmd += ["--no-user-cfg"] # For non-editable installs, don't put the .egg-info files at the root, # to avoid confusion due to the source code being considered an installed # egg. egg_base_option = [] # type: List[str] if not install_req.editable: egg_info_dir = os.path.join( install_req.unpacked_source_directory, 'pip-egg-info', ) egg_base_option = ['--egg-base', egg_info_dir] # setuptools complains if the target directory does not exist. ensure_dir(egg_info_dir) with install_req.build_env: call_subprocess( base_cmd + ["egg_info"] + egg_base_option, cwd=install_req.unpacked_source_directory, command_desc='python setup.py egg_info', ) # Return the .egg-info directory. return _find_egg_info( install_req.unpacked_source_directory, install_req.editable, ) def _generate_metadata(install_req): # type: (InstallRequirement) -> str return install_req.prepare_pep517_metadata() PK]r00*network/__pycache__/session.cpython-38.pycnu[U ʗRe H@s~UdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlmZmZmZmZmZmZmZmZmZmZddlmZmZddlmZ ddl!m"Z"m#Z#ddl!m$Z%ddl&m'Z'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0dd l1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>m?Z?ddl@mAZAerddlBmCZCddlDmEZEeFeGZHeeIeIeeeJeIffZKejLde.dddddddgZMeeKeNd<d ZOePd!d"d#ZQeId!d$d%ZRGd&d'd'e#ZSGd(d)d)ZTGd*d+d+eTe%Z$Gd,d-d-eTe ZGd.d/d/e$ZUGd0d1d1eZVGd2d3d3ejWZXdS)4zhPipSession and supporting code, containing all pip-specific network request configuration and behavior. N) TYPE_CHECKINGAnyDict GeneratorListMappingOptionalSequenceTupleUnion)requestsurllib3)CacheControlAdapter)DEFAULT_POOLBLOCK BaseAdapter) HTTPAdapter)PreparedRequestResponse)CaseInsensitiveDict)ConnectionPool)InsecureRequestWarning) __version__)get_default_environment)Link)MultiDomainBasicAuth) SafeFileCache)has_tls)libc_ver)build_url_from_netloc parse_netloc) url_to_path) SSLContext) PoolManagerignore)category)https*r&)r& localhostr&)r&z 127.0.0.0/8r&)r&z::1/128r&)filer&N)sshr&r&SECURE_ORIGINS) BUILD_BUILDIDBUILD_IDCI PIP_IS_CIreturncCstddtDS)z? Return whether it looks like pip is running under CI. css|]}|tjkVqdSN)osenviron).0namer6/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/session.py jsz looks_like_ci..)anyCI_ENVIRONMENT_VARIABLESr6r6r6r7 looks_like_cicsr;c Csdtdtdtid}|dddkr@t|dd<n|dddkrtj}|jd krl|d d }d d d|D|dd<nB|dddkrt|dd<n |dddkrt|dd<tjdrTddl m }| | | f}ttddtdddg|}ttddtddgt}|rF||d<|rT||d<tjdrtdrdtdd|d<trt|did<trt|did<trt|d<trdd l}|j|d <td!}|d k rt|j |d"<td#d k rzztj d#d$gtj!d%d&}Wnt"k rVYn$X|d'rz|#d(d)$|d*<t%rd+nd |d,<t&j'(d-} | d k r| |d.<d/j)|t*j+|d0d+d1d2S)3z6 Return a string representing the user agent. pip)r5versionr5) installerpythonimplementationr@CPythonr=PyPyfinalN.cSsg|] }t|qSr6)str)r4xr6r6r7 szuser_agent..Jython IronPythonlinuxr)distrocSs|dSNr6rGr6r6r7zuser_agent..idcSs|dSrMr6rOr6r6r7rPrQliblibcrLdarwinmacOSsystemreleasecpuopenssl_version setuptoolssetuptools_versionrustcz --versiong?)stderrtimeoutsrustc  rN rustc_versionTciPIP_USER_AGENT_USER_DATA user_dataz9{data[installer][name]}/{data[installer][version]} {json}),:) separators sort_keys)datajson),rplatformpython_versionpython_implementationsyspypy_version_info releaseleveljoin startswith pip._vendorrLr5r=codenamedictfilterziprmac_verrW setdefaultrXmachiner_sslOPENSSL_VERSIONrget_distributionrFshutilwhich subprocess check_outputSTDOUT Exceptionsplitdecoder;r2r3getformatrjdumps) rirorLlinux_distribution distro_infosrTsslsetuptools_dist rustc_outputrdr6r6r7 user_agentms               rc @sreZdZd eeeeeeeeffeee feee ee e ffee e e fe dddZ dddd Z dS) LocalFSAdapterFNT)requeststreamr_verifycertproxiesr0c Cst|j}t}d|_|j|_zt|} WnRtk r~} z4d|_t| j|_ t |j d|  d|_ W5d} ~ XYnPXtjj| jdd} t|dpd} t| | j| d |_t|d |_ |j j|_|S) Niz: utf8T)usegmtrz text/plain)z Content-TypezContent-Lengthz Last-Modifiedrb)r urlr status_coder2statOSErrortype__name__reasonioBytesIOencoderawemailutils formatdatest_mtime mimetypes guess_typerst_sizeheadersopenclose) selfrrr_rrrpathnamerespstatsexcmodified content_typer6r6r7sends*  0  zLocalFSAdapter.sendr/cCsdSr1r6)rr6r6r7rszLocalFSAdapter.close)FNTNN)r __module__ __qualname__rboolrr floatr rFrrrrr6r6r6r7rs  'rcsReZdZdZddededdfddZefeee edd fd d Z Z S) _SSLContextAdapterMixina#Mixin to add the ``ssl_context`` constructor argument to HTTP adapters. The additional argument is forwarded directly to the pool manager. This allows us to dynamically decide what SSL store to use at runtime, which is used to implement the optional ``truststore`` backend. N) ssl_contextr!)rkwargsr0c s||_tjf|dSr1) _ssl_contextsuper__init__)rrr __class__r6r7rsz _SSLContextAdapterMixin.__init__r") connectionsmaxsizeblock pool_kwargsr0c s2|jdk r|d|jtjf|||d|S)Nr)rrr)rryrinit_poolmanager)rrrrrrr6r7rs z(_SSLContextAdapterMixin.init_poolmanager) rrr__doc__rrrrintrr __classcell__r6r6rr7rs  rc@s eZdZdS)rNrrrr6r6r6r7r src@s eZdZdS)rNrr6r6r6r7r$src sFeZdZeeeeefeeeeeeffddfdd Z Z S)InsecureHTTPAdapterNconnrrrr0cstj||d|ddSNF)rrrrr cert_verifyrrrrrrr6r7r)szInsecureHTTPAdapter.cert_verify rrrrrFr rrr rrr6r6rr7r(s  rc sFeZdZeeeeefeeeeeeffddfdd Z Z S)InsecureCacheControlAdapterNrcstj||d|ddSrrrrr6r7r4sz'InsecureCacheControlAdapter.cert_verifyrr6r6rr7r3s  rc seZdZUdZeeed<ddddddeeeee eee eededdfdd Z e edd d d Z deeee ddddZeeddfdddZee dddZeeeeedfdd ZZS) PipSessionNr_rr6)retriescache trusted_hosts index_urlsrr!)argsrrrrrrr0c stj||g|_t|jd<t|d|_tj|ddddgdd}t |d }|rxt t |||d } t t ||d |_ nt||d } ||_ |d | |d||dt|D]} |j| ddqdS)zj :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. z User-Agent)riiiig?)totalstatus_forcelistbackoff_factor) max_retries)rrr)rr)rrzhttps://zhttp://zfile://T)suppress_loggingN)rrpip_trusted_originsrrrauthr Retryrrrr_trusted_host_adapterrmountradd_trusted_host) rrrrrrrrinsecure_adaptersecure_adapterhostrr6r7rBs6        zPipSession.__init__)new_index_urlsr0cCs ||j_dS)zn :param new_index_urls: New index urls to update the authentication handler with. N)rr)rrr6r6r7update_index_urlsszPipSession.update_index_urlsF)rsourcerr0cCs|s0d|}|dk r&|d|d7}t|t|}||jkrN|j||t|ddd|j|t|d|j|ds|t|ddd |j|t|d |jdS) z :param host: It is okay to provide a host that has previously been added. :param source: An optional source string, for logging where the host string came from. zadding trusted host: Nz (from )http)scheme/rNrf)loggerinforrappendrrr)rrrrmsg host_portr6r6r7rs&     zPipSession.add_trusted_hostr/ccs6tEdH|jD] \}}d||dkr(dn|fVqdS)Nr&)r*r)rrportr6r6r7iter_secure_originss zPipSession.iter_secure_origins)locationr0c Cstjt|}|j|j|j}}}|ddd}|D]}|\}}} ||kr^|dkr^q>zt |pjd} t |} Wn4t k r|r| | kr|dkrYq>Yn X| | krq>|| kr| dkr| dk rq>dStd||dS) N+rNr&TzThe repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host %s'.F)urllibparseurlparserFrhostnamerrsplitr ipaddress ip_address ip_network ValueErrorlowerrwarning) rrparsedorigin_protocol origin_host origin_port secure_originsecure_protocol secure_host secure_portaddrnetworkr6r6r7is_secure_originsJ     zPipSession.is_secure_origin)methodrrrr0cs2|d|j|d|jtj||f||S)Nr_r)ryr_rrr)rrrrrrr6r7rszPipSession.request)NF)rrrr_rr__annotations__rrFr rrrrrr SecureOriginrrrrrrr6r6rr7r>s8  O Cr)Yr email.utilsrrrrjloggingrr2rkr~rrn urllib.parserwarningstypingrrrrrrrr r r rsr r pip._vendor.cachecontrolr_BaseCacheControlAdapterZpip._vendor.requests.adaptersrrr_BaseHTTPAdapterZpip._vendor.requests.modelsrrZpip._vendor.requests.structuresrZ"pip._vendor.urllib3.connectionpoolrZpip._vendor.urllib3.exceptionsrr<rpip._internal.metadatarpip._internal.models.linkrpip._internal.network.authrpip._internal.network.cacherpip._internal.utils.compatrpip._internal.utils.glibcrpip._internal.utils.miscrrpip._internal.utils.urlsr rr!Zpip._vendor.urllib3.poolmanagerr" getLoggerrrrFrrfilterwarningsr*rr:rr;rrrrrSessionrr6r6r6r7sl0                   e,"  PK]yvG G (network/__pycache__/cache.cpython-38.pycnu[U ʗRea@sdZddlZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZmZdd lmZe ed d d Zeed dddZGdddeZdS)zHTTP cache implementation. N)contextmanager) GeneratorOptional) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dir)responsereturncCs t|ddS)N from_cacheF)getattr)r r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/cache.py is_from_cachesr)NNN)r ccs$z dVWntk rYnXdS)zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorrrrrsuppressed_cache_errorss rcsveZdZdZeddfdd ZeedddZeeed d d Z deeee dd d dZ edd ddZ Z S) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. N) directoryr cs$|dk stdt||_dS)Nz!Cache directory must not be None.)AssertionErrorsuper__init__r)selfr __class__rrr%s zSafeFileCache.__init__)namer cCs4t|}t|dd|g}tjj|jf|S)N)rencodelistospathjoinr)rrhashedpartsrrr_get_cache_path*s zSafeFileCache._get_cache_path)keyr c CsR||}t8t|d"}|W5QRW5QRSQRXW5QRXdS)Nrb)r%ropenread)rr&r!frrrget2s  zSafeFileCache.get)r&valueexpiresr c CsZ||}t@ttj|t|}||W5QRXt|j |W5QRXdSN) r%rr r r!dirnamerwriter r)rr&r,r-r!r*rrrset8s   zSafeFileCache.setc Cs*||}tt|W5QRXdSr.)r%rr remove)rr&r!rrrdeleteBs zSafeFileCache.delete)N)__name__ __module__ __qualname____doc__strrr%rbytesr+intr1r3 __classcell__rrrrrs  r)r7r contextlibrtypingrrZpip._vendor.cachecontrol.cacherpip._vendor.cachecontrol.cachesrZpip._vendor.requests.modelsrpip._internal.utils.filesystemrr pip._internal.utils.miscr boolrrrrrrrs      PK]}v v .network/__pycache__/cache.cpython-38.opt-1.pycnu[U .e@sdZddlZddlmZddlmZddlmZddlm Z m Z ddl m Z ddl mZerhdd lmZed d ZGd d d eZdS)zHTTP cache implementation. N)contextmanager) BaseCache) FileCache)adjacent_tmp_filereplace) ensure_dir)MYPY_CHECK_RUNNING)Optionalc cs(z dVWnttfk r"YnXdS)zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorIOErrorr r ?/usr/lib/python3.8/site-packages/pip/_internal/network/cache.pysuppressed_cache_errorss rcs@eZdZdZfddZddZddZdd Zd d ZZ S) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. cstt|||_dSN)superr__init__ directory)selfr __class__r r r&szSafeFileCache.__init__cCs4t|}t|dd|g}tjj|jf|S)N)rencodelistospathjoinr)rnameZhashedpartsr r r _get_cache_path,s zSafeFileCache._get_cache_pathc CsR||}t8t|d"}|W5QRW5QRSQRXW5QRXdS)Nrb)rropenread)rkeyrfr r r get5s  zSafeFileCache.getc CsZ||}t@ttj|t|}||W5QRXt|j |W5QRXdSr) rrrrrdirnamerwriterr)rr#valuerr$r r r set<s   zSafeFileCache.setc Cs*||}tt|W5QRXdSr)rrrremove)rr#rr r r deleteGs zSafeFileCache.delete) __name__ __module__ __qualname____doc__rrr%r)r+ __classcell__r r rr r s    r)r/r contextlibrZpip._vendor.cachecontrol.cacherZpip._vendor.cachecontrol.cachesrZpip._internal.utils.filesystemrrZpip._internal.utils.miscrZpip._internal.utils.typingrtypingr rrr r r r s       PK]bM2+network/__pycache__/__init__.cpython-38.pycnu[U ʗRe2@sdZdS)z+Contains purely network-related utilities. N)__doc__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/__init__.pyPK]2W88)network/__pycache__/xmlrpc.cpython-38.pycnu[U ʗRe@sdZddlZddlZddlZddlmZmZddl m Z ddl m Z ddl mZerdddlmZmZeeZGdd d ejjZdS) z#xmlrpclib.Transport implementation N) TYPE_CHECKINGTuple)NetworkConnectionError) PipSession)raise_for_status) _HostType _MarshallablecsJeZdZdZd eeeddfdd Zd deeee dd d d Z Z S)PipXmlrpcTransportzRProvide a `xmlrpclib.Transport` implementation via a `PipSession` object. FN) index_urlsession use_datetimereturncs*t|tj|}|j|_||_dS)N)super__init__urllibparseurlparsescheme_scheme_session)selfr r r Z index_parts __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/xmlrpc.pyrs  zPipXmlrpcTransport.__init__r)r.)hosthandler request_bodyverboser c Cst|tst|j||dddf}tj|}z8ddi}|jj|||dd}t |||_ | |j WSt k r} z"| jsttd| jj|W5d} ~ XYnXdS)Nz Content-Typeztext/xmlT)dataheadersstreamzHTTP error %s while getting %s) isinstancestrAssertionErrorrrr urlunparserpostrrparse_responserawrresponseloggercritical status_code) rrrrrpartsurlr r)excrrrrequest s,  zPipXmlrpcTransport.request)F)F) __name__ __module__ __qualname____doc__r#rboolrbytesrr0 __classcell__rrrrr s  r )r4logging urllib.parser xmlrpc.clientZxmlrpctypingrrpip._internal.exceptionsrpip._internal.network.sessionrpip._internal.network.utilsrrr getLoggerr1r*client Transportr rrrrs    PK]w vv'network/__pycache__/auth.cpython-38.pycnu[U ʗRe/ @s*dZddlZddlmZmZmZmZmZddl m Z m Z ddl m Z mZddlmZddlmZddlmZmZmZmZmZdd lmZeeZeeeefZz ddlaWnLe k rdaYn6e!k rZ"ze#d ee"daW5dZ"["XYnXeeeeeed d d Z$Gddde Z%dS)zNetwork Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. N)AnyDictListOptionalTuple)AuthBase HTTPBasicAuth)RequestResponse)get_netrc_auth) getLogger)ask ask_input ask_passwordremove_auth_from_urlsplit_auth_netloc_from_url)AuthInfo*Keyring is skipped due to an exception: %s)urlusernamereturnc Cs|rts dSzz tj}Wntk r,Yn4Xtd||||}|dk rZ|j|jfWSWdS|rtd|t||}|r||fWSWn6tk r}zt dt |daW5d}~XYnXdS)z3Return the tuple auth for a given url from keyring.Nz'Getting credentials from keyring for %sz$Getting password from keyring for %sr) keyringget_credentialAttributeErrorloggerdebugrpassword get_password Exceptionwarningstr)rrrcredrexcr#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/auth.pyget_keyring_auth(s0     r%c@seZdZd eeeeddddZeeedddZd!eeee d d d Z ee eeeeefd ddZ e e dddZee eeeeefdddZedddZeeedddZeeddddZeeddddZdS)"MultiDomainBasicAuthTN) prompting index_urlsrcCs||_||_i|_d|_dS)N)r'r( passwords_credentials_to_save)selfr'r(r#r#r$__init__JszMultiDomainBasicAuth.__init__)rrcCsB|r |jsdS|jD](}t|dd}||r|SqdS)aReturn the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. N/)r(rrstrip startswith)r+ruprefixr#r#r$_get_index_urlWs    z#MultiDomainBasicAuth._get_index_urlF) original_url allow_netrc allow_keyringrcCst|\}}}|\}}|dk r6|dk r6td||S||} | rft| } | rf| \} } } td| | r| ddk r| \}}|dk r|dk rtd|| S|rt|} | rtd|| S|rt| |pt||}|rtd||S||fS)z2Find and return credentials for the specified URL.NzFound credentials in url for %szFound index url %srz%Found credentials in index url for %sz!Found credentials in netrc for %sz#Found credentials in keyring for %s)rrrr2r r%)r+r3r4r5rnetlocurl_user_passwordrr index_url index_info_index_url_user_password netrc_authkr_authr#r#r$_get_new_credentialsms>         z)MultiDomainBasicAuth._get_new_credentials)r3rc Cst|\}}}||\}}|dks,|dkr^||jkr^|j|\}}|dksT||kr^||}}|dk sn|dk r|ptd}|p|d}||f|j|<|dk r|dk s|dkr|dkstd||||fS)a_Return the credentials to use for the provided URL. If allowed, netrc and keyring may be used to obtain the correct credentials. Returns (url_without_credentials, username, password). Note that even if the original URL contains credentials, this function may return a different username and password. Nz%Could not load credentials from url: )rr>r)AssertionError) r+r3rr6r:rrunpwr#r#r$_get_url_and_credentialss*  z-MultiDomainBasicAuth._get_url_and_credentials)reqrcCsH||j\}}}||_|dk r6|dk r6t|||}|d|j|S)Nresponse)rCrr register_hook handle_401)r+rDrrrr#r#r$__call__s zMultiDomainBasicAuth.__call__)r6rcCsbtd|d}|sdSt||}|rP|ddk rP|ddk rP|d|ddfStd}||dfS) Nz User for z: )NNFrFz Password: T)rr%r)r+r6rauthrr#r#r$_prompt_for_passwords z)MultiDomainBasicAuth._prompt_for_password)rcCstsdStdddgdkS)NFz#Save credentials to keyring [y/N]: yn)rr )r+r#r#r$ _should_save_password_to_keyringsz5MultiDomainBasicAuth._should_save_password_to_keyring)respkwargsrc Ks|jdkr|S|js|Stj|j}|j|jddd\}}d}|sZ|sZ||j\}}}d|_ |dk r|dk r||f|j |j<|r| r|j||f|_ |j |j t|pd|pd|j}|d|j|j r|d|j|jj|f|}|j||S)NFT)r4r5r?rE) status_coder'urllibparseurlparserr>rKr6r*r)rNcontentraw release_connrrequestrF warn_on_401save_credentials connectionsendhistoryappend) r+rOrPparsedrrsaverDnew_respr#r#r$rGs6     zMultiDomainBasicAuth.handle_401cKs|jdkrtd|jjdS)z6Response callback to warn about incorrect credentials.rQz)401 Error, Credentials not correct for %sN)rRrrrYr)r+rOrPr#r#r$rZ.s  z MultiDomainBasicAuth.warn_on_401cKsntdk stdtsdS|j}d|_|rj|jdkrjztdtj|Wntk rhtdYnXdS)z1Response callback to save credentials on success.Nz'should never reach here without keyringizSaving credentials to keyringzFailed to save credentials) rr@r*rRrinfo set_passwordr exception)r+rOrPcredsr#r#r$r[6s z%MultiDomainBasicAuth.save_credentials)TN)TF)__name__ __module__ __qualname__boolrrr r,r2rr>rrCr rHrKrNr rrGrZr[r#r#r#r$r&Is6   9 0 6r&)&__doc__ urllib.parserStypingrrrrrZpip._vendor.requests.authrrZpip._vendor.requests.modelsr r Zpip._vendor.requests.utilsr pip._internal.utils.loggingr pip._internal.utils.miscr rrrr pip._internal.vcs.versioncontrolrrgrr Credentialsr ImportErrorrr"rr%r&r#r#r#r$s,    !PK];&&/network/__pycache__/xmlrpc.cpython-38.opt-1.pycnu[U .e=@sPdZddlZddlmZddlmZddlmZe e Z Gdddej Z dS)z#xmlrpclib.Transport implementation N)requests) xmlrpc_client)parsec@s$eZdZdZdddZd ddZdS) PipXmlrpcTransportzRProvide a `xmlrpclib.Transport` implementation via a `PipSession` object. FcCs*tj||t|}|j|_||_dS)N)r Transport__init__ urllib_parseZurlparseZscheme_scheme_session)selfZ index_urlZsessionZ use_datetimeZ index_partsr @/usr/lib/python3.8/site-packages/pip/_internal/network/xmlrpc.pyrs zPipXmlrpcTransport.__init__c Cs|j||dddf}t|}z8ddi}|jj|||dd}|||_||jWSt j k r} zt d| j j|W5d} ~ XYnXdS)Nz Content-Typeztext/xmlT)dataheadersstreamzHTTP error %s while getting %s)r rZ urlunparser ZpostZraise_for_statusverboseZparse_responserawrZ HTTPErrorloggerZcriticalresponseZ status_code) r ZhostZhandlerZ request_bodyrpartsZurlrrexcr r r requests$  zPipXmlrpcTransport.requestN)F)F)__name__ __module__ __qualname____doc__rrr r r r rs r)rZloggingZ pip._vendorrZpip._vendor.six.movesrZpip._vendor.six.moves.urllibrrZ getLoggerrrrrr r r r s     PK]8Ml $ $0network/__pycache__/session.cpython-38.opt-1.pycnu[U .e=@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z m Z m Z ddlmZddlmZmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1e/rhddl2m3Z3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9e6e:e:e5e7e;e:ffZZ?e j@dedddddddgZAdZBddZCd d!ZDGd"d#d#eZEGd$d%d%eZFGd&d'd'e jGZHdS)(zhPipSession and supporting code, containing all pip-specific network request configuration and behavior. N)requestssixurllib3)CacheControlAdapter) BaseAdapter HTTPAdapter)Response)CaseInsensitiveDict)parse)InsecureRequestWarning) __version__)MultiDomainBasicAuth) SafeFileCache)HAS_TLS ipaddressssl)check_path_owner)libc_ver)build_url_from_netlocget_installed_version parse_netloc)MYPY_CHECK_RUNNING) url_to_path)IteratorListOptionalTupleUnion)Linkignore)category)Zhttps*r!)r!Z localhostr!)r!z 127.0.0.0/8r!)r!z::1/128r!)filer!N)Zsshr!r!)Z BUILD_BUILDIDZBUILD_IDZCIZ PIP_IS_CIcCstddtDS)z? Return whether it looks like pip is running under CI. css|]}|tjkVqdSN)osenviron).0namer(A/usr/lib/python3.8/site-packages/pip/_internal/network/session.py asz looks_like_ci..)anyCI_ENVIRONMENT_VARIABLESr(r(r(r) looks_like_ciYsr-cCsBdtdtdtid}|dddkr@t|dd<n|dddkrtjjd krltjd d }ntj}d d d|D|dd<nB|dddkrt|dd<n |dddkrt|dd<tjdrHddl m }t t ddt dddg|}t t ddt ddgt}|r:||d<|rH||d<tjdrztdrzdtdd|d<trt|did<trt|did<trt|d<trtj|d <td!}|d k r||d"<trd#nd |d$<tjd%}|d k r(||d&<d'j|tj|d(d#d)d*S)+z6 Return a string representing the user agent. pip)r'versionr')Z installerpythonimplementationr1ZCPythonr/ZPyPyfinalN.cSsg|] }t|qSr()str)r&xr(r(r) xszuser_agent..ZJythonZ IronPythonZlinuxr)distrocSs|dSNr(r6r(r(r)zuser_agent..idcSs|dSr9r(r;r(r(r)r<r=liblibcr8darwinZmacOSsystemreleaseZcpuZopenssl_versionZ setuptoolssetuptools_versionTZciZPIP_USER_AGENT_USER_DATA user_dataz9{data[installer][name]}/{data[installer][version]} {json}),:)Z separatorsZ sort_keys)datajson) r platformZpython_versionZpython_implementationsyspypy_version_info releaseleveljoin startswith pip._vendorr8dictfilterzipZlinux_distributionrZmac_verrB setdefaultrCmachinerrZOPENSSL_VERSIONrr-r$r%getformatrIdumps)rHrLr8Z distro_infosr@rDrEr(r(r) user_agentdsl           rYc@seZdZdddZddZdS)LocalFSAdapterNc Cst|j}t}d|_|j|_zt|} Wn.tk rZ} zd|_| |_W5d} ~ XYnPXtj j | j dd} t |dp~d} t| | j| d|_t|d|_|jj|_|S) NiT)Zusegmtrz text/plain)z Content-TypezContent-Lengthz Last-Modifiedrb)rurlrZ status_coder$statOSErrorrawemailZutilsZ formatdatest_mtime mimetypesZ guess_typer st_sizeheadersopenclose) selfrequeststreamtimeoutverifycertZproxiespathnameZrespZstatsexcZmodifiedZ content_typer(r(r)sends&    zLocalFSAdapter.sendcCsdSr#r()rhr(r(r)rgszLocalFSAdapter.close)NNNNN)__name__ __module__ __qualname__rprgr(r(r(r)rZs rZc@seZdZddZdS)InsecureHTTPAdaptercCsd|_d|_dS)NZ CERT_NONE)Z cert_reqsZca_certs)rhZconnr]rlrmr(r(r) cert_verifyszInsecureHTTPAdapter.cert_verifyN)rqrrrsrur(r(r(r)rtsrtcsFeZdZdZfddZd ddZddZd d Zfd d ZZ S) PipSessionNc s|dd}|dd}|dg}|dd}tt|j||g|_t|jd<t|d|_t j |d d d d gd d}|rt |st d|d}|rtt||d}n t|d}t|d}||_|d||d||dt|D]} |j| ddqdS)zj :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. retriesrcacheN trusted_hosts index_urlsz User-Agent)rziiiig?)ZtotalZstatus_forcelistZbackoff_factorzThe directory '%s' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.)rx max_retries)r{zhttps://zhttp://zfile://T)suppress_logging)popsuperrv__init__pip_trusted_originsrYrer ZauthrZRetryrloggerwarningrrrrt_insecure_adaptermountrZadd_trusted_host) rhargskwargsrwrxryrzZsecure_adapterZinsecure_adapterhost __class__r(r)rs@            zPipSession.__init__FcCs|s.d|}|dk r$|d|7}t|t|}||jkrL|j||t|d|j|ds|t|d|jdS)z :param host: It is okay to provide a host that has previously been added. :param source: An optional source string, for logging where the host string came from. zadding trusted host: {!r}Nz (from {})/r:rG) rWrinforrappendrrr)rhrsourcer|msgZ host_portr(r(r)r3s     zPipSession.add_trusted_hostccs<tD] }|Vq|jD] \}}d||dkr.dn|fVqdS)Nr!)SECURE_ORIGINSr)rh secure_originrportr(r(r)iter_secure_originsMszPipSession.iter_secure_originsc Cs tt|}|j|j|j}}}|ddd}|D]}|\}}} ||kr\|dkr\qsV                O!PK]7S-network/__pycache__/auth.cpython-38.opt-1.pycnu[U .eo+ @sdZddlZddlmZmZddlmZddlmZ ddl m Z m Z m Z mZmZddlmZerddlmZdd lmZmZmZdd lmZeeeefZeeZz ddlZWnLe k rdZYn6e!k rZ"ze#d ee"dZW5dZ"["XYnXd d Z$GdddeZ%dS)zNetwork Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. N)AuthBase HTTPBasicAuth)get_netrc_auth)parse)ask ask_input ask_passwordremove_auth_from_urlsplit_auth_netloc_from_url)MYPY_CHECK_RUNNING)Values)DictOptionalTuple)AuthInfo*Keyring is skipped due to an exception: %sc Cs|rts dSzz tj}Wntk r,Yn4Xtd||||}|dk rZ|j|jfWSWdS|rtd|t||}|r||fWSWn2tk r}zt dt |W5d}~XYnXdS)z3Return the tuple auth for a given url from keyring.Nz'Getting credentials from keyring for %sz$Getting password from keyring for %sr) keyringget_credentialAttributeErrorloggerdebugusernamepasswordZ get_password Exceptionwarningstr)urlrrZcredrexcr>/usr/lib/python3.8/site-packages/pip/_internal/network/auth.pyget_keyring_auth.s,     r c@s`eZdZdddZddZdddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS)MultiDomainBasicAuthTNcCs||_||_i|_d|_dS)N) prompting index_urls passwords_credentials_to_save)selfr"r#rrr__init__MszMultiDomainBasicAuth.__init__cCsB|r |jsdS|jD](}t|dd}||r|SqdS)aReturn the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. N/)r#r rstrip startswith)r&ruprefixrrr_get_index_urlYs   z#MultiDomainBasicAuth._get_index_urlcCst|\}}}|\}}|dk r6|dk r6td||S||} | rft| } | rf| \} } } td| | r| ddk r| \}}|dk r|dk rtd|| S|rt|} | rtd|| S|rt| |pt||}|rtd||S||fS)z2Find and return credentials for the specified URL.NzFound credentials in url for %szFound index url %srz%Found credentials in index url for %sz!Found credentials in netrc for %sz#Found credentials in keyring for %s)r rrr-rr )r& original_urlZ allow_netrcZ allow_keyringrnetlocZurl_user_passwordrrZ index_urlZ index_info_Zindex_url_user_passwordZ netrc_authZkr_authrrr_get_new_credentialsns>         z)MultiDomainBasicAuth._get_new_credentialscCsvt|\}}}|j|d\}}|dkr>|dkr>||\}}|dk sN|dk rl|pTd}|p\d}||f|j|<|||fS)a_Return the credentials to use for the provided URL. If allowed, netrc and keyring may be used to obtain the correct credentials. Returns (url_without_credentials, username, password). Note that even if the original URL contains credentials, this function may return a different username and password. NNN)r r$getr1)r&r.rr/r0rrrrr_get_url_and_credentialss  z-MultiDomainBasicAuth._get_url_and_credentialscCsH||j\}}}||_|dk r6|dk r6t|||}|d|j|S)Nresponse)r5rr register_hook handle_401)r&reqrrrrrr__call__s zMultiDomainBasicAuth.__call__cCsFtd|}|sdSt||}|r4|d|ddfStd}||dfS)Nz User for %s: r2rFz Password: T)rr r)r&r/rZauthrrrr_prompt_for_passwords  z)MultiDomainBasicAuth._prompt_for_passwordcCstsdStdddgdkS)NFz#Save credentials to keyring [y/N]: yn)rr)r&rrr _should_save_password_to_keyringsz5MultiDomainBasicAuth._should_save_password_to_keyringc Ks|jdkr|S|js|St|j}||j\}}}d|_|dk rv|dk rv||f|j|j<|rv| rv|j||f|_|j |j t |pd|pd|j}|d|j|jr|d|j|jj|f|}|j||S)Nr3r6) status_coder" urllib_parseZurlparserr<r/r%r$r?ZcontentrawZ release_connrrequestr7 warn_on_401save_credentialsZ connectionsendhistoryappend) r&respkwargsZparsedrrZsaver9Znew_resprrrr8s(     zMultiDomainBasicAuth.handle_401cKs|jdkrtd|jjdS)z6Response callback to warn about incorrect credentials.r@z)401 Error, Credentials not correct for %sN)rArrrDr)r&rJrKrrrrEs  z MultiDomainBasicAuth.warn_on_401cKs^tsdS|j}d|_|rZ|jdkrZztdtj|Wntk rXtdYnXdS)z1Response callback to save credentials on success.NizSaving credentials to keyringzFailed to save credentials)rr%rArinfoZ set_passwordrZ exception)r&rJrKZcredsrrrrFs z%MultiDomainBasicAuth.save_credentials)TN)TT) __name__ __module__ __qualname__r'r-r1r5r:r<r?r8rErFrrrrr!Ks  2( -r!)&__doc__ZloggingZpip._vendor.requests.authrrZpip._vendor.requests.utilsrZpip._vendor.six.moves.urllibrrBZpip._internal.utils.miscrrrr r Zpip._internal.utils.typingr Zoptparser typingr rrZ pip._internal.vcs.versioncontrolrrZ CredentialsZ getLoggerrMrr ImportErrorrrrr r!rrrrs0        PK]S1network/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e2@sdZdS)z+Contains purely network-related utilities. N)__doc__rrB/usr/lib/python3.8/site-packages/pip/_internal/network/__init__.pyPK]G\A44network/cache.pynu["""HTTP cache implementation. """ import os from contextlib import contextmanager from typing import Iterator, Optional from pip._vendor.cachecontrol.cache import BaseCache from pip._vendor.cachecontrol.caches import FileCache from pip._vendor.requests.models import Response from pip._internal.utils.filesystem import adjacent_tmp_file, replace from pip._internal.utils.misc import ensure_dir def is_from_cache(response: Response) -> bool: return getattr(response, "from_cache", False) @contextmanager def suppressed_cache_errors() -> Iterator[None]: """If we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. """ try: yield except OSError: pass class SafeFileCache(BaseCache): """ A file based cache which is safe to use even when the target directory may not be accessible or writable. """ def __init__(self, directory: str) -> None: assert directory is not None, "Cache directory must not be None." super().__init__() self.directory = directory def _get_cache_path(self, name: str) -> str: # From cachecontrol.caches.file_cache.FileCache._fn, brought into our # class for backwards-compatibility and to avoid using a non-public # method. hashed = FileCache.encode(name) parts = list(hashed[:5]) + [hashed] return os.path.join(self.directory, *parts) def get(self, key: str) -> Optional[bytes]: path = self._get_cache_path(key) with suppressed_cache_errors(): with open(path, "rb") as f: return f.read() def set(self, key: str, value: bytes) -> None: path = self._get_cache_path(key) with suppressed_cache_errors(): ensure_dir(os.path.dirname(path)) with adjacent_tmp_file(path) as f: f.write(value) replace(f.name, path) def delete(self, key: str) -> None: path = self._get_cache_path(key) with suppressed_cache_errors(): os.remove(path) PK]aYAYAnetwork/session.pynu["""PipSession and supporting code, containing all pip-specific network request configuration and behavior. """ import email.utils import io import ipaddress import json import logging import mimetypes import os import platform import shutil import subprocess import sys import urllib.parse import warnings from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union from pip._vendor import requests, urllib3 from pip._vendor.cachecontrol import CacheControlAdapter from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter from pip._vendor.requests.models import PreparedRequest, Response from pip._vendor.requests.structures import CaseInsensitiveDict from pip._vendor.urllib3.connectionpool import ConnectionPool from pip._vendor.urllib3.exceptions import InsecureRequestWarning from pip import __version__ from pip._internal.metadata import get_default_environment from pip._internal.models.link import Link from pip._internal.network.auth import MultiDomainBasicAuth from pip._internal.network.cache import SafeFileCache # Import ssl from compat so the initial import occurs in only one place. from pip._internal.utils.compat import has_tls from pip._internal.utils.glibc import libc_ver from pip._internal.utils.misc import build_url_from_netloc, parse_netloc from pip._internal.utils.urls import url_to_path logger = logging.getLogger(__name__) SecureOrigin = Tuple[str, str, Optional[Union[int, str]]] # Ignore warning raised when using --trusted-host. warnings.filterwarnings("ignore", category=InsecureRequestWarning) SECURE_ORIGINS: List[SecureOrigin] = [ # protocol, hostname, port # Taken from Chrome's list of secure origins (See: http://bit.ly/1qrySKC) ("https", "*", "*"), ("*", "localhost", "*"), ("*", "127.0.0.0/8", "*"), ("*", "::1/128", "*"), ("file", "*", None), # ssh is always secure. ("ssh", "*", "*"), ] # These are environment variables present when running under various # CI systems. For each variable, some CI systems that use the variable # are indicated. The collection was chosen so that for each of a number # of popular systems, at least one of the environment variables is used. # This list is used to provide some indication of and lower bound for # CI traffic to PyPI. Thus, it is okay if the list is not comprehensive. # For more background, see: https://github.com/pypa/pip/issues/5499 CI_ENVIRONMENT_VARIABLES = ( # Azure Pipelines "BUILD_BUILDID", # Jenkins "BUILD_ID", # AppVeyor, CircleCI, Codeship, Gitlab CI, Shippable, Travis CI "CI", # Explicit environment variable. "PIP_IS_CI", ) def looks_like_ci() -> bool: """ Return whether it looks like pip is running under CI. """ # We don't use the method of checking for a tty (e.g. using isatty()) # because some CI systems mimic a tty (e.g. Travis CI). Thus that # method doesn't provide definitive information in either direction. return any(name in os.environ for name in CI_ENVIRONMENT_VARIABLES) def user_agent() -> str: """ Return a string representing the user agent. """ data: Dict[str, Any] = { "installer": {"name": "pip", "version": __version__}, "python": platform.python_version(), "implementation": { "name": platform.python_implementation(), }, } if data["implementation"]["name"] == "CPython": data["implementation"]["version"] = platform.python_version() elif data["implementation"]["name"] == "PyPy": pypy_version_info = sys.pypy_version_info # type: ignore if pypy_version_info.releaselevel == "final": pypy_version_info = pypy_version_info[:3] data["implementation"]["version"] = ".".join( [str(x) for x in pypy_version_info] ) elif data["implementation"]["name"] == "Jython": # Complete Guess data["implementation"]["version"] = platform.python_version() elif data["implementation"]["name"] == "IronPython": # Complete Guess data["implementation"]["version"] = platform.python_version() if sys.platform.startswith("linux"): from pip._vendor import distro linux_distribution = distro.name(), distro.version(), distro.codename() distro_infos: Dict[str, Any] = dict( filter( lambda x: x[1], zip(["name", "version", "id"], linux_distribution), ) ) libc = dict( filter( lambda x: x[1], zip(["lib", "version"], libc_ver()), ) ) if libc: distro_infos["libc"] = libc if distro_infos: data["distro"] = distro_infos if sys.platform.startswith("darwin") and platform.mac_ver()[0]: data["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]} if platform.system(): data.setdefault("system", {})["name"] = platform.system() if platform.release(): data.setdefault("system", {})["release"] = platform.release() if platform.machine(): data["cpu"] = platform.machine() if has_tls(): import _ssl as ssl data["openssl_version"] = ssl.OPENSSL_VERSION setuptools_dist = get_default_environment().get_distribution("setuptools") if setuptools_dist is not None: data["setuptools_version"] = str(setuptools_dist.version) if shutil.which("rustc") is not None: # If for any reason `rustc --version` fails, silently ignore it try: rustc_output = subprocess.check_output( ["rustc", "--version"], stderr=subprocess.STDOUT, timeout=0.5 ) except Exception: pass else: if rustc_output.startswith(b"rustc "): # The format of `rustc --version` is: # `b'rustc 1.52.1 (9bc8c42bb 2021-05-09)\n'` # We extract just the middle (1.52.1) part data["rustc_version"] = rustc_output.split(b" ")[1].decode() # Use None rather than False so as not to give the impression that # pip knows it is not being run under CI. Rather, it is a null or # inconclusive result. Also, we include some value rather than no # value to make it easier to know that the check has been run. data["ci"] = True if looks_like_ci() else None user_data = os.environ.get("PIP_USER_AGENT_USER_DATA") if user_data is not None: data["user_data"] = user_data return "{data[installer][name]}/{data[installer][version]} {json}".format( data=data, json=json.dumps(data, separators=(",", ":"), sort_keys=True), ) class LocalFSAdapter(BaseAdapter): def send( self, request: PreparedRequest, stream: bool = False, timeout: Optional[Union[float, Tuple[float, float]]] = None, verify: Union[bool, str] = True, cert: Optional[Union[str, Tuple[str, str]]] = None, proxies: Optional[Mapping[str, str]] = None, ) -> Response: pathname = url_to_path(request.url) resp = Response() resp.status_code = 200 resp.url = request.url try: stats = os.stat(pathname) except OSError as exc: # format the exception raised as a io.BytesIO object, # to return a better error message: resp.status_code = 404 resp.reason = type(exc).__name__ resp.raw = io.BytesIO(f"{resp.reason}: {exc}".encode("utf8")) else: modified = email.utils.formatdate(stats.st_mtime, usegmt=True) content_type = mimetypes.guess_type(pathname)[0] or "text/plain" resp.headers = CaseInsensitiveDict( { "Content-Type": content_type, "Content-Length": stats.st_size, "Last-Modified": modified, } ) resp.raw = open(pathname, "rb") resp.close = resp.raw.close return resp def close(self) -> None: pass class InsecureHTTPAdapter(HTTPAdapter): def cert_verify( self, conn: ConnectionPool, url: str, verify: Union[bool, str], cert: Optional[Union[str, Tuple[str, str]]], ) -> None: super().cert_verify(conn=conn, url=url, verify=False, cert=cert) class InsecureCacheControlAdapter(CacheControlAdapter): def cert_verify( self, conn: ConnectionPool, url: str, verify: Union[bool, str], cert: Optional[Union[str, Tuple[str, str]]], ) -> None: super().cert_verify(conn=conn, url=url, verify=False, cert=cert) class PipSession(requests.Session): timeout: Optional[int] = None def __init__( self, *args: Any, retries: int = 0, cache: Optional[str] = None, trusted_hosts: Sequence[str] = (), index_urls: Optional[List[str]] = None, **kwargs: Any, ) -> None: """ :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. """ super().__init__(*args, **kwargs) # Namespace the attribute with "pip_" just in case to prevent # possible conflicts with the base class. self.pip_trusted_origins: List[Tuple[str, Optional[int]]] = [] # Attach our User Agent to the request self.headers["User-Agent"] = user_agent() # Attach our Authentication handler to the session self.auth = MultiDomainBasicAuth(index_urls=index_urls) # Create our urllib3.Retry instance which will allow us to customize # how we handle retries. retries = urllib3.Retry( # Set the total number of retries that a particular request can # have. total=retries, # A 503 error from PyPI typically means that the Fastly -> Origin # connection got interrupted in some way. A 503 error in general # is typically considered a transient error so we'll go ahead and # retry it. # A 500 may indicate transient error in Amazon S3 # A 520 or 527 - may indicate transient error in CloudFlare status_forcelist=[500, 503, 520, 527], # Add a small amount of back off between failed requests in # order to prevent hammering the service. backoff_factor=0.25, ) # type: ignore # Our Insecure HTTPAdapter disables HTTPS validation. It does not # support caching so we'll use it for all http:// URLs. # If caching is disabled, we will also use it for # https:// hosts that we've marked as ignoring # TLS errors for (trusted-hosts). insecure_adapter = InsecureHTTPAdapter(max_retries=retries) # We want to _only_ cache responses on securely fetched origins or when # the host is specified as trusted. We do this because # we can't validate the response of an insecurely/untrusted fetched # origin, and we don't want someone to be able to poison the cache and # require manual eviction from the cache to fix it. if cache: secure_adapter = CacheControlAdapter( cache=SafeFileCache(cache), max_retries=retries, ) self._trusted_host_adapter = InsecureCacheControlAdapter( cache=SafeFileCache(cache), max_retries=retries, ) else: secure_adapter = HTTPAdapter(max_retries=retries) self._trusted_host_adapter = insecure_adapter self.mount("https://", secure_adapter) self.mount("http://", insecure_adapter) # Enable file:// urls self.mount("file://", LocalFSAdapter()) for host in trusted_hosts: self.add_trusted_host(host, suppress_logging=True) def update_index_urls(self, new_index_urls: List[str]) -> None: """ :param new_index_urls: New index urls to update the authentication handler with. """ self.auth.index_urls = new_index_urls def add_trusted_host( self, host: str, source: Optional[str] = None, suppress_logging: bool = False ) -> None: """ :param host: It is okay to provide a host that has previously been added. :param source: An optional source string, for logging where the host string came from. """ if not suppress_logging: msg = f"adding trusted host: {host!r}" if source is not None: msg += f" (from {source})" logger.info(msg) host_port = parse_netloc(host) if host_port not in self.pip_trusted_origins: self.pip_trusted_origins.append(host_port) self.mount( build_url_from_netloc(host, scheme="http") + "/", self._trusted_host_adapter ) self.mount(build_url_from_netloc(host) + "/", self._trusted_host_adapter) if not host_port[1]: self.mount( build_url_from_netloc(host, scheme="http") + ":", self._trusted_host_adapter, ) # Mount wildcard ports for the same host. self.mount(build_url_from_netloc(host) + ":", self._trusted_host_adapter) def iter_secure_origins(self) -> Iterator[SecureOrigin]: yield from SECURE_ORIGINS for host, port in self.pip_trusted_origins: yield ("*", host, "*" if port is None else port) def is_secure_origin(self, location: Link) -> bool: # Determine if this url used a secure transport mechanism parsed = urllib.parse.urlparse(str(location)) origin_protocol, origin_host, origin_port = ( parsed.scheme, parsed.hostname, parsed.port, ) # The protocol to use to see if the protocol matches. # Don't count the repository type as part of the protocol: in # cases such as "git+ssh", only use "ssh". (I.e., Only verify against # the last scheme.) origin_protocol = origin_protocol.rsplit("+", 1)[-1] # Determine if our origin is a secure origin by looking through our # hardcoded list of secure origins, as well as any additional ones # configured on this PackageFinder instance. for secure_origin in self.iter_secure_origins(): secure_protocol, secure_host, secure_port = secure_origin if origin_protocol != secure_protocol and secure_protocol != "*": continue try: addr = ipaddress.ip_address(origin_host) network = ipaddress.ip_network(secure_host) except ValueError: # We don't have both a valid address or a valid network, so # we'll check this origin against hostnames. if ( origin_host and origin_host.lower() != secure_host.lower() and secure_host != "*" ): continue else: # We have a valid address and network, so see if the address # is contained within the network. if addr not in network: continue # Check to see if the port matches. if ( origin_port != secure_port and secure_port != "*" and secure_port is not None ): continue # If we've gotten here, then this origin matches the current # secure origin and we should return True return True # If we've gotten to this point, then the origin isn't secure and we # will not accept it as a valid location to search. We will however # log a warning that we are ignoring it. logger.warning( "The repository located at %s is not a trusted or secure host and " "is being ignored. If this repository is available via HTTPS we " "recommend you use HTTPS instead, otherwise you may silence " "this warning and allow it anyway with '--trusted-host %s'.", origin_host, origin_host, ) return False def request(self, method: str, url: str, *args: Any, **kwargs: Any) -> Response: # Allow setting a default timeout on a session kwargs.setdefault("timeout", self.timeout) # Dispatch the actual request return super().request(method, url, *args, **kwargs) PK]-{_network/xmlrpc.pynu["""xmlrpclib.Transport implementation """ import logging import urllib.parse import xmlrpc.client from typing import TYPE_CHECKING, Tuple from pip._internal.exceptions import NetworkConnectionError from pip._internal.network.session import PipSession from pip._internal.network.utils import raise_for_status if TYPE_CHECKING: from xmlrpc.client import _HostType, _Marshallable logger = logging.getLogger(__name__) class PipXmlrpcTransport(xmlrpc.client.Transport): """Provide a `xmlrpclib.Transport` implementation via a `PipSession` object. """ def __init__( self, index_url: str, session: PipSession, use_datetime: bool = False ) -> None: super().__init__(use_datetime) index_parts = urllib.parse.urlparse(index_url) self._scheme = index_parts.scheme self._session = session def request( self, host: "_HostType", handler: str, request_body: bytes, verbose: bool = False, ) -> Tuple["_Marshallable", ...]: assert isinstance(host, str) parts = (self._scheme, host, handler, None, None, None) url = urllib.parse.urlunparse(parts) try: headers = {"Content-Type": "text/xml"} response = self._session.post( url, data=request_body, headers=headers, stream=True, ) raise_for_status(response) self.verbose = verbose return self.parse_response(response.raw) except NetworkConnectionError as exc: assert exc.response logger.critical( "HTTP error %s while getting %s", exc.response.status_code, url, ) raise PK]=.R//network/auth.pynu["""Network Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. """ import urllib.parse from typing import Any, Dict, List, Optional, Tuple from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth from pip._vendor.requests.models import Request, Response from pip._vendor.requests.utils import get_netrc_auth from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ( ask, ask_input, ask_password, remove_auth_from_url, split_auth_netloc_from_url, ) from pip._internal.vcs.versioncontrol import AuthInfo logger = getLogger(__name__) Credentials = Tuple[str, str, str] try: import keyring except ImportError: keyring = None # type: ignore[assignment] except Exception as exc: logger.warning( "Keyring is skipped due to an exception: %s", str(exc), ) keyring = None # type: ignore[assignment] def get_keyring_auth(url: Optional[str], username: Optional[str]) -> Optional[AuthInfo]: """Return the tuple auth for a given url from keyring.""" global keyring if not url or not keyring: return None try: try: get_credential = keyring.get_credential except AttributeError: pass else: logger.debug("Getting credentials from keyring for %s", url) cred = get_credential(url, username) if cred is not None: return cred.username, cred.password return None if username: logger.debug("Getting password from keyring for %s", url) password = keyring.get_password(url, username) if password: return username, password except Exception as exc: logger.warning( "Keyring is skipped due to an exception: %s", str(exc), ) keyring = None # type: ignore[assignment] return None class MultiDomainBasicAuth(AuthBase): def __init__( self, prompting: bool = True, index_urls: Optional[List[str]] = None ) -> None: self.prompting = prompting self.index_urls = index_urls self.passwords: Dict[str, AuthInfo] = {} # When the user is prompted to enter credentials and keyring is # available, we will offer to save them. If the user accepts, # this value is set to the credentials they entered. After the # request authenticates, the caller should call # ``save_credentials`` to save these. self._credentials_to_save: Optional[Credentials] = None def _get_index_url(self, url: str) -> Optional[str]: """Return the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. """ if not url or not self.index_urls: return None for u in self.index_urls: prefix = remove_auth_from_url(u).rstrip("/") + "/" if url.startswith(prefix): return u return None def _get_new_credentials( self, original_url: str, allow_netrc: bool = True, allow_keyring: bool = False, ) -> AuthInfo: """Find and return credentials for the specified URL.""" # Split the credentials and netloc from the url. url, netloc, url_user_password = split_auth_netloc_from_url( original_url, ) # Start with the credentials embedded in the url username, password = url_user_password if username is not None and password is not None: logger.debug("Found credentials in url for %s", netloc) return url_user_password # Find a matching index url for this request index_url = self._get_index_url(url) if index_url: # Split the credentials from the url. index_info = split_auth_netloc_from_url(index_url) if index_info: index_url, _, index_url_user_password = index_info logger.debug("Found index url %s", index_url) # If an index URL was found, try its embedded credentials if index_url and index_url_user_password[0] is not None: username, password = index_url_user_password if username is not None and password is not None: logger.debug("Found credentials in index url for %s", netloc) return index_url_user_password # Get creds from netrc if we still don't have them if allow_netrc: netrc_auth = get_netrc_auth(original_url) if netrc_auth: logger.debug("Found credentials in netrc for %s", netloc) return netrc_auth # If we don't have a password and keyring is available, use it. if allow_keyring: # The index url is more specific than the netloc, so try it first # fmt: off kr_auth = ( get_keyring_auth(index_url, username) or get_keyring_auth(netloc, username) ) # fmt: on if kr_auth: logger.debug("Found credentials in keyring for %s", netloc) return kr_auth return username, password def _get_url_and_credentials( self, original_url: str ) -> Tuple[str, Optional[str], Optional[str]]: """Return the credentials to use for the provided URL. If allowed, netrc and keyring may be used to obtain the correct credentials. Returns (url_without_credentials, username, password). Note that even if the original URL contains credentials, this function may return a different username and password. """ url, netloc, _ = split_auth_netloc_from_url(original_url) # Try to get credentials from original url username, password = self._get_new_credentials(original_url) # If credentials not found, use any stored credentials for this netloc. # Do this if either the username or the password is missing. # This accounts for the situation in which the user has specified # the username in the index url, but the password comes from keyring. if (username is None or password is None) and netloc in self.passwords: un, pw = self.passwords[netloc] # It is possible that the cached credentials are for a different username, # in which case the cache should be ignored. if username is None or username == un: username, password = un, pw if username is not None or password is not None: # Convert the username and password if they're None, so that # this netloc will show up as "cached" in the conditional above. # Further, HTTPBasicAuth doesn't accept None, so it makes sense to # cache the value that is going to be used. username = username or "" password = password or "" # Store any acquired credentials. self.passwords[netloc] = (username, password) assert ( # Credentials were found (username is not None and password is not None) # Credentials were not found or (username is None and password is None) ), f"Could not load credentials from url: {original_url}" return url, username, password def __call__(self, req: Request) -> Request: # Get credentials for this request url, username, password = self._get_url_and_credentials(req.url) # Set the url of the request to the url without any credentials req.url = url if username is not None and password is not None: # Send the basic auth with this request req = HTTPBasicAuth(username, password)(req) # Attach a hook to handle 401 responses req.register_hook("response", self.handle_401) return req # Factored out to allow for easy patching in tests def _prompt_for_password( self, netloc: str ) -> Tuple[Optional[str], Optional[str], bool]: username = ask_input(f"User for {netloc}: ") if not username: return None, None, False auth = get_keyring_auth(netloc, username) if auth and auth[0] is not None and auth[1] is not None: return auth[0], auth[1], False password = ask_password("Password: ") return username, password, True # Factored out to allow for easy patching in tests def _should_save_password_to_keyring(self) -> bool: if not keyring: return False return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y" def handle_401(self, resp: Response, **kwargs: Any) -> Response: # We only care about 401 responses, anything else we want to just # pass through the actual response if resp.status_code != 401: return resp # We are not able to prompt the user so simply return the response if not self.prompting: return resp parsed = urllib.parse.urlparse(resp.url) # Query the keyring for credentials: username, password = self._get_new_credentials( resp.url, allow_netrc=False, allow_keyring=True, ) # Prompt the user for a new username and password save = False if not username and not password: username, password, save = self._prompt_for_password(parsed.netloc) # Store the new username and password to use for future requests self._credentials_to_save = None if username is not None and password is not None: self.passwords[parsed.netloc] = (username, password) # Prompt to save the password to keyring if save and self._should_save_password_to_keyring(): self._credentials_to_save = (parsed.netloc, username, password) # Consume content and release the original connection to allow our new # request to reuse the same one. resp.content resp.raw.release_conn() # Add our new username and password to the request req = HTTPBasicAuth(username or "", password or "")(resp.request) req.register_hook("response", self.warn_on_401) # On successful request, save the credentials that were used to # keyring. (Note that if the user responded "no" above, this member # is not set and nothing will be saved.) if self._credentials_to_save: req.register_hook("response", self.save_credentials) # Send our new request new_resp = resp.connection.send(req, **kwargs) new_resp.history.append(resp) return new_resp def warn_on_401(self, resp: Response, **kwargs: Any) -> None: """Response callback to warn about incorrect credentials.""" if resp.status_code == 401: logger.warning( "401 Error, Credentials not correct for %s", resp.request.url, ) def save_credentials(self, resp: Response, **kwargs: Any) -> None: """Response callback to save credentials on success.""" assert keyring is not None, "should never reach here without keyring" if not keyring: return creds = self._credentials_to_save self._credentials_to_save = None if creds and resp.status_code < 400: try: logger.info("Saving credentials to keyring") keyring.set_password(*creds) except Exception: logger.exception("Failed to save credentials") PK]J22network/__init__.pynu["""Contains purely network-related utilities. """ PK]Goo0cli/__pycache__/main_parser.cpython-38.opt-1.pycnu[U .e @sdZddlZddlZddlmZddlmZmZddlm Z m Z ddl m Z ddl mZmZddlmZer|dd lmZmZd d gZd d Zd d ZdS)z=A single place for constructing and exposing the main parser N) cmdoptions)ConfigOptionParserUpdatingDefaultsHelpFormatter) commands_dictget_similar_commands) CommandError)get_pip_versionget_prog)MYPY_CHECK_RUNNING)TupleListcreate_main_parser parse_commandcCstddtdtd}tf|}|t|_ttj|}| |d|_ dgddt D}d ||_|S) z6Creates and returns the main parser for pip's CLI z %prog [options]Fglobal)ZusageZadd_help_optionZ formatternameprogTcSsg|]\}}d||jfqS)z%-27s %s)Zsummary).0rZ command_inforA/usr/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py 2sz&create_main_parser.. )rr rZdisable_interspersed_argsrversionrZmake_option_groupZ general_groupZadd_option_groupmainritemsjoin description)Z parser_kwparserZgen_optsrrrrr s"    cCst}||\}}|jr>tj|jtjtjt|rZ|ddkrjt |dkrj| t|d}|t krt |}d|g}|r| d|td||dd}||||fS)Nrhelpzunknown command "%s"zmaybe you meant "%s"z - )r parse_argsrsysstdoutwriteoslinesepexitlenZ print_helprrappendrrremove)argsrZgeneral_optionsZ args_elseZcmd_nameZguessmsgZcmd_argsrrrr;s&    )__doc__r$r!Zpip._internal.clirZpip._internal.cli.parserrrZpip._internal.commandsrrZpip._internal.exceptionsrZpip._internal.utils.miscrr Zpip._internal.utils.typingr typingr r __all__r rrrrrs   #PK] Cmm1cli/__pycache__/status_codes.cpython-38.opt-1.pycnu[U .e@s(ddlmZdZdZdZdZdZdZdS))absolute_importN)Z __future__rSUCCESSZERRORZ UNKNOWN_ERRORZVIRTUALENV_NOT_FOUNDZPREVIOUS_BUILD_DIR_ERRORZNO_MATCHES_FOUNDr r B/usr/lib/python3.8/site-packages/pip/_internal/cli/status_codes.pys PK]QW҆+cli/__pycache__/status_codes.cpython-38.pycnu[U ʗRet@sdZdZdZdZdZdZdS)N)SUCCESSERROR UNKNOWN_ERRORVIRTUALENV_NOT_FOUNDPREVIOUS_BUILD_DIR_ERRORNO_MATCHES_FOUNDr r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/status_codes.pys PK]''%cli/__pycache__/parser.cpython-38.pycnu[U ʗReA*@sdZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZmZddlmZmZeeZGdd d ejZGd d d eZGd d d ejZGdddeZdS)zBase option parser setupN)suppress)AnyDict GeneratorListTuple) UNKNOWN_ERROR) ConfigurationConfigurationError)redact_auth_from_url strtoboolcseZdZdZeeddfdd ZejedddZ dejeeed d d Z eedddZ eedddZ eedddZ eedddZeeedddZZS)PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.N)argskwargsreturncs6d|d<d|d<tdd|d<tj||dS)Nmax_help_positionindent_incrementrwidth)shutilget_terminal_sizesuper__init__)selfrr __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/parser.pyrszPrettyHelpFormatter.__init__optionrcCs ||SN)_format_option_strings)rr!rrrformat_option_stringssz)PrettyHelpFormatter.format_option_strings <{}>, )r!mvarfmtoptseprcCsg}|jr||jd|jr0||jdt|dkrH|d||r|jdk s^t|jpl|j }|| | d |S)z Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string :param optsep: separator rrN) _short_optsappend _long_optsleninsert takes_valuedestAssertionErrormetavarlowerformatjoin)rr!r'r(optsr2rrrr#s   z*PrettyHelpFormatter._format_option_strings)headingrcCs|dkr dS|dS)NOptionsr): r)rr7rrrformat_heading9sz"PrettyHelpFormatter.format_heading)usagercCsd|t|d}|S)zz Ensure there is only one newline between usage and the first heading if there is no description. z Usage: {}  )r4 indent_linestextwrapdedent)rr;msgrrr format_usage>sz PrettyHelpFormatter.format_usage) descriptionrcCsZ|rRt|jdrd}nd}|d}|}|t|d}|d|d}|SdSdS)NmainCommands Description r<r9r))hasattrparserlstriprstripr=r>r?)rrBlabelrrrformat_descriptionFs  z&PrettyHelpFormatter.format_description)epilogrcCs|r|SdSdS)Nr)r)rrMrrr format_epilogXsz!PrettyHelpFormatter.format_epilog)textindentrcs"fdd|dD}d|S)Ncsg|] }|qSrr).0linerPrr `sz4PrettyHelpFormatter.indent_lines..rF)splitr5)rrOrP new_linesrrSrr=_sz PrettyHelpFormatter.indent_lines)r%r&)__name__ __module__ __qualname____doc__rroptparseOptionstrr$r#r:rArLrNr= __classcell__rrrrr s  r cs*eZdZdZejedfdd ZZS)UpdatingDefaultsHelpFormatterzCustom help formatter for use in ConfigOptionParser. This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. Also redact auth from url type options r csd}|jdk rLt|jtst|j|jj|jdk std|q$|dd\}}||kr$||||fq$|D] }||D]\}}||fVqzqndS)Nglobalz:env:cSsi|] }|gqSrr)rQr}rrr szGConfigOptionParser._get_ordered_configuration_items..z7Ignoring configuration key '%s' as it's value is empty..r)r}r~itemsloggerdebugrUr+)roverride_order section_items section_keyrksectionrrrr _get_ordered_configuration_itemss" z3ConfigOptionParser._get_ordered_configuration_items)rdrc stj_t}D]\}ddkr>qjdk sLtj dkrz t |}Wn&t k r d |YnXnj dkrtt t |}W5QRXtt t|}W5QRXt|tr|dkr d |nj dkr"|}fd d |D}n|j d krjdk s>t|j}||}jphd }jpti}j||f||n|}||j<q|D]tj|<qd_|S) zUpdates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).z--N) store_true store_falsezm{} is not a valid value for {} option, please specify a boolean value like yes/no, true/false or 1/0 instead.countrz{} is not a valid value for {} option, please instead specify either a non-negative integer or a boolean value like yes/no or false/true which is equivalent to 1/0.r+csg|]}|qSr)r)rQvrr!rrrrTsz7ConfigOptionParser._update_defaults..callbackr)r[Valuesrdvaluessetr get_optionr0r1actionr ValueErrorerrorr4rryrarUraddget_opt_string convert_value callback_argscallback_kwargsrgetattr)rrd late_evalrkopt_strrrrrrrcs\            z#ConfigOptionParser._update_defaultsc Cs|jst|jSz|jWn2tk rR}z|tt |W5d}~XYnX| |j }| D]B}|j dk s~t||j }t|t rl|}|||||j <qlt|S)zOverriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.N)process_default_valuesr[rrdr~loadr rrr]rccopy_get_all_optionsr0r1rerarr)rerrrdr!defaultrrrrget_default_valuess "   z%ConfigOptionParser.get_default_values)r@rcCs"|tj|t|ddS)NrF) print_usagerstderrrr)rr@rrrr$s zConfigOptionParser.error)rWrXrYrZrr]boolrr[r\rrrrrrcrrrr^rrrrrbs    @rb)rZloggingr[rrr> contextlibrtypingrrrrrpip._internal.cli.status_codesrpip._internal.configurationr r pip._internal.utils.miscr r getLoggerrWrIndentedHelpFormatterr r_ OptionParserrlrbrrrrs   R PK]4FKFK/cli/__pycache__/cmdoptions.cpython-38.opt-1.pycnu[U .eh@sdZddlmZddlZddlZddlZddlmZddlm Z ddl m Z m Z m Z ddlmZddlmZdd lmZmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZerddl m!Z!m"Z"m#Z#m$Z$m%Z%ddl m&Z&m'Z'ddl(m)Z)e*e+Z,ddZ-ddZ.dddZ/dddZ0e e dddddd Z1e e d!d"d#dd$d%Z2e e d&d'd(d#de d%Z3e e d)d*d+d,dd-d%Z4e e d.d/d#dd0d%Z5e e d1d2d3d#d4d Z6e e d5d6d7d,dd8d%Z7e e d9d:d;e8e9d:e9d?d@Z;e e dAdBdCdDdEdFdGZe e dPdQdRdSdTdOZ?e e dUdVdWdXdYdZd[d\Z@e e d]d^dLdMe dOZAd_d`ZBe e dadbdLdEdcddZCe e dedfdLddEdgdhZDe e didjdkdldmejEdndoZFdpdqZGe e drdsd#ddtd%ZHdudvZIdwdxZJdydzZKd{d|ZLd}d~ZMe e ddddddeddo ZNddZOddZPddZQddZRddZSe e ddddddoZTddZUddZVe e ddddeVdLdedd ZWe e ddddddoZXe e ddddddoZYddZZddZ[ddZ\e e ddedddZ]ddZ^e e ddde^ddZ_e e dddd#ddd%Z`e e ddddddddGZae e ddd#dd Zbe e dddddd%ZcddĄZde e ddd#ddd%Zee e dddedde dɍZfe e ddddddύZge e ddddddύZhe e dd#dddՍZie e dd#dddՍZje e ddd#ddd%Zke e dddd#e d Zldd߄Zme e dddemdddZne e ddd#ddd%Zoe e ddEddd ZpddZqde1e2e3e4e6e7ee?e@eAeBeJeCeDe]e_eke5gdZrdeFeGeHeIgdZsdS)aC shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. )absolute_importN) strtobool)partial) SUPPRESS_HELPOption OptionGroup)dedent) CommandError)USER_CACHE_DIRget_src_prefix) FormatControl)PyPI) TargetPython) STRONG_HASHES)MYPY_CHECK_RUNNING) BAR_TYPES)AnyCallableDictOptionalTuple) OptionParserValues)ConfigOptionParsercCs.d||}td|}||dS)z Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. z {} error: {} N)formattextwrapZfilljoinspliterror)parseroptionmsgr#@/usr/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error)s r%cCs,t||d}|dD]}||q|S)z Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser nameoptions)r add_option)groupr Z option_groupr!r#r#r$make_option_group7s r*csPdkr |fdd}dddg}tt||rL|j}|tjddd dS) zDisable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. Ncs t|dSN)getattr)n check_optionsr#r$getnameOsz+check_install_build_global..getnameZ build_optionsglobal_optionsinstall_optionszeDisabling all use of wheels due to the use of --build-options / --global-options / --install-options.) stacklevel)anymapformat_controlZdisallow_binarieswarningswarn)r'r/r0namesZcontrolr#r.r$check_install_build_globalDs  r;FcCsbt|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|r^|r^|j s^t ddS)zFunction for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. z:all:zWhen restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).zQCan not use any platform or abi specific options unless installing via '--target'N) r5python_versionplatformabiimplementationr setr7ignore_dependenciesr Z target_dir)r'Z check_targetZdist_restriction_setZ binary_onlyZsdist_dependencies_allowedr#r#r$check_dist_restriction[s&  rBz-hz--helphelpz Show help.)destactionrCz --isolated isolated_mode store_truezSRun pip in an isolated mode, ignoring environment variables and user configuration.rDrEdefaultrCz--require-virtualenvz--require-venvZ require_venvz-vz --verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z --no-colorno_colorzSuppress colored outputz-Vz --versionversionzShow version and exit.z-qz--quietquietzGive less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).z--progress-bar progress_barchoiceZonz*Specify type of progress to be displayed [|z] (default: %default))rDtypechoicesrIrCz--logz --log-filez --local-loglogpathz Path to a verbose appending log.)rDmetavarrCz --no-inputno_inputz--proxyproxystrz/src". The default for global installs is "/src".cCs t||jS)zGet a format_control object.)r,rD)valuesr!r#r#r$_get_format_controlsrycCs"t|j|}t||j|jdSr+)ryrxr handle_mutual_excludes no_binary only_binaryr!opt_strvaluer Zexistingr#r#r$_handle_no_binarys  rcCs"t|j|}t||j|jdSr+)ryrxr rzr|r{r}r#r#r$_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr7callbackrYa^Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.rDrErrRrIrC)r r@rrr7r#r#r$r{sr{c Cs$ttt}tdddtd|ddS)Nz --only-binaryr7rrYaGDo not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all source packages, :none: to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r)r r@rrrr#r#r$r|sr|z --platformr=z[Only use wheels compatible with . Defaults to the platform of the running system.cCs|sdS|d}t|dkr"dSt|dkrV|d}t|dkrV|d|ddg}ztdd |D}Wntk rYd SX|dfS) z Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. )NN.)r#z'at most three version parts are allowedrNcss|]}t|VqdSr+)r\).0partr#r#r$ sz*_convert_python_version..)r#z$each version part must be an integer)rlentuple ValueError)rparts version_infor#r#r$_convert_python_versions    rcCs:t|\}}|dk r.d||}t|||d||j_dS)z3 Handle a provided --python-version value. Nz(invalid --python-version value: {!r}: {}r!r")rrr%rxr<)r!r~rr rZ error_msgr"r#r#r$_handle_python_version s rz--python-versionr<ra The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). )rDrVrErrRrIrCz--implementationr?zOnly use wheels compatible with Python implementation , e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels.z--abir>zOnly use wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Generally you will need to specify --implementation, --platform, and --python-version when using this option.cCs4|t|t|t|tdSr+)r(r=r<r?r>)Zcmd_optsr#r#r$add_target_python_optionsIs   rcCst|j|j|j|jd}|S)N)r=Zpy_version_infor>r?)rr=r<r>r?)r'Z target_pythonr#r#r$make_target_pythonQsrcCstddddddS)Nz--prefer-binary prefer_binaryrGFz8Prefer older binary packages over newer source packages.rHrir#r#r#r$r]srz --cache-dir cache_dirzStore the cache data in .)rDrIrVrCc CsV|dk rJz t|Wn4tk rH}zt||t|dW5d}~XYnXd|j_dS)z Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. NrF)rrr%rYrxr)r!optrr excr#r#r$_handle_no_cache_dirrs  $ rz--no-cache-dirzDisable the cache.)rDrErrCz --no-depsz--no-dependenciesrAz#Don't install package dependencies.z-bz--buildz --build-dirz--build-directory build_dira>Directory to unpack packages into and build in. Note that an initial build still takes place in a temporary directory. The location of temporary directories can be controlled by setting the TMPDIR environment variable (TEMP on Windows) appropriately. When passed, build directories are not cleaned in case of failures.z--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationZbuild_isolationZ store_falseTzDisable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used.cCs&|dk rd}t|||dd|j_dS)z Process a value provided for the --no-use-pep517 option. This is an optparse.Option callback for the no_use_pep517 option. Na0A value was passed for --no-use-pep517, probably using either the PIP_NO_USE_PEP517 environment variable or the "no-use-pep517" config file option. Use an appropriate value of the PIP_USE_PEP517 environment variable or the "use-pep517" config file option instead. rF)r%rx use_pep517)r!rrr r"r#r#r$_handle_no_use_pep517s rz --use-pep517rz^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)rDrErrIrCz--install-optionr2rhr'a"Extra arguments to be supplied to the setup.py install command (use like --install-option="--install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.)rDrErVrCz--global-optionr1zTExtra global options to be supplied to the setup.py call before the install command.z --no-cleanz!Don't clean up build directories.)rErIrCz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--disable-pip-version-checkdisable_pip_version_checkz{Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.z-Zz--always-unzip always_unzipcCs|jjsi|j_z|dd\}}Wn"tk rF|d|YnX|tkrh|d|dtf|jj|g|dS)zkGiven a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.:rzTArguments to %s must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for %s are %s.z, N) rxhashesrrrrr setdefaultrh)r!r~rr ZalgoZdigestr#r#r$_handle_merge_hash)s  rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)rDrErrRrCz--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.z--pathz^Restrict to the specified installation path for listing packages (can be used multiple times).cCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')rUuserZlocalr )r'r#r#r$check_list_path_option_srzGeneral Options)r&r'zPackage Index Options)N)F)t__doc__Z __future__rZloggingrr8Zdistutils.utilr functoolsrZoptparserrrrZpip._internal.exceptionsr Zpip._internal.locationsr r Z#pip._internal.models.format_controlr Zpip._internal.models.indexr Z"pip._internal.models.target_pythonrZpip._internal.utils.hashesrZpip._internal.utils.typingrZpip._internal.utils.uirtypingrrrrrrrZpip._internal.cli.parserrZ getLogger__name__Zloggerr%r*r;rBZhelp_rFZrequire_virtualenvrJrLrMrNlistkeysrrOrTrWrXr[r^rarbrjrkZ simple_urlrlrnrorprrrsrurvsrcryrrr{r|r=rrr<r?r>rrrrrZno_cacheZno_depsrrZno_build_isolationrrZ no_use_pep517r2r1Zno_cleanZprerrrhashrZ list_pathrZ general_groupZ index_groupr#r#r#r$sB               ,                                         PK]j~""+cli/__pycache__/parser.cpython-38.opt-1.pycnu[U .e%@sdZddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZmZddlmZeeZGd d d ejZGd d d eZGd ddejZGdddeZddZdS)zBase option parser setup)absolute_importN) strtobool) string_types) UNKNOWN_ERROR) ConfigurationConfigurationError)get_terminal_sizec@sReZdZdZddZddZddd Zd d Zd d ZddZ ddZ ddZ dS)PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.cOs:d|d<d|d<tdd|d<tjj|f||dS)NZmax_help_positionZindent_incrementrwidth)roptparseIndentedHelpFormatter__init__)selfargskwargsr, )_format_option_stringsroptionrrrformat_option_strings!sz)PrettyHelpFormatter.format_option_stringsrrcCs|g}|jr||jd|jr0||jdt|dkrH|d||rr|jp^|j}|||d |S)a Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string - evaluated as mvarfmt % metavar :param optsep: separator rr ) Z _short_optsappendZ _long_optsleninsertZ takes_valuemetavardestlowerjoin)rrZmvarfmtZoptsepZoptsr rrrr$s  z*PrettyHelpFormatter._format_option_stringscCs|dkr dS|dS)NZOptionsrz: r)rZheadingrrrformat_heading;sz"PrettyHelpFormatter.format_headingcCsd|t|d}|S)zz Ensure there is only one newline between usage and the first heading if there is no description. z Usage: %s  ) indent_linestextwrapdedent)rZusagemsgrrr format_usage@sz PrettyHelpFormatter.format_usagecCsV|rNt|jdrd}nd}|d}|}|t|d}d||f}|SdSdS)NmainZCommandsZ Description r%z%s: %s r)hasattrparserlstriprstripr&r'r()r descriptionZlabelrrrformat_descriptionHs   z&PrettyHelpFormatter.format_descriptioncCs|r|SdSdS)Nrr)rZepilogrrr format_epilogZsz!PrettyHelpFormatter.format_epilogcs"fdd|dD}d|S)Ncsg|] }|qSrr).0lineindentrr bsz4PrettyHelpFormatter.indent_lines..r,)splitr#)rtextr7Z new_linesrr6rr&asz PrettyHelpFormatter.indent_linesN)rr) __name__ __module__ __qualname____doc__rrrr$r*r2r3r&rrrrr s r c@seZdZdZddZdS)UpdatingDefaultsHelpFormatterzCustom help formatter for use in ConfigOptionParser. This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. cCs(|jdk r|j|jjtj||S)N)r._update_defaultsdefaultsrrexpand_defaultrrrrrBms z,UpdatingDefaultsHelpFormatter.expand_defaultN)r;r<r=r>rBrrrrr?fsr?c@s eZdZddZeddZdS)CustomOptionParsercOs(|j||}|j|j|||S)z*Insert an OptionGroup at a given position.)Zadd_option_group option_groupspopr)ridxrrgrouprrrinsert_option_groupus  z&CustomOptionParser.insert_option_groupcCs*|jdd}|jD]}||jq|S)ztd|q$|dd\}}||kr$||||fq$|D] }||D]\}}||fVqzqndS)Nglobalz:env:cSsi|] }|gqSrr)r4rOrrr szGConfigOptionParser._get_ordered_configuration_items..z7Ignoring configuration key '%s' as it's value is empty..r )rOrQitemsloggerdebugr9r)rZoverride_orderZ section_itemsZ section_keyrYZsectionrXrrr _get_ordered_configuration_itemss z3ConfigOptionParser._get_ordered_configuration_itemsc sHtj_t}D]\}ddkr>qjdkrz t|}Wn,t k rt j|} |YnXnjdkr| }fdd|D}nhjdkr| j}||}jpd}jpi}j||f||n|}||j<q|D]tj|<q&d_|S) zUpdates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).z--N) store_true store_falsecountrcsg|]}|qSr)r[)r4vrXrrrrr8sz7ConfigOptionParser._update_defaults..callbackr)rValuesrAvaluessetrbZ get_optionactionr ValueErrorinvalid_config_error_messageerrorr9addr!get_opt_stringZ convert_valueZ callback_argsZcallback_kwargsrhr[getattr)rrAZ late_evalrYZ error_msgopt_strrrrrgrr@s@         z#ConfigOptionParser._update_defaultsc Cs|jst|jSz|jWn2tk rR}z|tt |W5d}~XYnX| |j }| D]4}| |j}t|trl|}|||||j<qlt|S)zOverriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.N)Zprocess_default_valuesrrirArQloadrrWrstrr@copyZ_get_all_optionsgetr! isinstancerrqrT)rerrrArdefaultrsrrrget_default_valuess "   z%ConfigOptionParser.get_default_valuescCs |tj|td|dS)Nz%s )Z print_usagerVstderrrWr)rr)rrrros zConfigOptionParser.errorN) r;r<r=r>rr[rbr@r{rorrrrrNs 1rNcCs |dkrd||Sd||S)zQReturns a better error message when invalid configuration option is provided.)rcrdzo{0} is not a valid value for {1} option, please specify a boolean value like yes/no, true/false or 1/0 instead.z[{0} is not a valid value for {1} option, please specify a numerical value like 1/0 instead.)format)rlrXrYrrrrnsrn)r>Z __future__rZloggingrrVr'Zdistutils.utilrZpip._vendor.sixrZpip._internal.cli.status_codesrZpip._internal.configurationrrZpip._internal.utils.compatrZ getLoggerr;r`rr r?rRrCrNrnrrrrs       O wPK]tp+cli/__pycache__/base_command.cpython-38.pycnu[U ʗRe@sLdZddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z m Z mZddlmZddlmZddlmZddlmZmZdd lmZmZmZmZdd lmZmZm Z m!Z!m"Z"m#Z#m$Z$dd l%m&Z&dd l'm(Z(m)Z)dd l*m+Z+m,Z,ddl-m.Z/ddl-m0Z0m1Z1ddl2m3Z3dgZ4e5e6Z7GdddeZ8dS)z(Base Command class, and related routinesN)Values)AnyCallableListOptionalTuple) traceback) cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERROR UNKNOWN_ERRORVIRTUALENV_NOT_FOUND) BadCommand CommandErrorDiagnosticPipErrorInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorUninstallationError)check_path_owner)BrokenStdoutLoggingError setup_logging)get_prognormalize_path)TempDirectoryTypeRegistry)global_tempdir_managertempdir_registry)running_under_virtualenvCommandcseZdZUdZeed<dZeed<deeeddfdd Zdd d d Z e dd d dZ e e ee dddZe eee e efdddZe ee dddZe ee dddZZS)r!usageFignore_require_venvN)namesummaryisolatedreturnc st||_||_t|jtd|td||j|d|_ d|_ |j d}t |j ||_ttj|j }|j ||dS)N F)r#prog formatteradd_help_optionr% descriptionr'z Options)super__init__r%r&r r#rr __doc__parserr capitalizeoptparse OptionGroupcmd_optsr make_option_group general_groupadd_option_group add_options)selfr%r&r' optgroup_namegen_opts __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/base_command.pyr/1s*   zCommand.__init__)r(cCsdSNr?)r:r?r?r@r9OszCommand.add_options)optionsr(cCst|drtdS)zf This is a no-op so that commands by default do not do the pip version check. no_indexN)hasattrAssertionError)r:rBr?r?r@handle_pip_version_checkRsz Command.handle_pip_version_check)rBargsr(cCstdSrA)NotImplementedError)r:rBrGr?r?r@run[sz Command.runrGr(cCs |j|SrA)r1 parse_argsr:rGr?r?r@rK^szCommand.parse_argsc Cs>z.|||W5QRW SQRXW5tXdSrA)loggingshutdown main_context_mainrLr?r?r@mainbs $z Command.mainc sF|t|_|t||\}}|j|j|_t|j|j|j d|j rZdt j d<|j rrd|j t j d<|jr|jststdtt|jrt|j|_t|jstd|jd|_d|jkrtd td tftd tfd fd d }z4|js||j }n|j }t!j"dd|||WS||XdS)N) verbosityno_color user_log_file1 PIP_NO_INPUTr)PIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zThe directory '%s' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.z 2020-resolverz--use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0..)run_funcr(cs$tttdfdd }|S)NrJc sz|}t|tst|WStk rb}z&td|tjdddtWYSd}~XYnptk r}z(t t |tjdddt WYSd}~XYn*t t ttfk r}z(t t |tjdddtWYSd}~XYntk r:}z&t d|tjdddtWYSd}~XYntk rztdtjdtjkrrtjtjdtYStk rt dtjdddtYStk rtj d ddtYSXdS) Nz[present-rich] %szException information:T)exc_infoz%sz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz Exception:) isinstanceintrErloggererrordebugr rcriticalstrrrrrrrrprintsysstderrrMDEBUGr print_excKeyboardInterrupt BaseExceptionr)rGstatusexc) level_numberrXr?r@exc_logging_wrappersJ    zLCommand._main..intercepts_unhandled_exc..exc_logging_wrapper) functoolswrapsrr\)rXrlrk)rXr@intercepts_unhandled_excs0z/Command._main..intercepts_unhandled_excT) show_locals)# enter_contextrrrKverbosequietrRrrSlogno_inputosenviron exists_actionjoin require_venvr$r r]r`rcexitr cache_dirrrwarningfeatures_enabledrr\rF debug_moderIrich_tracebackinstall)r:rGrBrprIr?ror@rPisN           6  z Command._main)F)__name__ __module__ __qualname__r#ra__annotations__r$boolr/r9rrFrr\rIrrKrQrP __classcell__r?r?r=r@r!-s     )9r0rmrMlogging.configr3rwrcrrtypingrrrrrpip._vendor.richrZpip._internal.clir !pip._internal.cli.command_contextr pip._internal.cli.parserr r pip._internal.cli.status_codesr rrrpip._internal.exceptionsrrrrrrrpip._internal.utils.filesystemrpip._internal.utils.loggingrrpip._internal.utils.miscrrpip._internal.utils.temp_dirrTempDirRegistryrrpip._internal.utils.virtualenvr __all__ getLoggerrr]r!r?r?r?r@s0    $    PK]9]]]])cli/__pycache__/cmdoptions.cpython-38.pycnu[U ʗRe!u@s UdZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZmZmZmZmZddlmZddlmZdd lmZdd lmZmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'e(e)Z*e e e+ddddZ,ee+efee dddZ-d8e ee ddddZ.d9e e/ddddZ0e e+e+e+dddZ1e e+e+e+dd d!Z2Gd"d#d#e Z3ee d$d%d&d&d'd(Z4ed)e fe5d*<ee d+d,d-dd.d/Z6ed)e fe5d,<ee d0d1d-dd2d/Z7ed)e fe5d1<ee d3d4d5d-dd6d/Z8ed)e fe5d7<ee d8d9d:d;ddd-dd?d/Z:ed)e fe5d><ee d@dAdBd-dCd(Z;ed)e fe5dB<ee dDdEdFd;ddGd/Zed)e fe5dR<ee dVdWd-ddXd/Z?ed)e fe5dW<ee dYdZd[d\d]d^Z@ed)e fe5dZ<ee d_d`dadbdcd^ZAed)e fe5d`<ee dddedfdgdhdidjdkZBed)e fe5dg<e dldmdnZCee3dodpdSdSdqdrZDed)e fe5dp<ee3dsdtdSddSdudvZEed)e fe5dt<ee dwdxdydzd{e!jFd|d}ZGed)e fe5dz<e dld~dZHee ddd-ddd/ZIed)e fe5d<e dlddZJe dlddZKe dlddZLe dlddZMe dlddZNe e+e+e ddddZOee3ddddddSdedeOdd ZPed)e fe5d<e e edddZQe e+e+e ddddZRe e+e+e ddddZSe dlddZTe dlddZUee dddddddZVed)e fe5d<e+eeeWd)fee+fdddZXe e+e+e ddddZYee ddddeYd[dedd ZZed)e fe5d<ee dddddd}Z[ed)e fe5d<ee dddddddZ\ed)e fe5d<e ddddZ]e e#dddZ^e dldd„Z_ee3ddeddSddƍZ`ed)e fe5d<e e+e+e ddǜddɄZaee dddeadd̍Zbed)e fe5d<ee dddd-ddd/Zced)e fe5d<ee ddd-dd(Zded)e fe5d<ee dddddd/Zeed)e fe5d<ee ddd-ddd/Zfed)e fe5d<e e+e+e ddǜddZgee ddd-ddd/Zhee5d<ee dddegde dZiee5d<e e+e+e ddddZjee dde+dejdddZked)e fe5d<ee ddddddZled)e fe5d<ee ddddddZmed)e fe5d<ee ddddddZned)e fe5d<ee dd-dddZoed)e fe5d<ee dd-dddZped)e fe5d<ee ddd-ddd/Zqed)e fe5d<ee dddddgdd Zred)e fe5d<e e+e+e ddd d Zsee d d desdddZted)e fe5d<ee ddd-ddd/Zued)e fe5d<ee3ddSdSdddZved)e fe5d<e ddddZwee3ddddddd Zxed)e fe5d!<ee d"d#d-dd$d/Zyed)e fe5d#<ee d%d&d'dgd(d)d*gd+d,Zzed)e fe5d-<ee d.d/d'dgd0gd1d,Z{ed)e fe5d2<d3e4e6e7e8e9e;ee?e@eAeBeCeKeDeEe`ebeqe:eyeze{gd4Z|ee+efe5d5<d6eGeHeIeJgd4Z}ee+efe5d7<dS(:aC shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. N)partial) SUPPRESS_HELPOption OptionGroup OptionParserValues)dedent)AnyCallableDictOptionalTuplecanonicalize_name)ConfigOptionParser) CommandError)USER_CACHE_DIRget_src_prefix) FormatControl)PyPI) TargetPython) STRONG_HASHES) strtobool)parseroptionmsgreturncCs0|d|}td|}||dS)z Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. z error:  N)textwrapfilljoinspliterror)rrrr#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error$s r%)grouprrcCs,t||d}|dD]}||q|S)z Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser nameoptions)r add_option)r&r option_grouprr#r#r$make_option_group2s r+)r( check_optionsrcsXdkr |tttdfdd }dddg}tt||rT|j}|tddS) zDisable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. N)nrcs t|dSN)getattr)r-r,r#r$getnameJsz+check_install_build_global..getname build_optionsglobal_optionsinstall_optionszbDisabling all use of wheels due to the use of --build-option / --global-option / --install-option.) strr r anymapformat_controldisallow_binariesloggerwarning)r(r,r1namescontrolr#r0r$check_install_build_global>s  r>F)r( check_targetrcCsbt|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|r^|r^|j s^t ddS)zFunction for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. z:all:zWhen restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).zQCan not use any platform or abi specific options unless installing via '--target'N) r6python_version platformsabisimplementationrsetr8ignore_dependenciesr target_dir)r(r?dist_restriction_set binary_onlysdist_dependencies_allowedr#r#r$check_dist_restrictionWs&  rJ)roptvaluercCs tj|Sr.)ospath expanduserrrKrLr#r#r$_path_option_checksrQcCst|Sr.rrPr#r#r$_package_name_option_checksrRc@s0eZdZejdZejZeed<eed<dS) PipOption)rN package_namerTrNN) __name__ __module__ __qualname__rTYPES TYPE_CHECKERcopyrRrQr#r#r#r$rSs  rSz-hz--helphelpz Show help.)destactionr[.help_z--debug debug_mode store_truezbLet unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.r\r]defaultr[z --isolated isolated_modezSRun pip in an isolated mode, ignoring environment variables and user configuration.z--require-virtualenvz--require-venv require_venvzMAllow pip to only run in a virtual environment; exit with an error otherwise.require_virtualenvz-vz --verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z --no-colorno_colorzSuppress colored output.z-Vz --versionversionzShow version and exit.z-qz--quietquietzGive less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).z--progress-bar progress_barchoiceonoffzGSpecify whether the progress bar should be used [on, off] (default: on))r\typechoicesrbr[z--logz --log-filez --local-loglogrNz Path to a verbose appending log.)r\metavarror[z --no-inputno_inputzDisable prompting for input.z--proxyproxyr5zESpecify a proxy in the form scheme://[user:passwd@]proxy.server:port.)r\rorbr[z --retriesretriesintzRMaximum number of retries each connection should attempt (default %default times).z --timeoutz--default-timeoutsectimeoutfloatz2Set the socket timeout (default %default seconds).)rrr\rorbr[)rc Cs"tddddddddggd d d d S) Nz--exists-action exists_actionrlsiwbaappendr]zYDefault action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.)r\rorprbr]rrr[rr#r#r#r$r}(s r}z--certcertzPath to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information.)r\rorrr[z --client-cert client_certzkPath to SSL client certificate, a single file containing the private key and the certificate in PEM format.)r\rorbrrr[z-iz --index-urlz --pypi-url index_urlURLzBase URL of the Python Package Index (default %default). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format.)r\rrrbr[cCstddddgddS)Nz--extra-index-urlextra_index_urlsrrzmExtra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url.r\rrr]rbr[rr#r#r#r$extra_index_url_srz --no-indexno_indexzAIgnore package index (only looking at --find-links URLs instead).c CstddddgdddS)Nz-fz --find-links find_linksrurlaIf a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that's a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported.r\r]rbrrr[rr#r#r#r$rvsrcCstddddgddS)Nz--trusted-host trusted_hostsrHOSTNAMEz]Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.)r\r]rrrbr[rr#r#r#r$ trusted_hostsrc CstddddgdddS)Nz-cz --constraint constraintsrfilez\Constrain versions using the given constraints file. This option can be used multiple times.rrr#r#r#r$rsrc CstddddgdddS)Nz-rz --requirement requirementsrrzQInstall from the given requirements file. This option can be used multiple times.rrr#r#r#r$rsrc CstddddgdddS)Nz-ez --editable editablesrzpath/urlzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.rrr#r#r#r$editablesr)ropt_strrLrrcCs tj|}t|j|j|dSr.)rMrNabspathsetattrvaluesr\)rrrLrr#r#r$ _handle_srcs rz--srcz--sourcez --source-dirz--source-directorysrc_dirdircallbackzDirectory to check out editable projects into. The default in a virtualenv is "/src". The default for global installs is "/src".)r\rorrrbr]rr[src)rrrcCs t||jS)zGet a format_control object.)r/r\)rrr#r#r$_get_format_controlsrcCs"t|j|}t||j|jdSr.)rrrhandle_mutual_excludes no_binary only_binaryrrrLrexistingr#r#r$_handle_no_binarys  rcCs"t|j|}t||j|jdSr.)rrrrrrrr#r#r$_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr8rr5avDo not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty the set (notice the colons), or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.r\r]rrorbr[)rrDrrr8r#r#r$rsrc Cs$ttt}tdddtd|ddS)Nz --only-binaryr8rr5aKDo not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all source packages, ":none:" to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r)rrDrrrr#r#r$rsrz --platformrAplatformrzOnly use wheels compatible with . Defaults to the platform of the running system. Use this option multiple times to specify multiple platforms supported by the target interpreter.r)rLrcCs|sdS|d}t|dkr"dSt|dkrV|d}t|dkrV|d|ddg}ztdd |D}Wntk rYd SX|dfS) z Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. )NN.)r#z'at most three version parts are allowedrNcss|]}t|VqdSr.)rw).0partr#r#r$ 7sz*_convert_python_version..)r#z$each version part must be an integer)r!lentuple ValueError)rLparts version_infor#r#r$_convert_python_version!s    rcCs:t|\}}|dk r.d||}t|||d||j_dS)z3 Handle a provided --python-version value. Nz(invalid --python-version value: {!r}: {}rr)rformatr%rr@)rrrLrr error_msgrr#r#r$_handle_python_version>s rz--python-versionr@a The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). )r\rrr]rrorbr[z--implementationrCzOnly use wheels compatible with Python implementation , e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels.z--abirBabiaLOnly use wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Use this option multiple times to specify multiple abis supported by the target interpreter. Generally you will need to specify --implementation, --platform, and --python-version when using this option.)cmd_optsrcCs4|t|t|t|tdSr.)r)rAr@rCrB)rr#r#r$add_target_python_optionss   r)r(rcCst|j|j|j|jd}|S)N)rApy_version_inforBrC)rrAr@rBrC)r( target_pythonr#r#r$make_target_pythonsrcCstddddddS)Nz--prefer-binary prefer_binaryr`Fz8Prefer older binary packages over newer source packages.rarr#r#r#r$rsrz --cache-dir cache_dirzStore the cache data in .)r\rbrrror[)rrKrLrrc CsV|dk rJz t|Wn4tk rH}zt||t|dW5d}~XYnXd|j_dS)z Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. NrF)rrr%r5rr)rrKrLrexcr#r#r$_handle_no_cache_dirs  $ rz--no-cache-dirzDisable the cache.)r\r]rr[no_cachez --no-depsz--no-dependenciesrEz#Don't install package dependencies.no_depsz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationbuild_isolation store_falseTzDisable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used.no_build_isolationz--check-build-dependenciescheck_build_depsz1Check the build dependencies when PEP517 is used.cCsD|dk rd}t|||dtjds8d}t|||dd|j_dS)z Process a value provided for the --no-use-pep517 option. This is an optparse.Option callback for the no_use_pep517 option. Na0A value was passed for --no-use-pep517, probably using either the PIP_NO_USE_PEP517 environment variable or the "no-use-pep517" config file option. Use an appropriate value of the PIP_USE_PEP517 environment variable or the "use-pep517" config file option instead. r setuptoolszGIt is not possible to use --no-use-pep517 without setuptools installed.F)r% importlibutil find_specr use_pep517)rrKrLrrr#r#r$_handle_no_use_pep517s  rz --use-pep517rz^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)r\r]rrbr[ no_use_pep517cCs`|d\}}}|dkr*|d|dt|j|j}|dkrTi}t|j|j||||<dS)N=z Arguments to z must be of the form KEY=VAL) partitionr"r/rr\r)rrrLrkeysepvalr\r#r#r$_handle_config_settings.srz--config-settingsconfig_settingssettingszConfiguration settings to be passed to the PEP 517 build backend. Settings take the form KEY=VALUE. Use multiple --config-settings options to pass multiple keys to the backend.)r\ror]rrrr[z--install-optionr4r(a"Extra arguments to be supplied to the setup.py install command (use like --install-option="--install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.)r\r]rrr[z--build-optionr2z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)r\rrr]r[z--global-optionr3zcExtra global options to be supplied to the setup.py call before the install or bdist_wheel command.z --no-cleanz!Don't clean up build directories.)r]rbr[no_cleanz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.prez--disable-pip-version-checkdisable_pip_version_checkz{Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.z--root-user-actionroot_user_actionwarnignorezLAction if pip is run as a root user. By default, a warning message is shown.)r\rbrpr[cCs|jjsi|j_z|dd\}}Wn$tk rH|d|YnX|tkrj|d|dt|jj|g |dS)zkGiven a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.:rzTArguments to {} must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N) rhashesr!rr"rrr setdefaultr)rrrLralgodigestr#r#r$_handle_merge_hashs$ rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)r\r]rror[hashz--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.z--pathz^Restrict to the specified installation path for listing packages (can be used multiple times).)r\ror]r[ list_pathcCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')rNuserlocalr)r(r#r#r$check_list_path_optionsrz --excludeexcludespackagerTz)Exclude specified package from the output)r\r]rrror[ list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z --use-featurefeatures_enabledfeaturez 2020-resolverz fast-deps truststorezboolrJrQrRrSr^__annotations__r_rcrerfrhrirjrkrqrsrtrvrzr}rr simple_urlrrrrrrrrrrrrrrrrArwrrr@rCrBrrrrrrrrrrrrrrrr4r2r3rrrrrrrrrrrrrrrr#r#r#r$s              (                      $                          PK]ǭ77'cli/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdZdS)zGSubpackage containing all of pip's command line interface related code N)__doc__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/__init__.pyPK]~)(w1cli/__pycache__/base_command.cpython-38.opt-1.pycnu[U .eh@s6dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZddlmZmZddlmZmZmZmZmZddlmZmZmZmZmZdd lmZdd l m!Z!m"Z"dd l#m$Z$dd l%m&Z&dd l'm(Z(e&rddl)m*Z*m+Z+m,Z,ddlm-Z-dgZ.e/e0Z1GdddeZ2dS)z(Base Command class, and related routines)absolute_importprint_functionN) cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERRORSUCCESS UNKNOWN_ERRORVIRTUALENV_NOT_FOUND) BadCommand CommandErrorInstallationErrorPreviousBuildDirErrorUninstallationError) deprecated)BrokenStdoutLoggingError setup_logging)get_prog)MYPY_CHECK_RUNNING)running_under_virtualenv)ListTupleAny)ValuesCommandcsNeZdZdZdZdfdd ZddZddZd d Zd d Z d dZ Z S)rNFcstt||jdt|ftd||j|d}||_||_t f||_ d|j }t |j ||_ttj|j }|j |dS)Nz%s %sF)usageprogZ formatterZadd_help_optionname descriptionisolatedz %s Options)superr__init__rrr__doc__rsummaryrparser capitalizeoptparseZ OptionGroupZcmd_optsrZmake_option_groupZ general_groupZadd_option_group)selfrr%r!Z parser_kwZ optgroup_nameZgen_opts __class__B/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.pyr#4s&   zCommand.__init__cCsdS)zf This is a no-op so that commands by default do not do the pip version check. Nr,)r)optionsr,r,r-handle_pip_version_checkPsz Command.handle_pip_version_checkcCstdSN)NotImplementedError)r)r.argsr,r,r-runZsz Command.runcCs |j|Sr0)r& parse_argsr)r2r,r,r-r4^szCommand.parse_argsc Cs>z.|||W5QRW SQRXW5tXdSr0)loggingZshutdownZ main_context_mainr5r,r,r-maincs $z Command.mainc Cs||\}}|j|j|_t|j|j|jd}tjdddkrhd}t dkrZd|}t |ddd|j rxdt jd <|jrd |jt jd <|jr|jststd ttzz(|||}t|tr|WWSWntk r2}z.tt|tjd ddtWYWRSd}~XYn>t t!t"fk r}z.tt|tjd ddt#WYWSd}~XYnt$k r}z*td|tjd ddt#WYWSd}~XYnt%k rt&dtj'd|t(j)krt*j+tj'dt#YWfSt,k rDtdtjd ddt#YW2St-k rntjdddt.YWSXW5||Xt/S)N) verbosityno_colorZ user_log_file)r;zA future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportZCPythonzPython 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. )Z replacementZgone_in1Z PIP_NO_INPUT ZPIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zException information:T)exc_infoz%sz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz Exception:)0r4verbosequietr9rr:logsys version_infoplatformZpython_implementationrZno_inputosenvironZ exists_actionjoinZ require_venvignore_require_venvrloggerZcriticalexitr r/r3 isinstanceintrstrdebugr rrr rrrprintstderrr6DEBUG traceback print_excKeyboardInterrupt BaseExceptionr r )r)r2r.Z level_numbermessageZstatusexcr,r,r-r7ksn             z Command._main)F) __name__ __module__ __qualname__rrJr#r/r3r4r8r7 __classcell__r,r,r*r-r0s )3r$Z __future__rrr6Zlogging.configr(rGrFrDrTZpip._internal.clirZ!pip._internal.cli.command_contextrZpip._internal.cli.parserrrZpip._internal.cli.status_codesrr r r r Zpip._internal.exceptionsr rrrrZpip._internal.utils.deprecationrZpip._internal.utils.loggingrrZpip._internal.utils.miscrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrtypingrrrr__all__Z getLoggerrZrKrr,r,r,r-s0        PK]x˴-cli/__pycache__/autocompletion.cpython-38.pycnu[U ʗRe@sdZddlZddlZddlZddlmZddlmZmZm Z m Z ddl m Z ddl mZmZddlmZddd d Ze eeeee ed d d ZeeeedddZdS)zBLogic that powers autocompletion installed by ``pip completion``. N)chain)AnyIterableListOptional)create_main_parser) commands_dictcreate_command)get_default_environment)returncsdtjkrdStjdddttjd}z|dWntk rZdYnXt}tt}g}d}D]}||krv|}qqv|dk rJ|dkrt d d o|d k}|rt } fd d |j d d D}|r|D] } t| qt d d o"|dk} | rNtdD]} t| q4t dt|} | jjD]8} | jtjkr^| j| jD]}||| jfq|q^dd d|dDfdd |D}fdd |D}t|| jj}|rt|}dd |D}|D]>}|d}|dr<|ddddkr<|d7}t|qndd |jD}||jt|} dr|D]$} | jtjkr|| j| j7}qn t||}|rtt|}tdfdd |Dt ddS)z:Entry Point for completion of main and subcommand options.PIP_AUTO_COMPLETEN COMP_WORDS COMP_CWORDhelp-)show uninstallcs0g|](}|jr|jddkr|jqS)rN)canonical_name startswith).0dist)cwordslc/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py 2s z autocomplete..T) local_onlyinstallpathcSsg|]}|ddqS)=r)splitrxrrrrNscs g|]\}}|kr||fqSrr)rr$v) prev_optsrrrOscs"g|]\}}|r||fqSrr)rkr%currentrrrQs cSsg|] }|dfqS)rr)rr rrrr\srz--r!cSsg|] }|jqSr) option_list)rirrrrfs csg|]}|r|qSrr'r#r)rrrss ) osenvironr"int IndexErrorrlistrsysexitrr loweriter_installed_distributionsprintauto_complete_pathsr parseroption_list_allroptparse SUPPRESS_HELP _long_opts _short_optsappendnargsget_path_completion_type option_groupsr,r from_iterablejoin)cwordr: subcommandsoptionssubcommand_namewordshould_list_installedenv installedrshould_list_installablesr subcommandoptopt_strcompletion_typepathsoption opt_labeloptsflattened_optsr)r*rrr&r autocompletes                 rX)rrFrVr cCs|dks||ddsdS|D]n}|jtjkr4q"t|dD]L}||ddd|krB|jrtdd|jdDrB|jSqBq"dS) aLGet the type of path completion (``file``, ``dir``, ``path`` or None) :param cwords: same as the environmental variable ``COMP_WORDS`` :param cword: same as the environmental variable ``COMP_CWORD`` :param opts: The available options to check :return: path completion type (``file``, ``dir``, ``path`` or None) r+rN/r!rcss|]}|dkVqdS))r filedirNrr#rrr sz+get_path_completion_type..)rrr<r=strr"metavarany)rrFrVrPorrrrBws   rB)r*rRr c#stj|\}tj|}t|tjs.dStjfddt|D}|D]`}tj||}tjtj||}|dkrtj |r|VqVtj |rVtj|dVqVdS)atIf ``completion_type`` is ``file`` or ``path``, list all regular files and directories starting with ``current``; otherwise only list directories starting with ``current``. :param current: The word to be completed :param completion_type: path completion type(``file``, ``path`` or ``dir``) :return: A generator of regular files and/or directories Nc3s$|]}tj|r|VqdS)N)r/r normcaserr#filenamerrr\sz&auto_complete_paths..r[r) r/r r"abspathaccessR_OKralistdirrEisfileisdir)r*rR directory current_path file_listfrP comp_filerrbrr9s     r9)__doc__r<r/r4 itertoolsrtypingrrrrpip._internal.cli.main_parserrpip._internal.commandsrr pip._internal.metadatar rXr]r1rBr9rrrrs   i PK]4++4cli/__pycache__/command_context.cpython-38.opt-1.pycnu[U .e@s,ddlmZddlmZGdddeZdS))contextmanager) ExitStackcs0eZdZfddZeddZddZZS)CommandContextMixIncs tt|d|_t|_dS)NF)superr__init___in_main_contextr _main_contextself __class__E/usr/lib/python3.8/site-packages/pip/_internal/cli/command_context.pyr szCommandContextMixIn.__init__c cs0d|_z|j dVW5QRXW5d|_XdS)NTF)rrr r r r main_contexts z CommandContextMixIn.main_contextcCs |j|S)N)r enter_context)r Zcontext_providerr r rrsz!CommandContextMixIn.enter_context)__name__ __module__ __qualname__rrrr __classcell__r r r rr s  rN) contextlibrZpip._vendor.contextlib2robjectrr r r rs  PK]*cli/__pycache__/main_parser.cpython-38.pycnu[U ʗRe6 @sdZddlZddlZddlmZmZddlmZddlm Z m Z ddl m Z m Z ddlmZddlmZmZd d gZe d d d Zeeeeeefd dd ZdS)z=A single place for constructing and exposing the main parser N)ListTuple) cmdoptions)ConfigOptionParserUpdatingDefaultsHelpFormatter) commands_dictget_similar_commands) CommandError)get_pip_versionget_progcreate_main_parser parse_command)returncCsltddtdtd}|t|_ttj|}| |d|_ dgddt D}d ||_|S) z1Creates and returns the main parser for pip's CLIz %prog [options]Fglobal)usageadd_help_option formatternameprogTcSs"g|]\}}|dd|jqS)27 )summary).0r command_infor/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py 'sz&create_main_parser.. )rrr disable_interspersed_argsr versionrmake_option_group general_groupadd_option_groupmainritemsjoin description)parsergen_optsr'rrrr s"   )argsrcCst}||\}}|jr>tj|jtjtjt|rZ|ddkrjt |dkrj| t|d}|t krt |}d|dg}|r| d|dtd||dd}||||fS)Nrhelpzunknown command ""zmaybe you meant "z - )r parse_argsr sysstdoutwriteoslinesepexitlen print_helprrappendr r&remove)r*r(general_options args_elsecmd_nameguessmsgcmd_argsrrrr 0s&   )__doc__r2r/typingrrZpip._internal.clirpip._internal.cli.parserrrpip._internal.commandsrrpip._internal.exceptionsr pip._internal.utils.miscr r __all__r strr rrrrs  PK]@0cli/__pycache__/req_command.cpython-38.opt-1.pycnu[U .ec,@sXdZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z dd lmZdd lmZdd lmZdd lmZmZmZdd lmZddlmZmZddlmZddlm Z e r"ddl!m"Z"ddl#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0GdddeZ1Gdddee1Z2Gddde2Z3dS)aContains the Command base classes that depend on PipSession. The classes in this module are in a separate module so the commands not needing download / PackageFinder capability don't unnecessarily import the PackageFinder machinery and all its vendored dependencies, etc. N)partial)Command)CommandContextMixIn) CommandError) PackageFinder)Resolver)SelectionPreferences) PipSession)RequirementPreparer)install_req_from_editableinstall_req_from_lineinstall_req_from_req_string)parse_requirements)make_link_collectorpip_self_version_check)normalize_path)MYPY_CHECK_RUNNING)Values)ListOptionalTuple) WheelCache) TargetPython)RequirementSet)RequirementTracker) TempDirectorycs>eZdZdZfddZeddZddZd d d ZZ S) SessionCommandMixinzE A class mixin for command classes needing _build_session(). cstt|d|_dS)N)superr__init___session)self __class__A/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.pyr2szSessionCommandMixin.__init__cCsLg}t|dds*t|dd}|r*||t|dd}|rD|||pJdS)z7Return a list of index urls from user-provided options.no_indexFZ index_urlNZextra_index_urls)getattrappendextend)clsoptions index_urlsZurlZurlsr#r#r$_get_index_urls6s     z#SessionCommandMixin._get_index_urlscCs"|jdkr||||_|jS)zGet a default-managed session.N)r enter_context_build_session)r r*r#r#r$get_default_sessionDs z'SessionCommandMixin.get_default_sessionNcCst|jrttj|jdnd|dk r*|n|j|j||d}|j rN|j |_ |j r\|j |_ |j sf|rz|dk rr|n|j |_ |j r|j |j d|_|j |j_|S)Nhttp)cacheretries trusted_hostsr+)r0Zhttps)r cache_dirrospathjoinr2r3r,ZcertZverifyZ client_certtimeoutproxyZproxiesZno_inputZauthZ prompting)r r*r2r8sessionr#r#r$r.Ks*   z"SessionCommandMixin._build_session)NN) __name__ __module__ __qualname____doc__r classmethodr,r/r. __classcell__r#r#r!r$r-s   rc@seZdZdZddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. c CsF|js |jrdS|j|dtd|jd}|t||W5QRXdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. Nr)r2r8)Zdisable_pip_version_checkr%r.minr8r)r r*r:r#r#r$handle_pip_version_checkzs  z*IndexGroupCommand.handle_pip_version_checkN)r;r<r=r>rDr#r#r#r$rArsrAc @s:eZdZed ddZedddZd d Zdd d ZdS)RequirementCommandNc Cs"|j}t||j|||j|j|dS)zQ Create a RequirementPreparer instance for the given parameters. )Z build_dirsrc_dir download_dirwheel_download_dir progress_barbuild_isolation req_tracker)r6r rFrIrJ)Ztemp_build_dirr*rKrGrHZtemp_build_dir_pathr#r#r$make_requirement_preparers z,RequirementCommand.make_requirement_preparerFTto-satisfy-onlyc Cs2tt|j|| d} t|||| ||j|||| | d S)zF Create a Resolver instance for the given parameters. )isolated wheel_cache use_pep517) preparerr:findermake_install_req use_user_siteignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info)rr isolated_moderrU) rQr:rRr*rOrTrVrWrXrYrPrZrSr#r#r$ make_resolvers&z RequirementCommand.make_resolverc Cs,|jD].}t|d||||dD]}d|_||qq|D]*} t| d|j|j|d}d|_||q:|jD](} t| |j|j|d}d|_||ql|j D]0}t||||||jdD]}d|_||qq|j |_ |s(|js(|j s(d|j i} |j rt dt| d|j d n t d | dS) z? Marshal cmd line args into a requirement set. T)Z constraintrRr*r:rON)rNrPrO)rRr*r:rOrPnamez^You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?) )ZlinkszLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))Z constraintsrZ is_directZadd_requirementr r[rPZ editablesr Z requirementsZrequire_hashesr]Z find_linksrdictr7) r Zrequirement_setargsr*rRr:rOfilenameZ req_to_addZreqZoptsr#r#r$populate_requirement_setsn        z+RequirementCommand.populate_requirement_setcCs4t||d}td|j|j|j|d}tj|||dS)z Create a package finder appropriate to this requirement command. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. )r*T)Z allow_yankedformat_controlZallow_all_prereleases prefer_binaryrW)link_collectorselection_prefs target_python)rrrcZprerdrZcreate)r r*r:rgrWrerfr#r#r$_build_package_finders z(RequirementCommand._build_package_finder)NN)NFTFFrMNN)NN)r;r<r= staticmethodrLr\rbrhr#r#r#r$rEs$  &GrE)4r>r5 functoolsrZpip._internal.cli.base_commandrZ!pip._internal.cli.command_contextrZpip._internal.exceptionsrZpip._internal.indexrZpip._internal.legacy_resolverZ$pip._internal.models.selection_prefsrZpip._internal.network.sessionr Z pip._internal.operations.preparer Zpip._internal.req.constructorsr r r Zpip._internal.req.req_filerZ!pip._internal.self_outdated_checkrrZpip._internal.utils.miscrZpip._internal.utils.typingrZoptparsertypingrrrZpip._internal.cacherZ"pip._internal.models.target_pythonrZpip._internal.req.req_setrZpip._internal.req.req_trackerrZpip._internal.utils.temp_dirrrrArEr#r#r#r$s4                   EPK]qq3cli/__pycache__/autocompletion.cpython-38.opt-1.pycnu[U .e@s`dZddlZddlZddlZddlmZddlmZmZddl m Z ddZ dd Z d d Z dS) zBLogic that powers autocompletion installed by ``pip completion``. N)create_main_parser) commands_dictcreate_command)get_installed_distributionscsdtjkrdStjddd}ttjd}z||dWntk rZdYnXttg}zfdd|Dd }Wntk rd}YnXt}|r:|d krt d|d kö d  }|r>g} }t d dD].}|j |r|j |ddkr||j q|r>|D]}t|q$t dt|} | jjD]8} | jtjkrN| j| jD]} || | jfqlqNdd|d|dDfdd|D}fdd|D}t||| jj} | rt| }dd|D}|D]>} | d }| dr,| d dddkr,|d7}t|qndd|jD}||jdd|D} d r|D]$} | jtjkrt| j| j7qtnt|||} | rt| tdfddDt ddS)z?Entry Point for completion of main and subcommand options. ZPIP_AUTO_COMPLETENZ COMP_WORDSZ COMP_CWORDcsg|]}|kr|qSr).0w) subcommandsrD/usr/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py !sz autocomplete..rhelp)ZshowZ uninstall-T)Z local_onlycSsg|]}|ddqS)=r)splitr xrrr r Dscs g|]\}}|kr||fqSrr)r rv) prev_optsrr r Escs"g|]\}}|r||fqSr startswith)r krcurrentrr r Gs css|]}|dfVqdS)rNr)r optrrr Pszautocomplete..z--rcSsg|] }|jqSr) option_list)r irrr r Zscss|]}|D] }|Vq qdSNr)r itorrr r\s csg|]}|r|qSrrrrrr r gs )osenvironrint IndexErrorlistrrsysexitrlowerrkeyappendprintrparserZoption_list_allroptparse SUPPRESS_HELPZ _long_optsZ _short_optsnargsget_path_completion_typeauto_complete_pathsZ option_groupsrjoin)cwordscwordZoptionsZsubcommand_namer/Zshould_list_installedZ installedZlcZdistZ subcommandrZopt_strcompletion_typeZoptionZ opt_labeloptsr)rrr r autocompletes              r:cCs|dks||ddsdS|D]n}|jtjkr4q"t|dD]L}||ddd|krB|jrtdd|jdDrB|jSqBq"dS) aLGet the type of path completion (``file``, ``dir``, ``path`` or None) :param cwords: same as the environmental variable ``COMP_WORDS`` :param cword: same as the environmental variable ``COMP_CWORD`` :param opts: The available options to check :return: path completion type (``file``, ``dir``, ``path`` or None) rrN/rrcss|]}|dkVqdS))pathfiledirNrrrrr rzsz+get_path_completion_type..)rrr0r1strrmetavarany)r6r7r9rr"rrr r3ks  r3c#stj|\}tj|}t|tjs.dStjfddt|D}|D]`}tj||}tjtj||}|dkrtj |r|VqVtj |rVtj|dVqVdS)aoIf ``completion_type`` is ``file`` or ``path``, list all regular files and directories starting with ``current``; otherwise only list directories starting with ``current``. :param current: The word to be completed :param completion_type: path completion type(`file`, `path` or `dir`)i :return: A generator of regular files and/or directories Nc3s$|]}tj|r|VqdSr )r$r<normcaserrfilenamerr rsz&auto_complete_paths..r>r) r$r<rabspathaccessR_OKrBlistdirr5isfileisdir)rr8Z directoryZ current_pathZ file_listfrZ comp_filerrCr r4s    r4)__doc__r0r$r)Zpip._internal.cli.main_parserrZpip._internal.commandsrrZpip._internal.utils.miscrr:r3r4rrrr s  [PK]c 3 3*cli/__pycache__/req_command.cpython-38.pycnu[U ʗReF@sdZddlZddlZddlZddlmZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZddlmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)m*Z*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5m6Z6m7Z7ddl8m9Z9e r^ddl:m;Z;ee ddddZ?GdddeZ@Gd d!d!ee@ZAe7jBe7jCe7jDgZEddd"d#ZFe e d$d%d&ZGGd'd(d(eAZHdS))aContains the Command base classes that depend on PipSession. The classes in this module are in a separate module so the commands not needing download / PackageFinder capability don't unnecessarily import the PackageFinder machinery and all its vendored dependencies, etc. N)partial)Values) TYPE_CHECKINGAnyListOptionalTuple) WheelCache) cmdoptions)Command)CommandContextMixIn) CommandErrorPreviousBuildDirError) LinkCollector) PackageFinder)SelectionPreferences) TargetPython) PipSession) BuildTracker)RequirementPreparer)install_req_from_editableinstall_req_from_line#install_req_from_parsed_requirementinstall_req_from_req_string)parse_requirements)InstallRequirement) BaseResolver)pip_self_version_check) TempDirectoryTempDirectoryTypeRegistry tempdir_kinds)running_under_virtualenv) SSLContextr"returncCsvtjdkrtdz ddl}Wn tk r>tdYdSXz ddl}Wntk rhtdYnX||j S)N) z9The truststore feature is only available for Python 3.10+rz1Disabling truststore since ssl support is missingz]To use the truststore feature, 'truststore' must be installed into pip's current environment.) sys version_infor ssl ImportErrorloggerwarning truststorer"PROTOCOL_TLS_CLIENT)r)r-r//builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/req_command.py_create_truststore_ssl_context2s     r1csreZdZdZddfdd Zeeeee dddZ ee dd d Z deee ee ee d d dZZS)SessionCommandMixinzE A class mixin for command classes needing _build_session(). Nr#cstd|_dSN)super__init___session)self __class__r/r0r5Ms zSessionCommandMixin.__init__optionsr$cCsLg}t|dds*t|dd}|r*||t|dd}|rD|||pJdS)z7Return a list of index urls from user-provided options.no_indexF index_urlNextra_index_urls)getattrappendextend)clsr; index_urlsurlurlsr/r/r0_get_index_urlsQs     z#SessionCommandMixin._get_index_urlscCs0|jdkr*||||_|jdk s*t|jS)zGet a default-managed session.N)r6 enter_context_build_sessionAssertionError)r7r;r/r/r0get_default_session_s z'SessionCommandMixin.get_default_sessionF)r;retriestimeoutfallback_to_certifir$cCs|j}|rtj|std|jkrPz t}WqTtk rL|sDd}YqTXnd}t|rhtj |dnd|dk rv|n|j |j | ||d}|j r|j |_|jr|j|_ |js|r|dk r|n|j|_|jr|j|jd|_|j |j_|S)Nr-http)cacherK trusted_hostsrC ssl_context)rNhttps) cache_dirospathisabsrIfeatures_enabledr1 ExceptionrjoinrKrPrFcertverify client_certrLproxyproxiesno_inputauth prompting)r7r;rKrLrMrSrQsessionr/r/r0rHis:      z"SessionCommandMixin._build_session)NNF)__name__ __module__ __qualname____doc__r5 classmethodrrrstrrFrrJintboolrH __classcell__r/r/r8r0r2Gs  r2c@s eZdZdZeddddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. Nr:c CsVt|dst|js|jrdS|j|dtd|jdd}|t||W5QRXdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r<NrT)rKrLrM)hasattrrIdisable_pip_version_checkr<rHminrLr)r7r;rbr/r/r0handle_pip_version_checks   z*IndexGroupCommand.handle_pip_version_check)rcrdrerfrrqr/r/r/r0rlsrlcCsNtr dSttdsdStjdks,tjdkr0dStdkr@dStddS)zOutput a warning for sudo users on Unix. In a virtual environment, sudo pip still writes to virtualenv. On Windows, users may run pip as Administrator without issues. This warning only applies to Unix root users outside of virtualenv. Ngetuidwin32cygwinrzRunning pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv)r!rnrTr'platformrrr+r,r/r/r/r0warn_if_run_as_roots  rv)funcr$cs6tddddttttttdfdd }|S)zNDecorator for common logic related to managing temporary directories. N)registryr$cSstD]}||dqdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)rxtr/r/r0configure_tempdir_registrysz0with_cleanup..configure_tempdir_registry)r7r;argsr$csR|jdk st|jr|jz|||WStk rL|jYnXdSr3)tempdir_registryrIno_cleanr)r7r;r}r|rwr/r0wrappers  zwith_cleanup..wrapper)rRequirementCommandrrrrri)rwrr/rr0 with_cleanupsrcseZdZeeddfdd ZeeedddZe de ee e e eeeeed d d Ze dee eeeeeeeeeeeeedfed ddZeeee e eedddZee ddddZdee eeeee dddZZS)rN)r}kwr$cs"tj|||jtdSr3)r4r5cmd_opts add_optionr r)r7r}rr8r/r0r5szRequirementCommand.__init__r:cCsd|jkrdSdS)zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy 2020-resolver)deprecated_features_enabledr;r/r/r0determine_resolver_variants z-RequirementCommand.determine_resolver_variantr) temp_build_dirr; build_trackerrbfinder use_user_site download_dir verbosityr$c Cs|j} | dk st||} | dkr>d|jk} | rVtdnd} d|jkrVtdt| |j||j|j |||j ||j || |d S)zQ Create a RequirementPreparer instance for the given parameters. Nrz fast-depszpip is using lazily downloaded wheels using HTTP range requests to obtain dependency information. This experimental feature is enabled through --use-feature=fast-deps and it is not ready for production.Fz;fast-deps has no effect when used with the legacy resolver.) build_dirsrc_dirrbuild_isolationcheck_build_depsrrb progress_barrrequire_hashesr lazy_wheelr) rUrIrrWr+r,rrrrrr) rBrr;rrbrrrrtemp_build_dir_pathresolver_variantrr/r/r0make_requirement_preparers:    z,RequirementCommand.make_requirement_preparerFTto-satisfy-only.) preparerrr; wheel_cacherignore_installedignore_requires_pythonforce_reinstallupgrade_strategy use_pep517py_version_infor$c  Cstt|j| t|ddd} ||} | dkr^ddl}|jjjj j |||| ||j |||| | d Sddl }|jjj j j |||| ||j |||| | d S)zF Create a Resolver instance for the given parameters. config_settingsN)isolatedrrrr) rrrmake_install_reqrignore_dependenciesrrrrr)rr isolated_moder?r,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibresolverResolverr(pip._internal.resolution.legacy.resolverr)rBrrr;rrrrrrrrrrpipr/r/r0 make_resolverDsH     z RequirementCommand.make_resolver)r}r;rrbr$c Csbg}|jD]6}t|d|||dD]}t||jdd}||q q |D].} t| d|j|jdt|ddd}||qF|jD],} t | d|j|jt|ddd}||q||j D]8}t||||d D]"}t||j|jdd }||qqt d d |Drd|_ |s^|js^|j s^d |j i} |jrNtdjft| d|jdntdjf| |S)zS Parse command-line arguments into the corresponding requirements. T) constraintrr;rbF)r user_suppliedNr)rrrr)rrrr)rr;rb)rrrcss|] }|jVqdSr3)has_hash_options).0reqr/r/r0 sz6RequirementCommand.get_requirements..namezXYou must give at least one requirement to {name} (maybe you meant "pip {name} {links}"?) )linkszHYou must give at least one requirement to {name} (see "pip help {name}")) constraintsrrrr@rrr? editablesr requirementsanyrr find_linksr formatdictrY) r7r}r;rrbrfilename parsed_req req_to_addroptsr/r/r0get_requirementss           z#RequirementCommand.get_requirements)rr$cCs |j}|}|rt|dS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsr+info)rr locationsr/r/r0trace_basic_infosz#RequirementCommand.trace_basic_info)r;rb target_pythonrr$cCs6tj||d}td|j|j|j|d}tj|||dS)z Create a package finder appropriate to this requirement command. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. rT) allow_yankedformat_controlallow_all_prereleases prefer_binaryr)link_collectorselection_prefsr)rcreaterrprerr)r7r;rbrrrrr/r/r0_build_package_finders z(RequirementCommand._build_package_finder)Nr)NFTFFrNN)NN)rcrdrerr5 staticmethodrrhrrgrrrrrjrrirrr rrrrrrrrrrkr/r/r8r0rsr 3= Qr)IrfloggingrTr' functoolsroptparsertypingrrrrrpip._internal.cacher Zpip._internal.clir pip._internal.cli.base_commandr !pip._internal.cli.command_contextr pip._internal.exceptionsr rpip._internal.index.collectorr"pip._internal.index.package_finderr$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.network.sessionr,pip._internal.operations.build.build_trackerr pip._internal.operations.preparerpip._internal.req.constructorsrrrrZpip._internal.req.req_filerZpip._internal.req.req_installrpip._internal.resolution.baser!pip._internal.self_outdated_checkrpip._internal.utils.temp_dirrrr pip._internal.utils.virtualenvr!r)r" getLoggerrcr+r1r2rl BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDryrvrrr/r/r/r0sL                    W$PK]J//.cli/__pycache__/command_context.cpython-38.pycnu[U ʗRe@sBddlmZmZddlmZmZmZedddZGdddZdS) ) ExitStackcontextmanager)ContextManager GeneratorTypeVar_TT) covariantcsLeZdZddfdd ZeeddddZeeedd d Z Z S) CommandContextMixInN)returncstd|_t|_dS)NF)super__init___in_main_contextr _main_contextself __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/command_context.pyr s zCommandContextMixIn.__init__)NNNc cs:|jr td|_z|j dVW5QRXW5d|_XdS)NTF)r AssertionErrorrrrrr main_context s  z CommandContextMixIn.main_context)context_providerr cCs|js t|j|S)N)r rr enter_context)rrrrrrs z!CommandContextMixIn.enter_context) __name__ __module__ __qualname__r rrrrrr __classcell__rrrrr s r N) contextlibrrtypingrrrrr rrrrs PK]E-cli/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e@sdZdS)zGSubpackage containing all of pip's command line interface related code N)__doc__rr>/usr/lib/python3.8/site-packages/pip/_internal/cli/__init__.pyPK]vnncli/base_command.pynu["""Base Command class, and related routines""" import functools import logging import logging.config import optparse import os import sys import traceback from optparse import Values from typing import Any, Callable, List, Optional, Tuple 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 ( ERROR, PREVIOUS_BUILD_DIR_ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND, ) from pip._internal.exceptions import ( BadCommand, CommandError, InstallationError, NetworkConnectionError, PreviousBuildDirError, UninstallationError, ) 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 __all__ = ["Command"] logger = logging.getLogger(__name__) class Command(CommandContextMixIn): usage: str = "" ignore_require_venv: bool = False def __init__(self, name: str, summary: str, isolated: bool = False) -> None: super().__init__() self.name = name self.summary = summary self.parser = ConfigOptionParser( usage=self.usage, prog=f"{get_prog()} {name}", formatter=UpdatingDefaultsHelpFormatter(), add_help_option=False, name=name, description=self.__doc__, isolated=isolated, ) self.tempdir_registry: Optional[TempDirRegistry] = None # Commands should add options to this option group optgroup_name = f"{self.name.capitalize()} Options" self.cmd_opts = optparse.OptionGroup(self.parser, optgroup_name) # Add the general options gen_opts = cmdoptions.make_option_group( cmdoptions.general_group, self.parser, ) self.parser.add_option_group(gen_opts) self.add_options() def add_options(self) -> None: pass def handle_pip_version_check(self, options: Values) -> None: """ This is a no-op so that commands by default do not do the pip version check. """ # Make sure we do the pip version check if the index_group options # are present. assert not hasattr(options, "no_index") def run(self, options: Values, args: List[str]) -> int: raise NotImplementedError def parse_args(self, args: List[str]) -> Tuple[Values, List[str]]: # factored out for testability return self.parser.parse_args(args) def main(self, args: List[str]) -> int: try: with self.main_context(): return self._main(args) finally: logging.shutdown() def _main(self, args: List[str]) -> int: # We must initialize this before the tempdir manager, otherwise the # configuration would not be accessible by the time we clean up the # tempdir manager. self.tempdir_registry = self.enter_context(tempdir_registry()) # Intentionally set as early as possible so globally-managed temporary # directories are available to the rest of the code. self.enter_context(global_tempdir_manager()) options, args = self.parse_args(args) # Set verbosity so that it can be used elsewhere. self.verbosity = options.verbose - options.quiet level_number = setup_logging( verbosity=self.verbosity, no_color=options.no_color, user_log_file=options.log, ) # TODO: Try to get these passing down from the command? # without resorting to os.environ to hold these. # This also affects isolated builds and it should. if options.no_input: os.environ["PIP_NO_INPUT"] = "1" if options.exists_action: os.environ["PIP_EXISTS_ACTION"] = " ".join(options.exists_action) if options.require_venv and not self.ignore_require_venv: # If a venv is required check if it can really be found if not running_under_virtualenv(): logger.critical("Could not find an activated virtualenv (required).") sys.exit(VIRTUALENV_NOT_FOUND) if options.cache_dir: options.cache_dir = normalize_path(options.cache_dir) if not check_path_owner(options.cache_dir): logger.warning( "The directory '%s' or its parent directory is not owned " "or is not writable by the current user. The cache " "has been disabled. Check the permissions and owner of " "that directory. If executing pip with sudo, you should " "use sudo's -H flag.", options.cache_dir, ) options.cache_dir = None if "2020-resolver" in options.features_enabled: logger.warning( "--use-feature=2020-resolver no longer has any effect, " "since it is now the default dependency resolver in pip. " "This will become an error in pip 21.0." ) def intercepts_unhandled_exc( run_func: Callable[..., int] ) -> Callable[..., int]: @functools.wraps(run_func) def exc_logging_wrapper(*args: Any) -> int: try: status = run_func(*args) assert isinstance(status, int) return status except PreviousBuildDirError as exc: logger.critical(str(exc)) logger.debug("Exception information:", exc_info=True) return PREVIOUS_BUILD_DIR_ERROR except ( InstallationError, UninstallationError, BadCommand, NetworkConnectionError, ) as exc: logger.critical(str(exc)) logger.debug("Exception information:", exc_info=True) return ERROR except CommandError as exc: logger.critical("%s", exc) logger.debug("Exception information:", exc_info=True) return ERROR except BrokenStdoutLoggingError: # Bypass our logger and write any remaining messages to # stderr because stdout no longer works. print("ERROR: Pipe to stdout was broken", file=sys.stderr) if level_number <= logging.DEBUG: traceback.print_exc(file=sys.stderr) return ERROR except KeyboardInterrupt: logger.critical("Operation cancelled by user") logger.debug("Exception information:", exc_info=True) return ERROR except BaseException: logger.critical("Exception:", exc_info=True) return UNKNOWN_ERROR return exc_logging_wrapper try: if not options.debug_mode: run = intercepts_unhandled_exc(self.run) else: run = self.run return run(options, args) finally: self.handle_pip_version_check(options) PK]o6 6 cli/main_parser.pynu["""A single place for constructing and exposing the main parser """ import os import sys from typing import List, Tuple 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 __all__ = ["create_main_parser", "parse_command"] def create_main_parser() -> ConfigOptionParser: """Creates and returns the main parser for pip's CLI""" parser = ConfigOptionParser( usage="\n%prog [options]", add_help_option=False, formatter=UpdatingDefaultsHelpFormatter(), name="global", prog=get_prog(), ) parser.disable_interspersed_args() parser.version = get_pip_version() # add the general options gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser) parser.add_option_group(gen_opts) # so the help formatter knows parser.main = True # type: ignore # create command listing for description description = [""] + [ f"{name:27} {command_info.summary}" for name, command_info in commands_dict.items() ] parser.description = "\n".join(description) return parser def parse_command(args: List[str]) -> Tuple[str, List[str]]: parser = create_main_parser() # Note: parser calls disable_interspersed_args(), so the result of this # call is to split the initial args into the general options before the # subcommand and everything else. # For example: # args: ['--timeout=5', 'install', '--user', 'INITools'] # general_options: ['--timeout==5'] # args_else: ['install', '--user', 'INITools'] general_options, args_else = parser.parse_args(args) # --version if general_options.version: sys.stdout.write(parser.version) sys.stdout.write(os.linesep) sys.exit() # pip || pip help -> print_help() if not args_else or (args_else[0] == "help" and len(args_else) == 1): parser.print_help() sys.exit() # the subcommand name cmd_name = args_else[0] if cmd_name not in commands_dict: guess = get_similar_commands(cmd_name) msg = [f'unknown command "{cmd_name}"'] if guess: msg.append(f'maybe you meant "{guess}"') raise CommandError(" - ".join(msg)) # all the args without the subcommand cmd_args = args[:] cmd_args.remove(cmd_name) return cmd_name, cmd_args PK]ñ$*$* cli/parser.pynu["""Base option parser setup""" import logging import optparse import shutil import sys import textwrap from contextlib import suppress from typing import Any, Dict, Iterator, List, 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 logger = logging.getLogger(__name__) class PrettyHelpFormatter(optparse.IndentedHelpFormatter): """A prettier/less verbose help formatter for optparse.""" def __init__(self, *args: Any, **kwargs: Any) -> None: # help position must be aligned with __init__.parseopts.description kwargs["max_help_position"] = 30 kwargs["indent_increment"] = 1 kwargs["width"] = shutil.get_terminal_size()[0] - 2 super().__init__(*args, **kwargs) def format_option_strings(self, option: optparse.Option) -> str: return self._format_option_strings(option) def _format_option_strings( self, option: optparse.Option, mvarfmt: str = " <{}>", optsep: str = ", " ) -> str: """ Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string :param optsep: separator """ opts = [] if option._short_opts: opts.append(option._short_opts[0]) if option._long_opts: opts.append(option._long_opts[0]) if len(opts) > 1: opts.insert(1, optsep) if option.takes_value(): assert option.dest is not None metavar = option.metavar or option.dest.lower() opts.append(mvarfmt.format(metavar.lower())) return "".join(opts) def format_heading(self, heading: str) -> str: if heading == "Options": return "" return heading + ":\n" def format_usage(self, usage: str) -> str: """ Ensure there is only one newline between usage and the first heading if there is no description. """ msg = "\nUsage: {}\n".format(self.indent_lines(textwrap.dedent(usage), " ")) return msg def format_description(self, description: str) -> str: # leave full control over description to us if description: if hasattr(self.parser, "main"): label = "Commands" else: label = "Description" # some doc strings have initial newlines, some don't description = description.lstrip("\n") # some doc strings have final newlines and spaces, some don't description = description.rstrip() # dedent, then reindent description = self.indent_lines(textwrap.dedent(description), " ") description = f"{label}:\n{description}\n" return description else: return "" def format_epilog(self, epilog: str) -> str: # leave full control over epilog to us if epilog: return epilog else: return "" def indent_lines(self, text: str, indent: str) -> str: new_lines = [indent + line for line in text.split("\n")] return "\n".join(new_lines) class UpdatingDefaultsHelpFormatter(PrettyHelpFormatter): """Custom help formatter for use in ConfigOptionParser. This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. Also redact auth from url type options """ def expand_default(self, option: optparse.Option) -> str: default_values = None if self.parser is not None: assert isinstance(self.parser, ConfigOptionParser) self.parser._update_defaults(self.parser.defaults) assert option.dest is not None default_values = self.parser.defaults.get(option.dest) help_text = super().expand_default(option) if default_values and option.metavar == "URL": if isinstance(default_values, str): default_values = [default_values] # If its not a list, we should abort and just return the help text if not isinstance(default_values, list): default_values = [] for val in default_values: help_text = help_text.replace(val, redact_auth_from_url(val)) return help_text class CustomOptionParser(optparse.OptionParser): def insert_option_group( self, idx: int, *args: Any, **kwargs: Any ) -> optparse.OptionGroup: """Insert an OptionGroup at a given position.""" group = self.add_option_group(*args, **kwargs) self.option_groups.pop() self.option_groups.insert(idx, group) return group @property def option_list_all(self) -> List[optparse.Option]: """Get a list of all options, including those in option groups.""" res = self.option_list[:] for i in self.option_groups: res.extend(i.option_list) return res class ConfigOptionParser(CustomOptionParser): """Custom option parser which updates its defaults by checking the configuration files and environmental variables""" def __init__( self, *args: Any, name: str, isolated: bool = False, **kwargs: Any, ) -> None: self.name = name self.config = Configuration(isolated) assert self.name super().__init__(*args, **kwargs) def check_default(self, option: optparse.Option, key: str, val: Any) -> Any: try: return option.check_value(key, val) except optparse.OptionValueError as exc: print(f"An error occurred during configuration: {exc}") sys.exit(3) def _get_ordered_configuration_items(self) -> Iterator[Tuple[str, Any]]: # Configuration gives keys in an unordered manner. Order them. override_order = ["global", self.name, ":env:"] # Pool the options into different groups section_items: Dict[str, List[Tuple[str, Any]]] = { name: [] for name in override_order } for section_key, val in self.config.items(): # ignore empty values if not val: logger.debug( "Ignoring configuration key '%s' as it's value is empty.", section_key, ) continue section, key = section_key.split(".", 1) if section in override_order: section_items[section].append((key, val)) # Yield each group in their override order for section in override_order: for key, val in section_items[section]: yield key, val def _update_defaults(self, defaults: Dict[str, Any]) -> Dict[str, Any]: """Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).""" # Accumulate complex default state. self.values = optparse.Values(self.defaults) late_eval = set() # Then set the options with those values for key, val in self._get_ordered_configuration_items(): # '--' because configuration supports only long names option = self.get_option("--" + key) # Ignore options not present in this parser. E.g. non-globals put # in [global] by users that want them to apply to all applicable # commands. if option is None: continue assert option.dest is not None if option.action in ("store_true", "store_false"): try: val = strtobool(val) except ValueError: self.error( "{} is not a valid value for {} option, " # noqa "please specify a boolean value like yes/no, " "true/false or 1/0 instead.".format(val, key) ) elif option.action == "count": with suppress(ValueError): val = strtobool(val) with suppress(ValueError): val = int(val) if not isinstance(val, int) or val < 0: self.error( "{} is not a valid value for {} option, " # noqa "please instead specify either a non-negative integer " "or a boolean value like yes/no or false/true " "which is equivalent to 1/0.".format(val, key) ) elif option.action == "append": val = val.split() val = [self.check_default(option, key, v) for v in val] elif option.action == "callback": assert option.callback is not None late_eval.add(option.dest) opt_str = option.get_opt_string() val = option.convert_value(opt_str, val) # From take_action args = option.callback_args or () kwargs = option.callback_kwargs or {} option.callback(option, opt_str, val, self, *args, **kwargs) else: val = self.check_default(option, key, val) defaults[option.dest] = val for key in late_eval: defaults[key] = getattr(self.values, key) self.values = None return defaults def get_default_values(self) -> optparse.Values: """Overriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.""" if not self.process_default_values: # Old, pre-Optik 1.5 behaviour. return optparse.Values(self.defaults) # Load the configuration, or error out in case of an error try: self.config.load() except ConfigurationError as err: self.exit(UNKNOWN_ERROR, str(err)) defaults = self._update_defaults(self.defaults.copy()) # ours for option in self._get_all_options(): assert option.dest is not None default = defaults.get(option.dest) if isinstance(default, str): opt_str = option.get_opt_string() defaults[option.dest] = option.check_value(opt_str, default) return optparse.Values(defaults) def error(self, msg: str) -> None: self.print_usage(sys.stderr) self.exit(UNKNOWN_ERROR, f"{msg}\n") PK]zKttcli/status_codes.pynu[SUCCESS = 0 ERROR = 1 UNKNOWN_ERROR = 2 VIRTUALENV_NOT_FOUND = 3 PREVIOUS_BUILD_DIR_ERROR = 4 NO_MATCHES_FOUND = 23 PK]pcli/autocompletion.pynu["""Logic that powers autocompletion installed by ``pip completion``. """ import optparse import os import sys 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 def autocomplete() -> None: """Entry Point for completion of main and subcommand options.""" # Don't complete if user hasn't sourced bash_completion file. if "PIP_AUTO_COMPLETE" not in os.environ: return cwords = os.environ["COMP_WORDS"].split()[1:] cword = int(os.environ["COMP_CWORD"]) try: current = cwords[cword - 1] except IndexError: current = "" parser = create_main_parser() subcommands = list(commands_dict) options = [] # subcommand subcommand_name: Optional[str] = None for word in cwords: if word in subcommands: subcommand_name = word break # subcommand options if subcommand_name is not None: # special case: 'help' subcommand has no options if subcommand_name == "help": sys.exit(1) # special case: list locally installed dists for show and uninstall should_list_installed = not current.startswith("-") and subcommand_name in [ "show", "uninstall", ] if should_list_installed: env = get_default_environment() lc = current.lower() installed = [ dist.canonical_name for dist in env.iter_installed_distributions(local_only=True) if dist.canonical_name.startswith(lc) and dist.canonical_name not in cwords[1:] ] # if there are no dists installed, fall back to option completion if installed: for dist in installed: print(dist) sys.exit(1) subcommand = create_command(subcommand_name) for opt in subcommand.parser.option_list_all: if opt.help != optparse.SUPPRESS_HELP: for opt_str in opt._long_opts + opt._short_opts: options.append((opt_str, opt.nargs)) # filter out previously specified options from available options prev_opts = [x.split("=")[0] for x in cwords[1 : cword - 1]] options = [(x, v) for (x, v) in options if x not in prev_opts] # filter options by current input options = [(k, v) for k, v in options if k.startswith(current)] # get completion type given cwords and available subcommand options completion_type = get_path_completion_type( cwords, cword, subcommand.parser.option_list_all, ) # get completion files and directories if ``completion_type`` is # ````, ```` or ```` if completion_type: paths = auto_complete_paths(current, completion_type) options = [(path, 0) for path in paths] for option in options: opt_label = option[0] # append '=' to options which require args if option[1] and option[0][:2] == "--": opt_label += "=" print(opt_label) else: # show main parser options only when necessary opts = [i.option_list for i in parser.option_groups] opts.append(parser.option_list) flattened_opts = chain.from_iterable(opts) if current.startswith("-"): for opt in flattened_opts: if opt.help != optparse.SUPPRESS_HELP: subcommands += opt._long_opts + opt._short_opts else: # get completion type given cwords and all available options completion_type = get_path_completion_type(cwords, cword, flattened_opts) if completion_type: subcommands = list(auto_complete_paths(current, completion_type)) print(" ".join([x for x in subcommands if x.startswith(current)])) sys.exit(1) def get_path_completion_type( cwords: List[str], cword: int, opts: Iterable[Any] ) -> Optional[str]: """Get the type of path completion (``file``, ``dir``, ``path`` or None) :param cwords: same as the environmental variable ``COMP_WORDS`` :param cword: same as the environmental variable ``COMP_CWORD`` :param opts: The available options to check :return: path completion type (``file``, ``dir``, ``path`` or None) """ if cword < 2 or not cwords[cword - 2].startswith("-"): return None for opt in opts: if opt.help == optparse.SUPPRESS_HELP: continue for o in str(opt).split("/"): if cwords[cword - 2].split("=")[0] == o: if not opt.metavar or any( x in ("path", "file", "dir") for x in opt.metavar.split("/") ): return opt.metavar return None def auto_complete_paths(current: str, completion_type: str) -> Iterable[str]: """If ``completion_type`` is ``file`` or ``path``, list all regular files and directories starting with ``current``; otherwise only list directories starting with ``current``. :param current: The word to be completed :param completion_type: path completion type(`file`, `path` or `dir`)i :return: A generator of regular files and/or directories """ directory, filename = os.path.split(current) current_path = os.path.abspath(directory) # Don't complete paths if they can't be accessed if not os.access(current_path, os.R_OK): return filename = os.path.normcase(filename) # list all files that start with ``filename`` file_list = ( x for x in os.listdir(current_path) if os.path.normcase(x).startswith(filename) ) for f in file_list: opt = os.path.join(current_path, f) comp_file = os.path.normcase(os.path.join(directory, f)) # complete regular files when there is not ```` after option # complete directories when there is ````, ```` or # ````after option if completion_type != "dir" and os.path.isfile(opt): yield comp_file elif os.path.isdir(opt): yield os.path.join(comp_file, "") PK]%BBcli/req_command.pynu["""Contains the Command base classes that depend on PipSession. The classes in this module are in a separate module so the commands not needing download / PackageFinder capability don't unnecessarily import the PackageFinder machinery and all its vendored dependencies, etc. """ import logging import os import sys from functools import partial 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.base_command import Command from pip._internal.cli.command_context import CommandContextMixIn 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.prepare import RequirementPreparer from 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.req.req_tracker import RequirementTracker from pip._internal.resolution.base import BaseResolver from pip._internal.self_outdated_check import pip_self_version_check from pip._internal.utils.deprecation import deprecated from pip._internal.utils.temp_dir import ( TempDirectory, TempDirectoryTypeRegistry, tempdir_kinds, ) from pip._internal.utils.virtualenv import running_under_virtualenv logger = logging.getLogger(__name__) class SessionCommandMixin(CommandContextMixIn): """ A class mixin for command classes needing _build_session(). """ def __init__(self) -> None: super().__init__() self._session: Optional[PipSession] = None @classmethod def _get_index_urls(cls, options: Values) -> Optional[List[str]]: """Return a list of index urls from user-provided options.""" index_urls = [] if not getattr(options, "no_index", False): url = getattr(options, "index_url", None) if url: index_urls.append(url) urls = getattr(options, "extra_index_urls", None) if urls: index_urls.extend(urls) # Return None rather than an empty list return index_urls or None def get_default_session(self, options: Values) -> PipSession: """Get a default-managed session.""" if self._session is None: self._session = self.enter_context(self._build_session(options)) # there's no type annotation on requests.Session, so it's # automatically ContextManager[Any] and self._session becomes Any, # then https://github.com/python/mypy/issues/7696 kicks in assert self._session is not None return self._session def _build_session( self, options: Values, retries: Optional[int] = None, timeout: Optional[int] = None, ) -> PipSession: assert not options.cache_dir or os.path.isabs(options.cache_dir) session = PipSession( cache=( os.path.join(options.cache_dir, "http") if options.cache_dir else None ), retries=retries if retries is not None else options.retries, trusted_hosts=options.trusted_hosts, index_urls=self._get_index_urls(options), ) # Handle custom ca-bundles from the user if options.cert: session.verify = options.cert # Handle SSL client certificate if options.client_cert: session.cert = options.client_cert # Handle timeouts if options.timeout or timeout: session.timeout = timeout if timeout is not None else options.timeout # Handle configured proxies if options.proxy: session.proxies = { "http": options.proxy, "https": options.proxy, } # Determine if we can prompt the user for authentication or not session.auth.prompting = not options.no_input return session class IndexGroupCommand(Command, SessionCommandMixin): """ Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. """ def handle_pip_version_check(self, options: Values) -> None: """ Do the pip version check if not disabled. This overrides the default behavior of not doing the check. """ # Make sure the index_group options are present. assert hasattr(options, "no_index") if options.disable_pip_version_check or options.no_index: return # Otherwise, check if we're using the latest version of pip available. session = self._build_session( options, retries=0, timeout=min(5, options.timeout) ) with session: pip_self_version_check(session, options) KEEPABLE_TEMPDIR_TYPES = [ tempdir_kinds.BUILD_ENV, tempdir_kinds.EPHEM_WHEEL_CACHE, tempdir_kinds.REQ_BUILD, ] def warn_if_run_as_root() -> None: """Output a warning for sudo users on Unix. In a virtual environment, sudo pip still writes to virtualenv. On Windows, users may run pip as Administrator without issues. This warning only applies to Unix root users outside of virtualenv. """ if running_under_virtualenv(): return if not hasattr(os, "getuid"): return # On Windows, there are no "system managed" Python packages. Installing as # Administrator via pip is the correct way of updating system environments. # # We choose sys.platform over utils.compat.WINDOWS here to enable Mypy platform # checks: https://mypy.readthedocs.io/en/stable/common_issues.html if sys.platform == "win32" or sys.platform == "cygwin": return if os.getuid() != 0: return logger.warning( "Running pip as the 'root' user can result in broken permissions and " "conflicting behaviour with the system package manager. " "It is recommended to use a virtual environment instead: " "https://pip.pypa.io/warnings/venv" ) def with_cleanup(func: Any) -> Any: """Decorator for common logic related to managing temporary directories. """ def configure_tempdir_registry(registry: TempDirectoryTypeRegistry) -> None: for t in KEEPABLE_TEMPDIR_TYPES: registry.set_delete(t, False) def wrapper( self: RequirementCommand, options: Values, args: List[Any] ) -> Optional[int]: assert self.tempdir_registry is not None if options.no_clean: configure_tempdir_registry(self.tempdir_registry) try: return func(self, options, args) except PreviousBuildDirError: # This kind of conflict can occur when the user passes an explicit # build directory with a pre-existing folder. In that case we do # not want to accidentally remove it. configure_tempdir_registry(self.tempdir_registry) raise return wrapper class RequirementCommand(IndexGroupCommand): def __init__(self, *args: Any, **kw: Any) -> None: super().__init__(*args, **kw) self.cmd_opts.add_option(cmdoptions.no_clean()) @staticmethod def determine_resolver_variant(options: Values) -> str: """Determines which resolver should be used, based on the given options.""" if "legacy-resolver" in options.deprecated_features_enabled: return "legacy" return "2020-resolver" @classmethod def make_requirement_preparer( cls, temp_build_dir: TempDirectory, options: Values, req_tracker: RequirementTracker, session: PipSession, finder: PackageFinder, use_user_site: bool, download_dir: Optional[str] = None, ) -> RequirementPreparer: """ Create a RequirementPreparer instance for the given parameters. """ temp_build_dir_path = temp_build_dir.path assert temp_build_dir_path is not None resolver_variant = cls.determine_resolver_variant(options) if resolver_variant == "2020-resolver": lazy_wheel = "fast-deps" in options.features_enabled if lazy_wheel: logger.warning( "pip is using lazily downloaded wheels using HTTP " "range requests to obtain dependency information. " "This experimental feature is enabled through " "--use-feature=fast-deps and it is not ready for " "production." ) else: lazy_wheel = False if "fast-deps" in options.features_enabled: logger.warning( "fast-deps has no effect when used with the legacy resolver." ) in_tree_build = "out-of-tree-build" not in options.deprecated_features_enabled if "in-tree-build" in options.features_enabled: deprecated( reason="In-tree builds are now the default.", replacement="to remove the --use-feature=in-tree-build flag", gone_in="22.1", ) if "out-of-tree-build" in options.deprecated_features_enabled: deprecated( reason="Out-of-tree builds are deprecated.", replacement=None, gone_in="22.1", ) return RequirementPreparer( build_dir=temp_build_dir_path, src_dir=options.src_dir, download_dir=download_dir, build_isolation=options.build_isolation, req_tracker=req_tracker, session=session, progress_bar=options.progress_bar, finder=finder, require_hashes=options.require_hashes, use_user_site=use_user_site, lazy_wheel=lazy_wheel, in_tree_build=in_tree_build, ) @classmethod def make_resolver( cls, preparer: RequirementPreparer, finder: PackageFinder, options: Values, wheel_cache: Optional[WheelCache] = None, use_user_site: bool = False, ignore_installed: bool = True, ignore_requires_python: bool = False, force_reinstall: bool = False, upgrade_strategy: str = "to-satisfy-only", use_pep517: Optional[bool] = None, py_version_info: Optional[Tuple[int, ...]] = None, ) -> BaseResolver: """ Create a Resolver instance for the given parameters. """ make_install_req = partial( install_req_from_req_string, isolated=options.isolated_mode, use_pep517=use_pep517, ) resolver_variant = cls.determine_resolver_variant(options) # The long import name and duplicated invocation is needed to convince # Mypy into correctly typechecking. Otherwise it would complain the # "Resolver" class being redefined. if resolver_variant == "2020-resolver": import pip._internal.resolution.resolvelib.resolver return pip._internal.resolution.resolvelib.resolver.Resolver( preparer=preparer, finder=finder, wheel_cache=wheel_cache, make_install_req=make_install_req, use_user_site=use_user_site, ignore_dependencies=options.ignore_dependencies, ignore_installed=ignore_installed, ignore_requires_python=ignore_requires_python, force_reinstall=force_reinstall, upgrade_strategy=upgrade_strategy, py_version_info=py_version_info, ) import pip._internal.resolution.legacy.resolver return pip._internal.resolution.legacy.resolver.Resolver( preparer=preparer, finder=finder, wheel_cache=wheel_cache, make_install_req=make_install_req, use_user_site=use_user_site, ignore_dependencies=options.ignore_dependencies, ignore_installed=ignore_installed, ignore_requires_python=ignore_requires_python, force_reinstall=force_reinstall, upgrade_strategy=upgrade_strategy, py_version_info=py_version_info, ) def get_requirements( self, args: List[str], options: Values, finder: PackageFinder, session: PipSession, ) -> List[InstallRequirement]: """ Parse command-line arguments into the corresponding requirements. """ requirements: List[InstallRequirement] = [] for filename in options.constraints: for parsed_req in parse_requirements( filename, constraint=True, finder=finder, options=options, session=session, ): req_to_add = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode, user_supplied=False, ) requirements.append(req_to_add) for req in args: req_to_add = install_req_from_line( req, None, isolated=options.isolated_mode, use_pep517=options.use_pep517, user_supplied=True, ) requirements.append(req_to_add) for req in options.editables: req_to_add = install_req_from_editable( req, user_supplied=True, isolated=options.isolated_mode, use_pep517=options.use_pep517, ) requirements.append(req_to_add) # NOTE: options.require_hashes may be set if --require-hashes is True for filename in options.requirements: for parsed_req in parse_requirements( filename, finder=finder, options=options, session=session ): req_to_add = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode, use_pep517=options.use_pep517, user_supplied=True, ) requirements.append(req_to_add) # If any requirement has hash options, enable hash checking. if any(req.has_hash_options for req in requirements): options.require_hashes = True if not (args or options.editables or options.requirements): opts = {"name": self.name} if options.find_links: raise CommandError( "You must give at least one requirement to {name} " '(maybe you meant "pip {name} {links}"?)'.format( **dict(opts, links=" ".join(options.find_links)) ) ) else: raise CommandError( "You must give at least one requirement to {name} " '(see "pip help {name}")'.format(**opts) ) return requirements @staticmethod def trace_basic_info(finder: PackageFinder) -> None: """ Trace basic information about the provided objects. """ # Display where finder is looking for packages search_scope = finder.search_scope locations = search_scope.get_formatted_locations() if locations: logger.info(locations) def _build_package_finder( self, options: Values, session: PipSession, target_python: Optional[TargetPython] = None, ignore_requires_python: Optional[bool] = None, ) -> PackageFinder: """ Create a package finder appropriate to this requirement command. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. """ link_collector = LinkCollector.create(session, options=options) selection_prefs = SelectionPreferences( allow_yanked=True, format_control=options.format_control, allow_all_prereleases=options.pre, prefer_binary=options.prefer_binary, ignore_requires_python=ignore_requires_python, ) return PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, target_python=target_python, ) PK]IDnncli/cmdoptions.pynu[""" shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. """ # The following comment should be removed at some point in the future. # mypy: strict-optional=False import os import textwrap import warnings from functools import partial from optparse import SUPPRESS_HELP, Option, OptionGroup, OptionParser, Values 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.cli.progress_bars import BAR_TYPES 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 def raise_option_error(parser: OptionParser, option: Option, msg: str) -> None: """ Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. """ msg = f"{option} error: {msg}" msg = textwrap.fill(" ".join(msg.split())) parser.error(msg) def make_option_group(group: Dict[str, Any], parser: ConfigOptionParser) -> OptionGroup: """ Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser """ option_group = OptionGroup(parser, group["name"]) for option in group["options"]: option_group.add_option(option()) return option_group def check_install_build_global( options: Values, check_options: Optional[Values] = None ) -> None: """Disable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. """ if check_options is None: check_options = options def getname(n: str) -> Optional[Any]: return getattr(check_options, n, None) names = ["build_options", "global_options", "install_options"] if any(map(getname, names)): control = options.format_control control.disallow_binaries() warnings.warn( "Disabling all use of wheels due to the use of --build-option " "/ --global-option / --install-option.", stacklevel=2, ) def check_dist_restriction(options: Values, check_target: bool = False) -> None: """Function for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. """ dist_restriction_set = any( [ options.python_version, options.platforms, options.abis, options.implementation, ] ) binary_only = FormatControl(set(), {":all:"}) sdist_dependencies_allowed = ( options.format_control != binary_only and not options.ignore_dependencies ) # Installations or downloads using dist restrictions must not combine # source distributions and dist-specific wheels, as they are not # guaranteed to be locally compatible. if dist_restriction_set and sdist_dependencies_allowed: raise CommandError( "When restricting platform and interpreter constraints using " "--python-version, --platform, --abi, or --implementation, " "either --no-deps must be set, or --only-binary=:all: must be " "set and --no-binary must not be set (or must be set to " ":none:)." ) if check_target: if dist_restriction_set and not options.target_dir: raise CommandError( "Can not use any platform or abi specific options unless " "installing via '--target'" ) def _path_option_check(option: Option, opt: str, value: str) -> str: return os.path.expanduser(value) def _package_name_option_check(option: Option, opt: str, value: str) -> str: return canonicalize_name(value) class PipOption(Option): TYPES = Option.TYPES + ("path", "package_name") TYPE_CHECKER = Option.TYPE_CHECKER.copy() TYPE_CHECKER["package_name"] = _package_name_option_check TYPE_CHECKER["path"] = _path_option_check ########### # options # ########### help_: Callable[..., Option] = partial( Option, "-h", "--help", dest="help", action="help", help="Show help.", ) debug_mode: Callable[..., Option] = partial( Option, "--debug", dest="debug_mode", action="store_true", default=False, help=( "Let unhandled exceptions propagate outside the main subroutine, " "instead of logging them to stderr." ), ) isolated_mode: Callable[..., Option] = partial( Option, "--isolated", dest="isolated_mode", action="store_true", default=False, help=( "Run pip in an isolated mode, ignoring environment variables and user " "configuration." ), ) require_virtualenv: Callable[..., Option] = partial( Option, # Run only if inside a virtualenv, bail if not. "--require-virtualenv", "--require-venv", dest="require_venv", action="store_true", default=False, help=SUPPRESS_HELP, ) verbose: Callable[..., Option] = partial( Option, "-v", "--verbose", dest="verbose", action="count", default=0, help="Give more output. Option is additive, and can be used up to 3 times.", ) no_color: Callable[..., Option] = partial( Option, "--no-color", dest="no_color", action="store_true", default=False, help="Suppress colored output.", ) version: Callable[..., Option] = partial( Option, "-V", "--version", dest="version", action="store_true", help="Show version and exit.", ) quiet: Callable[..., Option] = partial( Option, "-q", "--quiet", dest="quiet", action="count", default=0, help=( "Give less output. Option is additive, and can be used up to 3" " times (corresponding to WARNING, ERROR, and CRITICAL logging" " levels)." ), ) progress_bar: Callable[..., Option] = partial( Option, "--progress-bar", dest="progress_bar", type="choice", choices=list(BAR_TYPES.keys()), default="on", help=( "Specify type of progress to be displayed [" + "|".join(BAR_TYPES.keys()) + "] (default: %default)" ), ) log: Callable[..., Option] = partial( PipOption, "--log", "--log-file", "--local-log", dest="log", metavar="path", type="path", help="Path to a verbose appending log.", ) no_input: Callable[..., Option] = partial( Option, # Don't ask for input "--no-input", dest="no_input", action="store_true", default=False, help="Disable prompting for input.", ) proxy: Callable[..., Option] = partial( Option, "--proxy", dest="proxy", type="str", default="", help="Specify a proxy in the form [user:passwd@]proxy.server:port.", ) retries: Callable[..., Option] = partial( Option, "--retries", dest="retries", type="int", default=5, help="Maximum number of retries each connection should attempt " "(default %default times).", ) timeout: Callable[..., Option] = partial( Option, "--timeout", "--default-timeout", metavar="sec", dest="timeout", type="float", default=15, help="Set the socket timeout (default %default seconds).", ) def exists_action() -> Option: return Option( # Option when path already exist "--exists-action", dest="exists_action", type="choice", choices=["s", "i", "w", "b", "a"], default=[], action="append", metavar="action", help="Default action when a path already exists: " "(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.", ) cert: Callable[..., Option] = partial( PipOption, "--cert", dest="cert", type="path", metavar="path", help=( "Path to PEM-encoded CA certificate bundle. " "If provided, overrides the default. " "See 'SSL Certificate Verification' in pip documentation " "for more information." ), ) client_cert: Callable[..., Option] = partial( PipOption, "--client-cert", dest="client_cert", type="path", default=None, metavar="path", help="Path to SSL client certificate, a single file containing the " "private key and the certificate in PEM format.", ) index_url: Callable[..., Option] = partial( Option, "-i", "--index-url", "--pypi-url", dest="index_url", metavar="URL", default=PyPI.simple_url, help="Base URL of the Python Package Index (default %default). " "This should point to a repository compliant with PEP 503 " "(the simple repository API) or a local directory laid out " "in the same format.", ) def extra_index_url() -> Option: return Option( "--extra-index-url", dest="extra_index_urls", metavar="URL", action="append", default=[], help="Extra URLs of package indexes to use in addition to " "--index-url. Should follow the same rules as " "--index-url.", ) no_index: Callable[..., Option] = partial( Option, "--no-index", dest="no_index", action="store_true", default=False, help="Ignore package index (only looking at --find-links URLs instead).", ) def find_links() -> Option: return Option( "-f", "--find-links", dest="find_links", action="append", default=[], metavar="url", help="If a URL or path to an html file, then parse for links to " "archives such as sdist (.tar.gz) or wheel (.whl) files. " "If a local path or file:// URL that's a directory, " "then look for archives in the directory listing. " "Links to VCS project URLs are not supported.", ) def trusted_host() -> Option: return Option( "--trusted-host", dest="trusted_hosts", action="append", metavar="HOSTNAME", default=[], help="Mark this host or host:port pair as trusted, even though it " "does not have valid or any HTTPS.", ) def constraints() -> Option: return Option( "-c", "--constraint", dest="constraints", action="append", default=[], metavar="file", help="Constrain versions using the given constraints file. " "This option can be used multiple times.", ) def requirements() -> Option: return Option( "-r", "--requirement", dest="requirements", action="append", default=[], metavar="file", help="Install from the given requirements file. " "This option can be used multiple times.", ) def editable() -> Option: return Option( "-e", "--editable", dest="editables", action="append", default=[], metavar="path/url", help=( "Install a project in editable mode (i.e. setuptools " '"develop mode") from a local project path or a VCS url.' ), ) def _handle_src(option: Option, opt_str: str, value: str, parser: OptionParser) -> None: value = os.path.abspath(value) setattr(parser.values, option.dest, value) src: Callable[..., Option] = partial( PipOption, "--src", "--source", "--source-dir", "--source-directory", dest="src_dir", type="path", metavar="dir", default=get_src_prefix(), action="callback", callback=_handle_src, help="Directory to check out editable projects into. " 'The default in a virtualenv is "/src". ' 'The default for global installs is "/src".', ) def _get_format_control(values: Values, option: Option) -> Any: """Get a format_control object.""" return getattr(values, option.dest) def _handle_no_binary( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: existing = _get_format_control(parser.values, option) FormatControl.handle_mutual_excludes( value, existing.no_binary, existing.only_binary, ) def _handle_only_binary( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: existing = _get_format_control(parser.values, option) FormatControl.handle_mutual_excludes( value, existing.only_binary, existing.no_binary, ) def no_binary() -> Option: format_control = FormatControl(set(), set()) return Option( "--no-binary", dest="format_control", action="callback", callback=_handle_no_binary, type="str", default=format_control, help="Do not use binary packages. Can be supplied multiple times, and " 'each time adds to the existing value. Accepts either ":all:" to ' 'disable all binary packages, ":none:" to empty the set (notice ' "the colons), or one or more package names with commas between " "them (no colons). Note that some packages are tricky to compile " "and may fail to install when this option is used on them.", ) def only_binary() -> Option: format_control = FormatControl(set(), set()) return Option( "--only-binary", dest="format_control", action="callback", callback=_handle_only_binary, type="str", default=format_control, help="Do not use source packages. Can be supplied multiple times, and " 'each time adds to the existing value. Accepts either ":all:" to ' 'disable all source packages, ":none:" to empty the set, or one ' "or more package names with commas between them. Packages " "without binary distributions will fail to install when this " "option is used on them.", ) platforms: Callable[..., Option] = partial( Option, "--platform", dest="platforms", metavar="platform", action="append", default=None, help=( "Only use wheels compatible with . Defaults to the " "platform of the running system. Use this option multiple times to " "specify multiple platforms supported by the target interpreter." ), ) # This was made a separate function for unit-testing purposes. def _convert_python_version(value: str) -> Tuple[Tuple[int, ...], Optional[str]]: """ Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. """ if not value: # The empty string is the same as not providing a value. return (None, None) parts = value.split(".") if len(parts) > 3: return ((), "at most three version parts are allowed") if len(parts) == 1: # Then we are in the case of "3" or "37". value = parts[0] if len(value) > 1: parts = [value[0], value[1:]] try: version_info = tuple(int(part) for part in parts) except ValueError: return ((), "each version part must be an integer") return (version_info, None) def _handle_python_version( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: """ Handle a provided --python-version value. """ version_info, error_msg = _convert_python_version(value) if error_msg is not None: msg = "invalid --python-version value: {!r}: {}".format( value, error_msg, ) raise_option_error(parser, option=option, msg=msg) parser.values.python_version = version_info python_version: Callable[..., Option] = partial( Option, "--python-version", dest="python_version", metavar="python_version", action="callback", callback=_handle_python_version, type="str", default=None, help=dedent( """\ The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). """ ), ) implementation: Callable[..., Option] = partial( Option, "--implementation", dest="implementation", metavar="implementation", default=None, help=( "Only use wheels compatible with Python " "implementation , e.g. 'pp', 'jy', 'cp', " " or 'ip'. If not specified, then the current " "interpreter implementation is used. Use 'py' to force " "implementation-agnostic wheels." ), ) abis: Callable[..., Option] = partial( Option, "--abi", dest="abis", metavar="abi", action="append", default=None, help=( "Only use wheels compatible with Python abi , e.g. 'pypy_41'. " "If not specified, then the current interpreter abi tag is used. " "Use this option multiple times to specify multiple abis supported " "by the target interpreter. Generally you will need to specify " "--implementation, --platform, and --python-version when using this " "option." ), ) def add_target_python_options(cmd_opts: OptionGroup) -> None: cmd_opts.add_option(platforms()) cmd_opts.add_option(python_version()) cmd_opts.add_option(implementation()) cmd_opts.add_option(abis()) def make_target_python(options: Values) -> TargetPython: target_python = TargetPython( platforms=options.platforms, py_version_info=options.python_version, abis=options.abis, implementation=options.implementation, ) return target_python def prefer_binary() -> Option: return Option( "--prefer-binary", dest="prefer_binary", action="store_true", default=False, help="Prefer older binary packages over newer source packages.", ) cache_dir: Callable[..., Option] = partial( PipOption, "--cache-dir", dest="cache_dir", default=USER_CACHE_DIR, metavar="dir", type="path", help="Store the cache data in .", ) def _handle_no_cache_dir( option: Option, opt: str, value: str, parser: OptionParser ) -> None: """ Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. """ # The value argument will be None if --no-cache-dir is passed via the # command-line, since the option doesn't accept arguments. However, # the value can be non-None if the option is triggered e.g. by an # environment variable, like PIP_NO_CACHE_DIR=true. if value is not None: # Then parse the string value to get argument error-checking. try: strtobool(value) except ValueError as exc: raise_option_error(parser, option=option, msg=str(exc)) # Originally, setting PIP_NO_CACHE_DIR to a value that strtobool() # converted to 0 (like "false" or "no") caused cache_dir to be disabled # rather than enabled (logic would say the latter). Thus, we disable # the cache directory not just on values that parse to True, but (for # backwards compatibility reasons) also on values that parse to False. # In other words, always set it to False if the option is provided in # some (valid) form. parser.values.cache_dir = False no_cache: Callable[..., Option] = partial( Option, "--no-cache-dir", dest="cache_dir", action="callback", callback=_handle_no_cache_dir, help="Disable the cache.", ) no_deps: Callable[..., Option] = partial( Option, "--no-deps", "--no-dependencies", dest="ignore_dependencies", action="store_true", default=False, help="Don't install package dependencies.", ) ignore_requires_python: Callable[..., Option] = partial( Option, "--ignore-requires-python", dest="ignore_requires_python", action="store_true", help="Ignore the Requires-Python information.", ) no_build_isolation: Callable[..., Option] = partial( Option, "--no-build-isolation", dest="build_isolation", action="store_false", default=True, help="Disable isolation when building a modern source distribution. " "Build dependencies specified by PEP 518 must be already installed " "if this option is used.", ) def _handle_no_use_pep517( option: Option, opt: str, value: str, parser: OptionParser ) -> None: """ Process a value provided for the --no-use-pep517 option. This is an optparse.Option callback for the no_use_pep517 option. """ # Since --no-use-pep517 doesn't accept arguments, the value argument # will be None if --no-use-pep517 is passed via the command-line. # However, the value can be non-None if the option is triggered e.g. # by an environment variable, for example "PIP_NO_USE_PEP517=true". if value is not None: msg = """A value was passed for --no-use-pep517, probably using either the PIP_NO_USE_PEP517 environment variable or the "no-use-pep517" config file option. Use an appropriate value of the PIP_USE_PEP517 environment variable or the "use-pep517" config file option instead. """ raise_option_error(parser, option=option, msg=msg) # Otherwise, --no-use-pep517 was passed via the command-line. parser.values.use_pep517 = False use_pep517: Any = partial( Option, "--use-pep517", dest="use_pep517", action="store_true", default=None, help="Use PEP 517 for building source distributions " "(use --no-use-pep517 to force legacy behaviour).", ) no_use_pep517: Any = partial( Option, "--no-use-pep517", dest="use_pep517", action="callback", callback=_handle_no_use_pep517, default=None, help=SUPPRESS_HELP, ) install_options: Callable[..., Option] = partial( Option, "--install-option", dest="install_options", action="append", metavar="options", help="Extra arguments to be supplied to the setup.py install " 'command (use like --install-option="--install-scripts=/usr/local/' 'bin"). Use multiple --install-option options to pass multiple ' "options to setup.py install. If you are using an option with a " "directory path, be sure to use absolute path.", ) build_options: Callable[..., Option] = partial( Option, "--build-option", dest="build_options", metavar="options", action="append", help="Extra arguments to be supplied to 'setup.py bdist_wheel'.", ) global_options: Callable[..., Option] = partial( Option, "--global-option", dest="global_options", action="append", metavar="options", help="Extra global options to be supplied to the setup.py " "call before the install or bdist_wheel command.", ) no_clean: Callable[..., Option] = partial( Option, "--no-clean", action="store_true", default=False, help="Don't clean up build directories.", ) pre: Callable[..., Option] = partial( Option, "--pre", action="store_true", default=False, help="Include pre-release and development versions. By default, " "pip only finds stable versions.", ) disable_pip_version_check: Callable[..., Option] = partial( Option, "--disable-pip-version-check", dest="disable_pip_version_check", action="store_true", default=False, help="Don't periodically check PyPI to determine whether a new version " "of pip is available for download. Implied with --no-index.", ) def _handle_merge_hash( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: """Given a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.""" if not parser.values.hashes: parser.values.hashes = {} try: algo, digest = value.split(":", 1) except ValueError: parser.error( "Arguments to {} must be a hash name " # noqa "followed by a value, like --hash=sha256:" "abcde...".format(opt_str) ) if algo not in STRONG_HASHES: parser.error( "Allowed hash algorithms for {} are {}.".format( # noqa opt_str, ", ".join(STRONG_HASHES) ) ) parser.values.hashes.setdefault(algo, []).append(digest) hash: Callable[..., Option] = partial( Option, "--hash", # Hash values eventually end up in InstallRequirement.hashes due to # __dict__ copying in process_line(). dest="hashes", action="callback", callback=_handle_merge_hash, type="string", help="Verify that the package's archive matches this " "hash before installing. Example: --hash=sha256:abcdef...", ) require_hashes: Callable[..., Option] = partial( Option, "--require-hashes", dest="require_hashes", action="store_true", default=False, help="Require a hash to check each requirement against, for " "repeatable installs. This option is implied when any package in a " "requirements file has a --hash option.", ) list_path: Callable[..., Option] = partial( PipOption, "--path", dest="path", type="path", action="append", help="Restrict to the specified installation path for listing " "packages (can be used multiple times).", ) def check_list_path_option(options: Values) -> None: if options.path and (options.user or options.local): raise CommandError("Cannot combine '--path' with '--user' or '--local'") list_exclude: Callable[..., Option] = partial( PipOption, "--exclude", dest="excludes", action="append", metavar="package", type="package_name", help="Exclude specified package from the output", ) no_python_version_warning: Callable[..., Option] = partial( Option, "--no-python-version-warning", dest="no_python_version_warning", action="store_true", default=False, help="Silence deprecation warnings for upcoming unsupported Pythons.", ) use_new_feature: Callable[..., Option] = partial( Option, "--use-feature", dest="features_enabled", metavar="feature", action="append", default=[], choices=["2020-resolver", "fast-deps", "in-tree-build"], help="Enable new functionality, that may be backward incompatible.", ) use_deprecated_feature: Callable[..., Option] = partial( Option, "--use-deprecated", dest="deprecated_features_enabled", metavar="feature", action="append", default=[], choices=["legacy-resolver", "out-of-tree-build"], help=("Enable deprecated functionality, that will be removed in the future."), ) ########## # groups # ########## general_group: Dict[str, Any] = { "name": "General Options", "options": [ help_, debug_mode, isolated_mode, require_virtualenv, verbose, version, quiet, log, no_input, proxy, retries, timeout, exists_action, trusted_host, cert, client_cert, cache_dir, no_cache, disable_pip_version_check, no_color, no_python_version_warning, use_new_feature, use_deprecated_feature, ], } index_group: Dict[str, Any] = { "name": "Package Index Options", "options": [ index_url, extra_index_url, no_index, find_links, ], } PK]w4cli/__init__.pynu["""Subpackage containing all of pip's command line interface related code """ # This file intentionally does not import submodules PK] fcli/command_context.pynu[from contextlib import ExitStack, contextmanager from typing import ContextManager, Iterator, TypeVar _T = TypeVar("_T", covariant=True) class CommandContextMixIn: def __init__(self) -> None: super().__init__() self._in_main_context = False self._main_context = ExitStack() @contextmanager def main_context(self) -> Iterator[None]: assert not self._in_main_context self._in_main_context = True try: with self._main_context: yield finally: self._in_main_context = False def enter_context(self, context_provider: ContextManager[_T]) -> _T: assert self._in_main_context return self._main_context.enter_context(context_provider) PK]ߗmodels/index.pynu[import urllib.parse class PackageIndex: """Represents a Package Index and provides easier access to endpoints""" __slots__ = ["url", "netloc", "simple_url", "pypi_url", "file_storage_domain"] def __init__(self, url: str, file_storage_domain: str) -> None: super().__init__() self.url = url self.netloc = urllib.parse.urlsplit(url).netloc self.simple_url = self._url_for_path("simple") self.pypi_url = self._url_for_path("pypi") # This is part of a temporary hack used to block installs of PyPI # packages which depend on external urls only necessary until PyPI can # block such packages themselves self.file_storage_domain = file_storage_domain def _url_for_path(self, path: str) -> str: return urllib.parse.urljoin(self.url, path) PyPI = PackageIndex("https://pypi.org/", file_storage_domain="files.pythonhosted.org") TestPyPI = PackageIndex( "https://test.pypi.org/", file_storage_domain="test-files.pythonhosted.org" ) PK]bc models/format_control.pynu[from typing import FrozenSet, Optional, Set from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import CommandError class FormatControl: """Helper for managing formats from which a package can be installed.""" __slots__ = ["no_binary", "only_binary"] def __init__( self, no_binary: Optional[Set[str]] = None, only_binary: Optional[Set[str]] = None, ) -> None: if no_binary is None: no_binary = set() if only_binary is None: only_binary = set() self.no_binary = no_binary self.only_binary = only_binary def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented if self.__slots__ != other.__slots__: return False return all(getattr(self, k) == getattr(other, k) for k in self.__slots__) def __repr__(self) -> str: return "{}({}, {})".format( self.__class__.__name__, self.no_binary, self.only_binary ) @staticmethod def handle_mutual_excludes(value: str, target: Set[str], other: Set[str]) -> None: if value.startswith("-"): raise CommandError( "--no-binary / --only-binary option requires 1 argument." ) new = value.split(",") while ":all:" in new: other.clear() target.clear() target.add(":all:") del new[: new.index(":all:") + 1] # Without a none, we want to discard everything as :all: covers it if ":none:" not in new: return for name in new: if name == ":none:": target.clear() continue name = canonicalize_name(name) other.discard(name) target.add(name) def get_allowed_formats(self, canonical_name: str) -> FrozenSet[str]: result = {"binary", "source"} if canonical_name in self.only_binary: result.discard("source") elif canonical_name in self.no_binary: result.discard("binary") elif ":all:" in self.only_binary: result.discard("source") elif ":all:" in self.no_binary: result.discard("binary") return frozenset(result) def disallow_binaries(self) -> None: self.handle_mutual_excludes( ":all:", self.no_binary, self.only_binary, ) PK]@BJ))&models/__pycache__/link.cpython-38.pycnu[U ʗRe(@sddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZddlmZddlmZddlmZmZmZddlmZddlmZmZerddlmZee Z!d Z"Gd d d eZ#Gd d d e Z$e#e$dddZ%ej&dde#e#e'dddZ(dS)N) TYPE_CHECKINGDictListMapping NamedTupleOptionalTupleUnion)WHEEL_EXTENSION)Hashes)redact_auth_from_urlsplit_auth_from_netlocsplitext)KeyBasedCompareMixin) path_to_url url_to_path) IndexContent)sha512sha384sha256sha224sha1md5c s:eZdZdZdddddddgZdDeeeed feeeeeee eefd d fd d Z edddZ edddZ e edddZe edddZe edddZe edddZe edddZe edddZeeefdd d!Ze edd"d#Ze edd$d%Zed&Ze eedd'd(Zed)Ze eedd*d+Zed,jd-e d.Z!e eedd/d0Z"e eedd1d2Z#e edd3d4Z$e edd5d6Z%edd7d8Z&e edd9d:Z'e edd;d<Z(e edd=d>Z)e edd?d@Z*ee+edAdBdCZ,Z-S)ELinkz:Represents a parsed link from a Package Index's simple URL _parsed_url_url_hashes comes_fromrequires_python yanked_reasoncache_link_parsingNTr)urlrrrr hashesreturncsl|drt|}tj||_||_|dk r2|ni|_||_|rF|nd|_ ||_ t j |t d||_dS)aG :param url: url of the resource pointed to (href of the link) :param comes_from: instance of IndexContent where the link was found, or string. :param requires_python: String containing the `Requires-Python` metadata field, specified in PEP 345. This may be specified by a data-requires-python attribute in the HTML link tag, as described in PEP 503. :param yanked_reason: the reason the file has been yanked, if the file has been yanked, or None if the file hasn't been yanked. This is the value of the "data-yanked" attribute, if present, in a simple repository HTML link. If the file has been yanked but no reason was provided, this should be the empty string. See PEP 592 for more information and the specification. :param cache_link_parsing: A flag that is used elsewhere to determine whether resources retrieved from this link should be cached. PyPI index urls should generally have this set to False, for example. :param hashes: A mapping of hash names to digests to allow us to determine the validity of a download. z\\N)keydefining_class) startswithrurllibparseurlsplitrrrrrrsuper__init__rr )selfr!rrrr r" __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/link.pyr+4s! z Link.__init__)r#cCsH|jrd|jd}nd}|jr6dt|j|j|Stt|jSdS)Nz (requires-python:)z{} (from {}){})rrformatr rstr)r,rpr/r/r0__str__fsz Link.__str__cCs d|dS)Nzr/r,r/r/r0__repr__rsz Link.__repr__cCs|jSN)rr8r/r/r0r!uszLink.urlcCsR|jd}t|}|s,t|j\}}|Stj|}|sNt d|j d|S)N/zURL z produced no filename) pathrstrip posixpathbasenamer netlocr'r(unquoteAssertionErrorr)r,r<namer@ user_passr/r/r0filenameys   z Link.filenamecCs t|jSr:)rr!r8r/r/r0 file_pathszLink.file_pathcCs|jjSr:)rschemer8r/r/r0rGsz Link.schemecCs|jjS)z4 This can contain auth information. )rr@r8r/r/r0r@sz Link.netloccCstj|jjSr:)r'r(rArr<r8r/r/r0r<sz Link.pathcCstt|jdS)Nr;)rr>r?r<r=r8r/r/r0rsz Link.splitextcCs |dSN)rr8r/r/r0extszLink.extcCs&|j\}}}}}tj||||dfS)Nr2)rr'r( urlunsplit)r,rGr@r<queryfragmentr/r/r0url_without_fragmentszLink.url_without_fragmentz[#&]egg=([^&]*)cCs |j|j}|sdS|dSrH)_egg_fragment_researchrgroupr,matchr/r/r0 egg_fragmentszLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs |j|j}|sdS|dSrH)_subdirectory_fragment_rerPrrQrRr/r/r0subdirectory_fragmentszLink.subdirectory_fragmentz({choices})=([a-f0-9]+)|)choicescCsBtD]}||jkr|j|Sq|j|j}|r>|dSdS)N_SUPPORTED_HASHESr_hash_rerPrrQr,hashnamerSr/r/r0hashs  z Link.hashcCs<tD]}||jkr|Sq|j|j}|r8|dSdSrHrZr]r/r/r0 hash_names   zLink.hash_namecCs$t|jddddddS)N#rIr?)r>r?rsplitr8r/r/r0show_urlsz Link.show_urlcCs |jdkS)Nfile)rGr8r/r/r0is_filesz Link.is_filecCs|jotj|jSr:)rfosr<isdirrFr8r/r/r0is_existing_dirszLink.is_existing_dircCs |jtkSr:)rJr r8r/r/r0is_wheelsz Link.is_wheelcCsddlm}|j|jkS)Nr)vcs)pip._internal.vcsrkrG all_schemes)r,rkr/r/r0is_vcss z Link.is_vcscCs |jdk Sr:)rr8r/r/r0 is_yankedszLink.is_yankedcCs |jdk Sr:)r`r8r/r/r0has_hashsz Link.has_hash)r"r#cCs@|dks|jsdS|jdk s t|jdk s.t|j|j|jdS)zG Return True if the link has a hash and it is allowed. NF) hex_digest)rpr`rBr_is_hash_allowed)r,r"r/r/r0rrs zLink.is_hash_allowed)NNNTN).__name__ __module__ __qualname____doc__ __slots__r4rr boolrr+r6r9propertyr!rErFrGr@r<rrrJrNrecompilerOrTrUrVr3joinr[r\r_r`rdrfrirjrnrorpr rr __classcell__r/r/r-r0r's 2      rc@sJeZdZUdZejjed<ee e e fed<e ed<ee e fed<dS) _CleanResultaConvert link for equivalency check. This is used in the resolver to check whether two URL-specified requirements likely point to the same distribution and can be considered equivalent. This equivalency logic avoids comparing URLs literally, which can be too strict (e.g. "a=1&b=2" vs "b=2&a=1") and produce conflicts unexpecting to users. Currently this does three things: 1. Drop the basic auth part. This is technically wrong since a server can serve different content based on auth, but if it does that, it is even impossible to guarantee two URLs without auth are equivalent, since the user can input different auth information when prompted. So the practical solution is to assume the auth doesn't affect the response. 2. Parse the query to avoid the ordering issue. Note that ordering under the same key in the query are NOT cleaned; i.e. "a=1&a=2" and "a=2&a=1" are still considered different. 3. Explicitly drop most of the fragment part, except ``subdirectory=`` and hash values, since it should have no impact the downloaded content. Note that this drops the "egg=" part historically used to denote the requested project (and extras), which is wrong in the strictest sense, but too many people are supplying it inconsistently to cause superfluous resolution conflicts, so we choose to also ignore them. parsedrL subdirectoryr"N) rsrtrurvr'r( SplitResult__annotations__rr4rr/r/r/r0r~s  r~)linkr#c s|j}|jddd}|jdkr*|s*d}tj|jdkrLt d|zdd }Wnt t fk rxd }YnXfd d t D}t |j|d d d tj|j||dS)N@rIre localhosteggzIgnoring egg= fragment in %srrr2cs"i|]}|kr||dqS)rr/).0krMr/r0 /sz_clean_link..)r@rLrM)rrLrr")rr@rsplitrGr'r(parse_qsrMloggerdebug IndexErrorKeyErrorr[r~_replacerL)rrr@rr"r/rr0 _clean_links$   r)maxsize)link1link2r#cCst|t|kSr:)r)rrr/r/r0links_equivalent8sr)) functoolsloggingrgr>rz urllib.parser'typingrrrrrrrr pip._internal.utils.filetypesr pip._internal.utils.hashesr pip._internal.utils.miscr r rpip._internal.utils.modelsrpip._internal.utils.urlsrrpip._internal.index.collectorr getLoggerrsrr[rr~r lru_cacherxrr/r/r/r0s*(     X  PK]&'models/__pycache__/index.cpython-38.pycnu[U ʗRe@s2ddlZGdddZedddZedddZdS) NcsHeZdZdZdddddgZeeddfd d Zeed d d ZZS) PackageIndexzBRepresents a Package Index and provides easier access to endpointsurlnetloc simple_urlpypi_urlfile_storage_domainN)rrreturncsBt||_tj|j|_|d|_|d|_ ||_ dS)Nsimplepypi) super__init__rurllibparseurlsplitr _url_for_pathrrr)selfrr __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/index.pyr s    zPackageIndex.__init__)pathrcCstj|j|S)N)r rurljoinr)rrrrrrszPackageIndex._url_for_path) __name__ __module__ __qualname____doc__ __slots__strr r __classcell__rrrrrs rzhttps://pypi.org/zfiles.pythonhosted.org)rzhttps://test.pypi.org/ztest-files.pythonhosted.org) urllib.parser rPyPITestPyPIrrrrs  PK]%v̓ /models/__pycache__/target_python.cpython-38.pycnu[U ʗRe@sVddlZddlmZmZmZddlmZddlmZm Z ddl m Z GdddZ dS)N)ListOptionalTuple)Tag) get_supportedversion_info_to_nodot)normalize_version_infoc@szeZdZdZdddddddgZdeeeeee d feeeeed d d d Z edddZ ee dddZ d S) TargetPythonzx Encapsulates the properties of a Python interpreter one is targeting for a package install, download, etc. _given_py_version_infoabisimplementation platforms py_versionpy_version_info _valid_tagsN.)r rr r returncCsf||_|dkrtjdd}nt|}dtt|dd}||_||_||_ ||_ ||_ d|_ dS)a< :param platforms: A list of strings or None. If None, searches for packages that are supported by the current system. Otherwise, will find packages that can be built on the platforms passed in. These packages will only be downloaded for distribution: they will not be built locally. :param py_version_info: An optional tuple of ints representing the Python version information to use (e.g. `sys.version_info[:3]`). This can have length 1, 2, or 3 when provided. :param abis: A list of strings or None. This is passed to compatibility_tags.py's get_supported() function as is. :param implementation: A string or None. This is passed to compatibility_tags.py's get_supported() function as is. N.) r sys version_inforjoinmapstrr r r rrr)selfr rr r rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/target_python.py__init__szTargetPython.__init__)rcCsZd}|jdk r$ddd|jD}d|jfd|fd|jfd|jfg}d d d|DS) zD Format the given, non-None attributes for display. Nrcss|]}t|VqdS)N)r).0partrrr Isz,TargetPython.format_given..r rr r  css(|] \}}|dk r|d|VqdS)N=r)rkeyvaluerrrr Ss)r rr r r )rdisplay_version key_valuesrrr format_givenCs   zTargetPython.format_givencCsH|jdkrB|j}|dkrd}nt|}t||j|j|jd}||_|jS)z Return the supported PEP 425 tags to check wheel candidates against. The tags are returned in order of preference (most preferred first). N)versionr r impl)rr rrr r r )rrr(tagsrrrget_tagsWs zTargetPython.get_tags)NNNN)__name__ __module__ __qualname____doc__ __slots__rrrrintrr'rr+rrrrr s,    (r ) rtypingrrrZpip._vendor.packaging.tagsr&pip._internal.utils.compatibility_tagsrrpip._internal.utils.miscrr rrrrs   PK] 0models/__pycache__/format_control.cpython-38.pycnu[U ʗRe @s>ddlmZmZmZddlmZddlmZGdddZdS)) FrozenSetOptionalSet)canonicalize_name) CommandErrorc@seZdZdZddgZdeeeeeeddddZe e dd d Z ed d d Z e eeeeeddddZeeedddZdd ddZdS) FormatControlzBHelper for managing formats from which a package can be installed. no_binary only_binaryN)rr returncCs,|dkrt}|dkrt}||_||_dSN)setrr )selfrr r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/format_control.py__init__ s zFormatControl.__init__)otherr cs:tjstSjjkr dStfddjDS)NFc3s"|]}t|t|kVqdSr )getattr).0krr rr !sz'FormatControl.__eq__..) isinstance __class__NotImplemented __slots__all)r rrrr__eq__s   zFormatControl.__eq__)r cCsd|jj|j|jS)Nz {}({}, {}))formatr__name__rr r rrr__repr__#s zFormatControl.__repr__)valuetargetrr cCs|drtd|d}d|kr`|||d|d|dd=d|krdSq|D]2}|dkrz|qdt|}||||qddS)N-z7--no-binary / --only-binary option requires 1 argument.,:all:z:none:) startswithrsplitclearaddindexrdiscard)r!r"rnewnamerrrhandle_mutual_excludes(s&    z$FormatControl.handle_mutual_excludes)canonical_namer cCsfddh}||jkr|dn@||jkr4|dn*d|jkrJ|dnd|jkr^|dt|S)Nbinarysourcer%)r r,r frozenset)r r0resultrrrget_allowed_formats?s        z!FormatControl.get_allowed_formatscCs|d|j|jdS)Nr%)r/rr rrrrdisallow_binariesKs zFormatControl.disallow_binaries)NN)r __module__ __qualname____doc__rrrstrrobjectboolrr staticmethodr/rr5r6rrrrrs     rN) typingrrrpip._vendor.packaging.utilsrpip._internal.exceptionsrrrrrrs  PK]MD .models/__pycache__/search_scope.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZeeZGdddZdS) N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc@sreZdZdZddgZeeeeeddddZeeeedddd Z ed d d Z eeed ddZ dS) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urls)r r returncCsg}|D]0}|dr.t|}tj|r.|}||qtsvt||D](}t j |}|j dkrLt dqvqL|||dS)zQ Create a SearchScope object after normalizing the `find_links`. ~httpszipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.r r ) startswithrospathexistsappendr itertoolschainurllibparseurlparseschemeloggerwarning)clsr r built_find_linkslinknew_linkparsedr!/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/search_scope.pycreates&     zSearchScope.createNcCs||_||_dSNr)selfr r r!r!r"__init__AszSearchScope.__init__)r cCsg}g}|jrt|jtjgkrt|jD]:}t|}tj|}|jsR|jsRt d|| |q"| d d ||jr| d d dd|jDd |S)Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}css|]}t|VqdSr$)r.0urlr!r!r" hsz6SearchScope.get_formatted_locations.. )r r simple_urlrrrurlsplitrnetlocrrrformatjoinr )r%linesredacted_index_urlsr)redacted_index_urlpurlr!r!r"get_formatted_locationsIs,    z#SearchScope.get_formatted_locations) project_namer cs(ttdfdd fdd|jDS)zReturns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations )r)r cs.t|tjt}|ds*|d}|S)N/) posixpathr0rrquoterendswith)r)loc)r6r!r"mkurl_pypi_urlts z.mkurl_pypi_urlcsg|] }|qSr!r!r')r<r!r" sz8SearchScope.get_index_urls_locations..)strr )r%r6r!)r<r6r"get_index_urls_locationsms z$SearchScope.get_index_urls_locations) __name__ __module__ __qualname____doc__ __slots__ classmethodrr>r#r&r5r?r!r!r!r"rs) $r)rloggingrr8 urllib.parsertypingrpip._vendor.packaging.utilsrpip._internal.models.indexrpip._internal.utils.compatrpip._internal.utils.miscrr getLoggerr@rrr!r!r!r"s     PK]+0 5models/__pycache__/target_python.cpython-38.opt-1.pycnu[U .e@shddlZddlmZmZddlmZddlmZerTddlm Z m Z m Z ddlm Z Gddde ZdS) N) get_supportedversion_info_to_nodot)normalize_version_info)MYPY_CHECK_RUNNING)ListOptionalTuple) Pep425Tagc@s*eZdZdZd ddZddZddZdS) TargetPythonzx Encapsulates the properties of a Python interpreter one is targeting for a package install, download, etc. NcCsf||_|dkrtjdd}nt|}dtt|dd}||_||_||_ ||_ ||_ d|_ dS)a :param platform: A string or None. If None, searches for packages that are supported by the current system. Otherwise, will find packages that can be built on the platform passed in. These packages will only be downloaded for distribution: they will not be built locally. :param py_version_info: An optional tuple of ints representing the Python version information to use (e.g. `sys.version_info[:3]`). This can have length 1, 2, or 3 when provided. :param abi: A string or None. This is passed to pep425tags.py's get_supported() function as is. :param implementation: A string or None. This is passed to pep425tags.py's get_supported() function as is. N.) _given_py_version_infosys version_inforjoinmapstrabiimplementationplatform py_versionpy_version_info _valid_tags)selfrrrrrrF/usr/lib/python3.8/site-packages/pip/_internal/models/target_python.py__init__szTargetPython.__init__cCsZd}|jdk r$ddd|jD}d|jfd|fd|jfd|jfg}d d d|DS) zD Format the given, non-None attributes for display. Nr css|]}t|VqdS)N)r).0partrrr Csz,TargetPython.format_given..rrrr css&|]\}}|dk rd||VqdS)Nz{}={!r})format)rkeyvaluerrrr Ms)rrrrr)rZdisplay_versionZ key_valuesrrr format_given<s   zTargetPython.format_givencCsJ|jdkrD|j}|dkrd}n t|g}t||j|j|jd}||_|jS)z Return the supported PEP 425 tags to check wheel candidates against. The tags are returned in order of preference (most preferred first). N)versionsrrimpl)rrrrrrr)rrr&Ztagsrrrget_tagsRs  zTargetPython.get_tags)NNNN)__name__ __module__ __qualname____doc__rr%r(rrrrr s )r )rZpip._internal.pep425tagsrrZpip._internal.utils.miscrZpip._internal.utils.typingrtypingrrrr objectr rrrrs   PK]#b++*models/__pycache__/__init__.cpython-38.pycnu[U ʗRe?@sdZdS)z8A package that contains models that represent entities. N)__doc__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/__init__.pyPK]Mwzz-models/__pycache__/index.cpython-38.opt-1.pycnu[U .e$@s8ddlmZGdddeZedddZedddZd S) )parsecs(eZdZdZfddZddZZS) PackageIndexzGRepresents a Package Index and provides easier access to endpoints csDtt|||_t|j|_|d|_|d|_ ||_ dS)NZsimpleZpypi) superr__init__url urllib_parseZurlsplitZnetloc _url_for_pathZ simple_urlZpypi_urlfile_storage_domain)selfrr  __class__>/usr/lib/python3.8/site-packages/pip/_internal/models/index.pyrs   zPackageIndex.__init__cCst|j|S)N)rZurljoinr)r pathr r rrszPackageIndex._url_for_path)__name__ __module__ __qualname____doc__rr __classcell__r r r rrs rzhttps://pypi.org/zfiles.pythonhosted.org)r zhttps://test.pypi.org/ztest-files.pythonhosted.orgN)Zpip._vendor.six.moves.urllibrrobjectrZPyPIZTestPyPIr r r rs PK]@< 4models/__pycache__/search_scope.cpython-38.opt-1.pycnu[U .e@sddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZddlmZer|ddlmZeeZGd d d eZdS) N)canonicalize_name)parse)PyPI)HAS_TLS)normalize_pathredact_auth_from_url)MYPY_CHECK_RUNNING)Listc@s4eZdZdZeddZddZddZdd Zd S) SearchScopezF Encapsulates the locations that pip is configured to search. cCs~g}|D]0}|dr.t|}tj|r.|}||qtsrt||D]&}t |}|j dkrJt dqrqJ|||dS)zQ Create a SearchScope object after normalizing the `find_links`. ~Zhttpszipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. find_links index_urls) startswithrospathexistsappendr itertoolschain urllib_parseZurlparseZschemeloggerZwarning)clsr rZbuilt_find_linkslinkZnew_linkZparsedrE/usr/lib/python3.8/site-packages/pip/_internal/models/search_scope.pycreates&     zSearchScope.createcCs||_||_dSNr )selfr rrrr__init__GszSearchScope.__init__cCslg}|jr:|jtjgkr:|dddd|jD|jrb|dddd|jDd|S)NzLooking in indexes: {}z, css|]}t|VqdSrr.0urlrrr Usz6SearchScope.get_formatted_locations..zLooking in links: {}css|]}t|VqdSrr r!rrrr$Zs )rrZ simple_urlrformatjoinr )rlinesrrrget_formatted_locationsPsz#SearchScope.get_formatted_locationscs fddfdd|jDS)zReturns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations cs,t|tt}|ds(|d}|S)N/) posixpathr'rZquoterendswith)r#Zloc) project_namerrmkurl_pypi_urlgs  z.mkurl_pypi_urlcsg|] }|qSrrr!)r.rr tsz8SearchScope.get_index_urls_locations..)r)rr-r)r.r-rget_index_urls_locations_s z$SearchScope.get_index_urls_locationsN) __name__ __module__ __qualname____doc__ classmethodrrr)r0rrrrr s  ( r )rZloggingrr+Zpip._vendor.packaging.utilsrZpip._vendor.six.moves.urllibrrZpip._internal.models.indexrZpip._internal.utils.compatrZpip._internal.utils.miscrrZpip._internal.utils.typingrtypingr Z getLoggerr1robjectr rrrrs       PK]Bh<<7models/__pycache__/selection_prefs.cpython-38.opt-1.pycnu[U .et@s<ddlmZer(ddlmZddlmZGdddeZdS))MYPY_CHECK_RUNNING)Optional) FormatControlc@seZdZdZdddZdS)SelectionPreferenceszd Encapsulates the candidate selection preferences for downloading and installing files. FNcCs.|dkr d}||_||_||_||_||_dS)awCreate a SelectionPreferences object. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param format_control: A FormatControl object or None. Used to control the selection of source packages / binary packages when consulting the index and links. :param prefer_binary: Whether to prefer an old, but valid, binary dist over a new source dist. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. NF) allow_yankedallow_all_prereleasesformat_control prefer_binaryignore_requires_python)selfrrrr r r H/usr/lib/python3.8/site-packages/pip/_internal/models/selection_prefs.py__init__szSelectionPreferences.__init__)FNFN)__name__ __module__ __qualname____doc__rr r r r rs  rN)Zpip._internal.utils.typingrtypingrZ#pip._internal.models.format_controlrobjectrr r r r s   PK]}1models/__pycache__/candidate.cpython-38.opt-1.pycnu[U .e@s`ddlmZddlmZddlmZerLddlmZddlm Z ddl m Z GdddeZ d S) )parse)KeyBasedCompareMixin)MYPY_CHECK_RUNNING) _BaseVersion)Link)Anycs0eZdZdZfddZddZddZZS)InstallationCandidatez9Represents a potential "candidate" for installation. cs:||_t||_||_tt|j|j|j|jftddS)N)keyZdefining_class)project parse_versionversionlinksuperr__init__)selfr r r  __class__B/usr/lib/python3.8/site-packages/pip/_internal/models/candidate.pyrs  zInstallationCandidate.__init__cCsd|j|j|jS)Nz)formatr r r rrrr__repr__s zInstallationCandidate.__repr__cCsd|j|j|jS)Nz!{!r} candidate (version {} at {})rrrrr__str__$s zInstallationCandidate.__str__)__name__ __module__ __qualname____doc__rrr __classcell__rrrrrs rN) Zpip._vendor.packaging.versionrr Zpip._internal.utils.modelsrZpip._internal.utils.typingrrZpip._internal.models.linkrtypingrrrrrrs      PK]ڀ1models/__pycache__/selection_prefs.cpython-38.pycnu[U ʗRes@s*ddlmZddlmZGdddZdS))Optional) FormatControlc@s@eZdZdZdddddgZd eeeeeeedd d d ZdS) SelectionPreferenceszd Encapsulates the candidate selection preferences for downloading and installing files. allow_yankedallow_all_prereleasesformat_control prefer_binaryignore_requires_pythonFN)rrrrr returncCs.|dkr d}||_||_||_||_||_dS)awCreate a SelectionPreferences object. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param format_control: A FormatControl object or None. Used to control the selection of source packages / binary packages when consulting the index and links. :param prefer_binary: Whether to prefer an old, but valid, binary dist over a new source dist. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. NF)rrrrr )selfrrrrr r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/selection_prefs.py__init__szSelectionPreferences.__init__)FNFN) __name__ __module__ __qualname____doc__ __slots__boolrrrr r r r rs&rN)typingr#pip._internal.models.format_controlrrr r r r s  PK]Ҥ +models/__pycache__/candidate.cpython-38.pycnu[U ʗRe@s8ddlmZddlmZddlmZGdddeZdS))parse)Link)KeyBasedCompareMixincsReZdZdZdddgZeeeddfdd Zed d d Zed d d Z Z S)InstallationCandidatez4Represents a potential "candidate" for installation.nameversionlinkN)rrrreturncs6||_t||_||_tj|j|j|jftddS)N)keydefining_class)r parse_versionrrsuper__init__r)selfrrr __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/candidate.pyr s zInstallationCandidate.__init__)r cCsd|j|j|jS)Nz)formatrrrrrrr__repr__s zInstallationCandidate.__repr__cCsd|j|j|jS)Nz!{!r} candidate (version {} at {})rrrrr__str__s zInstallationCandidate.__str__) __name__ __module__ __qualname____doc__ __slots__strrrrr __classcell__rrrrrs   rN)Zpip._vendor.packaging.versionrr pip._internal.models.linkrpip._internal.utils.modelsrrrrrrs   PK]߂m,models/__pycache__/link.cpython-38.opt-1.pycnu[U .e@sddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z ddlmZddlmZmZerddlmZmZmZmZdd lmZdd lmZGd d d e ZdS) N)parse)WHEEL_EXTENSION)redact_auth_from_urlsplit_auth_from_netlocsplitext)KeyBasedCompareMixin)MYPY_CHECK_RUNNING) path_to_url url_to_path)OptionalTextTupleUnion)HTMLPage)Hashescs@eZdZdZd6fdd ZddZddZed d Zed d Z ed dZ eddZ eddZ eddZ ddZeddZeddZedZeddZedZedd Zed!Zed"d#Zed$d%Zed&d'Zed(d)Zd*d+Zed,d-Zed.d/Zed0d1Zed2d3Z d4d5Z!Z"S)7Linkz?Represents a parsed link from a Package Index's simple URL NcsV|drt|}t||_||_||_|r2|nd|_||_t t |j |t ddS)a` :param url: url of the resource pointed to (href of the link) :param comes_from: instance of HTMLPage where the link was found, or string. :param requires_python: String containing the `Requires-Python` metadata field, specified in PEP 345. This may be specified by a data-requires-python attribute in the HTML link tag, as described in PEP 503. :param yanked_reason: the reason the file has been yanked, if the file has been yanked, or None if the file hasn't been yanked. This is the value of the "data-yanked" attribute, if present, in a simple repository HTML link. If the file has been yanked but no reason was provided, this should be the empty string. See PEP 592 for more information and the specification. z\\N)keyZdefining_class) startswithr urllib_parseZurlsplit _parsed_url_url comes_fromrequires_python yanked_reasonsuperr__init__)selfurlrrr __class__=/usr/lib/python3.8/site-packages/pip/_internal/models/link.pyrs  z Link.__init__cCsD|jrd|j}nd}|jr2dt|j|j|fStt|jSdS)Nz (requires-python:%s)z%s (from %s)%s)rrrrstr)rZrpr r r!__str__Es  z Link.__str__cCsd|S)Nz r rr r r!__repr__Psz Link.__repr__cCs|jSN)rr%r r r!rSszLink.urlcCs:|jd}t|}|s,t|j\}}|St|}|SN/)pathrstrip posixpathbasenamernetlocrunquote)rr*namer.Z user_passr r r!filenameXs   z Link.filenamecCs t|jSr')r rr%r r r! file_pathgszLink.file_pathcCs|jjSr')rschemer%r r r!r3lsz Link.schemecCs|jjS)z4 This can contain auth information. )rr.r%r r r!r.qsz Link.netloccCst|jjSr')rr/rr*r%r r r!r*ysz Link.pathcCstt|jdSr()rr,r-r*r+r%r r r!r~sz Link.splitextcCs |dSN)rr%r r r!extszLink.extcCs$|j\}}}}}t||||dfSr')rrZ urlunsplit)rr3r.r*ZqueryZfragmentr r r!url_without_fragmentszLink.url_without_fragmentz[#&]egg=([^&]*)cCs |j|j}|sdS|dSr4)_egg_fragment_researchrgrouprmatchr r r! egg_fragmentszLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs |j|j}|sdS|dSr4)_subdirectory_fragment_rer9rr:r;r r r!subdirectory_fragmentszLink.subdirectory_fragmentz2(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)cCs |j|j}|r|dSdS)N_hash_rer9rr:r;r r r!hashs z Link.hashcCs |j|j}|r|dSdSr4rAr;r r r! hash_names zLink.hash_namecCs$t|jddddddS)N#r5r?)r,r-rsplitr%r r r!show_urlsz Link.show_urlcCs |jdkS)Nfile)r3r%r r r!is_filesz Link.is_filecCs|jotj|jSr')rJosr*isdirr2r%r r r!is_existing_dirszLink.is_existing_dircCs |jtkSr')r6rr%r r r!is_wheelsz Link.is_wheelcCsddlm}|j|jkS)Nr)vcs)Zpip._internal.vcsrOr3Z all_schemes)rrOr r r!is_vcss z Link.is_vcscCs |jdk Sr')rr%r r r! is_yankedszLink.is_yankedcCs |jdk Sr')rDr%r r r!has_hashsz Link.has_hashcCs$|dks|jsdS|j|j|jdS)zG Return True if the link has a hash and it is allowed. NF)Z hex_digest)rRis_hash_allowedrDrC)rZhashesr r r!rSszLink.is_hash_allowed)NNN)#__name__ __module__ __qualname____doc__rr$r&propertyrr1r2r3r.r*rr6r7recompiler8r=r>r?rBrCrDrHrJrMrNrPrQrRrS __classcell__r r rr!rsf'                     r)rKr,rYZpip._vendor.six.moves.urllibrrZpip._internal.utils.filetypesrZpip._internal.utils.miscrrrZpip._internal.utils.modelsrZpip._internal.utils.typingrZpip._internal.utils.urlsr r typingr r r rZpip._internal.collectorrZpip._internal.utils.hashesrrr r r r!s      PK]| p p 6models/__pycache__/format_control.cpython-38.opt-1.pycnu[U .e @sPddlmZddlmZddlmZers   PK]ௐ0models/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e?@sdZdS)z8A package that contains models that represent entities. N)__doc__rrA/usr/lib/python3.8/site-packages/pip/_internal/models/__init__.pyPK]0Omodels/candidate.pynu[from pip._vendor.packaging.version import parse as parse_version from pip._internal.models.link import Link from pip._internal.utils.models import KeyBasedCompareMixin class InstallationCandidate(KeyBasedCompareMixin): """Represents a potential "candidate" for installation.""" __slots__ = ["name", "version", "link"] def __init__(self, name: str, version: str, link: Link) -> None: self.name = name self.version = parse_version(version) self.link = link super().__init__( key=(self.name, self.version, self.link), defining_class=InstallationCandidate, ) def __repr__(self) -> str: return "".format( self.name, self.version, self.link, ) def __str__(self) -> str: return "{!r} candidate (version {} at {})".format( self.name, self.version, self.link, ) PK]QGemodels/target_python.pynu[import sys from typing import List, Optional, Tuple from pip._vendor.packaging.tags import Tag from pip._internal.utils.compatibility_tags import get_supported, version_info_to_nodot from pip._internal.utils.misc import normalize_version_info class TargetPython: """ Encapsulates the properties of a Python interpreter one is targeting for a package install, download, etc. """ __slots__ = [ "_given_py_version_info", "abis", "implementation", "platforms", "py_version", "py_version_info", "_valid_tags", ] def __init__( self, platforms: Optional[List[str]] = None, py_version_info: Optional[Tuple[int, ...]] = None, abis: Optional[List[str]] = None, implementation: Optional[str] = None, ) -> None: """ :param platforms: A list of strings or None. If None, searches for packages that are supported by the current system. Otherwise, will find packages that can be built on the platforms passed in. These packages will only be downloaded for distribution: they will not be built locally. :param py_version_info: An optional tuple of ints representing the Python version information to use (e.g. `sys.version_info[:3]`). This can have length 1, 2, or 3 when provided. :param abis: A list of strings or None. This is passed to compatibility_tags.py's get_supported() function as is. :param implementation: A string or None. This is passed to compatibility_tags.py's get_supported() function as is. """ # Store the given py_version_info for when we call get_supported(). self._given_py_version_info = py_version_info if py_version_info is None: py_version_info = sys.version_info[:3] else: py_version_info = normalize_version_info(py_version_info) py_version = ".".join(map(str, py_version_info[:2])) self.abis = abis self.implementation = implementation self.platforms = platforms self.py_version = py_version self.py_version_info = py_version_info # This is used to cache the return value of get_tags(). self._valid_tags: Optional[List[Tag]] = None def format_given(self) -> str: """ Format the given, non-None attributes for display. """ display_version = None if self._given_py_version_info is not None: display_version = ".".join( str(part) for part in self._given_py_version_info ) key_values = [ ("platforms", self.platforms), ("version_info", display_version), ("abis", self.abis), ("implementation", self.implementation), ] return " ".join( f"{key}={value!r}" for key, value in key_values if value is not None ) def get_tags(self) -> List[Tag]: """ Return the supported PEP 425 tags to check wheel candidates against. The tags are returned in order of preference (most preferred first). """ if self._valid_tags is None: # Pass versions=None if no py_version_info was given since # versions=None uses special default logic. py_version_info = self._given_py_version_info if py_version_info is None: version = None else: version = version_info_to_nodot(py_version_info) tags = get_supported( version=version, platforms=self.platforms, abis=self.abis, impl=self.implementation, ) self._valid_tags = tags return self._valid_tags PK]Z0tTY&Y&models/link.pynu[import functools import logging import os import posixpath import re import urllib.parse from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Tuple, Union from pip._internal.utils.filetypes import WHEEL_EXTENSION from pip._internal.utils.hashes import Hashes from pip._internal.utils.misc import ( redact_auth_from_url, split_auth_from_netloc, splitext, ) from pip._internal.utils.models import KeyBasedCompareMixin from pip._internal.utils.urls import path_to_url, url_to_path if TYPE_CHECKING: from pip._internal.index.collector import HTMLPage logger = logging.getLogger(__name__) _SUPPORTED_HASHES = ("sha1", "sha224", "sha384", "sha256", "sha512", "md5") class Link(KeyBasedCompareMixin): """Represents a parsed link from a Package Index's simple URL""" __slots__ = [ "_parsed_url", "_url", "comes_from", "requires_python", "yanked_reason", "cache_link_parsing", ] def __init__( self, url: str, comes_from: Optional[Union[str, "HTMLPage"]] = None, requires_python: Optional[str] = None, yanked_reason: Optional[str] = None, cache_link_parsing: bool = True, ) -> None: """ :param url: url of the resource pointed to (href of the link) :param comes_from: instance of HTMLPage where the link was found, or string. :param requires_python: String containing the `Requires-Python` metadata field, specified in PEP 345. This may be specified by a data-requires-python attribute in the HTML link tag, as described in PEP 503. :param yanked_reason: the reason the file has been yanked, if the file has been yanked, or None if the file hasn't been yanked. This is the value of the "data-yanked" attribute, if present, in a simple repository HTML link. If the file has been yanked but no reason was provided, this should be the empty string. See PEP 592 for more information and the specification. :param cache_link_parsing: A flag that is used elsewhere to determine whether resources retrieved from this link should be cached. PyPI index urls should generally have this set to False, for example. """ # url can be a UNC windows share if url.startswith("\\\\"): url = path_to_url(url) self._parsed_url = urllib.parse.urlsplit(url) # Store the url as a private attribute to prevent accidentally # trying to set a new value. self._url = url self.comes_from = comes_from self.requires_python = requires_python if requires_python else None self.yanked_reason = yanked_reason super().__init__(key=url, defining_class=Link) self.cache_link_parsing = cache_link_parsing def __str__(self) -> str: if self.requires_python: rp = f" (requires-python:{self.requires_python})" else: rp = "" if self.comes_from: return "{} (from {}){}".format( redact_auth_from_url(self._url), self.comes_from, rp ) else: return redact_auth_from_url(str(self._url)) def __repr__(self) -> str: return f"" @property def url(self) -> str: return self._url @property def filename(self) -> str: path = self.path.rstrip("/") name = posixpath.basename(path) if not name: # Make sure we don't leak auth information if the netloc # includes a username and password. netloc, user_pass = split_auth_from_netloc(self.netloc) return netloc name = urllib.parse.unquote(name) assert name, f"URL {self._url!r} produced no filename" return name @property def file_path(self) -> str: return url_to_path(self.url) @property def scheme(self) -> str: return self._parsed_url.scheme @property def netloc(self) -> str: """ This can contain auth information. """ return self._parsed_url.netloc @property def path(self) -> str: return urllib.parse.unquote(self._parsed_url.path) def splitext(self) -> Tuple[str, str]: return splitext(posixpath.basename(self.path.rstrip("/"))) @property def ext(self) -> str: return self.splitext()[1] @property def url_without_fragment(self) -> str: scheme, netloc, path, query, fragment = self._parsed_url return urllib.parse.urlunsplit((scheme, netloc, path, query, "")) _egg_fragment_re = re.compile(r"[#&]egg=([^&]*)") @property def egg_fragment(self) -> Optional[str]: match = self._egg_fragment_re.search(self._url) if not match: return None return match.group(1) _subdirectory_fragment_re = re.compile(r"[#&]subdirectory=([^&]*)") @property def subdirectory_fragment(self) -> Optional[str]: match = self._subdirectory_fragment_re.search(self._url) if not match: return None return match.group(1) _hash_re = re.compile( r"({choices})=([a-f0-9]+)".format(choices="|".join(_SUPPORTED_HASHES)) ) @property def hash(self) -> Optional[str]: match = self._hash_re.search(self._url) if match: return match.group(2) return None @property def hash_name(self) -> Optional[str]: match = self._hash_re.search(self._url) if match: return match.group(1) return None @property def show_url(self) -> str: return posixpath.basename(self._url.split("#", 1)[0].split("?", 1)[0]) @property def is_file(self) -> bool: return self.scheme == "file" def is_existing_dir(self) -> bool: return self.is_file and os.path.isdir(self.file_path) @property def is_wheel(self) -> bool: return self.ext == WHEEL_EXTENSION @property def is_vcs(self) -> bool: from pip._internal.vcs import vcs return self.scheme in vcs.all_schemes @property def is_yanked(self) -> bool: return self.yanked_reason is not None @property def has_hash(self) -> bool: return self.hash_name is not None def is_hash_allowed(self, hashes: Optional[Hashes]) -> bool: """ Return True if the link has a hash and it is allowed. """ if hashes is None or not self.has_hash: return False # Assert non-None so mypy knows self.hash_name and self.hash are str. assert self.hash_name is not None assert self.hash is not None return hashes.is_hash_allowed(self.hash_name, hex_digest=self.hash) class _CleanResult(NamedTuple): """Convert link for equivalency check. This is used in the resolver to check whether two URL-specified requirements likely point to the same distribution and can be considered equivalent. This equivalency logic avoids comparing URLs literally, which can be too strict (e.g. "a=1&b=2" vs "b=2&a=1") and produce conflicts unexpecting to users. Currently this does three things: 1. Drop the basic auth part. This is technically wrong since a server can serve different content based on auth, but if it does that, it is even impossible to guarantee two URLs without auth are equivalent, since the user can input different auth information when prompted. So the practical solution is to assume the auth doesn't affect the response. 2. Parse the query to avoid the ordering issue. Note that ordering under the same key in the query are NOT cleaned; i.e. "a=1&a=2" and "a=2&a=1" are still considered different. 3. Explicitly drop most of the fragment part, except ``subdirectory=`` and hash values, since it should have no impact the downloaded content. Note that this drops the "egg=" part historically used to denote the requested project (and extras), which is wrong in the strictest sense, but too many people are supplying it inconsistently to cause superfluous resolution conflicts, so we choose to also ignore them. """ parsed: urllib.parse.SplitResult query: Dict[str, List[str]] subdirectory: str hashes: Dict[str, str] def _clean_link(link: Link) -> _CleanResult: parsed = link._parsed_url netloc = parsed.netloc.rsplit("@", 1)[-1] # According to RFC 8089, an empty host in file: means localhost. if parsed.scheme == "file" and not netloc: netloc = "localhost" fragment = urllib.parse.parse_qs(parsed.fragment) if "egg" in fragment: logger.debug("Ignoring egg= fragment in %s", link) try: # If there are multiple subdirectory values, use the first one. # This matches the behavior of Link.subdirectory_fragment. subdirectory = fragment["subdirectory"][0] except (IndexError, KeyError): subdirectory = "" # If there are multiple hash values under the same algorithm, use the # first one. This matches the behavior of Link.hash_value. hashes = {k: fragment[k][0] for k in _SUPPORTED_HASHES if k in fragment} return _CleanResult( parsed=parsed._replace(netloc=netloc, query="", fragment=""), query=urllib.parse.parse_qs(parsed.query), subdirectory=subdirectory, hashes=hashes, ) @functools.lru_cache(maxsize=None) def links_equivalent(link1: Link, link2: Link) -> bool: return _clean_link(link1) == _clean_link(link2) PK]ssmodels/selection_prefs.pynu[from typing import Optional from pip._internal.models.format_control import FormatControl class SelectionPreferences: """ Encapsulates the candidate selection preferences for downloading and installing files. """ __slots__ = [ "allow_yanked", "allow_all_prereleases", "format_control", "prefer_binary", "ignore_requires_python", ] # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. def __init__( self, allow_yanked: bool, allow_all_prereleases: bool = False, format_control: Optional[FormatControl] = None, prefer_binary: bool = False, ignore_requires_python: Optional[bool] = None, ) -> None: """Create a SelectionPreferences object. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param format_control: A FormatControl object or None. Used to control the selection of source packages / binary packages when consulting the index and links. :param prefer_binary: Whether to prefer an old, but valid, binary dist over a new source dist. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. """ if ignore_requires_python is None: ignore_requires_python = False self.allow_yanked = allow_yanked self.allow_all_prereleases = allow_all_prereleases self.format_control = format_control self.prefer_binary = prefer_binary self.ignore_requires_python = ignore_requires_python PK]{(??models/__init__.pynu["""A package that contains models that represent entities. """ PK] W7models/search_scope.pynu[import itertools import logging import os import posixpath import urllib.parse from typing import List from pip._vendor.packaging.utils import canonicalize_name from pip._internal.models.index import PyPI from pip._internal.utils.compat import has_tls from pip._internal.utils.misc import normalize_path, redact_auth_from_url logger = logging.getLogger(__name__) class SearchScope: """ Encapsulates the locations that pip is configured to search. """ __slots__ = ["find_links", "index_urls"] @classmethod def create( cls, find_links: List[str], index_urls: List[str], ) -> "SearchScope": """ Create a SearchScope object after normalizing the `find_links`. """ # Build find_links. If an argument starts with ~, it may be # a local file relative to a home directory. So try normalizing # it and if it exists, use the normalized version. # This is deliberately conservative - it might be fine just to # blindly normalize anything starting with a ~... built_find_links: List[str] = [] for link in find_links: if link.startswith("~"): new_link = normalize_path(link) if os.path.exists(new_link): link = new_link built_find_links.append(link) # If we don't have TLS enabled, then WARN if anyplace we're looking # relies on TLS. if not has_tls(): for link in itertools.chain(index_urls, built_find_links): parsed = urllib.parse.urlparse(link) if parsed.scheme == "https": logger.warning( "pip is configured with locations that require " "TLS/SSL, however the ssl module in Python is not " "available." ) break return cls( find_links=built_find_links, index_urls=index_urls, ) def __init__( self, find_links: List[str], index_urls: List[str], ) -> None: self.find_links = find_links self.index_urls = index_urls def get_formatted_locations(self) -> str: lines = [] redacted_index_urls = [] if self.index_urls and self.index_urls != [PyPI.simple_url]: for url in self.index_urls: redacted_index_url = redact_auth_from_url(url) # Parse the URL purl = urllib.parse.urlsplit(redacted_index_url) # URL is generally invalid if scheme and netloc is missing # there are issues with Python and URL parsing, so this test # is a bit crude. See bpo-20271, bpo-23505. Python doesn't # always parse invalid URLs correctly - it should raise # exceptions for malformed URLs if not purl.scheme and not purl.netloc: logger.warning( 'The index url "%s" seems invalid, please provide a scheme.', redacted_index_url, ) redacted_index_urls.append(redacted_index_url) lines.append( "Looking in indexes: {}".format(", ".join(redacted_index_urls)) ) if self.find_links: lines.append( "Looking in links: {}".format( ", ".join(redact_auth_from_url(url) for url in self.find_links) ) ) return "\n".join(lines) def get_index_urls_locations(self, project_name: str) -> List[str]: """Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations """ def mkurl_pypi_url(url: str) -> str: loc = posixpath.join( url, urllib.parse.quote(canonicalize_name(project_name)) ) # For maximum compatibility with easy_install, ensure the path # ends in a trailing slash. Although this isn't in the spec # (and PyPI can handle it without the slash) some other index # implementations might break if they relied on easy_install's # behavior. if not loc.endswith("/"): loc = loc + "/" return loc return [mkurl_pypi_url(url) for url in self.index_urls] PK]I4+vcs/__pycache__/bazaar.cpython-38.opt-1.pycnu[U .eu@sddlmZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z ddlmZddlmZmZe rdd lmZmZdd lmZdd lmZmZeeZGd d d eZeedS))absolute_importN)parse) display_pathrmtree) make_command)MYPY_CHECK_RUNNING) path_to_url)VersionControlvcs)OptionalTuple) HiddenText)AuthInfo RevOptionscseZdZdZdZdZdZfddZeddZ d d Z d d Z d dZ ddZ efddZeddZeddZeddZZS)Bazaarbzrz.bzrbranch)rzbzr+httpz bzr+httpszbzr+sshzbzr+sftpzbzr+ftpzbzr+lpcs0tt|j||ttddr,tjdgdS)N uses_fragmentZlp)superr__init__getattr urllib_parserextend)selfargskwargs __class__|}td||t|tdd|||}||dS)NzChecking out %s%s to %sr-q)Z to_displayloggerinforrr(r')rdestr*r+Z rev_displaycmd_argsrrr fetch_new=szBazaar.fetch_newcCs|jtd||ddS)Nswitchcwd)r'r)rr/r*r+rrrr2Ksz Bazaar.switchcCs"tdd|}|j||ddS)NZpullr,r3)rr(r')rr/r*r+r0rrrupdateOsz Bazaar.updatecs2tt||\}}}|dr(d|}|||fS)Nzssh://zbzr+)rrget_url_rev_and_auth startswith)clsr*r Z user_passrrrr6Ts zBazaar.get_url_rev_and_authcCst|jdgd|d}|D]T}|}dD]B}||r*||d}||r`t|S|Sq*qdS)Nr.Fr#r4)zcheckout of branch: zparent branch: )r' splitlinesstripr7splitZ_is_local_repositoryr)r8r)ZurlslinexZreporrrget_remote_url]s   zBazaar.get_remote_urlcCs|jdgd|d}|dS)NZrevnoFr9)r'r;)r8r)Zrevisionrrr get_revisionks zBazaar.get_revisioncCsdS)z&Always assume the versions don't matchFr)r8r/namerrris_commit_id_equalrszBazaar.is_commit_id_equal)__name__ __module__ __qualname__rCdirnameZ repo_nameZschemesr staticmethodr!r"r1r2r5 classmethodr6r@rBrD __classcell__rrrrrs&    r)Z __future__rZloggingr$Zpip._vendor.six.moves.urllibrrZpip._internal.utils.miscrrZpip._internal.utils.subprocessrZpip._internal.utils.typingrZpip._internal.utils.urlsrZ pip._internal.vcs.versioncontrolr r typingr r r rrZ getLoggerrEr-rregisterrrrrs       ^PK]Lo_!_!)vcs/__pycache__/subversion.cpython-38.pycnu[U ʗRe-@sddlZddlZddlZddlmZmZmZddlmZm Z m Z m Z m Z ddl mZmZddlmZmZmZmZmZeeZedZedZedZed ZGd d d eZeedS) N)ListOptionalTuple) HiddenText display_pathis_console_interactiveis_installable_dirsplit_auth_from_netloc) CommandArgs make_command)AuthInfoRemoteNotFoundError RevOptionsVersionControlvcsz url="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z(.*)c seZdZdZdZdZdZeee dddZ e ee edd d Z eeed d d Zeeeeeeeeeeffdfdd Zeeeeeeefdfdd Ze eeeeedddZeeed ddZeeeeeefd ddZeeeee dddZd2e ddfd d! Zeed"fd#d$d%Zeed"fd#d&d'Zed#d(d)Zeeeedd*d+d,Z eeedd-d.d/Z!eeedd-d0d1Z"Z#S)3 Subversionsvnz.svncheckout)zsvn+sshzsvn+httpz svn+httpszsvn+svnzsvn+file) remote_urlreturncCsdS)NT)clsrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/subversion.pyshould_add_vcs_url_prefix$sz$Subversion.should_add_vcs_url_prefix)revrcCsd|gS)Nz-rr)rrrrget_base_rev_args(szSubversion.get_base_rev_args)locationrc Csd}t|D]\}}}|j|kr0g|dd<q||jtj||jd}tj|s\q||\}}||kr|dk s~t|d}n|r| |sg|dd<qt ||}qt |S)zR Return the maximum revision for all files under a given location rNentries/) oswalkdirnameremovepathjoinexists_get_svn_url_revAssertionError startswithmaxstr) rrrevisionbasedirs_ entries_fndirurllocalrevrrr get_revision,s$        zSubversion.get_revision)netlocschemercs|dkrt||St|S)z This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. ssh)superget_netloc_and_authr )rr3r4 __class__rrr7IszSubversion.get_netloc_and_auth)urlrcs.t|\}}}|dr$d|}|||fS)Nzssh://zsvn+)r6get_url_rev_and_authr()rr:r user_passr8rrr;Xs zSubversion.get_url_rev_and_auth)usernamepasswordrcCs(g}|r|d|g7}|r$|d|g7}|S)Nz --usernamez --passwordr)r=r> extra_argsrrr make_rev_args`s   zSubversion.make_rev_argscCsT|}t|s6|}tj|}||krtd|tq||\}}|dkrPt|S)NzMCould not find Python project for directory %s (tried all parent directories))rrr#r!loggerwarningr r&)rr orig_location last_locationr:_revrrrget_remote_urlls zSubversion.get_remote_urlc Csddlm}tj||jd}tj|rHt|}|}W5QRXnd}d}| dsn| dsn| drt t t j |d}|dd=|dd }d d |Ddg}n| d rt|} | std || d}dd t|Ddg}nrzP|jdd|gddd} t| } | dk s,t| d}dd t| D}Wn |k rldg}}YnX|r~t|} nd} || fS)Nr)InstallationErrorr8910z cSs,g|]$}t|dkr|drt|dqS) )lenint).0drrr s z/Subversion._get_svn_url_rev..zs     (PK];Eab1b1"vcs/__pycache__/git.cpython-38.pycnu[U ʗReF@sddlZddlZddlZddlZddlZddlZddlm Z m Z m Z ddl m Z mZddlmZmZmZddlmZddlmZmZmZmZmZmZmZejjZejjZe e!Z"e#dZ$e#dZ%e#d ej&Z'e(e)d d d Z*Gd ddeZ+e,e+dS)N)ListOptionalTuple) BadCommandInstallationError) HiddenText display_pathhide_url) make_command)AuthInfoRemoteNotFoundErrorRemoteNotValidError RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcsz(^git version (\d+)\.(\d+)(?:\.(\d+))?.*$z^[a-fA-F0-9]{40}$a/^ # Optional user, e.g. 'git@' (\w+@)? # Server, e.g. 'github.com'. ([^/:]+): # The server-side path. e.g. 'user/project.git'. Must start with an # alphanumeric character so as not to be confusable with a Windows paths # like 'C:/foo/bar' or 'C:\foo\bar'. (\w[^:]*) $)shareturncCstt|SN)bool HASH_REGEXmatch)rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/git.pylooks_like_hash7srcseZdZdZdZdZdZdZdZe e e e ddd Z e e e d d d Zeed fdddZee ee dddZee e eee e fdddZee e e dddZee eeedddZee ee e dddZe eeedd d!d"Ze eeddd#d$Ze eeddd%d&Zee e dd'd(Ze e e d)d*d+Zee e e d,d-d.Z edhsz&Git.get_git_version..) run_commandGIT_VERSION_REGEXrloggerwarningtuplegroups)r)r.rrrrget_git_version]s  zGit.get_git_version)locationrcCsDdddg}|j|ddd|d}|}|dr@|tdd Sd S) zl Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). z symbolic-ref-qr FTextra_ok_returncodesr0r1cwdz refs/heads/N)r6strip startswithlen)clsr=argsoutputrefrrrget_current_branchjs  zGit.get_current_branch)r%r!rc Cs|jd|g|dddd}i}|dD]V}|d}|s>q*z|jdd d \}}Wn"tk rvtd |YnX|||<q*d |}d |} ||} | dk r| dfS|| } | dfS)z Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name. zshow-refFTignore)rCr0r1 on_returncode   )maxsplitzunexpected show-ref line: zrefs/remotes/origin/z refs/tags/N)r6rDsplitrstrip ValueErrorget) rGr%r!rIrefslineref_sharef_name branch_reftag_refrrrrr(s0       zGit.get_revision_shacCs.|drdSt|sdS|||r*dSdS)a$ Return true if rev is a ref or is a commit that we don't have locally. Branches and tags are not considered in this method because they are assumed to be always available locally (which is a normal outcome of ``git clone`` and ``git fetch --tags``). zrefs/TF)rEr has_commit)rGr%r!rrr _should_fetchs  zGit._should_fetch)r%r$r+rcCs|j}|dk st|||\}}|dk rF||}|r<|nd|_|St|sZtd||||sj|S|j t dd|| |d|j |dd}||}|S)z Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object. Nz:Did not find branch or tag '%s', assuming revision or ref.fetchr>rC FETCH_HEADr") arg_revAssertionErrorr(make_new branch_namerr8r9r^r6r to_args get_revision)rGr%r$r+r!r is_branchrrrresolve_revisions*     zGit.resolve_revision)r%namercCs|sdS|||kS)z Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. F)rg)rGr%rjrrrr's zGit.is_commit_id_equalN)r%r$r+ verbosityrc CsJ|}td||t||dkr*d}n|dkr8d}nd}|dkrb|td|||fn|td|||f|jr||||}t |d d}t d |||dkr| ||jstd d | }|j||dn6| ||kr,d|} d d|d| g}|j||dn||} || }td||j||dS)NzCloning %s%s to %sr)z--quietr@r)z --verbosez --progress)rQr--filter=blob:nonerezRev options %s, branch_name %scheckoutr>r`zorigin/z-bz--trackzResolved %s to commit %s)rrm)r) to_displayr8inforr<r6r r!rigetattrdebugr'rfrKrgrdupdate_submodules) r)r%r$r+rk rev_displayflagsrecmd_args track_branchrrrr fetch_newsX      z Git.fetch_newcCsB|jtdd||dtdd|}|j||d||dS)Nconfigzremote.origin.urlr`rnr>)r6r rfrsr)r%r$r+rvrrrswitchDs z Git.switchcCsp|dkr"|jdddg|dn|jddg|d||||}tddd|}|j||d||dS)N)r@ r_r>z--tagsr`resetz--hard)r<r6rir rfrsrzrrrupdateNs z Git.updatecCs|jdddgddd|d}|}z |d}Wntk rFtYnX|D]}|d rL|}qdqL|d d }||S) z Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. ryz --get-regexpzremote\..*\.urlr?FTrArzremote.origin.url rPr@)r6 splitlines IndexErrorr rErS_git_remote_to_pip_urlrD)rGr=stdoutremotes found_remoteremoter$rrrget_remote_url\s$    zGit.get_remote_url)r$rcCsNtd|r|Stj|r*t|St|}|rB| dSt |dS)a8 Convert a remote url from what git uses to what pip accepts. There are 3 legal forms **url** may take: 1. A fully qualified url: ssh://git@example.com/foo/bar.git 2. A local project.git folder: /path/to/bare/repository.git 3. SCP shorthand for form 1: git@example.com:foo/bar.git Form 1 is output as-is. Form 2 must be converted to URI and form 3 must be converted to form 1. See the corresponding test test_git_remote_url_to_pip() for examples of sample inputs/outputs. z\w+://z ssh://\1\2/\3N) rerospathexistspathlibPurePathas_uri SCP_REGEXexpandr )r$ scp_matchrrrrzs    zGit._git_remote_to_pip_url)r=r!rcCs@z |jdddd|g|ddWntk r6YdSXdSdS) zU Check if rev is a commit that is available in the local repository. rev-parser>z--verifyzsha^F)rClog_failed_cmdTN)r6r)rGr=r!rrrr]s zGit.has_commitcCs*|dkr d}|jd|gdd|d}|S)Nr rFTr0r1rC)r6rD)rGr=r! current_revrrrrgszGit.get_revisioncCsT|jddgdd|d}tj|s4tj||}tjtj|d}t||S)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. rz --git-dirFTrz..)r6rDrrisabsjoinabspathr)rGr=git_dir repo_rootrrrget_subdirectorys  zGit.get_subdirectoryc st|\}}}}}|dr|dt|d }|tj|ddd}|dd} |d| t || d||||f}d|krd|kst |d d }t |\}} } |d d }nt |\}} } || | fS) a9 Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub. fileN/\+r@z://zfile:zgit+z git+ssh://zssh://) urlsplitendswithrFlstripurllibrequest url2pathnamereplacefind urlunsplitrcsuperget_url_rev_and_auth) rGr$schemenetlocrqueryfragmentinitial_slashesnewpath after_plusr! user_pass __class__rrrs(     zGit.get_url_rev_and_authcCs6tjtj|dsdS|jdddddg|ddS)Nz .gitmodules submoduler~z--initz --recursiver>r`)rrrrr6)rGr=rrrrss  zGit.update_submodulescs|t|}|r|Sz|jddg|ddddd}Wn6tk rTtd|YdStk rhYdSXtj | dS) Nrz--show-toplevelFTraise)rCr0r1rMrzKcould not determine if %s is under git control because git is not availablez ) rget_repository_rootr6rr8rrrrrnormpathrT)rGr=locrrrrrs*  zGit.get_repository_root)repo_urlrcCsdS)zEIn either https or ssh form, requirements must be prefixed with git+.Tr)rrrrshould_add_vcs_url_prefixszGit.should_add_vcs_url_prefix)N))__name__ __module__ __qualname__rjdirname repo_nameschemes unset_environdefault_arg_rev staticmethodstrrr#rr-rr2r< classmethodrrKr(r^rrrir'rxr{r~rrr]rgrr rrsrr __classcell__rrrrr;sd   -- ?  $r)-loggingos.pathrrr urllib.parserurllib.requesttypingrrrpip._internal.exceptionsrrpip._internal.utils.miscrrr pip._internal.utils.subprocessr pip._internal.vcs.versioncontrolr r r rrrrparserr getLoggerrr8compiler7rVERBOSErrrrrregisterrrrrs6 $    VPK]DV))'vcs/__pycache__/__init__.cpython-38.pycnu[U ʗReT@s@ddlZddlZddlZddlZddlmZmZmZm Z m Z dS)N)RemoteNotFoundErrorRemoteNotValidErroris_urlmake_vcs_requirement_urlvcs) pip._internal.vcs.bazaarpippip._internal.vcs.gitpip._internal.vcs.mercurialpip._internal.vcs.subversion pip._internal.vcs.versioncontrolrrrrrr r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/__init__.pysPK].dHH3vcs/__pycache__/versioncontrol.cpython-38.opt-1.pycnu[U .e~S@sdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZddlmZddlmZmZmZmZmZmZdd lmZmZdd lmZdd lmZerdd lm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)dd l*m+Z+ddlm,Z,ddlm-Z-e'e%e.e%e.fZ/dgZ0e1e2Z3ddZ4dddZ5ddZ6Gddde7Z8Gddde9Z:Gddde9Z;e;Z)r&r=r!r(r>r#r#r$__repr__szRevOptions.__repr__cCs|jdkr|jjS|jSN)r(r=default_arg_revr@r#r#r$arg_revs zRevOptions.arg_revcCs0g}|j}|dk r"||j|7}||j7}|S)z< Return the VCS-specific command arguments. N)rDr=get_base_rev_argsr<)r>argsr(r#r#r$to_argss  zRevOptions.to_argscCs|js dSd|jS)Nz (to revision {}))r(r&r@r#r#r$ to_displayszRevOptions.to_displaycCs|jj||jdS)z Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. r<)r=make_rev_optionsr<)r>r(r#r#r$make_newszRevOptions.make_new)NN) r8r9r:__doc__r?rApropertyrDrGrIrLr#r#r#r$r;js    r;cs|eZdZiZddddddgZfddZd d Zed d Zed dZ eddZ ddZ ddZ ddZ ddZZS) VcsSupportZsshZgitZhgZbzrZsftpZsvncs:tj|jttddr(tj|jtt|dS)N uses_fragment) urllib_parseZ uses_netlocextendschemesgetattrrPsuperrOr?r@ __class__r#r$r?s zVcsSupport.__init__cCs |jSrB) _registry__iter__r@r#r#r$rYszVcsSupport.__iter__cCst|jSrB)listrXvaluesr@r#r#r$backendsszVcsSupport.backendscCsdd|jDS)NcSsg|] }|jqSr#)r1).0backendr#r#r$ sz'VcsSupport.dirnames..)r\r@r#r#r$dirnamesszVcsSupport.dirnamescCs g}|jD]}||jq |SrB)r\rRrS)r>rSr^r#r#r$r s zVcsSupport.all_schemescCsHt|dstd|jdS|j|jkrD||j|j<td|jdS)Nr!zCannot register VCS %szRegistered VCS backend: %s)hasattrr2r3r8r!rXdebug)r>clsr#r#r$registers   zVcsSupport.registercCs||jkr|j|=dSrB)rXr>r!r#r#r$ unregisters zVcsSupport.unregistercCs6|jD]&}||r td||j|Sq dS)zv Return a VersionControl object if a repository of that type is found at the given directory. zDetermine that %s uses VCS: %sN)rXr[controls_locationr2rbr!)r>r5Z vcs_backendr#r#r$get_backend_for_dirs  zVcsSupport.get_backend_for_dircCs|}|j|S)z9 Return a VersionControl object or None. )lowerrXgetrer#r#r$ get_backendszVcsSupport.get_backend)r8r9r:rXrSr?rYrNr\r`r rdrfrhrk __classcell__r#r#rVr$rOs      rOc @s8eZdZdZdZdZdZdZdZe ddZ e ddZ e dd Z e d d Z ed d Ze d8ddZe ddZddZe ddZe ddZeddZddZeddZe ddZd d!Zd"d#Zd$d%Ze d&d'Zd(d)Zd*d+Ze d,d-Ze d.d/Z e d9d2d3Z!e d4d5Z"e d6d7Z#dS):VersionControlrHr#NcCs|d|j S)z Return whether the vcs prefix (e.g. "git+") should be added to a repository's remote url when used in a requirement. z{}:)ri startswithr&r!)rcZ remote_urlr#r#r$should_add_vcs_url_prefixsz(VersionControl.should_add_vcs_url_prefixcCsdS)z~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. Nr#rcr5r#r#r$get_subdirectoryszVersionControl.get_subdirectorycCs ||S)zR Return the revision string that should be used in a requirement. ) get_revision)rcrepo_dirr#r#r$get_requirement_revisionsz'VersionControl.get_requirement_revisioncCsV||}|dkrdS||r.d|j|}||}||}t||||d}|S)aC Return the requirement string to use to redownload the files currently at the given repository directory. Args: project_name: the (unescaped) project name. The return value has a form similar to the following: {repository_url}@{revision}#egg={project_name} Nz{}+{})r*)get_remote_urlror&r!rtrqr,)rcrsr)r'Zrevisionr*r+r#r#r$get_src_requirements    z"VersionControl.get_src_requirementcCstdS)z Return the base revision arguments for a vcs command. Args: rev: the name of a revision to install. Cannot be None. NNotImplementedError)r(r#r#r$rE8sz VersionControl.get_base_rev_argscCst|||dS)z Return a RevOptions object. Args: rev: the name of a revision to install. extra_args: a list of extra options. rJ)r;)rcr(r<r#r#r$rKBs zVersionControl.make_rev_optionscCs&tj|\}}|tjjp$t|S)zy posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\folder) )r-r. splitdrivernsepbool)rcZrepoZdrivetailr#r#r$_is_local_repositoryNsz#VersionControl._is_local_repositorycCstdS)z Export the repository at the url to the destination location i.e. only download the files, without vcs informations :param url: the repository URL starting with a vcs prefix. Nrwr>r5urlr#r#r$exportXszVersionControl.exportcCs|dfS)aZ Parse the repository URL's netloc, and return the new netloc to use along with auth information. Args: netloc: the original repository URL netloc. scheme: the repository URL's scheme without the vcs prefix. This is mainly for the Subversion class to override, so that auth information can be provided via the --username and --password options instead of through the URL. For other subclasses like Git without such an option, auth information must stay in the URL. Returns: (netloc, (username, password)). )NNr#)rcnetlocr"r#r#r$get_netloc_and_authbsz"VersionControl.get_netloc_and_authc Cst|\}}}}}d|kr*td||ddd}|||\}}d}d|krf|dd\}}t||||df}|||fS)z Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). +zvSorry, {!r} is a malformed VCS url. The format is +://, e.g. svn+http://myrepo/svn/MyApp#egg=MyAppN@rH)rQZurlsplit ValueErrorr&splitrrsplitZ urlunsplit) rcrr"rr.ZqueryZfrag user_passr(r#r#r$get_url_rev_and_authus z#VersionControl.get_url_rev_and_authcCsgS)zM Return the RevOptions "extra arguments" to use in obtain(). r#)usernamepasswordr#r#r$ make_rev_argsszVersionControl.make_rev_argsc CsT||j\}}}|\}}d}|dk r.t|}|||}|j||d} t|| fS)z Return the URL and RevOptions object to use in obtain() and in some cases export(), as a tuple (url, rev_options). NrJ)rsecretr rrKr ) r>rZ secret_urlr(rrZsecret_passwordrr< rev_optionsr#r#r$get_url_rev_optionss z"VersionControl.get_url_rev_optionscCst|dS)zi Normalize a URL for comparison by unquoting it and removing any trailing slash. /)rQZunquoterstriprr#r#r$ normalize_urlszVersionControl.normalize_urlcCs||||kS)zV Compare two repo URLs for identity, ignoring incidental differences. )r)rcZurl1Zurl2r#r#r$ compare_urlsszVersionControl.compare_urlscCstdS)z Fetch a revision from a repository, in the case that this is the first fetch from the repository. Args: dest: the directory to fetch the repository to. rev_options: a RevOptions object. Nrwr>destrrr#r#r$ fetch_news zVersionControl.fetch_newcCstdS)z} Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. Nrwrr#r#r$switchszVersionControl.switchcCstdS)z Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. Nrwrr#r#r$updateszVersionControl.updatecCstdS)z Return whether the id of the current commit equals the given name. Args: dest: the repository directory. name: a string name. Nrw)rcrr!r#r#r$is_commit_id_equals z!VersionControl.is_commit_id_equalc Cs||\}}tj|s,||||dS|}||r||}|||j rt d|j t|||||jst dt||j |||||n t ddSt d|j|j t||d}nt d||j|j d}t d |j|td |d |d }|d kr$td|dkrXt dt|t|||||dS|dkrt|}t dt||t||||||dS|dkrt d|j t|||||||dS)a Install or update in editable mode the package represented by this VersionControl object. :param dest: the repository directory in which to install or update. :param url: the repository URL starting with a vcs prefix. Nz)%s in %s exists, and has correct URL (%s)zUpdating %s %s%sz$Skipping because already up-to-date.z%s %s in %s exists with URL %s)z%(s)witch, (i)gnore, (w)ipe, (b)ackup )siwbz0Directory %s already exists, and is not a %s %s.)z(i)gnore, (w)ipe, (b)ackup )rrrz+The plan is to install the %s repository %szWhat to do? %srrarz Deleting %srzBacking up %s to %srzSwitching %s %s to %s%s)rr-r.r/rrIis_repository_directoryrurrr2rb repo_nametitler rr(inforr3r!rsysexitr rshutilZmover) r>rrrZ rev_displayZ existing_urlpromptZresponseZdest_dirr#r#r$obtains           zVersionControl.obtaincCs&tj|rt||j||ddS)z Clean up current location and download the url repository (and vcs infos) into location :param url: the repository URL starting with a vcs prefix. rN)r-r.r/r rr~r#r#r$unpack?s zVersionControl.unpackcCstdS)z Return the url used at location Raises RemoteNotFoundError if the repository does not have a remote url configured. Nrwrpr#r#r$ruKszVersionControl.get_remote_urlcCstdS)zR Return the current commit id of the files at the given location. Nrwrpr#r#r$rrUszVersionControl.get_revisionTraisec Cs|t|jf|}z t||||||||j|| d WStk rv} z(| jtjkrdtd|j|jfnW5d} ~ XYnXdS)z Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available ) on_returncodeextra_ok_returncodes command_desc extra_environ unset_environspinnerlog_failed_cmdzCCannot find command %r - do you have %r installed and in your PATH?N)rr!r rOSErrorerrnoZENOENTr) rccmdZ show_stdoutcwdrrrrrrer#r#r$ run_command\s&  zVersionControl.run_commandcCs,td||j|jtjtj||jS)zL Return whether a directory path is a repository directory. zChecking in %s for %s (%s)...)r2rbr1r!r-r.r/r0)rcr.r#r#r$rs z&VersionControl.is_repository_directorycCs ||S)a6 Check if a location is controlled by the vcs. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. This can do more than is_repository_directory() alone. For example, the Git override checks that Git is actually available. )rrpr#r#r$rgs z VersionControl.controls_location)NN)TNrNNNNT)$r8r9r:r!r1rrSrrC classmethodrorqrtrv staticmethodrErKr}rrrrrrrrrrrrrrurrrrrgr#r#r#r$rmsr                 ]    ' rm)N)>rMZ __future__rrZloggingr-rrZ pip._vendorrZpip._vendor.six.moves.urllibrrQZpip._internal.exceptionsrZpip._internal.utils.compatrZpip._internal.utils.miscrrr r r r Zpip._internal.utils.subprocessr rZpip._internal.utils.typingrZpip._internal.utils.urlsrtypingrrrrrrrrrrZpip._internal.utils.uirrrstrZAuthInfo__all__Z getLoggerr8r2r%r,r6 Exceptionr7objectr;rOrrmr#r#r#r$s<        0     HGPK]ESz##(vcs/__pycache__/git.cpython-38.opt-1.pycnu[U .e5@sddlmZddlZddlZddlZddlmZddl mZ ddl m Z ddl mZddlmZddlmZddlmZdd lmZdd lmZmZmZmZerdd lmZmZdd lmZdd lm Z m!Z!e j"Z"e j#Z#e$e%Z&e'dZ(ddZ)GdddeZ*e+e*dS))absolute_importN)parse)request) BadCommand) display_path) make_command) TempDirectory)MYPY_CHECK_RUNNING)RemoteNotFoundErrorVersionControl!find_path_to_setup_from_repo_rootvcs)OptionalTuple) HiddenText)AuthInfo RevOptionsz^[a-fA-F0-9]{40}$cCstt|SN)bool HASH_REGEXmatch)shar9/usr/lib/python3.8/site-packages/pip/_internal/vcs/git.pylooks_like_hash*srcseZdZdZdZdZdZdZdZe ddZ d d Z e d d Z d dZe ddZe ddZe ddZddZddZddZe ddZe d(ddZe d d!Ze fd"d#Ze d$d%Ze fd&d'ZZS))Gitgitz.gitclone)rzgit+httpz git+httpszgit+sshzgit+gitzgit+file)ZGIT_DIRZ GIT_WORK_TREEHEADcCs|gSrrrevrrrget_base_rev_args:szGit.get_base_rev_argscCs\d}|jdgdd}||r8|t|dd}nd}d|ddd}t|S) Nz git version versionF) show_stdoutr.) run_command startswithlensplitjoin parse_version)selfZ VERSION_PFXr"rrrget_git_version>s zGit.get_git_versioncCsBdddg}|j|dd|d}|}|dr>|tddSdS) zl Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). z symbolic-ref-qrFZextra_ok_returncodesr#cwdz refs/heads/N)r'stripr(r))clslocationargsoutputrefrrrget_current_branchKs  zGit.get_current_branchc CsX|ds|d}tdd2}|j|j|d|jdddd|gd |jd W5QRXd S) z@Export the Git repository at the url to the destination location/export)Zkind)urlzcheckout-indexz-az-fz--prefixFr#r3N)endswithrunpackpathr')r-r6r=Ztemp_dirrrrr<`s   z Git.exportc Cs|jd|g|ddd}i}|dD]V}|d}|s)r'r4)r5r6r Z current_revrrrrU%szGit.get_revisioncCsR|jddgd|d}tj|s2tj||}tjtj|d}t||S)z~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. riz --git-dirFr>z..)r'r4osrAisabsr+abspathr )r5r6Zgit_dirZ repo_rootrrrget_subdirectory.s  zGit.get_subdirectoryc st|\}}}}}|dr|dt|d }|t|ddd}t|||||f}|dd} |d| t|| d||||f}d|kr|dd }t t | |\}} } |d d }nt t | |\}} } || | fS) a9 Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub. fileNr;\+r1z://zgit+z git+ssh://zssh://r$) urlsplitr?r)lstripurllib_requestZ url2pathnamereplace urlunsplitfindsuperrget_url_rev_and_auth) r5r=ZschemeZnetlocrAZqueryZfragmentinitial_slashesnewpathZ after_plusr Z user_pass __class__rrrx=s.     zGit.get_url_rev_and_authcCs6tjtj|dsdS|jdddddg|ddS)Nz .gitmodulesZ submodulerdz--initz --recursiver/rQ)rjrAexistsr+r')r5r6rrrr]`s  zGit.update_submodulescsZtt||rdSz|jdg|dddd}| WStk rTtd|YdSXdS)NTriFrB)r3r#rCZlog_failed_cmdzKcould not determine if %s is under git control because git is not available)rwrcontrols_locationr'rrSdebug)r5r6rr{rrr~iszGit.controls_location)N)__name__ __module__ __qualname__rXdirnameZ repo_nameZschemesZ unset_environZdefault_arg_rev staticmethodr!r. classmethodr:r<rOrWrYr_rbrdrhrUrmrxr]r~ __classcell__rrr{rr.sB     ( ,     " r),Z __future__rZloggingZos.pathrjreZpip._vendor.packaging.versionrr,Zpip._vendor.six.moves.urllibZ urllib_parserrsZpip._internal.exceptionsrZpip._internal.utils.miscrZpip._internal.utils.subprocessrZpip._internal.utils.temp_dirrZpip._internal.utils.typingr Z pip._internal.vcs.versioncontrolr r r r typingrrrrrrqruZ getLoggerrrScompilerrrregisterrrrrs2            NPK]8&'!'!/vcs/__pycache__/subversion.cpython-38.opt-1.pycnu[U .e0@sddlmZddlZddlZddlZddlmZddlmZm Z m Z m Z ddl m Z ddlmZddlmZmZedZed Zed Zed Zerdd lmZmZdd l mZddlmZddlmZmZee Z!GdddeZ"e#e"dS))absolute_importN) indent_log) display_pathis_console_interactivermtreesplit_auth_from_netloc) make_command)MYPY_CHECK_RUNNING)VersionControlvcsz url="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z(.*))OptionalTuple) CommandArgs) HiddenText)AuthInfo RevOptionscseZdZdZdZdZdZeddZe ddZ ed d Z efd d Z efd dZ e ddZeddZeddZeddZd(fdd ZddZddZddZd d!Zd"d#Zd$d%Zd&d'ZZS)) Subversionsvnz.svncheckout)rzsvn+sshzsvn+httpz svn+httpszsvn+svncCsdS)NT)clsZ remote_urlrr@/usr/lib/python3.8/site-packages/pip/_internal/vcs/subversion.pyshould_add_vcs_url_prefix+sz$Subversion.should_add_vcs_url_prefixcCsd|gS)Nz-rr)revrrrget_base_rev_args/szSubversion.get_base_rev_argsc Csd}t|D]\}}}|j|kr0g|dd<q||jtj||jd}tj|s\q||\}}||kr||d}n|r||sg|dd<qt ||}q|S)zR Return the maximum revision for all files under a given location rNentries/) oswalkdirnameremovepathjoinexists_get_svn_url_rev startswithmax) rlocationZrevisionbasedirsfilesZ entries_fnZdirurlZlocalrevrrr get_revision3s"       zSubversion.get_revisioncs"|dkrtt|||St|S)z This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. Zssh)superrget_netloc_and_authr)rZnetlocZscheme __class__rrr-OszSubversion.get_netloc_and_authcs2tt||\}}}|dr(d|}|||fS)Nzssh://zsvn+)r,rget_url_rev_and_authr%)rurlrZ user_passr.rrr0\s zSubversion.get_url_rev_and_authcCs(g}|r|d|g7}|r$|d|g7}|S)Nz --usernamez --passwordr)ZusernameZpasswordZ extra_argsrrr make_rev_argses   zSubversion.make_rev_argscCsR|}tjtj|dsD|}tj|}||krtd|dSq||dS)Nzsetup.pyzGCould not find setup.py for directory %s (tried all parent directories)r)rr!r#r"rloggerZwarningr$)rr'Z orig_locationZ last_locationrrrget_remote_urlps zSubversion.get_remote_urlc Cspddlm}tj||jd}tj|rHt|}|}W5QRXnd}| dsj| dsj| drt t t j |d}|dd=|dd }d d |Ddg}n| d rt|}|std ||d}dd t|Ddg}n^z<|jdd|gdd} t| d}dd t| D}Wn |k rRdg}}YnX|rdt|} nd} || fS)Nr)InstallationErrorr89Z10z cSs,g|]$}t|dkr|drt|dqS) )lenint).0drrr s z/Subversion._get_svn_url_rev..zs,           *PK]c-vcs/__pycache__/__init__.cpython-38.opt-1.pycnu[U .ei@s<ddlZddlZddlZddlZddlmZmZmZm Z dS)N)RemoteNotFoundErroris_urlmake_vcs_requirement_urlvcs) Zpip._internal.vcs.bazaarZpipZpip._internal.vcs.gitZpip._internal.vcs.mercurialZpip._internal.vcs.subversionZ pip._internal.vcs.versioncontrolrrrrrr>/usr/lib/python3.8/site-packages/pip/_internal/vcs/__init__.pysPK]$X.vcs/__pycache__/mercurial.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZmZerdd l mZdd lmZeeZGd ddeZeedS))absolute_importN) configparser) BadCommandInstallationError) display_path) make_command) TempDirectory)MYPY_CHECK_RUNNING) path_to_url)VersionControl!find_path_to_setup_from_repo_rootvcs) HiddenText) RevOptionscseZdZdZdZdZdZeddZddZ d d Z d d Z d dZ e ddZe ddZe ddZe ddZe ddZe fddZZS) Mercurialhgz.hgclone)rzhg+filezhg+httpzhg+httpszhg+sshzhg+static-httpcCs|gS)N)Zrevrr?/usr/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_args'szMercurial.get_base_rev_argsc Cs@tdd,}|j|j|d|jd|gd|jdW5QRXdS)z?Export the Hg repository at the url to the destination locationexport)Zkind)urlarchiveF show_stdoutcwdN)runpackpath run_command)selflocationrZtemp_dirrrrr+s zMercurial.exportcCsP|}td||t||tddd|||jtdd||ddS)NzCloning hg %s%s to %srz --noupdate-qupdater)Z to_displayloggerinforrrto_args)rdestr rev_optionsZ rev_displayrrr fetch_new5szMercurial.fetch_newc Cstj||jd}t}z>|||dd|jt |d}| |W5QRXWn6t tj fk r}zt d||W5d}~XYn Xtdd|}|j||ddS) NZhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr"r!r#)osrjoindirnamerZRawConfigParserreadsetZsecretopenwriteOSErrorZNoSectionErrorr$Zwarningrr&r) rr'rr(Z repo_configZconfigZ config_fileexccmd_argsrrrswitchDs  zMercurial.switchcCs4|jddg|dtdd|}|j||ddS)NZpullr!r#r")rrr&)rr'rr(r6rrrr"UszMercurial.updatecCs2|jddgd|d}||r*t|}|S)NZ showconfigz paths.defaultFr)rstripZ_is_local_repositoryr )clsr rrrrget_remote_url[s  zMercurial.get_remote_urlcCs|jddgd|d}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}Frrr8)r9r Zcurrent_revisionrrr get_revisionds  zMercurial.get_revisioncCs|jddgd|d}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string r;z--template={node}Frr<)r9r Zcurrent_rev_hashrrrget_requirement_revisionns  z"Mercurial.get_requirement_revisioncCsdS)z&Always assume the versions don't matchFr)r9r'namerrris_commit_id_equalyszMercurial.is_commit_id_equalcCsB|jdgd|d}tj|s8tjtj||}t||S)z~ Return the path to setup.py, relative to the repo root. Return None if setup.py is in the repo root. rootFr)rr8r-risabsabspathr.r )r9r Z repo_rootrrrget_subdirectory~s  zMercurial.get_subdirectoryc sPtt||rdSz|jdg|ddddWdSttfk rJYdSXdS)NTZidentifyFraise)rrZ on_returncodeZlog_failed_cmd)superrcontrols_locationrrr)r9r  __class__rrrGszMercurial.controls_location)__name__ __module__ __qualname__r?r/Z repo_nameZschemes staticmethodrrr)r7r" classmethodr:r=r>r@rDrG __classcell__rrrHrrs,       r)Z __future__rZloggingr-Zpip._vendor.six.movesrZpip._internal.exceptionsrrZpip._internal.utils.miscrZpip._internal.utils.subprocessrZpip._internal.utils.temp_dirrZpip._internal.utils.typingr Zpip._internal.utils.urlsr Z pip._internal.vcs.versioncontrolr r r rrZ getLoggerrJr$rregisterrrrrs          |PK]f1(vcs/__pycache__/mercurial.cpython-38.pycnu[U ʗRev@sddlZddlZddlZddlmZmZmZddlmZm Z ddl m Z m Z ddl mZddlmZddlmZmZmZmZeeZGdd d eZeedS) N)ListOptionalTuple) BadCommandInstallationError) HiddenText display_path) make_command) path_to_url) RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcscseZdZdZdZdZdZeee edddZ ee e e dd d d Zee e dd d dZee e dd ddZeeedddZeeedddZeeedddZeeeeedddZeeeedddZeeeedfdd ZZS) Mercurialhgz.hgclone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-http)revreturncCs|gS)N)rrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_args szMercurial.get_base_rev_argsN)desturl rev_options verbosityrcCs|}td||t||dkr*d}n |dkr8d}n|dkrFd}nd}|td |||f|jtd||f|d dS)NzCloning hg %s%s to %sr)z--quietr) --verbose)rz--debugr --noupdateupdatecwd)rr)r) to_displayloggerinfor run_commandr to_args)selfrrrr rev_displayflagsrrr fetch_new$s&zMercurial.fetch_new)rrrrc Cstj||jd}t}z>|||dd|jt |d}| |W5QRXWn6t tj fk r}zt d||W5d}~XYn Xtdd|}|j||ddS) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr-qr )ospathjoindirname configparserRawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorr#warningr r&r%) r'rrr repo_configconfig config_fileexccmd_argsrrrswitch<s   zMercurial.switchcCs4|jddg|dtdd|}|j||ddS)Npullr/r r)r%r r&)r'rrrrBrrrrJszMercurial.update)locationrcCs4|jddgdd|d}||r,t|}|S)N showconfigz paths.defaultFT show_stdout stdout_onlyr!)r%strip_is_local_repositoryr )clsrErrrrget_remote_urlOs  zMercurial.get_remote_urlcCs|jddgdd|d}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}FTrGr%rJ)rLrEcurrent_revisionrrr get_revision[s zMercurial.get_revisioncCs|jddgdd|d}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rNz--template={node}FTrGrO)rLrEcurrent_rev_hashrrrget_requirement_revisionhs z"Mercurial.get_requirement_revision)rnamercCsdS)z&Always assume the versions don't matchFr)rLrrTrrris_commit_id_equalvszMercurial.is_commit_id_equalcCsD|jdgdd|d}tj|s:tjtj||}t||S)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. rootFTrG)r%rJr0r1isabsabspathr2r )rLrE repo_rootrrrget_subdirectory{s  zMercurial.get_subdirectorycszt|}|r|Sz|jdg|ddddd}Wn6tk rRtd|YdStk rfYdSXtj | dS)NrVFTraise)r!rHrI on_returncodelog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez ) superget_repository_rootr%rr#debugrr0r1normpathrstrip)rLrElocr __class__rrr_s*  zMercurial.get_repository_root)__name__ __module__ __qualname__rTr3 repo_nameschemes staticmethodstrrrrr intr*rCr classmethodrMrQrSrboolrUrZr_ __classcell__rrrerrs4     r)r4loggingr0typingrrrpip._internal.exceptionsrrpip._internal.utils.miscrrpip._internal.utils.subprocessr pip._internal.utils.urlsr pip._internal.vcs.versioncontrolr r r r getLoggerrgr#rregisterrrrrs   PK])'ouSS-vcs/__pycache__/versioncontrol.cpython-38.pycnu[U ʗReY@sdZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZmZmZmZddlmZddlmZmZddlmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'erdd lm(Z(d gZ)e*e+Z,eee-ee-fZ.e-e/d d d Z0de-e-e-ee-e-dddZ1e-e-ee-dddZ2Gddde3Z4Gddde3Z5GdddZ6GdddZ7e7Z8GdddZ9dS)z)Handles all VCS (version control) supportN) TYPE_CHECKINGAnyDictIterableIteratorListMappingOptionalTupleTypeUnion)SpinnerInterface) BadCommandInstallationError) HiddenTextask_path_exists backup_dir display_pathhide_url hide_valueis_installable_dirrmtree) CommandArgscall_subprocessformat_command_args make_command)get_url_scheme)LiteralvcsnamereturncCs*t|}|dkrdS|ddddgtjkS)z3 Return true if the name looks like a URL. NFhttphttpsfileftp)rr all_schemes)r schemer(/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.pyis_url9sr*)repo_urlrev project_namesubdirr!cCs6|dd}|d|d|}|r2|d|7}|S)z Return the URL for a VCS requirement. Args: repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+"). project_name: the (unescaped) project name. -_@z#egg=z&subdirectory=)replace)r+r,r-r.egg_project_namereqr(r(r)make_vcs_requirement_urlCs r5)location repo_rootr!cCsV|}t|s6|}tj|}||krtd|dSqtj||rHdStj||S)z Find the the Python project's root by searching up the filesystem from `location`. Return the path to project root relative to `repo_root`. Return None if the project root is `repo_root`, or cannot be found. zOCould not find a Python project for directory %s (tried all parent directories)N)rospathdirnameloggerwarningsamefilerelpath)r6r7 orig_location last_locationr(r(r)(find_path_to_project_root_from_repo_rootUs  rAc@s eZdZdS)RemoteNotFoundErrorN)__name__ __module__ __qualname__r(r(r(r)rBrsrBcs"eZdZedfdd ZZS)RemoteNotValidErrorurlcst|||_dSN)super__init__rH)selfrH __class__r(r)rKws zRemoteNotValidError.__init__)rCrDrEstrrK __classcell__r(r(rMr)rFvsrFc@seZdZdZdedeeeeddddZeddd Z e eedd d Z edd d Z edddZ eddddZdS) RevOptionsz Encapsulates a VCS-specific revision to install, along with any VCS install options. Instances of this class should be treated as if immutable. NVersionControl)vc_classr, extra_argsr!cCs(|dkr g}||_||_||_d|_dS)z Args: vc_class: a VersionControl subclass. rev: the name of the revision to install. extra_args: a list of extra options. N)rTr,rS branch_name)rLrSr,rTr(r(r)rKs zRevOptions.__init__r!cCsd|jjd|jdS)Nz )rSr r,rLr(r(r)__repr__szRevOptions.__repr__cCs|jdkr|jjS|jSrI)r,rSdefault_arg_revrXr(r(r)arg_revs zRevOptions.arg_revcCs0g}|j}|dk r"||j|7}||j7}|S)z< Return the VCS-specific command arguments. N)r[rSget_base_rev_argsrT)rLargsr,r(r(r)to_argss  zRevOptions.to_argscCs|js dSd|jdS)Nz (to revision )r,rXr(r(r) to_displayszRevOptions.to_displayr,r!cCs|jj||jdS)z Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. rT)rSmake_rev_optionsrT)rLr,r(r(r)make_newszRevOptions.make_new)NN)rCrDrE__doc__r r rOrrKrYpropertyr[r^rbrfr(r(r(r)rQ|s   rQcseZdZUiZeedfed<ddddddgZd d fd d Ze ed d dZ e e dd ddZ e e ed ddZe e ed ddZedd dddZed dddZeeddddZeedddd Zeeddd!d"ZZS)# VcsSupportrR _registrysshgithgbzrsftpsvnNrVcstjj|jtdSrI)urllibparse uses_netlocextendschemesrJrKrXrMr(r)rKszVcsSupport.__init__cCs |jSrI)rj__iter__rXr(r(r)rvszVcsSupport.__iter__cCst|jSrI)listrjvaluesrXr(r(r)backendsszVcsSupport.backendscCsdd|jDS)NcSsg|] }|jqSr()r:).0backendr(r(r) sz'VcsSupport.dirnames..)ryrXr(r(r)dirnamesszVcsSupport.dirnamescCs g}|jD]}||jq |SrI)ryrtru)rLrur{r(r(r)r&s zVcsSupport.all_schemes)clsr!cCsHt|dstd|jdS|j|jkrD||j|j<td|jdS)Nr zCannot register VCS %szRegistered VCS backend: %s)hasattrr;r<rCr rjdebug)rLr~r(r(r)registers   zVcsSupport.registerrcCs||jkr|j|=dSrI)rjrLr r(r(r) unregisters zVcsSupport.unregisterr6r!cCsXi}|jD],}||}|s"qtd||j|||<q|sDdSt|td}||S)zv Return a VersionControl object if a repository of that type is found at the given directory. zDetermine that %s uses VCS: %sN)key)rjrxget_repository_rootr;rr maxlen)rLr6 vcs_backends vcs_backend repo_pathinner_most_repo_pathr(r(r)get_backend_for_dirs   zVcsSupport.get_backend_for_dir)r'r!cCs&|jD]}||jkr |Sq dS)9 Return a VersionControl object or None. N)rjrxru)rLr'rr(r(r)get_backend_for_schemes  z!VcsSupport.get_backend_for_schemecCs|}|j|S)r)lowerrjgetrr(r(r) get_backendszVcsSupport.get_backend)rCrDrErjrrO__annotations__rurKrrvrhrryr}r&r rrr rrrrPr(r(rMr)ris  ric@seZdZUdZdZdZdZeedfe d<dZ eedfe d<dZ e ee d<e eedd d Ze ee ed d d Ze eedddZe eeedddZeeeedddZeeedddZe dQe ee eedddZe eedddZe eeeeee ee effd d!d"Ze eeee eefd#d$d%Zee ee eed&d'd(Zeeeefd#d)d*Z eeed#d+d,Z!e eeed-d.d/Z"eeee#dd0d1d2Z$eeedd3d4d5Z%eeedd3d6d7Z&e ee eed8d9d:Z'eee#dd;dd?d@Z)e eed dAdBZ*e eed dCdDZ+e dRe,eeefee edHe e-e#e ee e.ee/fe e0eeedI dJdKZ1e eedLdMdNZ2e ee ed dOdPZ3dS)SrRr_r(.ru unset_environNrZ) remote_urlr!cCs||jd S)z Return whether the vcs prefix (e.g. "git+") should be added to a repository's remote url when used in a requirement. :)r startswithr )r~rr(r(r)should_add_vcs_url_prefixsz(VersionControl.should_add_vcs_url_prefixrcCsdS)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. Nr(r~r6r(r(r)get_subdirectory$szVersionControl.get_subdirectory)repo_dirr!cCs ||S)zR Return the revision string that should be used in a requirement. ) get_revision)r~rr(r(r)get_requirement_revision,sz'VersionControl.get_requirement_revision)rr-r!cCsL||}||r$|jd|}||}||}t||||d}|S)aC Return the requirement string to use to redownload the files currently at the given repository directory. Args: project_name: the (unescaped) project name. The return value has a form similar to the following: {repository_url}@{revision}#egg={project_name} +)r.)get_remote_urlrr rrr5)r~rr-r+revisionr.r4r(r(r)get_src_requirement3s    z"VersionControl.get_src_requirementrccCstdS)z Return the base revision arguments for a vcs command. Args: rev: the name of a revision to install. Cannot be None. NNotImplementedErrorrar(r(r)r\Ksz VersionControl.get_base_rev_args)rHdestr!cCsdS)aZ Return true if the commit hash checked out at dest matches the revision in url. Always return False, if the VCS does not support immutable commit hashes. This method does not check if there are local uncommitted changes in dest after checkout, as pip currently has no use case for that. Fr()rLrHrr(r(r)is_immutable_rev_checkoutUs z(VersionControl.is_immutable_rev_checkout)r,rTr!cCst|||dS)z Return a RevOptions object. Args: rev: the name of a revision to install. extra_args: a list of extra options. rd)rQ)r~r,rTr(r(r)rebs zVersionControl.make_rev_options)repor!cCs&tj|\}}|tjjp$t|S)zs posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\folder) )r8r9 splitdriversepbool)r~rdrivetailr(r(r)_is_local_repositoryosz#VersionControl._is_local_repository)netlocr'r!cCs|dfS)aZ Parse the repository URL's netloc, and return the new netloc to use along with auth information. Args: netloc: the original repository URL netloc. scheme: the repository URL's scheme without the vcs prefix. This is mainly for the Subversion class to override, so that auth information can be provided via the --username and --password options instead of through the URL. For other subclasses like Git without such an option, auth information must stay in the URL. Returns: (netloc, (username, password)). )NNr()r~rr'r(r(r)get_netloc_and_authxsz"VersionControl.get_netloc_and_auth)rHr!c Cstj|\}}}}}d|kr,td||ddd}|||\}}d}d|krz|dd\}}|sztd|tj ||||df}|||fS)z Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). rzvSorry, {!r} is a malformed VCS url. The format is +://, e.g. svn+http://myrepo/svn/MyApp#egg=MyAppNr1zyThe URL {!r} has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.r_) rqrrurlsplit ValueErrorformatsplitrrsplitr urlunsplit) r~rHr'rr9queryfrag user_passr,r(r(r)get_url_rev_and_auths(z#VersionControl.get_url_rev_and_auth)usernamepasswordr!cCsgS)zM Return the RevOptions "extra arguments" to use in obtain(). r()rrr(r(r) make_rev_argsszVersionControl.make_rev_argsc CsT||j\}}}|\}}d}|dk r.t|}|||}|j||d} t|| fS)zq Return the URL and RevOptions object to use in obtain(), as a tuple (url, rev_options). Nrd)rsecretrrrer) rLrH secret_urlr,rrsecret_passwordrrT rev_optionsr(r(r)get_url_rev_optionss z"VersionControl.get_url_rev_optionscCstj|dS)zi Normalize a URL for comparison by unquoting it and removing any trailing slash. /)rqrrunquoterstriprGr(r(r) normalize_urlszVersionControl.normalize_url)url1url2r!cCs||||kS)zV Compare two repo URLs for identity, ignoring incidental differences. )r)r~rrr(r(r) compare_urlsszVersionControl.compare_urls)rrHr verbosityr!cCstdS)a Fetch a revision from a repository, in the case that this is the first fetch from the repository. Args: dest: the directory to fetch the repository to. rev_options: a RevOptions object. verbosity: verbosity level. Nr)rLrrHrrr(r(r) fetch_news zVersionControl.fetch_new)rrHrr!cCstdS)z} Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. NrrLrrHrr(r(r)switchszVersionControl.switchcCstdS)z Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. Nrrr(r(r)updateszVersionControl.update)rr r!cCstdS)z Return whether the id of the current commit equals the given name. Args: dest: the repository directory. name: a string name. Nr)r~rr r(r(r)is_commit_id_equals z!VersionControl.is_commit_id_equal)rrHrr!c Cs||\}}tj|s0|j||||ddS|}||r||}|||j rt d|j t|||||jst dt||j |||||n t ddSt d|j|j t||d}nt d||j|j d }t d |j|td |d |d }|dkr*td|dkrbt dt|t||j||||ddS|dkrt|} t dt|| t|| |j||||ddS|dkrt d|j t|||||||dS)a/ Install or update in editable mode the package represented by this VersionControl object. :param dest: the repository directory in which to install or update. :param url: the repository URL starting with a vcs prefix. :param verbosity: verbosity level. )rNz)%s in %s exists, and has correct URL (%s)zUpdating %s %s%sz$Skipping because already up-to-date.z%s %s in %s exists with URL %s)z%(s)witch, (i)gnore, (w)ipe, (b)ackup )siwbz0Directory %s already exists, and is not a %s %s.)z(i)gnore, (w)ipe, (b)ackup )rrrz+The plan is to install the %s repository %szWhat to do? {}rrarz Deleting %srzBacking up %s to %srzSwitching %s %s to %s%s)rr8r9existsrrbis_repository_directoryrrrr;r repo_nametitlerrr,inforr<r rrsysexitrrshutilmover) rLrrHrr rev_display existing_urlpromptresponsedest_dirr(r(r)obtains           zVersionControl.obtain)r6rHrr!cCs(tj|rt||j|||ddS)z Clean up current location and download the url repository (and vcs infos) into location :param url: the repository URL starting with a vcs prefix. :param verbosity: verbosity level. )rHrN)r8r9rrr)rLr6rHrr(r(r)unpackVs zVersionControl.unpackcCstdS)z Return the url used at location Raises RemoteNotFoundError if the repository does not have a remote url configured. Nrrr(r(r)rbszVersionControl.get_remote_urlcCstdS)zR Return the current commit id of the files at the given location. Nrrr(r(r)rlszVersionControl.get_revisionTraiseFz"Literal["raise", "warn", "ignore"]) cmd show_stdoutcwd on_returncodeextra_ok_returncodes command_desc extra_environspinnerlog_failed_cmd stdout_onlyr!c Cst|jf|}|dkr t|}z"t||||||||j|| | d WStk rptd|jd|jdYn&tk rtd|jdYnXdS)z Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available N)rrrrrrrrzCannot find command z - do you have z installed and in your PATH?zNo permission to execute z - install it locally, globally (ask admin), or check your PATH. See possible solutions at https://pip.pypa.io/en/latest/reference/pip_freeze/#fixing-permission-denied.)rr rrrFileNotFoundErrorrPermissionError) r~rrrrrrrrrrr(r(r) run_commandss2  zVersionControl.run_command)r9r!cCs,td||j|jtjtj||jS)zL Return whether a directory path is a repository directory. zChecking in %s for %s (%s)...)r;rr:r r8r9rjoin)r~r9r(r(r)rsz&VersionControl.is_repository_directorycCs||r|SdS)ay Return the "root" (top-level) directory controlled by the vcs, or `None` if the directory is not in any. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. This can do more than is_repository_directory() alone. For example, the Git override checks that Git is actually available. N)rrr(r(r)rs z"VersionControl.get_repository_root)NN) TNrNNNNTF)4rCrDrEr r:rrur rOrrrZr classmethodrrrrr staticmethodrr\rrrQrerrAuthInforrrrrrintrrrrrrrrr rrrr rrrr(r(r(r)rRs         Y   7rR)N):rgloggingr8rr urllib.parserqtypingrrrrrrrr r r r pip._internal.cli.spinnersr pip._internal.exceptionsrrpip._internal.utils.miscrrrrrrrrpip._internal.utils.subprocessrrrrpip._internal.utils.urlsrr__all__ getLoggerrCr;rOrrr*r5rA ExceptionrBrFrQrirrRr(r(r(r)sF4 (       CPPK] XL L %vcs/__pycache__/bazaar.cpython-38.pycnu[U ʗRe @sddlZddlmZmZmZddlmZmZddlm Z ddl m Z ddl m Z mZmZmZmZeeZGdddeZeedS) N)ListOptionalTuple) HiddenText display_path) make_command) path_to_url)AuthInfoRemoteNotFoundError RevOptionsVersionControlvcscseZdZdZdZdZdZeee edddZ ee e e dd d d Zee e dd d dZee e dd ddZeeeeeeefdfdd ZeeedddZeeedddZeeeeedddZZS)Bazaarbzrz.bzrbranch)zbzr+httpz bzr+httpszbzr+sshzbzr+sftpzbzr+ftpzbzr+lpzbzr+file)revreturncCsd|gS)Nz-r)rrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/vcs/bazaar.pyget_base_rev_args szBazaar.get_base_rev_argsN)desturl rev_options verbosityrcCsh|}td||t||dkr*d}n|dkr8d}ndd|}td||||}||dS) NzChecking out %s%s to %srz--quiet-vr) to_displayloggerinforrto_args run_command)selfrrrr rev_displayflagcmd_argsrrr fetch_new$szBazaar.fetch_new)rrrrcCs|jtd||ddS)Nswitchcwd)r"r)r#rrrrrrr(7sz Bazaar.switchcCs"tdd|}|j||ddS)Npullz-qr))rr!r")r#rrrr&rrrupdate:sz Bazaar.update)rrcs.t|\}}}|dr$d|}|||fS)Nzssh://zbzr+)superget_url_rev_and_auth startswith)clsrr user_pass __class__rrr.>s zBazaar.get_url_rev_and_auth)locationrcCsz|jdgdd|d}|D]T}|}dD]B}||r,||d}||rbt|S|Sq,qtdS)Nr FT show_stdout stdout_onlyr*)zcheckout of branch: zparent branch: r)r" splitlinesstripr/split_is_local_repositoryrr )r0r4urlslinexreporrrget_remote_urlFs   zBazaar.get_remote_urlcCs |jdgdd|d}|dS)NrevnoFTr5)r"r8)r0r4revisionrrr get_revisionUszBazaar.get_revision)rnamercCsdS)z&Always assume the versions don't matchFr)r0rrErrris_commit_id_equal_szBazaar.is_commit_id_equal)__name__ __module__ __qualname__rEdirname repo_nameschemes staticmethodstrrrrr intr'r(r, classmethodrrr r.r@rDboolrF __classcell__rrr2rrs,  $ r)loggingtypingrrrpip._internal.utils.miscrrpip._internal.utils.subprocessrpip._internal.utils.urlsr pip._internal.vcs.versioncontrolr r r r r getLoggerrGrrregisterrrrrs   SPK]oɩQQvcs/mercurial.pynu[import configparser import logging import os from typing import List, Optional from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( RevOptions, VersionControl, find_path_to_project_root_from_repo_root, vcs, ) logger = logging.getLogger(__name__) class Mercurial(VersionControl): name = "hg" dirname = ".hg" repo_name = "clone" schemes = ( "hg+file", "hg+http", "hg+https", "hg+ssh", "hg+static-http", ) @staticmethod def get_base_rev_args(rev: str) -> List[str]: return [rev] def fetch_new(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: rev_display = rev_options.to_display() logger.info( "Cloning hg %s%s to %s", url, rev_display, display_path(dest), ) self.run_command(make_command("clone", "--noupdate", "-q", url, dest)) self.run_command( make_command("update", "-q", rev_options.to_args()), cwd=dest, ) def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: repo_config = os.path.join(dest, self.dirname, "hgrc") config = configparser.RawConfigParser() try: config.read(repo_config) config.set("paths", "default", url.secret) with open(repo_config, "w") as config_file: config.write(config_file) except (OSError, configparser.NoSectionError) as exc: logger.warning("Could not switch Mercurial repository to %s: %s", url, exc) else: cmd_args = make_command("update", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: self.run_command(["pull", "-q"], cwd=dest) cmd_args = make_command("update", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) @classmethod def get_remote_url(cls, location: str) -> str: url = cls.run_command( ["showconfig", "paths.default"], show_stdout=False, stdout_only=True, cwd=location, ).strip() if cls._is_local_repository(url): url = path_to_url(url) return url.strip() @classmethod def get_revision(cls, location: str) -> str: """ Return the repository-local changeset revision number, as an integer. """ current_revision = cls.run_command( ["parents", "--template={rev}"], show_stdout=False, stdout_only=True, cwd=location, ).strip() return current_revision @classmethod def get_requirement_revision(cls, location: str) -> str: """ Return the changeset identification hash, as a 40-character hexadecimal string """ current_rev_hash = cls.run_command( ["parents", "--template={node}"], show_stdout=False, stdout_only=True, cwd=location, ).strip() return current_rev_hash @classmethod def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool: """Always assume the versions don't match""" return False @classmethod def get_subdirectory(cls, location: str) -> Optional[str]: """ Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. """ # find the repo root repo_root = cls.run_command( ["root"], show_stdout=False, stdout_only=True, cwd=location ).strip() if not os.path.isabs(repo_root): repo_root = os.path.abspath(os.path.join(location, repo_root)) return find_path_to_project_root_from_repo_root(location, repo_root) @classmethod def get_repository_root(cls, location: str) -> Optional[str]: loc = super().get_repository_root(location) if loc: return loc try: r = cls.run_command( ["root"], cwd=location, show_stdout=False, stdout_only=True, on_returncode="raise", log_failed_cmd=False, ) except BadCommand: logger.debug( "could not determine if %s is under hg control " "because hg is not available", location, ) return None except InstallationError: return None return os.path.normpath(r.rstrip("\r\n")) vcs.register(Mercurial) PK]s1!WWvcs/versioncontrol.pynu["""Handles all VCS (version control) support""" import logging import os import shutil import sys import urllib.parse from typing import ( TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Type, Union, ) from pip._internal.cli.spinners import SpinnerInterface from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import ( HiddenText, ask_path_exists, backup_dir, display_path, hide_url, hide_value, is_installable_dir, rmtree, ) from pip._internal.utils.subprocess import CommandArgs, call_subprocess, make_command from pip._internal.utils.urls import get_url_scheme if TYPE_CHECKING: # Literal was introduced in Python 3.8. # # TODO: Remove `if TYPE_CHECKING` when dropping support for Python 3.7. from typing import Literal __all__ = ["vcs"] logger = logging.getLogger(__name__) AuthInfo = Tuple[Optional[str], Optional[str]] def is_url(name: str) -> bool: """ Return true if the name looks like a URL. """ scheme = get_url_scheme(name) if scheme is None: return False return scheme in ["http", "https", "file", "ftp"] + vcs.all_schemes def make_vcs_requirement_url( repo_url: str, rev: str, project_name: str, subdir: Optional[str] = None ) -> str: """ Return the URL for a VCS requirement. Args: repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+"). project_name: the (unescaped) project name. """ egg_project_name = project_name.replace("-", "_") req = f"{repo_url}@{rev}#egg={egg_project_name}" if subdir: req += f"&subdirectory={subdir}" return req def find_path_to_project_root_from_repo_root( location: str, repo_root: str ) -> Optional[str]: """ Find the the Python project's root by searching up the filesystem from `location`. Return the path to project root relative to `repo_root`. Return None if the project root is `repo_root`, or cannot be found. """ # find project root. orig_location = location while not is_installable_dir(location): last_location = location location = os.path.dirname(location) if location == last_location: # We've traversed up to the root of the filesystem without # finding a Python project. logger.warning( "Could not find a Python project for directory %s (tried all " "parent directories)", orig_location, ) return None if os.path.samefile(repo_root, location): return None return os.path.relpath(location, repo_root) class RemoteNotFoundError(Exception): pass class RemoteNotValidError(Exception): def __init__(self, url: str): super().__init__(url) self.url = url class RevOptions: """ Encapsulates a VCS-specific revision to install, along with any VCS install options. Instances of this class should be treated as if immutable. """ def __init__( self, vc_class: Type["VersionControl"], rev: Optional[str] = None, extra_args: Optional[CommandArgs] = None, ) -> None: """ Args: vc_class: a VersionControl subclass. rev: the name of the revision to install. extra_args: a list of extra options. """ if extra_args is None: extra_args = [] self.extra_args = extra_args self.rev = rev self.vc_class = vc_class self.branch_name: Optional[str] = None def __repr__(self) -> str: return f"" @property def arg_rev(self) -> Optional[str]: if self.rev is None: return self.vc_class.default_arg_rev return self.rev def to_args(self) -> CommandArgs: """ Return the VCS-specific command arguments. """ args: CommandArgs = [] rev = self.arg_rev if rev is not None: args += self.vc_class.get_base_rev_args(rev) args += self.extra_args return args def to_display(self) -> str: if not self.rev: return "" return f" (to revision {self.rev})" def make_new(self, rev: str) -> "RevOptions": """ Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. """ return self.vc_class.make_rev_options(rev, extra_args=self.extra_args) class VcsSupport: _registry: Dict[str, "VersionControl"] = {} schemes = ["ssh", "git", "hg", "bzr", "sftp", "svn"] def __init__(self) -> None: # Register more schemes with urlparse for various version control # systems urllib.parse.uses_netloc.extend(self.schemes) super().__init__() def __iter__(self) -> Iterator[str]: return self._registry.__iter__() @property def backends(self) -> List["VersionControl"]: return list(self._registry.values()) @property def dirnames(self) -> List[str]: return [backend.dirname for backend in self.backends] @property def all_schemes(self) -> List[str]: schemes: List[str] = [] for backend in self.backends: schemes.extend(backend.schemes) return schemes def register(self, cls: Type["VersionControl"]) -> None: if not hasattr(cls, "name"): logger.warning("Cannot register VCS %s", cls.__name__) return if cls.name not in self._registry: self._registry[cls.name] = cls() logger.debug("Registered VCS backend: %s", cls.name) def unregister(self, name: str) -> None: if name in self._registry: del self._registry[name] def get_backend_for_dir(self, location: str) -> Optional["VersionControl"]: """ Return a VersionControl object if a repository of that type is found at the given directory. """ vcs_backends = {} for vcs_backend in self._registry.values(): repo_path = vcs_backend.get_repository_root(location) if not repo_path: continue logger.debug("Determine that %s uses VCS: %s", location, vcs_backend.name) vcs_backends[repo_path] = vcs_backend if not vcs_backends: return None # Choose the VCS in the inner-most directory. Since all repository # roots found here would be either `location` or one of its # parents, the longest path should have the most path components, # i.e. the backend representing the inner-most repository. inner_most_repo_path = max(vcs_backends, key=len) return vcs_backends[inner_most_repo_path] def get_backend_for_scheme(self, scheme: str) -> Optional["VersionControl"]: """ Return a VersionControl object or None. """ for vcs_backend in self._registry.values(): if scheme in vcs_backend.schemes: return vcs_backend return None def get_backend(self, name: str) -> Optional["VersionControl"]: """ Return a VersionControl object or None. """ name = name.lower() return self._registry.get(name) vcs = VcsSupport() class VersionControl: name = "" dirname = "" repo_name = "" # List of supported schemes for this Version Control schemes: Tuple[str, ...] = () # Iterable of environment variable names to pass to call_subprocess(). unset_environ: Tuple[str, ...] = () default_arg_rev: Optional[str] = None @classmethod def should_add_vcs_url_prefix(cls, remote_url: str) -> bool: """ Return whether the vcs prefix (e.g. "git+") should be added to a repository's remote url when used in a requirement. """ return not remote_url.lower().startswith(f"{cls.name}:") @classmethod def get_subdirectory(cls, location: str) -> Optional[str]: """ Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. """ return None @classmethod def get_requirement_revision(cls, repo_dir: str) -> str: """ Return the revision string that should be used in a requirement. """ return cls.get_revision(repo_dir) @classmethod def get_src_requirement(cls, repo_dir: str, project_name: str) -> str: """ Return the requirement string to use to redownload the files currently at the given repository directory. Args: project_name: the (unescaped) project name. The return value has a form similar to the following: {repository_url}@{revision}#egg={project_name} """ repo_url = cls.get_remote_url(repo_dir) if cls.should_add_vcs_url_prefix(repo_url): repo_url = f"{cls.name}+{repo_url}" revision = cls.get_requirement_revision(repo_dir) subdir = cls.get_subdirectory(repo_dir) req = make_vcs_requirement_url(repo_url, revision, project_name, subdir=subdir) return req @staticmethod def get_base_rev_args(rev: str) -> List[str]: """ Return the base revision arguments for a vcs command. Args: rev: the name of a revision to install. Cannot be None. """ raise NotImplementedError def is_immutable_rev_checkout(self, url: str, dest: str) -> bool: """ Return true if the commit hash checked out at dest matches the revision in url. Always return False, if the VCS does not support immutable commit hashes. This method does not check if there are local uncommitted changes in dest after checkout, as pip currently has no use case for that. """ return False @classmethod def make_rev_options( cls, rev: Optional[str] = None, extra_args: Optional[CommandArgs] = None ) -> RevOptions: """ Return a RevOptions object. Args: rev: the name of a revision to install. extra_args: a list of extra options. """ return RevOptions(cls, rev, extra_args=extra_args) @classmethod def _is_local_repository(cls, repo: str) -> bool: """ posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\\folder) """ drive, tail = os.path.splitdrive(repo) return repo.startswith(os.path.sep) or bool(drive) @classmethod def get_netloc_and_auth( cls, netloc: str, scheme: str ) -> Tuple[str, Tuple[Optional[str], Optional[str]]]: """ Parse the repository URL's netloc, and return the new netloc to use along with auth information. Args: netloc: the original repository URL netloc. scheme: the repository URL's scheme without the vcs prefix. This is mainly for the Subversion class to override, so that auth information can be provided via the --username and --password options instead of through the URL. For other subclasses like Git without such an option, auth information must stay in the URL. Returns: (netloc, (username, password)). """ return netloc, (None, None) @classmethod def get_url_rev_and_auth(cls, url: str) -> Tuple[str, Optional[str], AuthInfo]: """ Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). """ scheme, netloc, path, query, frag = urllib.parse.urlsplit(url) if "+" not in scheme: raise ValueError( "Sorry, {!r} is a malformed VCS url. " "The format is +://, " "e.g. svn+http://myrepo/svn/MyApp#egg=MyApp".format(url) ) # Remove the vcs prefix. scheme = scheme.split("+", 1)[1] netloc, user_pass = cls.get_netloc_and_auth(netloc, scheme) rev = None if "@" in path: path, rev = path.rsplit("@", 1) if not rev: raise InstallationError( "The URL {!r} has an empty revision (after @) " "which is not supported. Include a revision after @ " "or remove @ from the URL.".format(url) ) url = urllib.parse.urlunsplit((scheme, netloc, path, query, "")) return url, rev, user_pass @staticmethod def make_rev_args( username: Optional[str], password: Optional[HiddenText] ) -> CommandArgs: """ Return the RevOptions "extra arguments" to use in obtain(). """ return [] def get_url_rev_options(self, url: HiddenText) -> Tuple[HiddenText, RevOptions]: """ Return the URL and RevOptions object to use in obtain(), as a tuple (url, rev_options). """ secret_url, rev, user_pass = self.get_url_rev_and_auth(url.secret) username, secret_password = user_pass password: Optional[HiddenText] = None if secret_password is not None: password = hide_value(secret_password) extra_args = self.make_rev_args(username, password) rev_options = self.make_rev_options(rev, extra_args=extra_args) return hide_url(secret_url), rev_options @staticmethod def normalize_url(url: str) -> str: """ Normalize a URL for comparison by unquoting it and removing any trailing slash. """ return urllib.parse.unquote(url).rstrip("/") @classmethod def compare_urls(cls, url1: str, url2: str) -> bool: """ Compare two repo URLs for identity, ignoring incidental differences. """ return cls.normalize_url(url1) == cls.normalize_url(url2) def fetch_new(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: """ Fetch a revision from a repository, in the case that this is the first fetch from the repository. Args: dest: the directory to fetch the repository to. rev_options: a RevOptions object. """ raise NotImplementedError def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: """ Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. """ raise NotImplementedError def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: """ Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. """ raise NotImplementedError @classmethod def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool: """ Return whether the id of the current commit equals the given name. Args: dest: the repository directory. name: a string name. """ raise NotImplementedError def obtain(self, dest: str, url: HiddenText) -> None: """ Install or update in editable mode the package represented by this VersionControl object. :param dest: the repository directory in which to install or update. :param url: the repository URL starting with a vcs prefix. """ url, rev_options = self.get_url_rev_options(url) if not os.path.exists(dest): self.fetch_new(dest, url, rev_options) return rev_display = rev_options.to_display() if self.is_repository_directory(dest): existing_url = self.get_remote_url(dest) if self.compare_urls(existing_url, url.secret): logger.debug( "%s in %s exists, and has correct URL (%s)", self.repo_name.title(), display_path(dest), url, ) if not self.is_commit_id_equal(dest, rev_options.rev): logger.info( "Updating %s %s%s", display_path(dest), self.repo_name, rev_display, ) self.update(dest, url, rev_options) else: logger.info("Skipping because already up-to-date.") return logger.warning( "%s %s in %s exists with URL %s", self.name, self.repo_name, display_path(dest), existing_url, ) prompt = ("(s)witch, (i)gnore, (w)ipe, (b)ackup ", ("s", "i", "w", "b")) else: logger.warning( "Directory %s already exists, and is not a %s %s.", dest, self.name, self.repo_name, ) # https://github.com/python/mypy/issues/1174 prompt = ("(i)gnore, (w)ipe, (b)ackup ", ("i", "w", "b")) # type: ignore logger.warning( "The plan is to install the %s repository %s", self.name, url, ) response = ask_path_exists("What to do? {}".format(prompt[0]), prompt[1]) if response == "a": sys.exit(-1) if response == "w": logger.warning("Deleting %s", display_path(dest)) rmtree(dest) self.fetch_new(dest, url, rev_options) return if response == "b": dest_dir = backup_dir(dest) logger.warning("Backing up %s to %s", display_path(dest), dest_dir) shutil.move(dest, dest_dir) self.fetch_new(dest, url, rev_options) return # Do nothing if the response is "i". if response == "s": logger.info( "Switching %s %s to %s%s", self.repo_name, display_path(dest), url, rev_display, ) self.switch(dest, url, rev_options) def unpack(self, location: str, url: HiddenText) -> None: """ Clean up current location and download the url repository (and vcs infos) into location :param url: the repository URL starting with a vcs prefix. """ if os.path.exists(location): rmtree(location) self.obtain(location, url=url) @classmethod def get_remote_url(cls, location: str) -> str: """ Return the url used at location Raises RemoteNotFoundError if the repository does not have a remote url configured. """ raise NotImplementedError @classmethod def get_revision(cls, location: str) -> str: """ Return the current commit id of the files at the given location. """ raise NotImplementedError @classmethod def run_command( cls, cmd: Union[List[str], CommandArgs], show_stdout: bool = True, cwd: Optional[str] = None, on_returncode: 'Literal["raise", "warn", "ignore"]' = "raise", extra_ok_returncodes: Optional[Iterable[int]] = None, command_desc: Optional[str] = None, extra_environ: Optional[Mapping[str, Any]] = None, spinner: Optional[SpinnerInterface] = None, log_failed_cmd: bool = True, stdout_only: bool = False, ) -> str: """ Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available """ cmd = make_command(cls.name, *cmd) try: return call_subprocess( cmd, show_stdout, cwd, on_returncode=on_returncode, extra_ok_returncodes=extra_ok_returncodes, command_desc=command_desc, extra_environ=extra_environ, unset_environ=cls.unset_environ, spinner=spinner, log_failed_cmd=log_failed_cmd, stdout_only=stdout_only, ) except FileNotFoundError: # errno.ENOENT = no such file or directory # In other words, the VCS executable isn't available raise BadCommand( f"Cannot find command {cls.name!r} - do you have " f"{cls.name!r} installed and in your PATH?" ) except PermissionError: # errno.EACCES = Permission denied # This error occurs, for instance, when the command is installed # only for another user. So, the current user don't have # permission to call the other user command. raise BadCommand( f"No permission to execute {cls.name!r} - install it " f"locally, globally (ask admin), or check your PATH. " f"See possible solutions at " f"https://pip.pypa.io/en/latest/reference/pip_freeze/" f"#fixing-permission-denied." ) @classmethod def is_repository_directory(cls, path: str) -> bool: """ Return whether a directory path is a repository directory. """ logger.debug("Checking in %s for %s (%s)...", path, cls.dirname, cls.name) return os.path.exists(os.path.join(path, cls.dirname)) @classmethod def get_repository_root(cls, location: str) -> Optional[str]: """ Return the "root" (top-level) directory controlled by the vcs, or `None` if the directory is not in any. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. This can do more than is_repository_directory() alone. For example, the Git override checks that Git is actually available. """ if cls.is_repository_directory(location): return location return None PK]A@\) ) vcs/bazaar.pynu[import logging from typing import List, Optional, Tuple from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RevOptions, VersionControl, vcs, ) logger = logging.getLogger(__name__) class Bazaar(VersionControl): name = "bzr" dirname = ".bzr" repo_name = "branch" schemes = ( "bzr+http", "bzr+https", "bzr+ssh", "bzr+sftp", "bzr+ftp", "bzr+lp", "bzr+file", ) @staticmethod def get_base_rev_args(rev: str) -> List[str]: return ["-r", rev] def fetch_new(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: rev_display = rev_options.to_display() logger.info( "Checking out %s%s to %s", url, rev_display, display_path(dest), ) cmd_args = make_command("branch", "-q", rev_options.to_args(), url, dest) self.run_command(cmd_args) def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: self.run_command(make_command("switch", url), cwd=dest) def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: cmd_args = make_command("pull", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) @classmethod def get_url_rev_and_auth(cls, url: str) -> Tuple[str, Optional[str], AuthInfo]: # hotfix the URL scheme after removing bzr+ from bzr+ssh:// readd it url, rev, user_pass = super().get_url_rev_and_auth(url) if url.startswith("ssh://"): url = "bzr+" + url return url, rev, user_pass @classmethod def get_remote_url(cls, location: str) -> str: urls = cls.run_command( ["info"], show_stdout=False, stdout_only=True, cwd=location ) for line in urls.splitlines(): line = line.strip() for x in ("checkout of branch: ", "parent branch: "): if line.startswith(x): repo = line.split(x)[1] if cls._is_local_repository(repo): return path_to_url(repo) return repo raise RemoteNotFoundError @classmethod def get_revision(cls, location: str) -> str: revision = cls.run_command( ["revno"], show_stdout=False, stdout_only=True, cwd=location, ) return revision.splitlines()[-1] @classmethod def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool: """Always assume the versions don't match""" return False vcs.register(Bazaar) PK]jbL-L-vcs/subversion.pynu[import logging import os import re from typing import List, Optional, Tuple from pip._internal.utils.misc import ( HiddenText, display_path, is_console_interactive, is_installable_dir, split_auth_from_netloc, ) from pip._internal.utils.subprocess import CommandArgs, make_command from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RevOptions, VersionControl, vcs, ) logger = logging.getLogger(__name__) _svn_xml_url_re = re.compile('url="([^"]+)"') _svn_rev_re = re.compile(r'committed-rev="(\d+)"') _svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"') _svn_info_xml_url_re = re.compile(r"(.*)") class Subversion(VersionControl): name = "svn" dirname = ".svn" repo_name = "checkout" schemes = ("svn+ssh", "svn+http", "svn+https", "svn+svn", "svn+file") @classmethod def should_add_vcs_url_prefix(cls, remote_url: str) -> bool: return True @staticmethod def get_base_rev_args(rev: str) -> List[str]: return ["-r", rev] @classmethod def get_revision(cls, location: str) -> str: """ Return the maximum revision for all files under a given location """ # Note: taken from setuptools.command.egg_info revision = 0 for base, dirs, _ in os.walk(location): if cls.dirname not in dirs: dirs[:] = [] continue # no sense walking uncontrolled subdirs dirs.remove(cls.dirname) entries_fn = os.path.join(base, cls.dirname, "entries") if not os.path.exists(entries_fn): # FIXME: should we warn? continue dirurl, localrev = cls._get_svn_url_rev(base) if base == location: assert dirurl is not None base = dirurl + "/" # save the root url elif not dirurl or not dirurl.startswith(base): dirs[:] = [] continue # not part of the same svn tree, skip it revision = max(revision, localrev) return str(revision) @classmethod def get_netloc_and_auth( cls, netloc: str, scheme: str ) -> Tuple[str, Tuple[Optional[str], Optional[str]]]: """ This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. """ if scheme == "ssh": # The --username and --password options can't be used for # svn+ssh URLs, so keep the auth information in the URL. return super().get_netloc_and_auth(netloc, scheme) return split_auth_from_netloc(netloc) @classmethod def get_url_rev_and_auth(cls, url: str) -> Tuple[str, Optional[str], AuthInfo]: # hotfix the URL scheme after removing svn+ from svn+ssh:// readd it url, rev, user_pass = super().get_url_rev_and_auth(url) if url.startswith("ssh://"): url = "svn+" + url return url, rev, user_pass @staticmethod def make_rev_args( username: Optional[str], password: Optional[HiddenText] ) -> CommandArgs: extra_args: CommandArgs = [] if username: extra_args += ["--username", username] if password: extra_args += ["--password", password] return extra_args @classmethod def get_remote_url(cls, location: str) -> str: # In cases where the source is in a subdirectory, we have to look up in # the location until we find a valid project root. orig_location = location while not is_installable_dir(location): last_location = location location = os.path.dirname(location) if location == last_location: # We've traversed up to the root of the filesystem without # finding a Python project. logger.warning( "Could not find Python project for directory %s (tried all " "parent directories)", orig_location, ) raise RemoteNotFoundError url, _rev = cls._get_svn_url_rev(location) if url is None: raise RemoteNotFoundError return url @classmethod def _get_svn_url_rev(cls, location: str) -> Tuple[Optional[str], int]: from pip._internal.exceptions import InstallationError entries_path = os.path.join(location, cls.dirname, "entries") if os.path.exists(entries_path): with open(entries_path) as f: data = f.read() else: # subversion >= 1.7 does not have the 'entries' file data = "" url = None if data.startswith("8") or data.startswith("9") or data.startswith("10"): entries = list(map(str.splitlines, data.split("\n\x0c\n"))) del entries[0][0] # get rid of the '8' url = entries[0][3] revs = [int(d[9]) for d in entries if len(d) > 9 and d[9]] + [0] elif data.startswith("= 1.7 # Note that using get_remote_call_options is not necessary here # because `svn info` is being run against a local directory. # We don't need to worry about making sure interactive mode # is being used to prompt for passwords, because passwords # are only potentially needed for remote server requests. xml = cls.run_command( ["info", "--xml", location], show_stdout=False, stdout_only=True, ) match = _svn_info_xml_url_re.search(xml) assert match is not None url = match.group(1) revs = [int(m.group(1)) for m in _svn_info_xml_rev_re.finditer(xml)] except InstallationError: url, revs = None, [] if revs: rev = max(revs) else: rev = 0 return url, rev @classmethod def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool: """Always assume the versions don't match""" return False def __init__(self, use_interactive: bool = None) -> None: if use_interactive is None: use_interactive = is_console_interactive() self.use_interactive = use_interactive # This member is used to cache the fetched version of the current # ``svn`` client. # Special value definitions: # None: Not evaluated yet. # Empty tuple: Could not parse version. self._vcs_version: Optional[Tuple[int, ...]] = None super().__init__() def call_vcs_version(self) -> Tuple[int, ...]: """Query the version of the currently installed Subversion client. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not be parsed. :raises: BadCommand: If ``svn`` is not installed. """ # Example versions: # svn, version 1.10.3 (r1842928) # compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0 # svn, version 1.7.14 (r1542130) # compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu # svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0) # compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2 version_prefix = "svn, version " version = self.run_command(["--version"], show_stdout=False, stdout_only=True) if not version.startswith(version_prefix): return () version = version[len(version_prefix) :].split()[0] version_list = version.partition("-")[0].split(".") try: parsed_version = tuple(map(int, version_list)) except ValueError: return () return parsed_version def get_vcs_version(self) -> Tuple[int, ...]: """Return the version of the currently installed Subversion client. If the version of the Subversion client has already been queried, a cached value will be used. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not be parsed. :raises: BadCommand: If ``svn`` is not installed. """ if self._vcs_version is not None: # Use cached version, if available. # If parsing the version failed previously (empty tuple), # do not attempt to parse it again. return self._vcs_version vcs_version = self.call_vcs_version() self._vcs_version = vcs_version return vcs_version def get_remote_call_options(self) -> CommandArgs: """Return options to be used on calls to Subversion that contact the server. These options are applicable for the following ``svn`` subcommands used in this class. - checkout - switch - update :return: A list of command line arguments to pass to ``svn``. """ if not self.use_interactive: # --non-interactive switch is available since Subversion 0.14.4. # Subversion < 1.8 runs in interactive mode by default. return ["--non-interactive"] svn_version = self.get_vcs_version() # By default, Subversion >= 1.8 runs in non-interactive mode if # stdin is not a TTY. Since that is how pip invokes SVN, in # call_subprocess(), pip must pass --force-interactive to ensure # the user can be prompted for a password, if required. # SVN added the --force-interactive option in SVN 1.8. Since # e.g. RHEL/CentOS 7, which is supported until 2024, ships with # SVN 1.7, pip should continue to support SVN 1.7. Therefore, pip # can't safely add the option if the SVN version is < 1.8 (or unknown). if svn_version >= (1, 8): return ["--force-interactive"] return [] def fetch_new(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: rev_display = rev_options.to_display() logger.info( "Checking out %s%s to %s", url, rev_display, display_path(dest), ) cmd_args = make_command( "checkout", "-q", self.get_remote_call_options(), rev_options.to_args(), url, dest, ) self.run_command(cmd_args) def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: cmd_args = make_command( "switch", self.get_remote_call_options(), rev_options.to_args(), url, dest, ) self.run_command(cmd_args) def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: cmd_args = make_command( "update", self.get_remote_call_options(), rev_options.to_args(), dest, ) self.run_command(cmd_args) vcs.register(Subversion) PK]_EE vcs/git.pynu[import logging import os.path import pathlib import re import urllib.parse import urllib.request from typing import List, Optional, Tuple from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path, hide_url from pip._internal.utils.subprocess import make_command from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RemoteNotValidError, RevOptions, VersionControl, find_path_to_project_root_from_repo_root, vcs, ) urlsplit = urllib.parse.urlsplit urlunsplit = urllib.parse.urlunsplit logger = logging.getLogger(__name__) GIT_VERSION_REGEX = re.compile( r"^git version " # Prefix. r"(\d+)" # Major. r"\.(\d+)" # Dot, minor. r"(?:\.(\d+))?" # Optional dot, patch. r".*$" # Suffix, including any pre- and post-release segments we don't care about. ) HASH_REGEX = re.compile("^[a-fA-F0-9]{40}$") # SCP (Secure copy protocol) shorthand. e.g. 'git@example.com:foo/bar.git' SCP_REGEX = re.compile( r"""^ # Optional user, e.g. 'git@' (\w+@)? # Server, e.g. 'github.com'. ([^/:]+): # The server-side path. e.g. 'user/project.git'. Must start with an # alphanumeric character so as not to be confusable with a Windows paths # like 'C:/foo/bar' or 'C:\foo\bar'. (\w[^:]*) $""", re.VERBOSE, ) def looks_like_hash(sha: str) -> bool: return bool(HASH_REGEX.match(sha)) class Git(VersionControl): name = "git" dirname = ".git" repo_name = "clone" schemes = ( "git+http", "git+https", "git+ssh", "git+git", "git+file", ) # Prevent the user's environment variables from interfering with pip: # https://github.com/pypa/pip/issues/1130 unset_environ = ("GIT_DIR", "GIT_WORK_TREE") default_arg_rev = "HEAD" @staticmethod def get_base_rev_args(rev: str) -> List[str]: return [rev] def is_immutable_rev_checkout(self, url: str, dest: str) -> bool: _, rev_options = self.get_url_rev_options(hide_url(url)) if not rev_options.rev: return False if not self.is_commit_id_equal(dest, rev_options.rev): # the current commit is different from rev, # which means rev was something else than a commit hash return False # return False in the rare case rev is both a commit hash # and a tag or a branch; we don't want to cache in that case # because that branch/tag could point to something else in the future is_tag_or_branch = bool(self.get_revision_sha(dest, rev_options.rev)[0]) return not is_tag_or_branch def get_git_version(self) -> Tuple[int, ...]: version = self.run_command(["version"], show_stdout=False, stdout_only=True) match = GIT_VERSION_REGEX.match(version) if not match: logger.warning("Can't parse git version: %s", version) return () return tuple(int(c) for c in match.groups()) @classmethod def get_current_branch(cls, location: str) -> Optional[str]: """ Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). """ # git-symbolic-ref exits with empty stdout if "HEAD" is a detached # HEAD rather than a symbolic ref. In addition, the -q causes the # command to exit with status code 1 instead of 128 in this case # and to suppress the message to stderr. args = ["symbolic-ref", "-q", "HEAD"] output = cls.run_command( args, extra_ok_returncodes=(1,), show_stdout=False, stdout_only=True, cwd=location, ) ref = output.strip() if ref.startswith("refs/heads/"): return ref[len("refs/heads/") :] return None @classmethod def get_revision_sha(cls, dest: str, rev: str) -> Tuple[Optional[str], bool]: """ Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name. """ # Pass rev to pre-filter the list. output = cls.run_command( ["show-ref", rev], cwd=dest, show_stdout=False, stdout_only=True, on_returncode="ignore", ) refs = {} # NOTE: We do not use splitlines here since that would split on other # unicode separators, which can be maliciously used to install a # different revision. for line in output.strip().split("\n"): line = line.rstrip("\r") if not line: continue try: ref_sha, ref_name = line.split(" ", maxsplit=2) except ValueError: # Include the offending line to simplify troubleshooting if # this error ever occurs. raise ValueError(f"unexpected show-ref line: {line!r}") refs[ref_name] = ref_sha branch_ref = f"refs/remotes/origin/{rev}" tag_ref = f"refs/tags/{rev}" sha = refs.get(branch_ref) if sha is not None: return (sha, True) sha = refs.get(tag_ref) return (sha, False) @classmethod def _should_fetch(cls, dest: str, rev: str) -> bool: """ Return true if rev is a ref or is a commit that we don't have locally. Branches and tags are not considered in this method because they are assumed to be always available locally (which is a normal outcome of ``git clone`` and ``git fetch --tags``). """ if rev.startswith("refs/"): # Always fetch remote refs. return True if not looks_like_hash(rev): # Git fetch would fail with abbreviated commits. return False if cls.has_commit(dest, rev): # Don't fetch if we have the commit locally. return False return True @classmethod def resolve_revision( cls, dest: str, url: HiddenText, rev_options: RevOptions ) -> RevOptions: """ Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object. """ rev = rev_options.arg_rev # The arg_rev property's implementation for Git ensures that the # rev return value is always non-None. assert rev is not None sha, is_branch = cls.get_revision_sha(dest, rev) if sha is not None: rev_options = rev_options.make_new(sha) rev_options.branch_name = rev if is_branch else None return rev_options # Do not show a warning for the common case of something that has # the form of a Git commit hash. if not looks_like_hash(rev): logger.warning( "Did not find branch or tag '%s', assuming revision or ref.", rev, ) if not cls._should_fetch(dest, rev): return rev_options # fetch the requested revision cls.run_command( make_command("fetch", "-q", url, rev_options.to_args()), cwd=dest, ) # Change the revision to the SHA of the ref we fetched sha = cls.get_revision(dest, rev="FETCH_HEAD") rev_options = rev_options.make_new(sha) return rev_options @classmethod def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool: """ Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. """ if not name: # Then avoid an unnecessary subprocess call. return False return cls.get_revision(dest) == name def fetch_new(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: rev_display = rev_options.to_display() logger.info("Cloning %s%s to %s", url, rev_display, display_path(dest)) if self.get_git_version() >= (2, 17): # Git added support for partial clone in 2.17 # https://git-scm.com/docs/partial-clone # Speeds up cloning by functioning without a complete copy of repository self.run_command( make_command( "clone", "--filter=blob:none", "-q", url, dest, ) ) else: self.run_command(make_command("clone", "-q", url, dest)) if rev_options.rev: # Then a specific revision was requested. rev_options = self.resolve_revision(dest, url, rev_options) branch_name = getattr(rev_options, "branch_name", None) logger.debug("Rev options %s, branch_name %s", rev_options, branch_name) if branch_name is None: # Only do a checkout if the current commit id doesn't match # the requested revision. if not self.is_commit_id_equal(dest, rev_options.rev): cmd_args = make_command( "checkout", "-q", rev_options.to_args(), ) self.run_command(cmd_args, cwd=dest) elif self.get_current_branch(dest) != branch_name: # Then a specific branch was requested, and that branch # is not yet checked out. track_branch = f"origin/{branch_name}" cmd_args = [ "checkout", "-b", branch_name, "--track", track_branch, ] self.run_command(cmd_args, cwd=dest) else: sha = self.get_revision(dest) rev_options = rev_options.make_new(sha) logger.info("Resolved %s to commit %s", url, rev_options.rev) #: repo may contain submodules self.update_submodules(dest) def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: self.run_command( make_command("config", "remote.origin.url", url), cwd=dest, ) cmd_args = make_command("checkout", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) self.update_submodules(dest) def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None: # First fetch changes from the default remote if self.get_git_version() >= (1, 9): # fetch tags in addition to everything else self.run_command(["fetch", "-q", "--tags"], cwd=dest) else: self.run_command(["fetch", "-q"], cwd=dest) # Then reset to wanted revision (maybe even origin/master) rev_options = self.resolve_revision(dest, url, rev_options) cmd_args = make_command("reset", "--hard", "-q", rev_options.to_args()) self.run_command(cmd_args, cwd=dest) #: update submodules self.update_submodules(dest) @classmethod def get_remote_url(cls, location: str) -> str: """ Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. """ # We need to pass 1 for extra_ok_returncodes since the command # exits with return code 1 if there are no matching lines. stdout = cls.run_command( ["config", "--get-regexp", r"remote\..*\.url"], extra_ok_returncodes=(1,), show_stdout=False, stdout_only=True, cwd=location, ) remotes = stdout.splitlines() try: found_remote = remotes[0] except IndexError: raise RemoteNotFoundError for remote in remotes: if remote.startswith("remote.origin.url "): found_remote = remote break url = found_remote.split(" ")[1] return cls._git_remote_to_pip_url(url.strip()) @staticmethod def _git_remote_to_pip_url(url: str) -> str: """ Convert a remote url from what git uses to what pip accepts. There are 3 legal forms **url** may take: 1. A fully qualified url: ssh://git@example.com/foo/bar.git 2. A local project.git folder: /path/to/bare/repository.git 3. SCP shorthand for form 1: git@example.com:foo/bar.git Form 1 is output as-is. Form 2 must be converted to URI and form 3 must be converted to form 1. See the corresponding test test_git_remote_url_to_pip() for examples of sample inputs/outputs. """ if re.match(r"\w+://", url): # This is already valid. Pass it though as-is. return url if os.path.exists(url): # A local bare remote (git clone --mirror). # Needs a file:// prefix. return pathlib.PurePath(url).as_uri() scp_match = SCP_REGEX.match(url) if scp_match: # Add an ssh:// prefix and replace the ':' with a '/'. return scp_match.expand(r"ssh://\1\2/\3") # Otherwise, bail out. raise RemoteNotValidError(url) @classmethod def has_commit(cls, location: str, rev: str) -> bool: """ Check if rev is a commit that is available in the local repository. """ try: cls.run_command( ["rev-parse", "-q", "--verify", "sha^" + rev], cwd=location, log_failed_cmd=False, ) except InstallationError: return False else: return True @classmethod def get_revision(cls, location: str, rev: Optional[str] = None) -> str: if rev is None: rev = "HEAD" current_rev = cls.run_command( ["rev-parse", rev], show_stdout=False, stdout_only=True, cwd=location, ) return current_rev.strip() @classmethod def get_subdirectory(cls, location: str) -> Optional[str]: """ Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. """ # find the repo root git_dir = cls.run_command( ["rev-parse", "--git-dir"], show_stdout=False, stdout_only=True, cwd=location, ).strip() if not os.path.isabs(git_dir): git_dir = os.path.join(location, git_dir) repo_root = os.path.abspath(os.path.join(git_dir, "..")) return find_path_to_project_root_from_repo_root(location, repo_root) @classmethod def get_url_rev_and_auth(cls, url: str) -> Tuple[str, Optional[str], AuthInfo]: """ Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub. """ # Works around an apparent Git bug # (see https://article.gmane.org/gmane.comp.version-control.git/146500) scheme, netloc, path, query, fragment = urlsplit(url) if scheme.endswith("file"): initial_slashes = path[: -len(path.lstrip("/"))] newpath = initial_slashes + urllib.request.url2pathname(path).replace( "\\", "/" ).lstrip("/") after_plus = scheme.find("+") + 1 url = scheme[:after_plus] + urlunsplit( (scheme[after_plus:], netloc, newpath, query, fragment), ) if "://" not in url: assert "file:" not in url url = url.replace("git+", "git+ssh://") url, rev, user_pass = super().get_url_rev_and_auth(url) url = url.replace("ssh://", "") else: url, rev, user_pass = super().get_url_rev_and_auth(url) return url, rev, user_pass @classmethod def update_submodules(cls, location: str) -> None: if not os.path.exists(os.path.join(location, ".gitmodules")): return cls.run_command( ["submodule", "update", "--init", "--recursive", "-q"], cwd=location, ) @classmethod def get_repository_root(cls, location: str) -> Optional[str]: loc = super().get_repository_root(location) if loc: return loc try: r = cls.run_command( ["rev-parse", "--show-toplevel"], cwd=location, show_stdout=False, stdout_only=True, on_returncode="raise", log_failed_cmd=False, ) except BadCommand: logger.debug( "could not determine if %s is under git control " "because git is not available", location, ) return None except InstallationError: return None return os.path.normpath(r.rstrip("\r\n")) @staticmethod def should_add_vcs_url_prefix(repo_url: str) -> bool: """In either https or ssh form, requirements must be prefixed with git+.""" return True vcs.register(Git) PK]/TTvcs/__init__.pynu[# Expose a limited set of classes and functions so callers outside of # the vcs package don't need to import deeper than `pip._internal.vcs`. # (The test directory may still need to import from a vcs sub-package.) # Import all vcs modules to register each VCS in the VcsSupport object. import pip._internal.vcs.bazaar import pip._internal.vcs.git import pip._internal.vcs.mercurial import pip._internal.vcs.subversion # noqa: F401 from pip._internal.vcs.versioncontrol import ( # noqa: F401 RemoteNotFoundError, RemoteNotValidError, is_url, make_vcs_requirement_url, vcs, ) PK]?EQEQ download.pynu[# The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False from __future__ import absolute_import import cgi import logging import mimetypes import os import re import shutil import sys from pip._vendor import requests from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response from pip._vendor.six import PY2 from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._internal.exceptions import HashMismatch, InstallationError from pip._internal.models.index import PyPI from pip._internal.network.session import PipSession from pip._internal.utils.encoding import auto_decode from pip._internal.utils.filesystem import copy2_fixed from pip._internal.utils.misc import ( ask_path_exists, backup_dir, consume, display_path, format_size, hide_url, path_to_display, rmtree, splitext, ) from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.utils.ui import DownloadProgressProvider from pip._internal.utils.unpacking import unpack_file from pip._internal.utils.urls import get_url_scheme from pip._internal.vcs import vcs if MYPY_CHECK_RUNNING: from typing import ( IO, Callable, List, Optional, Text, Tuple, ) from mypy_extensions import TypedDict from pip._internal.models.link import Link from pip._internal.utils.hashes import Hashes from pip._internal.vcs.versioncontrol import VersionControl if PY2: CopytreeKwargs = TypedDict( 'CopytreeKwargs', { 'ignore': Callable[[str, List[str]], List[str]], 'symlinks': bool, }, total=False, ) else: CopytreeKwargs = TypedDict( 'CopytreeKwargs', { 'copy_function': Callable[[str, str], None], 'ignore': Callable[[str, List[str]], List[str]], 'ignore_dangling_symlinks': bool, 'symlinks': bool, }, total=False, ) __all__ = ['get_file_content', 'unpack_vcs_link', 'unpack_file_url', 'unpack_http_url', 'unpack_url', 'parse_content_disposition', 'sanitize_content_filename'] logger = logging.getLogger(__name__) def get_file_content(url, comes_from=None, session=None): # type: (str, Optional[str], Optional[PipSession]) -> Tuple[str, Text] """Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. :param url: File path or url. :param comes_from: Origin description of requirements. :param session: Instance of pip.download.PipSession. """ if session is None: raise TypeError( "get_file_content() missing 1 required keyword argument: 'session'" ) scheme = get_url_scheme(url) if scheme in ['http', 'https']: # FIXME: catch some errors resp = session.get(url) resp.raise_for_status() return resp.url, resp.text elif scheme == 'file': if comes_from and comes_from.startswith('http'): raise InstallationError( 'Requirements file %s references URL %s, which is local' % (comes_from, url)) path = url.split(':', 1)[1] path = path.replace('\\', '/') match = _url_slash_drive_re.match(path) if match: path = match.group(1) + ':' + path.split('|', 1)[1] path = urllib_parse.unquote(path) if path.startswith('/'): path = '/' + path.lstrip('/') url = path try: with open(url, 'rb') as f: content = auto_decode(f.read()) except IOError as exc: raise InstallationError( 'Could not open requirements file: %s' % str(exc) ) return url, content _url_slash_drive_re = re.compile(r'/*([a-z])\|', re.I) def unpack_vcs_link(link, location): # type: (Link, str) -> None vcs_backend = _get_used_vcs_backend(link) assert vcs_backend is not None vcs_backend.unpack(location, url=hide_url(link.url)) def _get_used_vcs_backend(link): # type: (Link) -> Optional[VersionControl] """ Return a VersionControl object or None. """ for vcs_backend in vcs.backends: if link.scheme in vcs_backend.schemes: return vcs_backend return None def _progress_indicator(iterable, *args, **kwargs): return iterable def _download_url( resp, # type: Response link, # type: Link content_file, # type: IO hashes, # type: Optional[Hashes] progress_bar # type: str ): # type: (...) -> None try: total_length = int(resp.headers['content-length']) except (ValueError, KeyError, TypeError): total_length = 0 cached_resp = getattr(resp, "from_cache", False) if logger.getEffectiveLevel() > logging.INFO: show_progress = False elif cached_resp: show_progress = False elif total_length > (40 * 1000): show_progress = True elif not total_length: show_progress = True else: show_progress = False show_url = link.show_url def resp_read(chunk_size): try: # Special case for urllib3. for chunk in resp.raw.stream( chunk_size, # We use decode_content=False here because we don't # want urllib3 to mess with the raw bytes we get # from the server. If we decompress inside of # urllib3 then we cannot verify the checksum # because the checksum will be of the compressed # file. This breakage will only occur if the # server adds a Content-Encoding header, which # depends on how the server was configured: # - Some servers will notice that the file isn't a # compressible file and will leave the file alone # and with an empty Content-Encoding # - Some servers will notice that the file is # already compressed and will leave the file # alone and will add a Content-Encoding: gzip # header # - Some servers won't notice anything at all and # will take a file that's already been compressed # and compress it again and set the # Content-Encoding: gzip header # # By setting this not to decode automatically we # hope to eliminate problems with the second case. decode_content=False): yield chunk except AttributeError: # Standard file-like object. while True: chunk = resp.raw.read(chunk_size) if not chunk: break yield chunk def written_chunks(chunks): for chunk in chunks: content_file.write(chunk) yield chunk progress_indicator = _progress_indicator if link.netloc == PyPI.netloc: url = show_url else: url = link.url_without_fragment if show_progress: # We don't show progress on cached responses progress_indicator = DownloadProgressProvider(progress_bar, max=total_length) if total_length: logger.info("Downloading %s (%s)", url, format_size(total_length)) else: logger.info("Downloading %s", url) elif cached_resp: logger.info("Using cached %s", url) else: logger.info("Downloading %s", url) downloaded_chunks = written_chunks( progress_indicator( resp_read(CONTENT_CHUNK_SIZE), CONTENT_CHUNK_SIZE ) ) if hashes: hashes.check_against_chunks(downloaded_chunks) else: consume(downloaded_chunks) def _copy_file(filename, location, link): copy = True download_location = os.path.join(location, link.filename) if os.path.exists(download_location): response = ask_path_exists( 'The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abort' % display_path(download_location), ('i', 'w', 'b', 'a')) if response == 'i': copy = False elif response == 'w': logger.warning('Deleting %s', display_path(download_location)) os.remove(download_location) elif response == 'b': dest_file = backup_dir(download_location) logger.warning( 'Backing up %s to %s', display_path(download_location), display_path(dest_file), ) shutil.move(download_location, dest_file) elif response == 'a': sys.exit(-1) if copy: shutil.copy(filename, download_location) logger.info('Saved %s', display_path(download_location)) def unpack_http_url( link, # type: Link location, # type: str download_dir=None, # type: Optional[str] session=None, # type: Optional[PipSession] hashes=None, # type: Optional[Hashes] progress_bar="on" # type: str ): # type: (...) -> None if session is None: raise TypeError( "unpack_http_url() missing 1 required keyword argument: 'session'" ) with TempDirectory(kind="unpack") as temp_dir: # If a download dir is specified, is the file already downloaded there? already_downloaded_path = None if download_dir: already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path content_type = mimetypes.guess_type(from_path)[0] else: # let's download to a tmp dir from_path, content_type = _download_http_url(link, session, temp_dir.path, hashes, progress_bar) # unpack the archive to the build dir location. even when only # downloading archives, they have to be unpacked to parse dependencies unpack_file(from_path, location, content_type) # a download dir is specified; let's copy the archive there if download_dir and not already_downloaded_path: _copy_file(from_path, download_dir, link) if not already_downloaded_path: os.unlink(from_path) def _copy2_ignoring_special_files(src, dest): # type: (str, str) -> None """Copying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. """ try: copy2_fixed(src, dest) except shutil.SpecialFileError as e: # SpecialFileError may be raised due to either the source or # destination. If the destination was the cause then we would actually # care, but since the destination directory is deleted prior to # copy we ignore all of them assuming it is caused by the source. logger.warning( "Ignoring special file error '%s' encountered copying %s to %s.", str(e), path_to_display(src), path_to_display(dest), ) def _copy_source_tree(source, target): # type: (str, str) -> None target_abspath = os.path.abspath(target) target_basename = os.path.basename(target_abspath) target_dirname = os.path.dirname(target_abspath) def ignore(d, names): skipped = [] # type: List[str] if d == source: # Pulling in those directories can potentially be very slow, # exclude the following directories if they appear in the top # level dir (and only it). # See discussion at https://github.com/pypa/pip/pull/6770 skipped += ['.tox', '.nox'] if os.path.abspath(d) == target_dirname: # Prevent an infinite recursion if the target is in source. # This can happen when TMPDIR is set to ${PWD}/... # and we copy PWD to TMPDIR. skipped += [target_basename] return skipped kwargs = dict(ignore=ignore, symlinks=True) # type: CopytreeKwargs if not PY2: # Python 2 does not support copy_function, so we only ignore # errors on special file copy in Python 3. kwargs['copy_function'] = _copy2_ignoring_special_files shutil.copytree(source, target, **kwargs) def unpack_file_url( link, # type: Link location, # type: str download_dir=None, # type: Optional[str] hashes=None # type: Optional[Hashes] ): # type: (...) -> None """Unpack link into location. If download_dir is provided and link points to a file, make a copy of the link file inside download_dir. """ link_path = link.file_path # If it's a url to a local directory if link.is_existing_dir(): if os.path.isdir(location): rmtree(location) _copy_source_tree(link_path, location) if download_dir: logger.info('Link is a directory, ignoring download_dir') return # If --require-hashes is off, `hashes` is either empty, the # link's embedded hash, or MissingHashes; it is required to # match. If --require-hashes is on, we are satisfied by any # hash in `hashes` matching: a URL-based or an option-based # one; no internet-sourced hash will be in `hashes`. if hashes: hashes.check_against_path(link_path) # If a download dir is specified, is the file already there and valid? already_downloaded_path = None if download_dir: already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path else: from_path = link_path content_type = mimetypes.guess_type(from_path)[0] # unpack the archive to the build dir location. even when only downloading # archives, they have to be unpacked to parse dependencies unpack_file(from_path, location, content_type) # a download dir is specified and not already downloaded if download_dir and not already_downloaded_path: _copy_file(from_path, download_dir, link) def unpack_url( link, # type: Link location, # type: str download_dir=None, # type: Optional[str] session=None, # type: Optional[PipSession] hashes=None, # type: Optional[Hashes] progress_bar="on" # type: str ): # type: (...) -> None """Unpack link. If link is a VCS link: if only_download, export into download_dir and ignore location else unpack into location for other types of link: - unpack into location - if download_dir, copy the file into download_dir - if only_download, mark location for deletion :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. """ # non-editable vcs urls if link.is_vcs: unpack_vcs_link(link, location) # file urls elif link.is_file: unpack_file_url(link, location, download_dir, hashes=hashes) # http urls else: if session is None: session = PipSession() unpack_http_url( link, location, download_dir, session, hashes=hashes, progress_bar=progress_bar ) def sanitize_content_filename(filename): # type: (str) -> str """ Sanitize the "filename" value from a Content-Disposition header. """ return os.path.basename(filename) def parse_content_disposition(content_disposition, default_filename): # type: (str, str) -> str """ Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. """ _type, params = cgi.parse_header(content_disposition) filename = params.get('filename') if filename: # We need to sanitize the filename to prevent directory traversal # in case the filename contains ".." path parts. filename = sanitize_content_filename(filename) return filename or default_filename def _download_http_url( link, # type: Link session, # type: PipSession temp_dir, # type: str hashes, # type: Optional[Hashes] progress_bar # type: str ): # type: (...) -> Tuple[str, str] """Download link url into temp_dir using provided session""" target_url = link.url.split('#', 1)[0] try: resp = session.get( target_url, # We use Accept-Encoding: identity here because requests # defaults to accepting compressed responses. This breaks in # a variety of ways depending on how the server is configured. # - Some servers will notice that the file isn't a compressible # file and will leave the file alone and with an empty # Content-Encoding # - Some servers will notice that the file is already # compressed and will leave the file alone and will add a # Content-Encoding: gzip header # - Some servers won't notice anything at all and will take # a file that's already been compressed and compress it again # and set the Content-Encoding: gzip header # By setting this to request only the identity encoding We're # hoping to eliminate the third case. Hopefully there does not # exist a server which when given a file will notice it is # already compressed and that you're not asking for a # compressed file and will then decompress it before sending # because if that's the case I don't think it'll ever be # possible to make this work. headers={"Accept-Encoding": "identity"}, stream=True, ) resp.raise_for_status() except requests.HTTPError as exc: logger.critical( "HTTP error %s while getting %s", exc.response.status_code, link, ) raise content_type = resp.headers.get('content-type', '') filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess content_disposition = resp.headers.get('content-disposition') if content_disposition: filename = parse_content_disposition(content_disposition, filename) ext = splitext(filename)[1] # type: Optional[str] if not ext: ext = mimetypes.guess_extension(content_type) if ext: filename += ext if not ext and link.url != resp.url: ext = os.path.splitext(resp.url)[1] if ext: filename += ext file_path = os.path.join(temp_dir, filename) with open(file_path, 'wb') as content_file: _download_url(resp, link, content_file, hashes, progress_bar) return file_path, content_type def _check_download_dir(link, download_dir, hashes): # type: (Link, str, Optional[Hashes]) -> Optional[str] """ Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None """ download_path = os.path.join(download_dir, link.filename) if not os.path.exists(download_path): return None # If already downloaded, does its hash match? logger.info('File was already downloaded %s', download_path) if hashes: try: hashes.check_against_path(download_path) except HashMismatch: logger.warning( 'Previously-downloaded file %s has bad hash. ' 'Re-downloading.', download_path ) os.unlink(download_path) return None return download_path PK]Za3a3configuration.pynu["""Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from """ import configparser import locale import os import sys from typing import Any, Dict, Iterable, List, NewType, Optional, Tuple from pip._internal.exceptions import ( ConfigurationError, ConfigurationFileCouldNotBeLoaded, ) from pip._internal.utils import appdirs from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ensure_dir, enum RawConfigParser = configparser.RawConfigParser # Shorthand Kind = NewType("Kind", str) CONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf" ENV_NAMES_IGNORED = "version", "help" # The kinds of configurations there are. kinds = enum( USER="user", # User Specific GLOBAL="global", # System Wide SITE="site", # [Virtual] Environment Specific ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) OVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE logger = getLogger(__name__) # NOTE: Maybe use the optionx attribute to normalize keynames. def _normalize_name(name: str) -> str: """Make a name consistent regardless of source (environment or file)""" name = name.lower().replace("_", "-") if name.startswith("--"): name = name[2:] # only prefer long opts return name def _disassemble_key(name: str) -> List[str]: if "." not in name: error_message = ( "Key does not contain dot separated section and key. " "Perhaps you wanted to use 'global.{}' instead?" ).format(name) raise ConfigurationError(error_message) return name.split(".", 1) def get_configuration_files() -> Dict[Kind, List[str]]: global_config_files = [ os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip") ] site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME) legacy_config_file = os.path.join( os.path.expanduser("~"), "pip" if WINDOWS else ".pip", CONFIG_BASENAME, ) new_config_file = os.path.join(appdirs.user_config_dir("pip"), CONFIG_BASENAME) return { kinds.GLOBAL: global_config_files, kinds.SITE: [site_config_file], kinds.USER: [legacy_config_file, new_config_file], } class Configuration: """Handles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. """ def __init__(self, isolated: bool, load_only: Optional[Kind] = None) -> None: super().__init__() if load_only is not None and load_only not in VALID_LOAD_ONLY: raise ConfigurationError( "Got invalid value for load_only - should be one of {}".format( ", ".join(map(repr, VALID_LOAD_ONLY)) ) ) self.isolated = isolated self.load_only = load_only # Because we keep track of where we got the data from self._parsers: Dict[Kind, List[Tuple[str, RawConfigParser]]] = { variant: [] for variant in OVERRIDE_ORDER } self._config: Dict[Kind, Dict[str, Any]] = { variant: {} for variant in OVERRIDE_ORDER } self._modified_parsers: List[Tuple[str, RawConfigParser]] = [] def load(self) -> None: """Loads configuration from configuration files and environment""" self._load_config_files() if not self.isolated: self._load_environment_vars() def get_file_to_edit(self) -> Optional[str]: """Returns the file with highest priority in configuration""" assert self.load_only is not None, "Need to be specified a file to be editing" try: return self._get_parser_to_modify()[0] except IndexError: return None def items(self) -> Iterable[Tuple[str, Any]]: """Returns key-value pairs like dict.items() representing the loaded configuration """ return self._dictionary.items() def get_value(self, key: str) -> Any: """Get a value from the configuration.""" try: return self._dictionary[key] except KeyError: raise ConfigurationError(f"No such key - {key}") def set_value(self, key: str, value: Any) -> None: """Modify a value in the configuration.""" self._ensure_have_load_only() assert self.load_only fname, parser = self._get_parser_to_modify() if parser is not None: section, name = _disassemble_key(key) # Modify the parser and the configuration if not parser.has_section(section): parser.add_section(section) parser.set(section, name, value) self._config[self.load_only][key] = value self._mark_as_modified(fname, parser) def unset_value(self, key: str) -> None: """Unset a value in the configuration.""" self._ensure_have_load_only() assert self.load_only if key not in self._config[self.load_only]: raise ConfigurationError(f"No such key - {key}") fname, parser = self._get_parser_to_modify() if parser is not None: section, name = _disassemble_key(key) if not ( parser.has_section(section) and parser.remove_option(section, name) ): # The option was not removed. raise ConfigurationError( "Fatal Internal error [id=1]. Please report as a bug." ) # The section may be empty after the option was removed. if not parser.items(section): parser.remove_section(section) self._mark_as_modified(fname, parser) del self._config[self.load_only][key] def save(self) -> None: """Save the current in-memory state.""" self._ensure_have_load_only() for fname, parser in self._modified_parsers: logger.info("Writing to %s", fname) # Ensure directory exists. ensure_dir(os.path.dirname(fname)) with open(fname, "w") as f: parser.write(f) # # Private routines # def _ensure_have_load_only(self) -> None: if self.load_only is None: raise ConfigurationError("Needed a specific file to be modifying.") logger.debug("Will be working with %s variant only", self.load_only) @property def _dictionary(self) -> Dict[str, Any]: """A dictionary representing the loaded configuration.""" # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} for variant in OVERRIDE_ORDER: retval.update(self._config[variant]) return retval def _load_config_files(self) -> None: """Loads configuration from configuration files""" config_files = dict(self.iter_config_files()) if config_files[kinds.ENV][0:1] == [os.devnull]: logger.debug( "Skipping loading configuration files due to " "environment's PIP_CONFIG_FILE being os.devnull" ) return for variant, files in config_files.items(): for fname in files: # If there's specific variant set in `load_only`, load only # that variant, not the others. if self.load_only is not None and variant != self.load_only: logger.debug("Skipping file '%s' (variant: %s)", fname, variant) continue parser = self._load_file(variant, fname) # Keeping track of the parsers used self._parsers[variant].append((fname, parser)) def _load_file(self, variant: Kind, fname: str) -> RawConfigParser: logger.verbose("For variant '%s', will try loading '%s'", variant, fname) parser = self._construct_parser(fname) for section in parser.sections(): items = parser.items(section) self._config[variant].update(self._normalized_keys(section, items)) return parser def _construct_parser(self, fname: str) -> RawConfigParser: parser = configparser.RawConfigParser() # If there is no such file, don't bother reading it but create the # parser anyway, to hold the data. # Doing this is useful when modifying and saving files, where we don't # need to construct a parser. if os.path.exists(fname): try: parser.read(fname) except UnicodeDecodeError: # See https://github.com/pypa/pip/issues/4963 raise ConfigurationFileCouldNotBeLoaded( reason="contains invalid {} characters".format( locale.getpreferredencoding(False) ), fname=fname, ) except configparser.Error as error: # See https://github.com/pypa/pip/issues/4893 raise ConfigurationFileCouldNotBeLoaded(error=error) return parser def _load_environment_vars(self) -> None: """Loads configuration from environment variables""" self._config[kinds.ENV_VAR].update( self._normalized_keys(":env:", self.get_environ_vars()) ) def _normalized_keys( self, section: str, items: Iterable[Tuple[str, Any]] ) -> Dict[str, Any]: """Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or environment. """ normalized = {} for name, val in items: key = section + "." + _normalize_name(name) normalized[key] = val return normalized def get_environ_vars(self) -> Iterable[Tuple[str, str]]: """Returns a generator with all environmental vars with prefix PIP_""" for key, val in os.environ.items(): if key.startswith("PIP_"): name = key[4:].lower() if name not in ENV_NAMES_IGNORED: yield name, val # XXX: This is patched in the tests. def iter_config_files(self) -> Iterable[Tuple[Kind, List[str]]]: """Yields variant and configuration files associated with it. This should be treated like items of a dictionary. """ # SMELL: Move the conditions out of this function # environment variables have the lowest priority config_file = os.environ.get("PIP_CONFIG_FILE", None) if config_file is not None: yield kinds.ENV, [config_file] else: yield kinds.ENV, [] config_files = get_configuration_files() # at the base we have any global configuration yield kinds.GLOBAL, config_files[kinds.GLOBAL] # per-user configuration next should_load_user_config = not self.isolated and not ( config_file and os.path.exists(config_file) ) if should_load_user_config: # The legacy config file is overridden by the new config file yield kinds.USER, config_files[kinds.USER] # finally virtualenv configuration first trumping others yield kinds.SITE, config_files[kinds.SITE] def get_values_in_config(self, variant: Kind) -> Dict[str, Any]: """Get values present in a config file""" return self._config[variant] def _get_parser_to_modify(self) -> Tuple[str, RawConfigParser]: # Determine which parser to modify assert self.load_only parsers = self._parsers[self.load_only] if not parsers: # This should not happen if everything works correctly. raise ConfigurationError( "Fatal Internal error [id=2]. Please report as a bug." ) # Use the highest priority parser. return parsers[-1] # XXX: This is patched in the tests. def _mark_as_modified(self, fname: str, parser: RawConfigParser) -> None: file_parser_tuple = (fname, parser) if file_parser_tuple not in self._modified_parsers: self._modified_parsers.append(file_parser_tuple) def __repr__(self) -> str: return f"{self.__class__.__name__}({self._dictionary!r})" PK]eeutils/typing.pynu["""For neatly implementing static typing in pip. `mypy` - the static type analysis tool we use - uses the `typing` module, which provides core functionality fundamental to mypy's functioning. Generally, `typing` would be imported at runtime and used in that fashion - it acts as a no-op at runtime and does not have any run-time overhead by design. As it turns out, `typing` is not vendorable - it uses separate sources for Python 2/Python 3. Thus, this codebase can not expect it to be present. To work around this, mypy allows the typing import to be behind a False-y optional to prevent it from running at runtime and type-comments can be used to remove the need for the types to be accessible directly during runtime. This module provides the False-y guard in a nicely named fashion so that a curious maintainer can reach here to read this. In pip, all static-typing related imports should be guarded as follows: from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ... Ref: https://github.com/python/mypy/issues/3216 """ MYPY_CHECK_RUNNING = False PK]ɓ - -utils/logging.pynu[import contextlib import errno import logging import logging.handlers import os import sys from logging import Filter from typing import IO, Any, Callable, Iterator, Optional, TextIO, Type, cast from pip._internal.utils._log import VERBOSE, getLogger from pip._internal.utils.compat import WINDOWS from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX from pip._internal.utils.misc import ensure_dir try: import threading except ImportError: import dummy_threading as threading # type: ignore try: from pip._vendor import colorama # Lots of different errors can come from this, including SystemError and # ImportError. except Exception: colorama = None _log_state = threading.local() subprocess_logger = getLogger("pip.subprocessor") class BrokenStdoutLoggingError(Exception): """ Raised if BrokenPipeError occurs for the stdout stream while logging. """ def _is_broken_pipe_error(exc_class: Type[BaseException], exc: BaseException) -> bool: if exc_class is BrokenPipeError: return True # On Windows, a broken pipe can show up as EINVAL rather than EPIPE: # https://bugs.python.org/issue19612 # https://bugs.python.org/issue30418 if not WINDOWS: return False return isinstance(exc, OSError) and exc.errno in (errno.EINVAL, errno.EPIPE) @contextlib.contextmanager def indent_log(num: int = 2) -> Iterator[None]: """ A context manager which will cause the log output to be indented for any log messages emitted inside it. """ # For thread-safety _log_state.indentation = get_indentation() _log_state.indentation += num try: yield finally: _log_state.indentation -= num def get_indentation() -> int: return getattr(_log_state, "indentation", 0) class IndentingFormatter(logging.Formatter): default_time_format = "%Y-%m-%dT%H:%M:%S" def __init__( self, *args: Any, add_timestamp: bool = False, **kwargs: Any, ) -> None: """ A logging.Formatter that obeys the indent_log() context manager. :param add_timestamp: A bool indicating output lines should be prefixed with their record's timestamp. """ self.add_timestamp = add_timestamp super().__init__(*args, **kwargs) def get_message_start(self, formatted: str, levelno: int) -> str: """ Return the start of the formatted log message (not counting the prefix to add to each line). """ if levelno < logging.WARNING: return "" if formatted.startswith(DEPRECATION_MSG_PREFIX): # Then the message already has a prefix. We don't want it to # look like "WARNING: DEPRECATION: ...." return "" if levelno < logging.ERROR: return "WARNING: " return "ERROR: " def format(self, record: logging.LogRecord) -> str: """ Calls the standard formatter, but will indent all of the log message lines by our current indentation level. """ formatted = super().format(record) message_start = self.get_message_start(formatted, record.levelno) formatted = message_start + formatted prefix = "" if self.add_timestamp: prefix = f"{self.formatTime(record)} " prefix += " " * get_indentation() formatted = "".join([prefix + line for line in formatted.splitlines(True)]) return formatted def _color_wrap(*colors: str) -> Callable[[str], str]: def wrapped(inp: str) -> str: return "".join(list(colors) + [inp, colorama.Style.RESET_ALL]) return wrapped class ColorizedStreamHandler(logging.StreamHandler): # Don't build up a list of colors if we don't have colorama if colorama: COLORS = [ # This needs to be in order from highest logging level to lowest. (logging.ERROR, _color_wrap(colorama.Fore.RED)), (logging.WARNING, _color_wrap(colorama.Fore.YELLOW)), ] else: COLORS = [] def __init__(self, stream: Optional[TextIO] = None, no_color: bool = None) -> None: super().__init__(stream) self._no_color = no_color if WINDOWS and colorama: self.stream = colorama.AnsiToWin32(self.stream) def _using_stdout(self) -> bool: """ Return whether the handler is using sys.stdout. """ if WINDOWS and colorama: # Then self.stream is an AnsiToWin32 object. stream = cast(colorama.AnsiToWin32, self.stream) return stream.wrapped is sys.stdout return self.stream is sys.stdout def should_color(self) -> bool: # Don't colorize things if we do not have colorama or if told not to if not colorama or self._no_color: return False real_stream = ( self.stream if not isinstance(self.stream, colorama.AnsiToWin32) else self.stream.wrapped ) # If the stream is a tty we should color it if hasattr(real_stream, "isatty") and real_stream.isatty(): return True # If we have an ANSI term we should color it if os.environ.get("TERM") == "ANSI": return True # If anything else we should not color it return False def format(self, record: logging.LogRecord) -> str: msg = super().format(record) if self.should_color(): for level, color in self.COLORS: if record.levelno >= level: msg = color(msg) break return msg # The logging module says handleError() can be customized. def handleError(self, record: logging.LogRecord) -> None: exc_class, exc = sys.exc_info()[:2] # If a broken pipe occurred while calling write() or flush() on the # stdout stream in logging's Handler.emit(), then raise our special # exception so we can handle it in main() instead of logging the # broken pipe error and continuing. if ( exc_class and exc and self._using_stdout() and _is_broken_pipe_error(exc_class, exc) ): raise BrokenStdoutLoggingError() return super().handleError(record) class BetterRotatingFileHandler(logging.handlers.RotatingFileHandler): def _open(self) -> IO[Any]: ensure_dir(os.path.dirname(self.baseFilename)) return super()._open() class MaxLevelFilter(Filter): def __init__(self, level: int) -> None: self.level = level def filter(self, record: logging.LogRecord) -> bool: return record.levelno < self.level class ExcludeLoggerFilter(Filter): """ A logging Filter that excludes records from a logger (or its children). """ def filter(self, record: logging.LogRecord) -> bool: # The base Filter class allows only records from a logger (or its # children). return not super().filter(record) def setup_logging(verbosity: int, no_color: bool, user_log_file: Optional[str]) -> int: """Configures and sets up all of the logging Returns the requested logging level, as its integer value. """ # Determine the level to be logging at. if verbosity >= 2: level_number = logging.DEBUG elif verbosity == 1: level_number = VERBOSE elif verbosity == -1: level_number = logging.WARNING elif verbosity == -2: level_number = logging.ERROR elif verbosity <= -3: level_number = logging.CRITICAL else: level_number = logging.INFO level = logging.getLevelName(level_number) # The "root" logger should match the "console" level *unless* we also need # to log to a user log file. include_user_log = user_log_file is not None if include_user_log: additional_log_file = user_log_file root_level = "DEBUG" else: additional_log_file = "/dev/null" root_level = level # Disable any logging besides WARNING unless we have DEBUG level logging # enabled for vendored libraries. vendored_log_level = "WARNING" if level in ["INFO", "ERROR"] else "DEBUG" # Shorthands for clarity log_streams = { "stdout": "ext://sys.stdout", "stderr": "ext://sys.stderr", } handler_classes = { "stream": "pip._internal.utils.logging.ColorizedStreamHandler", "file": "pip._internal.utils.logging.BetterRotatingFileHandler", } handlers = ["console", "console_errors", "console_subprocess"] + ( ["user_log"] if include_user_log else [] ) logging.config.dictConfig( { "version": 1, "disable_existing_loggers": False, "filters": { "exclude_warnings": { "()": "pip._internal.utils.logging.MaxLevelFilter", "level": logging.WARNING, }, "restrict_to_subprocess": { "()": "logging.Filter", "name": subprocess_logger.name, }, "exclude_subprocess": { "()": "pip._internal.utils.logging.ExcludeLoggerFilter", "name": subprocess_logger.name, }, }, "formatters": { "indent": { "()": IndentingFormatter, "format": "%(message)s", }, "indent_with_timestamp": { "()": IndentingFormatter, "format": "%(message)s", "add_timestamp": True, }, }, "handlers": { "console": { "level": level, "class": handler_classes["stream"], "no_color": no_color, "stream": log_streams["stdout"], "filters": ["exclude_subprocess", "exclude_warnings"], "formatter": "indent", }, "console_errors": { "level": "WARNING", "class": handler_classes["stream"], "no_color": no_color, "stream": log_streams["stderr"], "filters": ["exclude_subprocess"], "formatter": "indent", }, # A handler responsible for logging to the console messages # from the "subprocessor" logger. "console_subprocess": { "level": level, "class": handler_classes["stream"], "no_color": no_color, "stream": log_streams["stderr"], "filters": ["restrict_to_subprocess"], "formatter": "indent", }, "user_log": { "level": "DEBUG", "class": handler_classes["file"], "filename": additional_log_file, "encoding": "utf-8", "delay": True, "formatter": "indent_with_timestamp", }, }, "root": { "level": root_level, "handlers": handlers, }, "loggers": {"pip._vendor": {"level": vendored_log_level}}, } ) return level_number PK]7utils/__pycache__/inject_securetransport.cpython-38.pycnu[U ʗRe@s$dZddlZddddZedS)a-A helper module that injects SecureTransport, on import. The import should be done as early as possible, to ensure all requests and sessions (or whatever) are created after injecting SecureTransport. Note that we only do the injection on macOS, when the linked OpenSSL is too old to handle TLSv1.2. N)returnc CsxtjdkrdSz ddl}Wntk r0YdSX|jdkr@dSzddlm}Wnttfk rjYdSX|dS)Ndarwinri)securetransport) sysplatformssl ImportErrorOPENSSL_VERSION_NUMBERpip._vendor.urllib3.contribrOSErrorinject_into_urllib3)rrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/inject_securetransport.pyinject_securetransport s   r)__doc__rrr r r rs PK] ##.utils/__pycache__/logging.cpython-38.opt-1.pycnu[U .e2@sddlmZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z ddl m Z ddlmZddlmZz ddlZWnek rddlZYnXzddlmZWnek rdZYnXdd lmZeZeZde_e d ZGd d d eZe r&e rd dZ nddZ ne r6ddZ nddZ ej!d%ddZ"ddZ#Gdddej$Z%ddZ&Gdddej'Z(Gdddej)j*Z+Gdd d eZ,Gd!d"d"eZ-d#d$Z.dS)&)absolute_importN)Filter getLogger)PY2)WINDOWS)DEPRECATION_MSG_PREFIX) ensure_dir)colorama)Forezpip.subprocessorc@seZdZdZdS)BrokenStdoutLoggingErrorzO Raised if BrokenPipeError occurs for the stdout stream while logging. N)__name__ __module__ __qualname____doc__rr?/usr/lib/python3.8/site-packages/pip/_internal/utils/logging.pyr ;sr cCs|tko|jtjtjfkSz1See the docstring for non-Windows Python 3 below.)IOErrorerrnoEINVALEPIPE exc_classexcrrr_is_broken_pipe_errorIsrcCs"|tkp |tko |jtjtjfkSr)BrokenPipeErrorOSErrorrrrrrrrrOscCs|tko|jtjkSr)rrrrrrrrUscCs|tkS)z Return whether an exception is a broken pipe error. Args: exc_class: an exception class. exc: an exception instance. )rrrrrrZsc cs.tj|7_z dVW5tj|8_XdS)zv A context manager which will cause the log output to be indented for any log messages emitted inside it. N) _log_state indentation)Znumrrr indent_loges r cCs ttddS)Nrr)getattrrrrrrget_indentationrsr"cs0eZdZfddZddZfddZZS)IndentingFormattercs$|dd|_tt|j||dS)z A logging.Formatter that obeys the indent_log() context manager. :param add_timestamp: A bool indicating output lines should be prefixed with their record's timestamp. add_timestampFN)popr$superr#__init__)selfargskwargs __class__rrr'xszIndentingFormatter.__init__cCs.|tjkrdS|trdS|tjkr*dSdS)zv Return the start of the formatted log message (not counting the prefix to add to each line). z WARNING: zERROR: )loggingWARNING startswithrERROR)r( formattedlevelnorrrget_message_starts   z$IndentingFormatter.get_message_startcsztt||}|||j}||}d|jrJ||d}d||jfdt7d fdd| dD}|S)z Calls the standard formatter, but will indent all of the log message lines by our current indentation level. r-z%Y-%m-%dT%H:%M:%Sz%s,%03d  csg|] }|qSrr).0lineprefixrr sz-IndentingFormatter.format..T) r&r#formatr4r3r$Z formatTimeZmsecsr"join splitlines)r(recordr2Z message_starttr+r8rr;s zIndentingFormatter.format)r r rr'r4r; __classcell__rrr+rr#vs r#csfdd}|S)Ncsdt|tjjgS)Nr-)r<listr ZStyleZ RESET_ALL)Zinpcolorsrrwrappedsz_color_wrap..wrappedr)rCrDrrBr _color_wraps rEcsheZdZer.ejeejfej eej fgZ ngZ d ddZ ddZ ddZdd Zfd d ZZS) ColorizedStreamHandlerNcCs.tj||||_tr*tr*t|j|_dSN)r. StreamHandlerr' _no_colorrr AnsiToWin32stream)r(rKno_colorrrrr'szColorizedStreamHandler.__init__cCs"trtr|jjtjkS|jtjkS)zA Return whether the handler is using sys.stdout. )rr rKrDsysstdoutr(rrr _using_stdoutsz$ColorizedStreamHandler._using_stdoutcCsXtr |jrdSt|jtjs"|jn|jj}t|dr@|r@dStj ddkrTdSdS)NFisattyTZTERMZANSI) r rI isinstancerKrJrDhasattrrQosenvironget)r(Z real_streamrrr should_colors z#ColorizedStreamHandler.should_colorcCs@tj||}|r<|jD]\}}|j|kr||}qmsglevelZcolorrrrr;s zColorizedStreamHandler.formatcs@tdd\}}|r0|r0t||r0ttt||S)Nr)rMexc_inforPrr r&rF handleError)r(r>rrr+rrr\s  z"ColorizedStreamHandler.handleError)NN)r r rr r.r1rEr ZREDr/ZYELLOWrXr'rPrWr;r\r@rrr+rrFs   rFc@seZdZddZdS)BetterRotatingFileHandlercCs ttj|jtjj|SrG) rrTpathdirnameZ baseFilenamer.handlersRotatingFileHandler_openrOrrrrbszBetterRotatingFileHandler._openN)r r rrbrrrrr]sr]c@seZdZddZddZdS)MaxLevelFiltercCs ||_dSrG)rZ)r(rZrrrr'szMaxLevelFilter.__init__cCs |j|jkSrG)r3rZr(r>rrrfilterszMaxLevelFilter.filterN)r r rr'rerrrrrcsrccs eZdZdZfddZZS)ExcludeLoggerFilterzQ A logging Filter that excludes records from a logger (or its children). cstt|| SrG)r&rfrerdr+rrreszExcludeLoggerFilter.filter)r r rrrer@rrr+rrf srfc Csf|dkrd}n.|dkrd}n |dkr*d}n|dkr8d}nd }tt|}|d k }|r\|}d}nd }|}|d krpdnd}d dd} ddd} dddg|rdgng} tjdddtjddtjddtjddtddtdd d!d"|| d#|| d$d%d&gd'd(d| d#|| d)d%gd'd(|| d#|| d)d*gd'd(d| d+|d d,d-d.|| d/d0d1|iid2|S)3znConfigures and sets up all of the logging Returns the requested logging level, as its integer value. DEBUGr/r1ZCRITICALINFONz /dev/null)rlr1zext://sys.stdoutzext://sys.stderr)rNstderrz2pip._internal.utils.logging.ColorizedStreamHandlerz5pip._internal.utils.logging.BetterRotatingFileHandler)rKfileconsoleconsole_errorsconsole_subprocessuser_logFz*pip._internal.utils.logging.MaxLevelFilter)()rZzlogging.Filter)rsnamez/pip._internal.utils.logging.ExcludeLoggerFilter)exclude_warningsrestrict_to_subprocessexclude_subprocessz %(message)s)rsr;T)rsr;r$)indentindent_with_timestamprKrNrwrurx)rZclassrLrKfilters formatterrmrvrnry)rZrzfilenameZdelayr|)rorprqrr)rZr`z pip._vendorrZ)versionZdisable_existing_loggersr{Z formattersr`rootZloggers)r!r.ZconfigZ dictConfigr/subprocess_loggerrtr#) verbosityrLZ user_log_filerZZ level_numberZinclude_user_logZadditional_log_fileZ root_levelZvendored_log_levelZ log_streamsZhandler_classesr`rrr setup_loggings      $Jr)r)/Z __future__r contextlibrr.Zlogging.handlersrTrMrrZpip._vendor.sixrZpip._internal.utils.compatrZpip._internal.utils.deprecationrZpip._internal.utils.miscrZ threading ImportErrorZdummy_threadingZ pip._vendorr Z _colorama ExceptionZpip._vendor.coloramar Zlocalrrrr rcontextmanagerr r"Z Formatterr#rErHrFr`rar]rcrfrrrrrsT              2K  PK]8NX/utils/__pycache__/encoding.cpython-38.opt-1.pycnu[U .e(@sddlZddlZddlZddlZddlmZerDddlmZmZm Z ej dfej dfej dfej dfejdfejd fejd fgZed Zd d ZdS)N)MYPY_CHECK_RUNNING)ListTupleTextzutf-8zutf-16z utf-16-bez utf-16-lezutf-32z utf-32-bez utf-32-lescoding[:=]\s*([-\w.]+)cCstD],\}}||r|t|d|Sq|dddD]D}|dddkrDt|rDt|dd}||SqD|t dpt S) zCheck a bytes string for a BOM to correctly detect the encoding Fallback to locale.getpreferredencoding(False) like open() on Python3N r#asciiF) BOMS startswithlendecodesplit ENCODING_REsearchgroupslocaleZgetpreferredencodingsysgetdefaultencoding)dataZbomencodingliner@/usr/lib/python3.8/site-packages/pip/_internal/utils/encoding.py auto_decodes  r)codecsrrerZpip._internal.utils.typingrtypingrrrBOM_UTF8 BOM_UTF16 BOM_UTF16_BE BOM_UTF16_LE BOM_UTF32 BOM_UTF32_BE BOM_UTF32_LEr compilerrrrrrs   PK]ykk.utils/__pycache__/appdirs.cpython-38.opt-1.pycnu[U .e&&@sdZddlmZddlZddlZddlmZmZddlm Z m Z ddl m Z e r\ddl mZdd Zdd d ZdddZddZddZddZe rzddlZeZWnek reZYnXddZdS)zd This code was taken from https://github.com/ActiveState/appdirs and modified to suit our purposes. )absolute_importN)PY2 text_type)WINDOWS expanduser)MYPY_CHECK_RUNNING)ListcCstr Unix: ~/.cache/ (XDG default) Windows: C:\Users\\AppData\Local\\Cache On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir`). Apps typically put cache data somewhere *under* the given dir here. Some examples: ...\Mozilla\Firefox\Profiles\\Cache ...\Acme\SuperApp\Cache\1.0 OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. CSIDL_LOCAL_APPDATAZCachedarwinz~/Library/CachesZXDG_CACHE_HOMEz~/.cache)rospathnormpath_get_win_folderr isinstancer_win_path_to_bytesjoinsysplatformrgetenv)appnamer r?/usr/lib/python3.8/site-packages/pip/_internal/utils/appdirs.pyuser_cache_dirs rFcCstr,|r dpd}tjtjt||}ndtjdkrvtjtjt d|rbtjt d|ntjt d|}ntjt dt d|}|S)a Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: macOS: ~/Library/Application Support/ if it exists, else ~/.config/ Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\ ... ...Application Data\ Win XP (roaming): C:\Documents and Settings\\Local ... ...Settings\Application Data\ Win 7 (not roaming): C:\\Users\\AppData\Local\ Win 7 (roaming): C:\\Users\\AppData\Roaming\ For Unix, we follow the XDG spec and support $XDG_DATA_HOME. That means, by default "~/.local/share/". CSIDL_APPDATAr r z~/Library/Application Support/z ~/.config/Z XDG_DATA_HOMEz~/.local/share) rr r rr rrrisdirrr)rroamingconstr rrr user_data_dirHs,    rTcCsHtrt||d}n2tjdkr&t|}ntdtd}tj||}|S)arReturn full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "roaming" (boolean, default True) can be set False to not use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: macOS: same as user_data_dir Unix: ~/.config/ Win *: same as user_data_dir For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. That means, by default "~/.config/". )rr ZXDG_CONFIG_HOMEz ~/.config) rrrrr rrr r)rrr rrruser_config_dir}s  rcstr&tjtd}tj|g}nVtjdkrBtjdg}n:tdd}|rnfdd| tj D}ng}| d|S) aReturn a list of potential user-shared config dirs for this application. "appname" is the name of application. Typical user config directories are: macOS: /Library/Application Support// Unix: /etc or $XDG_CONFIG_DIRS[i]// for each value in $XDG_CONFIG_DIRS Win XP: C:\Documents and Settings\All Users\Application ... ...Data\\ Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: Hidden, but writeable on Win 7: C:\ProgramData\\ CSIDL_COMMON_APPDATAr z/Library/Application SupportZXDG_CONFIG_DIRSz/etc/xdgcsg|]}tjt|qSr)r r rr).0xrrr sz$site_config_dirs..z/etc) rr r r rrrrrsplitpathsepappend)rr ZpathlistZxdg_config_dirsrr"rsite_config_dirss     r'cCs:ddl}dddd|}||jd}|||\}}|S)z This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. rNZAppDatazCommon AppDataz Local AppDatarrr z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)_winregOpenKeyHKEY_CURRENT_USERZ QueryValueEx) csidl_namer)Zshell_folder_namekeyZ directoryZ_typerrr_get_win_folder_from_registrysr.cCsdddd|}td}tj}|jd|dd|d}|D]}t|dkr. If encoding using ASCII and MBCS fails, return the original Unicode path. )ASCIIZMBCS)encodeUnicodeEncodeError LookupError)r encodingrrrrs r)F)T)__doc__Z __future__rr rZpip._vendor.sixrrZpip._internal.utils.compatrrZpip._internal.utils.typingrtypingrrrrr'r.r8r3r ImportErrorrrrrrs*   1 5 ") PK]ez00-utils/__pycache__/hashes.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlmZmZmZddlmZm Z m Z ddl m Z ddl mZerddlmZmZmZmZmZddlmZerdd lmZn dd lmZd Zd d d gZGdddeZGdddeZdS))absolute_importN) iteritemsiterkeys itervalues) HashMismatch HashMissingInstallationError) read_chunks)MYPY_CHECK_RUNNING)DictListBinaryIONoReturnIterator)PY3)_Hash)_hashZsha256Zsha384Zsha512c@s^eZdZdZdddZeddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS)HasheszaA wrapper that builds multiple hashes at once and checks them against known-good values NcCs|dkr in||_dS)zo :param hashes: A dict of algorithm names pointing to lists of allowed hex digests N)_allowed)selfhashesr>/usr/lib/python3.8/site-packages/pip/_internal/utils/hashes.py__init__,szHashes.__init__cCstdd|jDS)Ncss|]}t|VqdSN)len).0Zdigestsrrr 7sz&Hashes.digest_count..)sumrvaluesrrrr digest_count4szHashes.digest_countcCs||j|gkS)z/Return whether the given hex digest is allowed.)rget)r hash_nameZ hex_digestrrris_hash_allowed9szHashes.is_hash_allowedc Csi}t|jD]<}zt|||<Wqttfk rHtd|YqXq|D]}t|D]}||q\qPt |D] \}}| |j|krvdSqv| |dS)zCheck good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. zUnknown hash name: %sN) rrhashlibnew ValueError TypeErrorrrupdater hexdigest_raise)rZchunksgotsr#chunkhashZgotrrrcheck_against_chunksAs zHashes.check_against_chunkscCst|j|dSr)rrrr,rrrr+Ysz Hashes._raisecCs|t|S)zaCheck good hashes against a file-like object Raise HashMismatch if none match. )r/r )rfilerrrcheck_against_file]szHashes.check_against_filec Cs,t|d}||W5QRSQRXdS)Nrb)openr2)rpathr1rrrcheck_against_pathfs zHashes.check_against_pathcCs t|jS)z,Return whether I know any known-good hashes.)boolrr rrr __nonzero__kszHashes.__nonzero__cCs|Sr)r8r rrr__bool__pszHashes.__bool__)N)__name__ __module__ __qualname____doc__rpropertyr!r$r/r+r2r6r8r9rrrrr's   rcs(eZdZdZfddZddZZS) MissingHasheszA workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. cstt|jtgiddS)z!Don't offer the ``hashes`` kwarg.)rN)superr?r FAVORITE_HASHr  __class__rrr|szMissingHashes.__init__cCst|tdSr)rrAr*r0rrrr+szMissingHashes._raise)r:r;r<r=rr+ __classcell__rrrBrr?us r?)Z __future__rr%Zpip._vendor.sixrrrZpip._internal.exceptionsrrrZpip._internal.utils.miscr Zpip._internal.utils.typingr typingr r r rrrrrrAZ STRONG_HASHESobjectrr?rrrrs      NPK]o,HO ,utils/__pycache__/deprecation.cpython-38.pycnu[U ʗRe6 @sUdZddlZddlZddlmZmZmZmZmZddl m Z ddl m Z dZGdddeZdaeed <deeefeeeeeeeedd d d Zdd ddZdddeeeeeeeeeddddZdS)zN A module that implements tooling to enable easy warnings about deprecations. N)AnyOptionalTextIOTypeUnion)parse) __version__z DEPRECATION: c@s eZdZdS)PipDeprecationWarningN)__name__ __module__ __qualname__r r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/deprecation.pyr sr _original_showwarning)messagecategoryfilenamelinenofilelinereturncCsZ|dk r$tdk rVt||||||n2t|trDtd}||nt||||||dS)Nzpip._internal.deprecations)r issubclassr logging getLoggerwarning)rrrrrrloggerr r r _showwarnings   r)rcCs(tjdtddtdkr$tjatt_dS)NdefaultT)append)warnings simplefilterr r showwarningrr r r rinstall_warning_logger,sr") feature_flagissue)reason replacementgone_inr#r$rcCs|dk ottt|k}|tdf||s.dndf|df||sBdndf|dfg}dd d |D}|rpt|tj|td d dS) aHelper to deprecate existing functionality. reason: Textual reason shown to the user about why this functionality has been deprecated. Should be a complete sentence. replacement: Textual suggestion shown to the user about what alternative functionality they can use. gone_in: The version of pip does this functionality should get removed in. Raises an error if pip's current version is greater than or equal to this. feature_flag: Command-line flag of the form --use-feature={feature_flag} for testing upcoming functionality. issue: Issue number on the tracker that would serve as a useful place for users to find related discussion and provide feedback. Nz{}z*pip {} will enforce this behaviour change.z*Since pip {}, this is no longer supported.zA possible replacement is {}.zEYou can use the flag --use-feature={} to test the upcoming behaviour.z@Discussion can be found at https://github.com/pypa/pip/issues/{} css,|]$\}}|dk r|dk r||VqdS)N)format).0value format_strr r r nszdeprecated..)r stacklevel)rcurrent_versionDEPRECATION_MSG_PREFIXjoinr rwarn)r%r&r'r#r$is_gone message_partsrr r r deprecated7s2  r6)NN)__doc__rrtypingrrrrrZpip._vendor.packaging.versionrpiprr0r1DeprecationWarningr r__annotations__Warningstrintrr"r6r r r rs<     PK]c"FF+utils/__pycache__/urls.cpython-38.opt-1.pycnu[U .e@shddlZddlZddlmZddlmZddlmZerLddl m Z m Z m Z ddZ dd Zd d ZdS) N)parse)request)MYPY_CHECK_RUNNING)OptionalTextUnioncCs d|kr dS|dddS)N:r)splitlower)urlr s    PK]wS!U!U%utils/__pycache__/misc.cpython-38.pycnu[U ʗReqT@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddlm Z ddlmZmZmZddlmZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'm(Z(m)Z)ddl*m+Z+dd l,m-Z-dd l.m/Z/dd l0m1Z1dd l2m3Z3d dddddddddddddgZ4e5e6Z7e"dZ8e e!e9e9efZ:e e;e;e;fZe=dddZ?e e;dfe e;e;e;fd d!d"Z@e=dd#d$dZAe=dd%dZBe'd&e(d'e)d(d)de=eCdd+d,d ZDedefe=e:dd-d.d/ZEe=e=d#d0dZFde=e=e=d2d3dZGe=ee=e=d4d5d6ZHe=dd7d8d9ZIe=ee=e=d4d:dZJe=e=d7d;d<ZKe=e=d7d=d>ZLe=e;d?d@dAZMeNe=dBdCdZOeeee ee=ee;fdDdEdFZPe=eCd#dGdZQejRfee;eeSddfdHdIdJZTde=eCe=dKdLdZUe=e e=e=fd#dMdZVe=e=ddNdOdZWe=eCd#dPdQZXeeddRdSdTZYGdUdVdVe ZZej[e=eeZddfdWdXdYZ\eeZddZdZ]eeZdd[d\Z^eee!ed]d^d_Z_e=ee;e=d`dadbZ`de=e=e=dddedfZae=e e=ee;fdgdhdiZbe=e>dgdjdkZce=e=dgdldmZde=ee=ge edffe e=e>fdndodpZee=e>dgdqdrZfe=e e=dgdsdtZge=e e=e=e e=e=ffdudvdwZhe=e=dudxdZie=e=dudydzZjGd{d|d|Zke=ekd}d~dZle=ekduddZmeCddddZneCdddZode=e;e ee;fdddZpeCdddZqeeee eefdddZree8geCfee8e ee8ee8fdddZsGddde%ZtdS)N)StringIO) filterfalsetee zip_longest) TracebackType)AnyBinaryIOCallableContextManagerDict GeneratorIterableIteratorListOptionalTextIOTupleTypeTypeVarcast)Pep517HookCaller)retrystop_after_delay wait_fixed) __version__) CommandError)get_major_minor_version)WINDOWS)running_under_virtualenvrmtree display_path backup_dirasksplitext format_sizeis_installable_dirnormalize_pathrenamesget_progcaptured_stdout ensure_dirremove_auth_from_urlConfiguredPep517HookCallerTreturncCs4tjtjtdd}tj|}dt|tS)Nz..zpip {} from {} (python {})) ospathjoindirname__file__abspathformatrr) pip_pkg_dirr8/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/misc.pyget_pip_versionHs r:.)py_version_infor/cCsDt|dkr"|dt|d7}nt|dkr:|dd}td|S)ax Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None). )rN VersionInfo)lenr)r;r8r8r9normalize_version_infoSs   r?)r1r/c CsPzt|Wn<tk rJ}z|jtjkr:|jtjkr:W5d}~XYnXdS)z os.path.makedirs without EEXIST.N)r0makedirsOSErrorerrnoEEXIST ENOTEMPTY)r1er8r8r9r*fs c CsRz2tjtjd}|dkr*tjdWS|WSWntttfk rLYnXdS)Nr)z __main__.pyz-cz -m pippip) r0r1basenamesysargv executableAttributeError TypeError IndexError)progr8r8r9r(ps Tr<g?)reraisestopwaitF)dir ignore_errorsr/cCstj||tddS)N)rSonerror)shutilrrmtree_errorhandler)rRrSr8r8r9r~s)funcr1exc_infor/cCsTzt|jtj@ }Wntk r.YdSX|rNt|tj||dSdS)zOn Windows, the files in .svn are read-only, so when rmtree() tries to remove them, an exception is thrown. We catch that here, remove the read-only attribute, and hopefully continue without problems.N)r0statst_modeS_IWRITErAchmod)rWr1rXhas_attr_readonlyr8r8r9rVsrVcCsFtjtj|}|ttjjrBd|ttd}|S)zTGives the display value for a given path, making it relative to cwd if possible..N)r0r1normcaser5 startswithgetcwdsepr>r1r8r8r9r s.bak)rRextr/cCs6d}|}tj||r.|d7}|t|}q||S)z\Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc))r0r1existsstr)rRren extensionr8r8r9r!s )messageoptionsr/cCs2tjddD]}||kr|Sqt||S)NPIP_EXISTS_ACTION)r0environgetsplitr")rkrlactionr8r8r9ask_path_existss rs)rkr/cCstjdrtd|dS)z&Raise an error if no input is allowed. PIP_NO_INPUTz5No input was expected ($PIP_NO_INPUT set); question: N)r0rorp Exceptionrkr8r8r9_check_no_inputs rwcCsFt|t|}|}||krYour response ({!r}) was not one of the expected responses: {}z, N)rwinputstriplowerprintr6r2)rkrlresponser8r8r9r"s cCst|t|S)zAsk for input interactively.)rwrxrvr8r8r9 ask_inputsr}cCst|t|S)z!Ask for a password interactively.)rwgetpassrvr8r8r9 ask_passwordsr)valr/cCs2|}|dkrdS|dkr dStd|dS)zConvert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. )yyesttrueon1rf)rinoffalseoff0rzinvalid truth value N)rz ValueError)rr8r8r9 strtobools r)bytesr/cCs\|dkrd|ddS|dkr4dt|dS|dkrJd|dSdt|SdS) Ni@Bz {:.1f} MBg@@ii'z{} kBz {:.1f} kBz{} bytes)r6int)rr8r8r9r$s)rowsr/cs@dd|D}ddt|ddiDfdd|D}|fS)zReturn a list of formatted rows and a list of column sizes. For example:: >>> tabulate([['foobar', 2000], [0xdeadbeef]]) (['foobar 2000', '3735928559'], [10, 4]) cSsg|]}ttt|qSr8)tuplemaprh.0rowr8r8r9 sztabulate..cSsg|]}ttt|qSr8)maxrr>)rcolr8r8r9rs fillvaluerncs$g|]}dttj|qS) )r2rrhljustrstriprsizesr8r9rs)r)rtabler8rr9tabulatesrcCsHtj|sdStjtj|dr*dStjtj|drDdSdS)atIs path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which are already covered by the pyproject.toml check. Fzpyproject.tomlTzsetup.py)r0r1isdirisfiler2rcr8r8r9r%s )filesizer/ccs||}|sq|VqdS)z7Yield pieces of data from a file-like object until EOF.N)read)rrchunkr8r8r9 read_chunkss r)r1resolve_symlinksr/cCs6tj|}|rtj|}n tj|}tj|S)zN Convert a path to its canonical, case-normalized, absolute version. )r0r1 expanduserrealpathr5r_)r1rr8r8r9r&s   cCs@t|\}}|dr8|dd|}|dd}||fS)z,Like os.path.splitext, but take off .tar tooz.tarN) posixpathr#rzendswith)r1baserer8r8r9r#'s  )oldnewr/cCsztj|\}}|r.|r.tj|s.t|t||tj|\}}|rv|rvzt|Wntk rtYnXdS)z7Like os.renames(), but handles renaming across devices.N) r0r1rqrgr@rUmove removedirsrA)rrheadtailr8r8r9r'0s  cCsts dS|ttjS)z Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path. T)rr`r&rHprefixrcr8r8r9is_localAs r)msgargsr/cGstj|f|dSN)loggerinfo)rrr8r8r9 write_outputOsrc@s:eZdZUdZeed<eeddddZeddZ dS) StreamWrapperN orig_stream)rr/cCs ||_|Sr)r)clsrr8r8r9 from_streamVszStreamWrapper.from_streamcCs|jjSr)rencodingselfr8r8r9r]szStreamWrapper.encoding) __name__ __module__ __qualname__rr__annotations__ classmethodrpropertyrr8r8r8r9rSs  r) stream_namer/c cs@tt|}tt|t|ztt|VW5tt||XdS)zReturn a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo. N)getattrrHsetattrrr)r orig_stdoutr8r8r9captured_outputbs  rcCstdS)zCapture the output of sys.stdout: with captured_stdout() as stdout: print('hello') self.assertEqual(stdout.getvalue(), 'hello ') Taken from Lib/support/__init__.py in the CPython repo. stdoutrr8r8r8r9r)qs cCstdS)z See captured_stdout(). stderrrr8r8r8r9captured_stderr}sr) sequentialnamedr/cOs@tt|tt|f|}dd|D}||d<tdd|S)NcSsi|]\}}||qSr8r8)rkeyvaluer8r8r9 szenum..reverse_mappingEnumr8)dictzipranger>itemstype)rrenumsreverser8r8r9enumsr)hostportr/cCs.|dkr |Sd|kr d|d}|d|S)z. Build a netloc from a host-port pair N:[]r8)rrr8r8r9 build_netlocs  rhttps)netlocschemer/cCs8|ddkr*d|kr*d|kr*d|d}|d|S)z) Build a full URL from a netloc. r@rrz://)count)rrr8r8r9build_url_from_netlocs r)rr/cCs t|}tj|}|j|jfS)z2 Return the host-port pair from a netloc. )rurllibparseurlparsehostnamer)rurlparsedr8r8r9 parse_netlocs rcCstd|kr|dfS|dd\}}d}d|kr>|dd\}}n |d}}tj|}|dk rhtj|}|||ffS)zp Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). r)NNrfNr)rsplitrqrrunquote)rauthpwuserr8r8r9split_auth_from_netlocs   rcCsNt|\}\}}|dkr|S|dkr.d}d}ntj|}d}dj|||dS)z Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com" N****rnz:****z{user}{password}@{netloc})rpasswordr)rrrquoter6)rrrr8r8r9 redact_netlocs r)rtransform_netlocr/cCsJtj|}||j}|j|d|j|j|jf}tj|}|t d|fS)aRTransform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1. r NetlocTuple) rrurlsplitrrr1queryfragment urlunsplitr)rrpurl netloc_tuple url_piecessurlr8r8r9_transform_urls   r cCst|Sr)rrr8r8r9 _get_netlocsr cCs t|fSr)rr r8r8r9_redact_netlocsr )rr/cCst|t\}\}}|||fS)z Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password)) r r )rurl_without_authrrr8r8r9split_auth_netloc_from_urlsrcCst|tdS)z7Return a copy of url with 'username:password@' removed.rrrr8r8r9r+scCst|tdS)z.Replace the password in a given url with ****.r)r r rr8r8r9redact_auth_from_url src@sJeZdZeeddddZedddZeddd Zeed d d Z dS) HiddenTextN)secretredactedr/cCs||_||_dSr)rr)rrrr8r8r9__init__szHiddenText.__init__r.cCsdt|S)Nz)r6rhrr8r8r9__repr__szHiddenText.__repr__cCs|jSrrrr8r8r9__str__szHiddenText.__str__)otherr/cCs t|t|krdS|j|jkS)NF)rr)rrr8r8r9__eq__szHiddenText.__eq__) rrrrhrrrrboolrr8r8r8r9rsr)rr/cCs t|ddS)Nrr)r)rr8r8r9 hide_value%srcCst|}t||dS)Nr)rr)rrr8r8r9hide_url)sr) modifying_pipr/cCs|ddtjjdtjjdtjjg}|oDtoDtjtjd|k}|rxtj ddgtjdd}t d d |dS) zProtection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... rFr^rz-mrfNz3To modify pip, please run the following command: {}r) rH version_infomajorminorrr0r1rGrIrJrr6r2)r pip_namesshould_show_use_python_msg new_commandr8r8r9(protect_pip_from_modification_on_windows.s r&cCstjdk otjS)zIs this console interactive?N)rHstdinisattyr8r8r8r9is_console_interactiveHsr))r1 blocksizer/c CsRt}d}t|d.}t||dD]}|t|7}||q$W5QRX||fS)z5Return (hash, length) for path using hashlib.sha256()rrb)r)hashlibsha256openrr>update)r1r+hlengthrblockr8r8r9 hash_fileMs  r4cCs(z ddl}Wntk r"YdSXdS)z8 Return whether the wheel package is installed. rNFT)wheel ImportError)r5r8r8r9is_wheel_installedYs  r7)iterabler/cCst|}t||S)zb Return paired elements. For example: s -> (s0, s1), (s2, s3), (s4, s5), ... )iterr)r8r8r8r9pairwiseesr:)predr8r/cCs t|\}}t||t||fS)z Use a predicate to partition entries into false entries and true entries, like partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 )rrfilter)r;r8t1t2r8r8r9 partitionps r?csteZdZdeeeeeeedeedfdd Zdeeeeefeeedfdd Z deeeeefed fd d Z deeeeefeeedfd d Z deeeefe edfdd Z d eeeefe edfdd Zd!eeeefe edfdd Zd"eeeeefeedfdd Zd#eeeeefeedfdd ZZS)$r,N).N) config_holder source_dir build_backend backend_pathrunnerpython_executablecst|||||||_dSr)superrr@)rr@rArBrCrDrE __class__r8r9rs z#ConfiguredPep517HookCaller.__init__)wheel_directoryconfig_settingsmetadata_directoryr/cs|jj}tj|||dSN)rJrK)r@rJrF build_wheelrrIrJrKcsrGr8r9rMs z&ConfiguredPep517HookCaller.build_wheel)sdist_directoryrJr/cs|jj}tj||dSN)rJ)r@rJrF build_sdist)rrPrJrOrGr8r9rRsz&ConfiguredPep517HookCaller.build_sdistcs|jj}tj|||dSrL)r@rJrFbuild_editablerNrGr8r9rSs z)ConfiguredPep517HookCaller.build_editable)rJr/cs|jj}tj|dSrQ)r@rJrFget_requires_for_build_wheelrrJrOrGr8r9rTsz7ConfiguredPep517HookCaller.get_requires_for_build_wheelcs|jj}tj|dSrQ)r@rJrFget_requires_for_build_sdistrUrGr8r9rVsz7ConfiguredPep517HookCaller.get_requires_for_build_sdistcs|jj}tj|dSrQ)r@rJrFget_requires_for_build_editablerUrGr8r9rWsz:ConfiguredPep517HookCaller.get_requires_for_build_editableT)rKrJ_allow_fallbackr/cs|jj}tj|||dSN)rKrJrX)r@rJrF prepare_metadata_for_build_wheelrrKrJrXrOrGr8r9rZs z;ConfiguredPep517HookCaller.prepare_metadata_for_build_wheelcs|jj}tj|||dSrY)r@rJrF#prepare_metadata_for_build_editabler[rGr8r9r\s z>ConfiguredPep517HookCaller.prepare_metadata_for_build_editable)NNN)NN)N)NN)N)N)N)NT)NT)rrrrrhrr rr rMrRrSrrTrVrWrrZr\ __classcell__r8r8rGr9r,~s     )F)rd)T)r)r*)u contextlibrBr~r-iologgingr0rrUrYrH urllib.parserr itertoolsrrrtypesrtypingrrr r r r r rrrrrrrrpip._vendor.pep517rpip._vendor.tenacityrrrrFrpip._internal.exceptionsrpip._internal.locationsrpip._internal.utils.compatrpip._internal.utils.virtualenvr__all__ getLoggerrrr- BaseExceptionExcInforr=rhrr:r?r*r(rrrVr r!rsrwr"r}rrfloatr$rr%DEFAULT_BUFFER_SIZErrr&r#r'rrrcontextmanagerrr)rrrrrrrr r r rr+rrrrr&r)r4r7r:r?r,r8r8r8r9s  D        "    (        "    PK]T]V[V[+utils/__pycache__/misc.cpython-38.opt-1.pycnu[U .ec@sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZddlmZddlmZmZddlmZddlmZdd lmZdd lmZdd lm Z dd l!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1er8ddlm2Z3n ddlm3Z3e.rddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>ddl?m@Z@edddddddddd d!d"d#d$gZCeDeEZFd%d&ZGd'd(ZHd)d"ZId*d ZJed+d,d-dd/dZKd0d1ZLd2d3ZMd4dZNdd6dZOd7d8ZPd9d:ZQd;dZRdd?ZTd@dZUdAdZVejWfdBdCZXddEdZYdFdZZdGdZ[dHdIZ\dJdKZ]dLdMZ^dNdOZ_dPdQZ`dRdSZadDe)dDd.d.dfdTdUZbdVdWZcdXdYZddZd[Zed\d]ZfGd^d_d_egZhGd`dadae3ZiejjdbdcZkddd!ZldedfZmGdgdhdhegZnddid#ZodjdkZpdldmZqdndoZrddqdrZsdsdtZtdudvZudwdxZvdydzZwd{d|Zxd}d~ZyddZzdd$Z{ddZ|GdddegZ}ddZ~ddZddZddZdS))absolute_importNdeque) pkg_resources)retry)PY2 text_type)input)parse)unquote) __version__) CommandError)distutils_schemeget_major_minor_version site_packages user_site)WINDOWS expanduser stdlib_pkgsstr_to_display)write_delete_marker_file)MYPY_CHECK_RUNNING)running_under_virtualenvvirtualenv_no_global)BytesIO)StringIO) AnyAnyStr ContainerIterableListOptionalTextTupleUnioncast) DistributioncCs|SN)Ztype_valuer(r(}z|jtjkr.W5d}~XYnXdS)z os.path.makedirs without EEXIST.N)r9makedirsOSErrorerrnoZEEXIST)r:er(r(r*r6qs  c CsPz0tjtjd}|dkr(dtjWS|WSWntttfk rJYnXdS)Nr)z __main__.pyz-cz %s -m pippip) r9r:basenamesysargv executableAttributeError TypeError IndexError)progr(r(r*r4{s  i i)Zstop_max_delayZ wait_fixedFcCstj||tddS)N) ignore_errorsonerror)shutilr+rmtree_errorhandler)dirrRr(r(r*r+sc CsXzt|jtj@ }Wnttfk r2YdSX|rRt|tj||dSdS)zOn Windows, the files in .svn are read-only, so when rmtree() tries to remove them, an exception is thrown. We catch that here, remove the read-only attribute, and hopefully continue without problems.N)r9statst_modeS_IWRITEIOErrorrFchmod)funcr:exc_infoZhas_attr_readonlyr(r(r*rUsrUcCsd|dkr dSt|tr|Sz|td}Wn0tk r^trRtd|}nt |}YnX|S)z Convert a bytes (or text) path to text (unicode in Python 2) for display and logging purposes. This function should never error out. Also, this function is mainly needed for Python 2 since in Python 3 str paths are already text. Nstrictzb{!r}) isinstancerdecoderKgetfilesystemencodingUnicodeDecodeErrorrrr?ascii)r:r,r(r(r*path_to_displays  rdcCsttjtj|}tjddkrB|td}|t d}| t tjj rpd|t t d}|S)zTGives the display value for a given path, making it relative to cwd if possible.rreplace.N)r9r:normcaser>rK version_infor`raencodegetdefaultencoding startswithgetcwdseprCr:r(r(r*r,s.bakcCs6d}|}tj||r.|d7}|t|}q||S)z\Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc))r9r:existsstr)rVextn extensionr(r(r*r-s cCs2tjddD]}||kr|Sqt||S)NZPIP_EXISTS_ACTION)r9environgetsplitr.)messageoptionsactionr(r(r*ask_path_existss r~cCstjdrtd|dS)z&Raise an error if no input is allowed.Z PIP_NO_INPUTz7No input was expected ($PIP_NO_INPUT set); question: %sN)r9rxry Exceptionr{r(r(r*_check_no_inputs  rcCsFt|t|}|}||krrh)r:Zresolve_symlinksr(r(r*r23s  cCs@t|\}}|dr8|dd|}|dd}||fS)z,Like os.path.splitext, but take off .tar tooz.tarN) posixpathr/rendswith)r:basertr(r(r*r/As  cCsztj|\}}|r.|r.tj|s.t|t||tj|\}}|rv|rvzt|Wntk rtYnXdS)z7Like os.renames(), but handles renaming across devices.N) r9r:rzrrrErTZmove removedirsrF)oldnewheadtailr(r(r*r3Ks  cCsts dS|ttjS)z Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path. T)rrlr2rKprefixror(r(r*is_local]s rcCs tt|S)z Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv. )r dist_locationdistr(r(r* dist_is_localls rcCst|ttS)zF Return True if given Distribution is installed in user site. )rrlr2rrr(r(r*dist_in_usersitexsrcCst|ttS)z[ Return True if given Distribution is installed in sysconfig.get_python_lib(). )rrlr2rrr(r(r*dist_in_site_packagessrcCs,tt|}|ttddddS)zf Return True if given Distribution is installed in path matching distutils_scheme layout. rwZpurelibpythonr)r2rrlrrz)rZ norm_pathr(r(r*dist_in_install_paths rcCs6tjD]*}tj||jd}tj|rdSqdS)zC Return True if given Distribution is an editable install. .egg-linkTF)rKr:r9r; project_namer)rZ path_itemegg_linkr(r(r*dist_is_editables   rcs|rt|}ntj}|r tndd|r6ddndd|rLddndd|r^tnd d fd d |DS) a^ Return a list of installed Distribution objects. If ``local_only`` is True (default), only return installations local to the current virtualenv, if in a virtualenv. ``skip`` argument is an iterable of lower-case project names to ignore; defaults to stdlib_pkgs If ``include_editables`` is False, don't report editables. If ``editables_only`` is True , only report editables. If ``user_only`` is True , only report installations in the user site directory. If ``paths`` is set, only report the distributions present at the specified list of locations. cSsdSNTr(dr(r(r* local_testsz/get_installed_distributions..local_testcSsdSrr(rr(r(r* editable_testsz2get_installed_distributions..editable_testcSs t| Sr'rrr(r(r*rscSst|Sr'rrr(r(r*editables_only_testsz8get_installed_distributions..editables_only_testcSsdSrr(rr(r(r*rscSsdSrr(rr(r(r* user_testsz.get_installed_distributions..user_testcs:g|]2}|r|jkr|r|r|r|qSr()key).0rrrrskiprr(r* s z/get_installed_distributions..)r WorkingSet working_setrr)Z local_onlyrZinclude_editablesZeditables_onlyZ user_onlypathsrr(rr*get_installed_distributionss    rcCsxg}tr*|ttsBtrB|tntr8|t|t|D],}tj||jd}tj |rF|SqFdS)a Return the path for the .egg-link file if it exists, otherwise, None. There's 3 scenarios: 1) not in a virtualenv try to find in site.USER_SITE, then site_packages 2) in a no-global virtualenv try to find in site_packages 3) in a yes-global virtualenv try to find in site_packages, then site.USER_SITE (don't look in global location) For #1 and #3, there could be odd cases, where there's an egg-link in 2 locations. This method will just return the first one found. rN) rappendrrrr9r:r;rr)rZsitesZsiteZegglinkr(r(r* egg_link_paths       rcCst|}|rt|St|jS)aO Get the site-packages location of this distribution. Generally this is dist.location, except in the case of develop-installed packages, where dist.location is the source code location, and we want to know where the egg-link file is. The returned location is normalized (in particular, with symlinks removed). )rr2location)rrr(r(r*rs rcGstj|f|dSr')loggerinfo)msgargsr(r(r* write_outputsrcCst|t|dSr')r9rEr)Z build_dirr(r(r*_make_build_dirs rc@s(eZdZdZddZddZddZdS) FakeFilezQWrap a list of lines in an object with readline() to make ConfigParser happy.cCsdd|D|_dS)Ncss|] }|VqdSr'r()rlr(r(r* &sz$FakeFile.__init__.._gen)selflinesr(r(r*__init__%szFakeFile.__init__cCsPz4zt|jWWStk r0|jYWSXWntk rJYdSXdS)Nrw)nextr NameError StopIterationrr(r(r*readline(szFakeFile.readlinecCs|jSr'rrr(r(r*__iter__1szFakeFile.__iter__N)__name__ __module__ __qualname____doc__rrrr(r(r(r*r"s rc@s$eZdZeddZeddZdS) StreamWrappercCs ||_|Sr') orig_stream)clsrr(r(r* from_stream7szStreamWrapper.from_streamcCs|jjSr')rencodingrr(r(r*r=szStreamWrapper.encodingN)rrr classmethodrpropertyrr(r(r(r*r5s rc cs@tt|}tt|t|ztt|VW5tt||XdS)zReturn a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo. N)getattrrKsetattrrr)Z stream_nameZ orig_stdoutr(r(r*captured_outputBs  rcCstdS)zCapture the output of sys.stdout: with captured_stdout() as stdout: print('hello') self.assertEqual(stdout.getvalue(), 'hello ') Taken from Lib/support/__init__.py in the CPython repo. stdoutrr(r(r(r*r5Qs cCstdS)z See captured_stdout(). stderrrr(r(r(r*captured_stderr]src@s eZdZdZddZddZdS)cached_propertyzA property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175 cCst|d|_||_dS)Nr)rrr\)rr\r(r(r*rls zcached_property.__init__cCs(|dkr |S||}|j|jj<|Sr')r\__dict__r)robjrr)r(r(r*__get__pszcached_property.__get__N)rrrrrrr(r(r(r*rdsrcCs4tj|}|dkrt}||}|r0|jSdS)zCGet the installed version of dist_name avoiding pkg_resources cacheN)rZ Requirementr rfindversion)Z dist_namerZreqrr(r(r*r7xs   cCst|dddS)zConsume an iterable at C speed.r)maxlenNr)iteratorr(r(r*consumesrcOs@tt|tt|f|}dd|D}||d<tdd|S)NcSsi|]\}}||qSr(r()rrr)r(r(r* szenum..Zreverse_mappingEnumr()dictziprangerCitemstype)Z sequentialZnamedZenumsreverser(r(r*enumsrcCs*|dkr |Sd|krd|}d||S)z. Build a netloc from a host-port pair N:[{}]z{}:{})r?)Zhostportr(r(r* build_netlocs  rhttpscCs4|ddkr(d|kr(d|kr(d|}d||S)z) Build a full URL from a netloc. rre@[rz{}://{})countr?)netlocschemer(r(r*build_url_from_netlocs rcCst|}t|}|j|jfS)z2 Return the host-port pair from a netloc. )r urllib_parseZurlparseZhostnamer)rurlZparsedr(r(r* parse_netlocs rcCsXd|kr|dfS|dd\}}d|kr6|dd}n|df}tdd|D}||fS)zp Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). r)NNrqrNcss"|]}|dkrdnt|VqdSr')urllib_unquote)rxr(r(r*rsz)split_auth_from_netloc..)rsplitrztuple)rauthZ user_passr(r(r*split_auth_from_netlocsrcCsLt|\}\}}|dkr|S|dkr.d}d}nt|}d}dj|||dS)z Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com" N****rwz:****z{user}{password}@{netloc})userpasswordr)rrZquoter?)rr r r(r(r* redact_netlocs  r cCs@t|}||j}|j|d|j|j|jf}t|}||fS)aRTransform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1. r)rZurlsplitrrr:ZqueryZfragmentZ urlunsplit)rZtransform_netlocZpurlZ netloc_tupleZ url_piecesZsurlr(r(r*_transform_urls   r cCst|Sr')rrr(r(r* _get_netlocsrcCs t|fSr')r r r(r(r*_redact_netlocsrcCst|t\}\}}|||fS)z Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password)) r r)rZurl_without_authrrr(r(r*split_auth_netloc_from_urlsrcCst|tdS)z7Return a copy of url with 'username:password@' removed.rrrr(r(r*r8scCst|tdS)z.Replace the password in a given url with ****.r)r rrr(r(r*redact_auth_from_urlsrc@s4eZdZddZddZddZddZd d Zd S) HiddenTextcCs||_||_dSr')secretredacted)rrrr(r(r*r"szHiddenText.__init__cCsdt|S)Nz)r?rsrr(r(r*__repr__+szHiddenText.__repr__cCs|jSr'rrr(r(r*__str__/szHiddenText.__str__cCs t|t|krdS|j|jkS)NF)rrrotherr(r(r*__eq__4szHiddenText.__eq__cCs ||k Sr'r(rr(r(r*__ne__?szHiddenText.__ne__N)rrrrrrrrr(r(r(r*r!s   rcCs t|ddS)Nrr)r)r)r(r(r* hide_valueDsrcCst|}t||dS)Nr)rr)rrr(r(r*hide_urlIsrcCst}dD]P}|dj|d|djtjd|d|djtjddd |iq |oxtoxtjtj d|k}|rtj d d gtj d d}t d d |dS)zProtection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... )rwz.exezpip{ext})rtz pip{}{ext}rz pip{}.{}{ext}Nrertz-mrIrqz3To modify pip, please run the following command: {} ) setaddr?rKrirr9r:rJrLrMr r;)Z modifying_pipZ pip_namesrtZshould_show_use_python_msgZ new_commandr(r(r*(protect_pip_from_modification_on_windowsOs," r#cCstjdk otjS)z!Is this console interactive? N)rKstdinisattyr(r(r(r*is_console_interactivemsr&)F)rp)T)N)r)Z __future__r contextlibrGrioZloggingr9rrTrWrK collectionsrZ pip._vendorrZpip._vendor.retryingrZpip._vendor.sixrrZpip._vendor.six.movesr Zpip._vendor.six.moves.urllibr rZ"pip._vendor.six.moves.urllib.parser rrIr Zpip._internal.exceptionsr Zpip._internal.locationsrrrrZpip._internal.utils.compatrrrrZ pip._internal.utils.marker_filesrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrrrrtypingrrrrr r!r"r#r$r%Zpip._vendor.pkg_resourcesr&intrB__all__Z getLoggerrrr@rDr6r4r+rUrdr,r-r~rr.rrr0r1DEFAULT_BUFFER_SIZErr2r/r3rrrrrrrrrrrobjectrrcontextmanagerrr5rrr7rrrrrrr r rrrr8rrrrr#r&r(r(r(r*s            0      "          E$       #PK]-70&utils/__pycache__/glibc.cpython-38.pycnu[U ʗRe& @spddlZddlZddlmZmZeedddZeedddZeeddd Zeeefdd d Z dS) N)OptionalTuple)returncCs tp tS)z9Returns glibc version string, or None if not using glibc.)glibc_version_string_confstrglibc_version_string_ctypesrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/glibc.pyglibc_version_string sr c CsFtjdkrdSztd\}}Wntttfk r@YdSX|S)z@Primary implementation of glibc_version_string using os.confstr.win32NCS_GNU_LIBC_VERSION)sysplatformosconfstrsplitAttributeErrorOSError ValueError)_versionrrrrs rcCsvz ddl}Wntk r"YdSX|d}z |j}Wntk rNYdSX|j|_|}t|tsr| d}|S)z=Fallback implementation of glibc_version_string using ctypes.rNascii) ctypes ImportErrorCDLLgnu_get_libc_versionrc_char_prestype isinstancestrdecode)rprocess_namespacer version_strrrrrs     rcCst}|dkrdSd|fSdS)zTry to determine the glibc version Returns a tuple of strings (lib, version) which default to empty strings in case the lookup fails. N)r"glibc)r ) glibc_versionrrrlibc_verNsr%) rr typingrrrr rrr%rrrrs /PK][ 1utils/__pycache__/filesystem.cpython-38.opt-1.pycnu[U .e @sddlZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZddlmZerdd lmZmZGd d d eZd d ZddZddZeddZe dddZe reddZn eejZdS)N)contextmanager)NamedTemporaryFile)retry)PY2) get_path_uid)cast)MYPY_CHECK_RUNNING)BinaryIOIteratorc@seZdZeddZdS)NamedTemporaryFileResultcCsdSN)selfr r B/usr/lib/python3.8/site-packages/pip/_internal/utils/filesystem.pyfileszNamedTemporaryFileResult.fileN)__name__ __module__ __qualname__propertyrr r r rr sr cCsttdsdSd}||krtj|rntdkr^z t|}Wntk rTYdSX|dkSt|tjSq|tj |}}qdS)NgeteuidTrF) hasattrospathlexistsrrOSErroraccessW_OKdirname)rZpreviousZpath_uidr r rcheck_path_owners    rc Csrzt||Wn\ttfk rl||fD]8}z t|}Wntk rPYq,X|r,td|q,YnXdS)zWrap shutil.copy2() but map errors copying socket files to SpecialFileError as expected. See also https://bugs.python.org/issue37700. z`%s` is a socketN)shutilZcopy2rIOError is_socketZSpecialFileError)srcdestfZis_socket_filer r r copy2_fixed5s  r%cCstt|jSr )statS_ISSOCKrlstatst_mode)rr r rr!Msr!c csbtdtj|tj|dd8}td|}z |VW5|jt|j XW5QRXdS)zGiven a path to a file, open a temp file next to it securely and ensure it is written to disk after the context reaches its end. Fz.tmp)deletedirprefixsuffixr N) rrrrbasenamerrflushfsyncfileno)rr$resultr r radjacent_tmp_fileRs     r3i)Zstop_max_delayZ wait_fixedcCs@zt||Wn*tk r:t|t||YnXdSr )rrenamerremove)r"r#r r rreplaceis  r7)rZos.pathrr& contextlibrZtempfilerZpip._vendor.retryingrZpip._vendor.sixrZpip._internal.utils.compatrZpip._internal.utils.miscrZpip._internal.utils.typingrtypingr r r rr%r!r3Z_replace_retryr7r r r rs.          PK]a,utils/__pycache__/glibc.cpython-38.opt-1.pycnu[U .e-@sxddlmZddlZddlZddlZddlmZerDddlmZm Z ddZ ddZ d d Z d d Z d dZddZdS))absolute_importN)MYPY_CHECK_RUNNING)OptionalTuplecCs tp tS)z9Returns glibc version string, or None if not using glibc.)glibc_version_string_confstrglibc_version_string_ctypesrr=/usr/lib/python3.8/site-packages/pip/_internal/utils/glibc.pyglibc_version_stringsr c Cs8ztd\}}Wntttfk r2YdSX|S)z@Primary implementation of glibc_version_string using os.confstr.CS_GNU_LIBC_VERSIONN)osconfstrsplitAttributeErrorOSError ValueError)_versionrrr rs rcCsvz ddl}Wntk r"YdSX|d}z |j}Wntk rNYdSX|j|_|}t|tsr| d}|S)z=Fallback implementation of glibc_version_string using ctypes.rNascii) ctypes ImportErrorZCDLLgnu_get_libc_versionrZc_char_pZrestype isinstancestrdecode)rZprocess_namespacer version_strrrr r&s     rcCsHtd|}|s$td|tdSt|d|koFt|d|kS)Nz$(?P[0-9]+)\.(?P[0-9]+)z=Expected glibc version with 2 components major.minor, got: %sFmajorminor)rematchwarningswarnRuntimeWarningintgroup)rrequired_major minimum_minormrrr check_glibc_versionFs r(cCst}|dkrdSt|||S)NF)r r()r%r&rrrr have_compatible_glibcWsr)cCst}|dkrdSd|fSdS)zTry to determine the glibc version Returns a tuple of strings (lib, version) which default to empty strings in case the lookup fails. N)r*Zglibc)r )Z glibc_versionrrr libc_verpsr+)Z __future__rr rr Zpip._internal.utils.typingrtypingrrr rrr(r)r+rrrr s   PK]50*utils/__pycache__/unpacking.cpython-38.pycnu[U ʗReu"@sdZddlZddlZddlZddlZddlZddlZddlmZm Z m Z ddlm Z ddl m Z ddlmZmZmZmZddlmZeeZeeZzddlZee7ZWnek redYnXzddlZee7ZWnek red YnXed d d Zee ed ddZ eee!dddZ"eee!dddZ#edd ddZ$e e!dddZ%d%eee!ddddZ&eeddd d!Z'd&eee edd"d#d$Z(dS)'zUtilities related archives. N)IterableListOptional)ZipInfo)InstallationError)BZ2_EXTENSIONSTAR_EXTENSIONS XZ_EXTENSIONSZIP_EXTENSIONS) ensure_dirzbz2 module is not availablezlzma module is not available)returncCstd}t||S)zBGet the current umask which involves having to set it temporarily.r)osumask)maskr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py current_umask+s  r)pathr cCsh|dd}d|krHd|kr4|d|dkss r!) directorytargetr cCs0tj|}tj|}tj||g}||kS)zL Return true if the absolute path of target is within the directory )r rabspath commonprefix)r"r# abs_directory abs_targetrrrris_within_directoryMs  r(cCst|dt@dBdS)zx Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs iIN)r chmodrrrrr2set_extracted_file_to_default_mode_plus_executableXsr+)infor cCs$|jd?}t|o t|o |d@S)Nr)) external_attrboolstatS_ISREG)r,moderrrzip_item_is_executable`s r3T)filenamelocationflattenr c Cst|t|d}ztj|dd}t|o0|}|D]}|j}|}|rXt |d}t j ||}t j |} t||sd} t| ||||ds|drt|q:t| ||} z&t|d} t| | W5QRXW5| t|rt|Xq:W5|Xd S) a Unzip the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. rbT) allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rrwbN)r openclosezipfileZipFiler!namelistinfolistr4rr rjoindirnamer(rformatendswithr3r+shutil copyfileobj) r4r5r6zipfpzipleadingr,namefndirmessagefpdestfprrr unzip_filegs6          rO)r4r5r c Cs.t||ds$|dr*d}nL|tr>d}n8|trRd}n$|drfd}ntd|d }tj||d d }zt d d | D}| D]p}|j }|rt |d}tj||}t||sd}t|||||rt|q|rbz|||Wn>tk r^} ztd||j | WYqW5d} ~ XYnXqz||} WnBttfk r} ztd||j | WYqW5d} ~ XYnXttj|| dk stt|d} t| | W5QRX| ||||j d@rt!|qW5| XdS)a Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. z.gzz.tgzzr:gzzr:bz2zr:xzz.tarrz-Cannot determine compression type for file %szr:*zutf-8)encodingcSsg|] }|jqSr)rI).0memberrrr szuntar_file..rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNr9r))"r lowerrCrr loggerwarningtarfiler:r;r! getmembersrIrr rr@r(rrBisdirissym_extract_member Exception extractfileKeyErrorAttributeErrorrAAssertionErrorrDrEutimer2r+) r4r5r2tarrHrSrJrrLexcrMrNrrr untar_filest         re)r4r5 content_typer cCstj|}|dks,|ts,t|rDt|||d dnR|dkslt |sl|t t t rxt||ntd|||td|dS)Nzapplication/zipz.whl)r6zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )r rrealpathrUrCr r< is_zipfilerOrX is_tarfilerrr rerVcriticalr)r4r5rfrrr unpack_files,   rk)T)N))__doc__loggingr rDr0rXr<typingrrrrpip._internal.exceptionsrpip._internal.utils.filetypesrrr r pip._internal.utils.miscr getLogger__name__rVSUPPORTED_EXTENSIONSbz2 ImportErrordebuglzmaintrstrrr/r!r(r+r3rOrerkrrrrsL        .SPK]hp--)utils/__pycache__/ui.cpython-38.opt-1.pycnu[U .eR6@sxddlmZmZddlZddlZddlZddlZddlZddlm Z m Z mZddl m Z ddl mZmZddlmZmZmZddlmZddlmZdd lmZdd lmZdd lmZerdd lmZm Z m!Z!zdd l m"Z"Wne#k rdZ"YnXe$e%Z&ddZ'e'eeZ(Gddde)Z*GdddeZ+GdddeZ,Gddde)Z-Gddde)Z.Gddde.e*e-Z/Gddde/e(Z0Gddde/e+Z1Gd d!d!e/eZ2Gd"d#d#e/eZ3Gd$d%d%e/e,Z4Gd&d'd'e.e*e-eZ5e1e1fe0e5fe2e5fe3e5fe4e5fd(Z6d7d)d*Z7ej8d+d,Z9Gd-d.d.e)Z:Gd/d0d0e)Z;Gd1d2d2e;ZdS)8)absolute_importdivisionN)SIGINTdefault_int_handlersignal)six) HIDE_CURSOR SHOW_CURSOR)BarFillingCirclesBarIncrementalBar)Spinner)WINDOWS)get_indentation) format_size)MYPY_CHECK_RUNNING)AnyIteratorIO)coloramacCst|jdd}|s|St|dtt|dtg}|tt|dg7}zt||Wntk rz|YSX|SdS)NencodingZ empty_fillZfillphases)getattrfilerZ text_typelistjoinencodeUnicodeEncodeError)Z preferredZfallbackrZ charactersr:/usr/lib/python3.8/site-packages/pip/_internal/utils/ui.py_select_progress_class%s r cs4eZdZdZfddZfddZddZZS)InterruptibleMixina Helper to ensure that self.finish() gets called on keyboard interrupt. This allows downloads to be interrupted without leaving temporary state (like hidden cursors) behind. This class is similar to the progress library's existing SigIntMixin helper, but as of version 1.2, that helper has the following problems: 1. It calls sys.exit(). 2. It discards the existing SIGINT handler completely. 3. It leaves its own handler in place even after an uninterrupted finish, which will have unexpected delayed effects if the user triggers an unrelated keyboard interrupt some time after a progress-displaying download has already completed, for example. cs4tt|j||tt|j|_|jdkr0t|_dS)z= Save the original SIGINT handler for later. N)superr!__init__rr handle_sigintoriginal_handlerrselfargskwargs __class__rrr#Us zInterruptibleMixin.__init__cstt|tt|jdS)z Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. N)r"r!finishrrr%r'r*rrr,eszInterruptibleMixin.finishcCs||||dS)z Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. N)r,r%)r'Zsignumframerrrr$osz InterruptibleMixin.handle_sigint)__name__ __module__ __qualname____doc__r#r,r$ __classcell__rrr*rr!Cs  r!c@seZdZddZdS) SilentBarcCsdSNrr-rrrupdate|szSilentBar.updateN)r/r0r1r6rrrrr4zsr4c@seZdZdZdZdZdZdS) BlueEmojiBar %(percent)d%% )u🔹u🔷u🔵N)r/r0r1suffixZ bar_prefixZ bar_suffixrrrrrr7sr7csJeZdZfddZeddZeddZeddZd d d ZZ S) DownloadProgressMixincs,tt|j||dtd|j|_dS)Nr9)r"r;r#rmessager&r*rrr#szDownloadProgressMixin.__init__cCs t|jSr5)rindexr-rrr downloadedsz DownloadProgressMixin.downloadedcCs |jdkrdStd|jdS)Ngz...z/s)Zavgrr-rrrdownload_speeds z$DownloadProgressMixin.download_speedcCs|jrd|jSdS)Nzeta %s)ZetaZeta_tdr-rrr pretty_etas z DownloadProgressMixin.pretty_etar@ccs&|D]}|V||q|dSr5)nextr,)r'itnxrrriters zDownloadProgressMixin.iter)r@) r/r0r1r#propertyr?rArCrHr3rrr*rr;s    r;cseZdZfddZZS) WindowsMixincs\trjrd_ttj||trXtrXtj_fddj_fddj_ dS)NFcs jjSr5)rwrappedisattyrr-rrz'WindowsMixin.__init__..cs jjSr5)rrKflushrr-rrrMrN) rZ hide_cursorr"rJr#rZ AnsiToWin32rrLrOr&r*r-rr#s zWindowsMixin.__init__)r/r0r1r#r3rrr*rrJsrJc@seZdZejZdZdZdS)BaseDownloadProgressBarr8z0%(downloaded)s %(download_speed)s %(pretty_eta)sN)r/r0r1sysstdoutrr=r:rrrrrPsrPc@s eZdZdS)DefaultDownloadProgressBarNr/r0r1rrrrrSsrSc@s eZdZdS)DownloadSilentBarNrTrrrrrUsrUc@s eZdZdS) DownloadBarNrTrrrrrVsrVc@s eZdZdS)DownloadFillingCirclesBarNrTrrrrrWsrWc@s eZdZdS)DownloadBlueEmojiProgressBarNrTrrrrrXsrXc@s&eZdZejZdZddZddZdS)DownloadProgressSpinnerz!%(downloaded)s %(download_speed)scCs"t|dst|j|_t|jS)N_phaser)hasattr itertoolscyclerrZrDr-rrr next_phases z"DownloadProgressSpinner.next_phasecCsN|j|}|}|j|}d||r*dnd||r6dnd|g}||dS)NrBr9)r=r^r:rZwriteln)r'r=Zphaser:linerrrr6s    zDownloadProgressSpinner.updateN) r/r0r1rQrRrr:r^r6rrrrrYsrY)ZoffZonasciiZprettyZemojicCs8|dks|dkr t|djSt|d|djSdS)Nrr@)max) BAR_TYPESrH)Z progress_barrarrrDownloadProgressProvider srcc csPtr dVn@|r"ttjkr*dVn"|tz dVW5|tXdSr5) rrLloggergetEffectiveLevelloggingINFOwriterr )rrrr hidden_cursors  ric@s$eZdZddZddZddZdS) RateLimitercCs||_d|_dS)Nr)_min_update_interval_seconds _last_update)r'min_update_interval_secondsrrrr#-szRateLimiter.__init__cCst}||j}||jkSr5)timerlrk)r'ZnowZdeltarrrready2s zRateLimiter.readycCst|_dSr5)rnrlr-rrrreset8szRateLimiter.resetN)r/r0r1r#rorprrrrrj,srjc@seZdZddZddZdS)SpinnerInterfacecCs tdSr5NotImplementedErrorr-rrrspin>szSpinnerInterface.spincCs tdSr5rrr'Z final_statusrrrr,BszSpinnerInterface.finishN)r/r0r1rtr,rrrrrq=srqc@s.eZdZd ddZddZdd Zd d ZdS) InteractiveSpinnerN-\|/?cCs\||_|dkrtj}||_t||_d|_t||_ |j dt |jdd|_ dS)NFr9z ... r) _messagerQrR_filerj _rate_limiter _finishedr\r] _spin_cyclerhr_width)r'r=rZ spin_charsrmrrrr#Hs  zInteractiveSpinner.__init__cCsRd|j}|j|d|j||j|t||_|j|jdS)Nr9)r~rzrhlenrOr{rp)r'statusZbackuprrr_writeWs     zInteractiveSpinner._writecCs,|jr dS|jsdS|t|jdSr5)r|r{rorrDr}r-rrrrtcs  zInteractiveSpinner.spincCs4|jr dS|||jd|jd|_dS)N T)r|rrzrhrOrurrrr,ks    zInteractiveSpinner.finish)Nrwrx)r/r0r1r#rrtr,rrrrrvGs   rvc@s.eZdZd ddZddZddZdd Zd S) NonInteractiveSpinner<cCs$||_d|_t||_|ddS)NFZstarted)ryr|rjr{_update)r'r=rmrrrr#zs zNonInteractiveSpinner.__init__cCs|jtd|j|dS)Nz%s: %s)r{rprdinfory)r'rrrrrs zNonInteractiveSpinner._updatecCs&|jr dS|jsdS|ddS)Nzstill running...)r|r{rorr-rrrrts  zNonInteractiveSpinner.spincCs$|jr dS|d|fd|_dS)Nzfinished with status '%s'T)r|rrurrrr,szNonInteractiveSpinner.finishN)r)r/r0r1r#rrtr,rrrrrys rc cstjr"ttjkr"t|}nt|}z t tj |VW5QRXWn>t k rj| dYn*t k r| dYn X| ddS)NZcancelederrorZdone) rQrRrLrdrerfrgrvrriKeyboardInterruptr, Exception)r=Zspinnerrrr open_spinners    r)N)?Z __future__rr contextlibr\rfrQrnrrrZ pip._vendorrZpip._vendor.progressrr Zpip._vendor.progress.barr r r Zpip._vendor.progress.spinnerr Zpip._internal.utils.compatrZpip._internal.utils.loggingrZpip._internal.utils.miscrZpip._internal.utils.typingrtypingrrrrrZ getLoggerr/rdr Z_BaseBarobjectr!r4r7r;rJrPrSrUrVrWrXrYrbrccontextmanagerrirjrqrvrrrrrrs~         7       2PK]t׀+utils/__pycache__/filesystem.cpython-38.pycnu[U ʗRe@sfddlZddlZddlZddlZddlZddlmZddlmZddl m Z m Z m Z m Z mZmZddlmZmZmZddlmZddlmZeedd d Zeee e e ddfd d d ZedededdZeejZeedddZeedddZeee edddZ eee!e"fdddZ#eedddZ$eee!e"fdddZ%eeddd Z&dS)!N)contextmanager)NamedTemporaryFile)AnyBinaryIO GeneratorListUnioncast)retrystop_after_delay wait_fixed) get_path_uid) format_size)pathreturncCstjdksttdsdStj|s(td}||krtj|rtdkrxz t |}Wnt k rnYdSX|dkSt |tj Sq,|tj |}}q,dS)Nwin32geteuidTrF)sysplatformhasattrosrisabsAssertionErrorlexistsrr OSErroraccessW_OKdirname)rpreviouspath_uidr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/filesystem.pycheck_path_owners   r")rkwargsrc ksftfdtj|tj|dd|4}tt|}z |VW5|t| XW5QRXdS)a%Return a file-like object pointing to a tmp file next to path. The file is created securely and is ensured to be written to disk after the context reaches its end. kwargs will be passed to tempfile.NamedTemporaryFile to control the way the temporary file will be opened. Fz.tmp)deletedirprefixsuffixN) rrrrbasenamer rflushfsyncfileno)rr#fresultr r r!adjacent_tmp_file+s     r.Tg?)reraisestopwaitcCsHtj|s(tj|}||kr"q(|}qtjdkr@t|tjSt|S)zgCheck if a directory is writable. Uses os.access() on POSIX, tries creating files on Windows. posix)rrisdirrnamerr_test_writable_dir_win)rparentr r r!test_writable_dirLs   r8c sd}dtdD]}|dfddtdD}tj||}zt|tjtjBtjB}Wn*tk rtYqt k rYdSXt |t |d Sqt d dS) N(accesstest_deleteme_fishfingers_custard_$abcdefghijklmnopqrstuvwxyz0123456789 c3s|]}tVqdSN)randomchoice).0_alphabetr r! dsz)_test_writable_dir_win..FTz3Unexpected condition testing for writable directory) rangejoinrropenO_RDWRO_CREATO_EXCLFileExistsErrorPermissionErrorcloseunlinkr)rr(rAr5filefdr rBr!r6^s     r6)rpatternrcsBg}t|D].\}}t||}|fdd|Dq|S)zReturns a list of absolute paths of files beneath path, recursively, with filenames which match the UNIX-style shell glob pattern.c3s|]}tj|VqdSr=)rrrG)r@r,rootr r!rDszfind_files..)rwalkfnmatchfilterextend)rrRr-rAfilesmatchesr rSr! find_fileszs  r[cCstj|rdStj|S)Nr)rrislinkgetsizerr r r! file_sizes r_cCs tt|Sr=)rr_r^r r r!format_file_sizesr`cCsBd}t|D].\}}}|D]}tj||}|t|7}qq|S)Ng)rrUrrGr_)rsizerT_dirsrYfilename file_pathr r r!directory_sizes recCs tt|Sr=)rrer^r r r!format_directory_sizesrf)'rVros.pathr>r contextlibrtempfilertypingrrrrrr pip._vendor.tenacityr r r pip._internal.utils.compatr pip._internal.utils.miscrstrboolr"r._replace_retryreplacer8r6r[intfloatr_r`rerfr r r r!s,        PK]z6:٠-utils/__pycache__/marker_files.cpython-38.pycnu[U .e7@s$ddlZdZdZddZddZdS)NzThis file is placed here by pip to indicate the source was put here by pip. Once this package is successfully installed this source code will be deleted (unless you remove this file). zpip-delete-this-directory.txtcCstjtj|tS)N)ospathexistsjoinPIP_DELETE_MARKER_FILENAME) directoryrD/usr/lib/python3.8/site-packages/pip/_internal/utils/marker_files.pyhas_delete_marker_filesr c Cs2tj|t}t|d}|tW5QRXdS)z? Write the pip delete marker file into this directory. wN)rrrropenwriteDELETE_MARKER_MESSAGE)rfilepathZ marker_fprrr write_delete_marker_files r)Zos.pathrrrr rrrrr sPK] *utils/__pycache__/filetypes.cpython-38.pycnu[U ʗRe@sUdZddlmZddlmZdZdZeedfed<dZ eedfed <d efZ eedfed <d Z eedfed <e ee e Z ee dddZdS)zFiletype information. )Tuple)splitextz.whl)z.tar.bz2z.tbz.BZ2_EXTENSIONS)z.tar.xzz.txzz.tlzz.tar.lzz .tar.lzma XZ_EXTENSIONSz.zipZIP_EXTENSIONS)z.tar.gzz.tgzz.tarTAR_EXTENSIONS)namereturncCs t|d}|tkrdSdS)z9Return True if `name` is a considered as an archive file.TF)rlowerARCHIVE_EXTENSIONS)rextr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/filetypes.pyis_archive_filesrN)__doc__typingrpip._internal.utils.miscrWHEEL_EXTENSIONrstr__annotations__rrrr boolrrrrrs  PK].1utils/__pycache__/subprocess.cpython-38.opt-1.pycnu[U .e& @sddlmZddlZddlZddlZddlmZddlmZddl m Z m Z ddl m Z ddlmZmZddlmZdd lmZerdd lmZmZmZmZmZmZmZmZdd lmZeeeefZ d Z!d dZ"ddZ#ddZ$ddZ%dddZ&ddZ'dS))absolute_importN) shlex_quote)InstallationError)console_to_strstr_to_display)subprocess_logger) HiddenTextpath_to_display)MYPY_CHECK_RUNNING) open_spinner)AnyCallableIterableListMappingOptionalTextUnion)SpinnerInterfacez(----------------------------------------cGs2g}|D]$}t|tr"||q||q|S)z& Create a CommandArgs object. ) isinstancelistextendappend)argsZ command_argsargrB/usr/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py make_commands    rcCsddd|DS)z/ Format command arguments for display.  css,|]$}t|trtt|nt|VqdS)N)rrrstr.0rrrr ;sz&format_command_args..)joinrrrrformat_command_args1s r%cCsdd|DS)z= Return the arguments in their raw, unredacted form. cSs g|]}t|tr|jn|qSr)rrZsecretr rrr Fsz'reveal_command_args..rr$rrrreveal_command_argsAsr'c CsDt|}t|dd}t|}d|}dj|||t||td}|S)z Create and return the error message to use to log a subprocess error with command output. :param lines: A list of lines, each ending with a newline. z command bytes)ZdesczCommand errored out with exit status {exit_status}: command: {command_display} cwd: {cwd_display} Complete output ({line_count} lines): {output}{divider}) exit_statuscommand_display cwd_displayZ line_countoutputZdivider)r%rr r#formatlen LOG_DIVIDER) cmd_argscwdlinesr)Zcommandr*r+r,msgrrrmake_subprocess_output_errorKs    r4FraiseTc  Cs4|dkr g}|dkrg}|r*tj} tj} n tj} tj} t| k} | oN|dk } |dkr`t|}| d|tj }|r| ||D]}| |dqz.t jt|t jt jt j||d}|jWn6tk r}z| rtd||W5d}~XYnXg}t|j}|sqJ|}||d| || r|qz |W5|jrj|jX|jo||j|k}| r|r|dn |d|r*|dkr| s| rt||||jd }t |d !|j|}t"|n:|d krt#d ||j|n|d krnt$dt%|d&|S)a Args: show_stdout: if true, use INFO to log the subprocess's stderr and stdout streams. Otherwise, use DEBUG. Defaults to False. extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. unset_environ: an iterable of environment variable names to unset prior to calling subprocess.Popen(). log_failed_cmd: if false, failed commands are not logged, only raised. NzRunning command %s)stderrstdinstdoutr1envz#Error %s while executing command %s errorZdoner5)r0r1r2r)zSCommand errored out with exit status {}: {} Check the logs for full command output.warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=%sr()'rinfologgingINFOdebugDEBUGZgetEffectiveLevelr%osenvironcopyupdatepop subprocessPopenr'ZSTDOUTPIPEr7close ExceptionZcriticalrr8readlinerstriprZspinwait returncodeZfinishr4r;r-rZwarning ValueErrorreprr#)cmdZ show_stdoutr1Z on_returncodeZextra_ok_returncodesZ command_desc extra_environZ unset_environspinnerZlog_failed_cmdZlog_subprocessZ used_levelZshowing_subprocessZ use_spinnerr9nameprocexcZ all_outputlineZproc_had_errorr3Zexc_msgrrrcall_subprocessus               rZcsdfdd }|S)zProvide a subprocess_runner that shows a spinner message. Intended for use with for pep517's Pep517HookCaller. Thus, the runner has an API that matches what's expected by Pep517HookCaller.subprocess_runner. Nc s(t}t||||dW5QRXdS)N)r1rTrU)r rZ)rSr1rTrUmessagerrrunners z+runner_with_spinner_message..runner)NNr)r\r]rr[rrunner_with_spinner_messages r^) FNr5NNNNNT)(Z __future__rr?rCrHZpip._vendor.six.movesrZpip._internal.exceptionsrZpip._internal.utils.compatrrZpip._internal.utils.loggingrZpip._internal.utils.miscrr Zpip._internal.utils.typingr Zpip._internal.utils.uir typingr r rrrrrrrrZ CommandArgsr/rr%r'r4rZr^rrrrs>      (  ,  PK]z6:٠3utils/__pycache__/marker_files.cpython-38.opt-1.pycnu[U .e7@s$ddlZdZdZddZddZdS)NzThis file is placed here by pip to indicate the source was put here by pip. Once this package is successfully installed this source code will be deleted (unless you remove this file). zpip-delete-this-directory.txtcCstjtj|tS)N)ospathexistsjoinPIP_DELETE_MARKER_FILENAME) directoryrD/usr/lib/python3.8/site-packages/pip/_internal/utils/marker_files.pyhas_delete_marker_filesr c Cs2tj|t}t|d}|tW5QRXdS)z? Write the pip delete marker file into this directory. wN)rrrropenwriteDELETE_MARKER_MESSAGE)rfilepathZ marker_fprrr write_delete_marker_files r)Zos.pathrrrr rrrrr sPK]/~7utils/__pycache__/setuptools_build.cpython-38.opt-1.pycnu[U .e_@s:ddlZddlmZer(ddlmZmZdZdddZdS) N)MYPY_CHECK_RUNNING)ListSequencezimport sys, setuptools, tokenize; sys.argv[0] = {0!r}; __file__={0!r};f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))FcCsJtjg}|r|d|dt|g|r8|||rF|d|S)ao Get setuptools command arguments with shim wrapped setup file invocation. :param setup_py_path: The path to setup.py to be wrapped. :param global_options: Additional global options. :param no_user_config: If True, disables personal user configuration. :param unbuffered_output: If True, adds the unbuffered switch to the argument list. z-uz-cz --no-user-cfg)sys executableappendextend_SETUPTOOLS_SHIMformat)Z setup_py_pathZglobal_optionsZno_user_configZunbuffered_outputargsr H/usr/lib/python3.8/site-packages/pip/_internal/utils/setuptools_build.pymake_setuptools_shim_argss   r)NFF)rZpip._internal.utils.typingrtypingrrr rr r r r s   PK]J O})utils/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdS)Nrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/__init__.pyPK]M22'utils/__pycache__/models.cpython-38.pycnu[U ʗRe@s2dZddlZddlmZmZmZGdddZdS)zUtilities for defining models N)AnyCallableTypec@seZdZdZddgZeedddddZedd d Z ee d d d Z ee d ddZ ee d ddZ ee d ddZee d ddZeeeege fe dddZdS)KeyBasedCompareMixinz7Provides comparison capabilities that is based on a key _compare_key_defining_classN)keydefining_classreturncCs||_||_dSN)rr)selfrr r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/models.py__init__ szKeyBasedCompareMixin.__init__)r cCs t|jSr )hashr)r r r r__hash__szKeyBasedCompareMixin.__hash__)otherr cCs||tjSr )_compareoperator__lt__r rr r rrszKeyBasedCompareMixin.__lt__cCs||tjSr )rr__le__rr r rrszKeyBasedCompareMixin.__le__cCs||tjSr )rr__gt__rr r rrszKeyBasedCompareMixin.__gt__cCs||tjSr )rr__ge__rr r rrszKeyBasedCompareMixin.__ge__cCs||tjSr )rr__eq__rr r rr szKeyBasedCompareMixin.__eq__)rmethodr cCst||jstS||j|jSr ) isinstancerNotImplementedr)r rrr r rr#s zKeyBasedCompareMixin._compare)__name__ __module__ __qualname____doc__ __slots__rrrintrboolrrrrrrrr r r rrsr)r!rtypingrrrrr r r rsPK]*h=utils/__pycache__/inject_securetransport.cpython-38.opt-1.pycnu[U .e*@sdZddlZddZedS)a-A helper module that injects SecureTransport, on import. The import should be done as early as possible, to ensure all requests and sessions (or whatever) are created after injecting SecureTransport. Note that we only do the injection on macOS, when the linked OpenSSL is too old to handle TLSv1.2. Nc CsxtjdkrdSz ddl}Wntk r0YdSX|jdkr@dSzddlm}Wnttfk rjYdSX|dS)Ndarwinri)securetransport) sysplatformssl ImportErrorZOPENSSL_VERSION_NUMBERZpip._vendor.urllib3.contribrOSErrorZinject_into_urllib3)rrr N/usr/lib/python3.8/site-packages/pip/_internal/utils/inject_securetransport.pyinject_securetransport s   r )__doc__rr r r r r s PK]N0 0 0utils/__pycache__/packaging.cpython-38.opt-1.pycnu[U .e @sddlmZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z ddlmZerdd lmZmZdd lmZdd lmZeeZd d ZddZddZddZdS))absolute_importN) FeedParser) pkg_resources) specifiersversion)NoneMetadataError) display_path)MYPY_CHECK_RUNNING)OptionalTuple)Message) DistributioncCs4|dkr dSt|}tdtt|}||kS)a Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return `False`. :raises InvalidSpecifier: If `requires_python` has an invalid format. NT.)rZ SpecifierSetrparsejoinmapstr)requires_python version_infoZrequires_python_specifierZpython_versionrA/usr/lib/python3.8/site-packages/pip/_internal/utils/packaging.pycheck_requires_pythons  rcCsd}t|tjr&||r&||}n0|dr@d}||}ntdt|jd}|dkrht ||t }| || S)z :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. ZMETADATAzPKG-INFOzNo metadata found in %sN) isinstancerZDistInfoDistribution has_metadata get_metadataloggerZwarningrlocationrrZfeedclose)distZ metadata_nameZmetadataZ feed_parserrrrr,s      rcCs&t|}|d}|dk r"t|}|S)z_ Return the "Requires-Python" metadata for a distribution, or None if not present. zRequires-PythonN)rgetr)rZ pkg_info_dictrrrrget_requires_pythonGs  r!cCs2|dr.|dD]}|r|SqdS)NZ INSTALLERr)rZget_metadata_linesstrip)rlinerrr get_installerXs  r$)Z __future__rZloggingZ email.parserrZ pip._vendorrZpip._vendor.packagingrrZpip._internal.exceptionsrZpip._internal.utils.miscrZpip._internal.utils.typingr typingr r Z email.messager Zpip._vendor.pkg_resourcesr Z getLogger__name__rrrr!r$rrrrs         PK]B-utils/__pycache__/models.cpython-38.opt-1.pycnu[U .e|@s dZddlZGdddeZdS)zUtilities for defining models Nc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS)KeyBasedCompareMixinz/usr/lib/python3.8/site-packages/pip/_internal/utils/models.py__init__ szKeyBasedCompareMixin.__init__cCs t|jSr)hashr)rrrr __hash__szKeyBasedCompareMixin.__hash__cCs||tjSr)_compareoperator__lt__rotherrrr rszKeyBasedCompareMixin.__lt__cCs||tjSr)r r__le__rrrr rszKeyBasedCompareMixin.__le__cCs||tjSr)r r__gt__rrrr rszKeyBasedCompareMixin.__gt__cCs||tjSr)r r__ge__rrrr rszKeyBasedCompareMixin.__ge__cCs||tjSr)r r__eq__rrrr r szKeyBasedCompareMixin.__eq__cCs||tjSr)r r__ne__rrrr r#szKeyBasedCompareMixin.__ne__cCst||jstS||j|jSr) isinstancerNotImplementedr)rrmethodrrr r &s zKeyBasedCompareMixin._compareN) __name__ __module__ __qualname____doc__r r rrrrrrr rrrr r sr)rrobjectrrrrr sPK]v1utils/__pycache__/setuptools_build.cpython-38.pycnu[U ʗRe @sddlZddlZddlmZmZmZedZde ee e e ee dddZ e ee ee e ee dd d Z e ee ee d d d Z e ee ee e ee ee e ee dddZe ee e ee dddZe ee ee e ee ee ee ee e e e ee d ddZdS)N)ListOptionalSequenceah exec(compile(''' # This is -- a caller that pip uses to run setup.py # # - It imports setuptools before invoking setup.py, to enable projects that directly # import from `distutils.core` to work with newer packaging standards. # - It provides a clear error message when setuptools is not installed. # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so # setuptools doesn't think the script is `-c`. This avoids the following warning: # manifest_maker: standard file '-c' not found". # - It generates a shim setup.py, for handling setup.cfg-only projects. import os, sys, tokenize try: import setuptools except ImportError as error: print( "ERROR: Can not execute `setup.py` since setuptools is not available in " "the build environment.", file=sys.stderr, ) sys.exit(1) __file__ = %r sys.argv[0] = __file__ if os.path.exists(__file__): filename = __file__ with tokenize.open(__file__) as f: setup_py_code = f.read() else: filename = "" setup_py_code = "from setuptools import setup; setup()" exec(compile(setup_py_code, filename, "exec")) ''' % ({!r},), "", "exec")) F) setup_py_pathglobal_optionsno_user_configunbuffered_outputreturncCsFtjg}|r|dg7}|dt|g7}|r4||7}|rB|dg7}|S)ao Get setuptools command arguments with shim wrapped setup file invocation. :param setup_py_path: The path to setup.py to be wrapped. :param global_options: Additional global options. :param no_user_config: If True, disables personal user configuration. :param unbuffered_output: If True, adds the unbuffered switch to the argument list. z-uz-cz --no-user-cfg)sys executable_SETUPTOOLS_SHIMformat)rrrrargsr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/setuptools_build.pymake_setuptools_shim_args1s  r)rr build_optionsdestination_dirr cCs(t||dd}|dd|g7}||7}|S)NTrr bdist_wheelz-dr)rrrrrrrr make_setuptools_bdist_wheel_argsKs r)rrr cCst||dd}|ddg7}|S)NTrcleanz--allr)rrrrrrmake_setuptools_clean_args]s r)rrinstall_optionsrprefixhome use_user_siter cCsf|r |r tt|||d}|ddg7}||7}|r>|d|g7}|dk rR|d|g7}|rb|ddg7}|S)N)rrdevelopz --no-deps--prefixz --install-dir--user --prefix=AssertionErrorr)rrrrrrrrrrrmake_setuptools_develop_argshs     r$)r egg_info_dirrr cCs*t||d}|dg7}|r&|d|g7}|S)N)regg_infoz --egg-baser)rr%rrrrrmake_setuptools_egg_info_argss    r') rrrrecord_filenamerootr header_dirrrr pycompiler c Cs|r |r t|r|rtt||| dd} | dd|g7} | dg7} |dk rT| d|g7} |dk rh| d|g7} |dk r|| d|g7} |r| d d g7} | r| d g7} n | d g7} |r| d |g7} | |7} | S)NT)rrrinstallz--recordz#--single-version-externally-managedz--rootrz--homer r!z --compilez --no-compilez--install-headersr") rrrr(r)rr*rrrr+rrrrmake_setuptools_install_argss2          r-)NFF)r textwraptypingrrrdedentrstripr strboolrrrr$r'r-rrrrsh+    ! PK]_'n +utils/__pycache__/virtualenv.cpython-38.pycnu[U ʗRe @sddlZddlZddlZddlZddlZddlmZmZee Z e dZ e dddZe dddZe dd d Zeeedd d Ze dd dZe dddZe dddZdS)N)ListOptionalz8include-system-site-packages\s*=\s*(?Ptrue|false))returncCstjttdtjkS)znChecks if sys.base_prefix and sys.prefix match. This handles PEP 405 compliant virtual environments. base_prefix)sysprefixgetattrr r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/virtualenv.py_running_under_venvsr cCs ttdS)zmChecks if sys.real_prefix is set. This handles virtual environments created with pypa's virtualenv. real_prefix)hasattrrr r r r !_running_under_regular_virtualenvsrcCs tp tS)zBReturn True if we're running inside a virtualenv, False otherwise.)r rr r r r running_under_virtualenvsrc Cs^tjtjd}z2t|dd}|W5QRWSQRXWntk rXYdSXdS)zReads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines Returns None, if it could not read/access the file. z pyvenv.cfgzutf-8)encodingN) ospathjoinrropenread splitlinesOSError)pyvenv_cfg_filefr r r _get_pyvenv_cfg_lines$s $rcCsPt}|dkrtddS|D]*}t|}|dk r |ddkr dSq dS)aZCheck `{sys.prefix}/pyvenv.cfg` for system site-packages inclusion PEP 405 specifies that when system site-packages are not supposed to be visible from a virtual environment, `pyvenv.cfg` must contain the following line: include-system-site-packages = false Additionally, log a warning if accessing the file fails. NzCould not access 'pyvenv.cfg' despite a virtual environment being active. Assuming global site-packages is not accessible in this environment.TvaluefalseF)rloggerwarning#_INCLUDE_SYSTEM_SITE_PACKAGES_REGEXmatchgroup) cfg_linesliner r r r _no_global_under_venv3s  r$cCs0tjtjtj}tj|d}tj|S)zCheck if "no-global-site-packages.txt" exists beside site.py This mirrors logic in pypa/virtualenv for determining whether system site-packages are visible in the virtual environment. zno-global-site-packages.txt)rrdirnameabspathsite__file__rexists) site_mod_dirno_global_site_packages_filer r r #_no_global_under_regular_virtualenvPs r,cCstr tStrtSdS)zHReturns a boolean, whether running in venv with no system site-packages.F)r r$rr,r r r r virtualenv_no_global^s r-)loggingrrer'rtypingrr getLogger__name__rcompilerboolr rrstrrr$r,r-r r r r s   PK]uߥV-utils/__pycache__/typing.cpython-38.opt-1.pycnu[U .ee@s dZdZdS)aBFor neatly implementing static typing in pip. `mypy` - the static type analysis tool we use - uses the `typing` module, which provides core functionality fundamental to mypy's functioning. Generally, `typing` would be imported at runtime and used in that fashion - it acts as a no-op at runtime and does not have any run-time overhead by design. As it turns out, `typing` is not vendorable - it uses separate sources for Python 2/Python 3. Thus, this codebase can not expect it to be present. To work around this, mypy allows the typing import to be behind a False-y optional to prevent it from running at runtime and type-comments can be used to remove the need for the types to be accessible directly during runtime. This module provides the False-y guard in a nicely named fashion so that a curious maintainer can reach here to read this. In pip, all static-typing related imports should be guarded as follows: from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ... Ref: https://github.com/python/mypy/issues/3216 FN)__doc__ZMYPY_CHECK_RUNNINGrr>/usr/lib/python3.8/site-packages/pip/_internal/utils/typing.pysPK]PAk˷-utils/__pycache__/compat.cpython-38.opt-1.pycnu[U .e]% @s~dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z m Z ddl mZddlmZerddlmZmZmZmZz ddlZWnek rdZYnXeZz ddlZWnVek rzddlmZWn.ek rddlZeje_eje_YnXYnXd d d d d dddddg Z e!e"Z#edk pDeZ$e rddl%Z%z e%j&Z&Wne'k rxdZ&YnXe&dk Z(ndZ(ddl)m&Z&e rddZ*e+de*dZ,ndZ,d/ddZ-dd Z.e rd0dd Z/n d1dd Z/dd Z0e r dd l%m1Z1d!dZ2ndd"l3m4Z4d#dZ2d$d%Z5d&d'd(hZ6e j78d)pRe j7d*koRej9d+kZ:d,dZ;e/usr/lib/python3.8/site-packages/pip/_internal/utils/compat.py Lsz-backslashreplace_decode_fn..css|]}t|VqdSr)ord)rbrrrrNscss|]}d|VqdS)z\x%xNr)rcrrrrOs)rangestartendjoin)rZ raw_bytesrrrbackslashreplace_decode_fnKsr(backslashreplace_decodebackslashreplacecCst|tr|St}|r*t|jdkr.d}z||}WnDtk r|dkrXd}d |}t |||j|t d}YnXt t tdddd}|r|j|d d}||}|S) a For display or logging purposes, convert a bytes object (or text) to text (e.g. unicode in Python 2) safe for output. :param desc: An optional phrase describing the input data, for use in the log message if a warning is logged. Defaults to "Bytes object". This function should never error out and so can take a best effort approach. It is okay to be lossy if needed since the return value is just for display. We assume the data is in the locale preferred encoding. If it won't decode properly, we warn the user but decode as best we can. We also ensure that the output can be safely written to standard output without encoding errors. asciiutf-8Nz Bytes objectz&{} does not appear to be encoded as %s)errors __stderr__encodingr*) isinstancerlocaleZgetpreferredencodingcodecslookupnamedecodeUnicodeDecodeErrorformatloggerZwarningr)getattrsysencode)datadescr/Z decoded_dataZ msg_formatZoutput_encodingZoutput_encodedrrrstr_to_displayYs0     r>cCs t|ddS)z)r<rrrrsFcCst|tr|dS|S)Nr,)r0rr;sreplacerrrrs  cCs"t|tr|d|rdndS|S)Nr,rAstrict)r0bytesr5r?rrrrs cCs`ttdr6t|tjtjB}t|j}t|n&tj |sPt |j}n t d||S)a) Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read. O_NOFOLLOWz1%s is a symlink; Will not return uid for symlinks) hasattrosopenO_RDONLYrDfstatst_uidclosepathislinkstatOSError)rLfdZfile_uidrrrrs     get_suffixescCsddtDS)NcSsg|] }|dqS)rr)rsuffixrrr sz*get_extension_suffixes..rQrrrrrsEXTENSION_SUFFIXEScCstSrrUrrrrrscCs0tj|}|dr,|dr,|dd}|S)zm Expand ~ and ~user constructions. Includes a workaround for https://bugs.python.org/issue14768 z~/z//N)rFrL expanduser startswith)rLZexpandedrrrrXs  rXpythonZwsgirefargparsewinZclintcCsNttjdrtj||Stjtj|}tjtj|}||kSdS)z>Provide an alternative for os.path.samefile on Windows/Python2rN)rErFrLrnormcaseabspath)Zfile1Zfile2Zpath1Zpath2rrrrs  cCs ttS) Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. )tupleshutilrrrrrrscCsdd}|dp|dp|d}|sbz(tttj}||}t|Wntk r`YnX|stjddtjdd f}t|dt|dfS) r`cSs\z4ddl}ddl}ddl}|d|||jd}Wntk rJYdSX|dkrXdS|S)NrZhhZ12345678)rr)fcntltermiosstruct unpack_fromZioctlZ TIOCGWINSZ Exception)rPrcrdrecrrrr ioctl_GWINSZsz'get_terminal_size..ioctl_GWINSZrrWZLINESZCOLUMNSP) rFrGctermidrHrKrgenvirongetint)rirhrPrrrr s)N)F)F)>__doc__Z __future__rrr2r1ZloggingrFrbr:Zpip._vendor.sixrrZpip._vendor.urllib3.utilrZpip._internal.utils.typingrtypingrr r r Z_ssl ImportErrorZsslr Z pip._vendorZipaddrZ IPAddressZ ip_addressZ IPNetworkZ ip_network__all__Z getLogger__name__r8ZHAS_TLSZimprAttributeErrorr importlib.utilr(register_errorr)r>rrrrRrZimportlib.machineryrVrXrplatformrYr4rrrErrrrrs           B        PK]U%%(utils/__pycache__/logging.cpython-38.pycnu[U ʗRep-@sddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddlm Z ddl m Z mZmZmZmZmZmZddlmZmZmZmZmZmZddlmZddlmZdd lm Z dd l!m"Z"dd l#m$Z$m%Z%dd l&m'Z'dd l(m)Z)ddl*m+Z+e,Z-e%dZ.Gddde/Z0ee1e1e2dddZ3ej4d,e5eddddZ6e5dddZ7Gdddej8Z9eGdd d Z:Gd!d"d"eZ;Gd#d$d$ejGd%d&d&e Z?Gd'd(d(e Z@e5e2eeAe5d)d*d+ZBdS)-N) dataclass) TextIOWrapper)Filter)AnyClassVar GeneratorListOptionalTextIOType)ConsoleConsoleOptionsConsoleRenderableRenderableType RenderResultRichCast)NullHighlighter) RichHandler)Segment)Style)VERBOSE getLogger)WINDOWS)DEPRECATION_MSG_PREFIX) ensure_dirzpip.subprocessorc@seZdZdZdS)BrokenStdoutLoggingErrorzO Raised if BrokenPipeError occurs for the stdout stream while logging. N)__name__ __module__ __qualname____doc__r r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/logging.pyr#sr) exc_classexcreturncCs0|tkr dStsdSt|to.|jtjtjfkS)NTF)BrokenPipeErrorr isinstanceOSErrorerrnoEINVALEPIPE)r"r#r r r!_is_broken_pipe_error)s r+)NNN)numr$c cs6tt_tj|7_z dVW5tj|8_XdS)zv A context manager which will cause the log output to be indented for any log messages emitted inside it. N)get_indentation _log_state indentation)r-r r r! indent_log6s  r1r$cCs ttddS)Nr0r)getattrr/r r r r!r.Esr.csZeZdZdZddeeeddfddZeeedd d Z e j ed fd d Z Z S)IndentingFormatterz%Y-%m-%dT%H:%M:%SF) add_timestampN)argsr5kwargsr$cs||_tj||dS)z A logging.Formatter that obeys the indent_log() context manager. :param add_timestamp: A bool indicating output lines should be prefixed with their record's timestamp. N)r5super__init__)selfr5r6r7 __class__r r!r9Ls zIndentingFormatter.__init__) formattedlevelnor$cCs.|tjkrdS|trdS|tjkr*dSdS)zv Return the start of the formatted log message (not counting the prefix to add to each line). z WARNING: zERROR: )loggingWARNING startswithrERROR)r:r=r>r r r!get_message_start[s   z$IndentingFormatter.get_message_startrecordr$cslt|}|||j}||}d|jr<||ddt7dfdd|dD}|S)z Calls the standard formatter, but will indent all of the log message lines by our current indentation level. r? csg|] }|qSr r ).0lineprefixr r! xsz-IndentingFormatter.format..T) r8formatrDr>r5 formatTimer.join splitlines)r:rFr= message_startr;rJr!rMks zIndentingFormatter.format)rrrdefault_time_formatrboolr9strintrDr@ LogRecordrM __classcell__r r r;r!r4Isr4c@s0eZdZUeed<eed<eeedddZ dS)IndentedRenderable renderableindent)consoleoptionsr$ccsJ||j|}t|}|D](}td|jV|EdHtdVqdS)NrG )renderrYr split_linesrZ)r:r[r\segmentslinesrIr r r!__rich_console__s   z#IndentedRenderable.__rich_console__N) rrrr__annotations__rUr r rrbr r r r!rX|s rXcsleZdZUgZeeeeed<ee e ddfdd Z e j ddddZe j ddfd d ZZS) RichPipStreamHandlerKEYWORDSN)streamno_colorr$cs&tjt||dddddtddS)NT)filerg soft_wrapF)r[ show_time show_level show_path highlighter)r8r9r r)r:rfrgr;r r!r9s zRichPipStreamHandler.__init__rEcCsd}t|jtst|jdkrdt|jdkrd|jd}t|tttfsTt|dt |t d}nN| |}| ||}|j dk r|j tjkrtdd}n|j tjkrtdd}z|jj|d d |d Wntk r||YnXdS) Nz[present-rich] %srz is not rich-console-renderable)rZred)coloryellowignoreF)overflowcropstyle)r&r6tupleAssertionErrormsglenrrrTrXr.rMrender_messager>r@rCrrAr[print Exception handleError)r:rFrurich_renderablerYmessager r r!emits2        zRichPipStreamHandler.emitcsFtdd\}}|r:|r:|jjtjkr:t||r:tt|S)z1Called when logging is unable to log some output.Nr,) sysexc_infor[rhstdoutr+rr8r})r:rFr"r#r;r r!r}s z RichPipStreamHandler.handleError)rrrrerr rrTrcr rSr9r@rVrr}rWr r r;r!rds  rdcs"eZdZedfdd ZZS)BetterRotatingFileHandlerr2csttj|jtSN)rospathdirname baseFilenamer8_open)r:r;r r!rszBetterRotatingFileHandler._open)rrrrrrWr r r;r!rsrc@s.eZdZeddddZejedddZdS)MaxLevelFilterN)levelr$cCs ||_dSr)r)r:rr r r!r9szMaxLevelFilter.__init__rEcCs |j|jkSr)r>rr:rFr r r!filterszMaxLevelFilter.filter) rrrrUr9r@rVrSrr r r r!rsrcs*eZdZdZejedfdd ZZS)ExcludeLoggerFilterzQ A logging Filter that excludes records from a logger (or its children). rEcst| Sr)r8rrr;r r!rszExcludeLoggerFilter.filter) rrrrr@rVrSrrWr r r;r!rsr) verbosityrg user_log_filer$c Cs|dkrtj}nD|dkrt}n6|dkr.tj}n&|dkr>tj}n|dkrNtj}ntj}t|}|dk }|rt|}d}nd}|}|d krd nd}d d d } ddd} dddg|rdgng} tj dddtjddt j ddt j ddt ddt dddd || d!|| d"d#d$gd%d&d | d!|| d'd#gd%d&|| d!| d'|d(gd%d)d| d*|d+dd,d-d.|| d/d0d1|iid2|S)3znConfigures and sets up all of the logging Returns the requested logging level, as its integer value. r,rnNDEBUGz /dev/null)INFOrCrAzext://sys.stdoutzext://sys.stderr)rstderrz0pip._internal.utils.logging.RichPipStreamHandlerz5pip._internal.utils.logging.BetterRotatingFileHandler)rfrhr[console_errorsconsole_subprocessuser_logFz*pip._internal.utils.logging.MaxLevelFilter)()rzlogging.Filter)rnamez/pip._internal.utils.logging.ExcludeLoggerFilter)exclude_warningsrestrict_to_subprocessexclude_subprocessz %(message)s)rrMT)rrMr5)rZindent_with_timestamprfrrrrZ)rclassrgrffilters formatterrr)rrrfrgrrrhzutf-8r)rrfilenameencodingdelayr)r[rrr)rhandlersz pip._vendorr)versiondisable_existing_loggersr formattersrrootloggers) r@rrrArCCRITICALr getLevelNameconfig dictConfigsubprocess_loggerrr4) rrgr level_numberrinclude_user_logadditional_log_file root_levelvendored_log_level log_streamshandler_classesrr r r! setup_loggings      % Ir)r,)C contextlibr(r@logging.handlersrr threading dataclassesriorrtypingrrrrr r r pip._vendor.rich.consoler r rrrrZpip._vendor.rich.highlighterrpip._vendor.rich.loggingrZpip._vendor.rich.segmentrpip._vendor.rich.stylerZpip._internal.utils._logrrpip._internal.utils.compatrpip._internal.utils.deprecationrpip._internal.utils.miscrlocalr/rr|r BaseExceptionrSr+contextmanagerrUr1r. Formatterr4rXrdrRotatingFileHandlerrrrrTrr r r r!sD   $         3< PK]>&k --0utils/__pycache__/unpacking.cpython-38.opt-1.pycnu[U .e%@sXdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZddlmZddlmZerddlmZmZmZmZmZeeZee ZzddlZee 7ZWnek re d YnXzddl!Z!ee7ZWn ek re d YnXd d Z"d dZ#ddZ$ddZ%dddZ&ddZ'dddZ(dS)zUtilities related archives. )absolute_importN)InstallationError)BZ2_EXTENSIONSTAR_EXTENSIONS XZ_EXTENSIONSZIP_EXTENSIONS) ensure_dir)MYPY_CHECK_RUNNING)IterableListOptionalTextUnionzbz2 module is not availablezlzma module is not availablecCstd}t||S)zBGet the current umask which involves having to set it temporarily.r)osumask)maskrA/usr/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py current_umask2s  rcCsh|dd}d|krHd|kr4|d|dksd}n8|trRd}n$|drfd}ntd|d }t||}zt d d | D}| D]}|j }|rt |d }tj||}t||sd }t||||zt|j|d|Wntjk rYnX|r4t|q|rz|||Wn>tk r} ztd||j | WYqW5d} ~ XYnXqz||} WnBttfk r} ztd||j | WYqW5d} ~ XYnXttj|t|d} t | | W5QRX| |!|||j"d@rt#|dt$dBqW5| XdS)a Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. z.gzz.tgzzr:gzzr:bz2zr:xzz.tarrz-Cannot determine compression type for file %szr:*cSsg|] }|jqSrr=).0memberrrr szuntar_file..rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})rFz/In the tar file %s the member %s is invalid: %sNr*r(r))%rlowerr2rrloggerZwarningtarfiler+r,r!Z getmembersr=rrrr/r%rr1Z data_filterreplaceZLinkOutsideDestinationErrorisdirZissymZ_extract_member ExceptionZ extractfileKeyErrorAttributeErrorr0r6r7utimerBr5r) r.r8rBZtarr;rHr>rr@excrArCrrr untar_files           rTcCstj|}|dks,|ts,t|rDt|||d dnR|dkslt |sl|t t t rxt||ntd|||td|dS)Nzapplication/zipz.whl)r9zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of {})rrrealpathrJr2rr-Z is_zipfilerDrLZ is_tarfilerrrrTrKZcriticalrr1)r.r8Z content_typerrr unpack_files<     rV)T)N))__doc__Z __future__rZloggingrr6r3rLr-Zpip._internal.exceptionsrZpip._internal.utils.filetypesrrrrZpip._internal.utils.miscrZpip._internal.utils.typingr typingr r r r rZ getLogger__name__rKZSUPPORTED_EXTENSIONSbz2 ImportErrordebugZlzmarrr!r%rDrTrVrrrrsB        4^PK]g{nn1utils/__pycache__/virtualenv.cpython-38.opt-1.pycnu[U .e{@s,ddlZddlZddlZddZddZdS)NcCs*ttdrdStjttdtjkr&dSdS)zM Return True if we're running inside a virtualenv, False otherwise. Z real_prefixT base_prefixF)hasattrsysprefixgetattrrrB/usr/lib/python3.8/site-packages/pip/_internal/utils/virtualenv.pyrunning_under_virtualenvs  r cCsBtjtjtj}tj|d}tr:tj|r:dSdSdS)z? Return True if in a venv and no system site packages. zno-global-site-packages.txtTFN) ospathdirnameabspathsite__file__joinr isfile)Z site_mod_dirZno_global_filerrrvirtualenv_no_globals r)Zos.pathr rrr rrrrrsPK]a'utils/__pycache__/compat.cpython-38.pycnu[U ʗRe\@s|dZddlZddlZddlZdddgZeeZedddZ e e d d dZ d d d hZ ejdpvejdkovejdkZdS)zKStuff that differs in different Python versions and platform distributions.N get_path_uid stdlib_pkgsWINDOWS)returncCs4zddl}WdStk r"YnXddlm}|S)NrT) IS_PYOPENSSL)_ssl ImportErrorpip._vendor.urllib3.utilr)rrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/compat.pyhas_tlss r )pathrcCsbttdr6t|tjtjB}t|j}t|n(tj |sPt |j}nt |d|S)a) Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read. O_NOFOLLOWz/ is a symlink; Will not return uid for symlinks) hasattrosopenO_RDONLYrfstatst_uidcloser islinkstatOSError)r fdfile_uidr r r rs    pythonwsgirefargparsewinclint)__doc__loggingrsys__all__ getLogger__name__loggerboolr strintrrplatform startswithnamerr r r r s    PK]G.2MM)utils/__pycache__/encoding.cpython-38.pycnu[U ʗRe@sUddlZddlZddlZddlZddlmZmZejdfejdfej dfej dfej dfej dfej d fgZeeeefed <ed Zeed d dZdS)N)ListTuplezutf-8zutf-16z utf-16-bez utf-16-lezutf-32z utf-32-bez utf-32-leBOMSscoding[:=]\s*([-\w.]+))datareturncCstD],\}}||r|t|d|Sq|dddD]T}|dddkrDt|rDt|}|dk sxt|dd}||SqD|t dpt S) zCheck a bytes string for a BOM to correctly detect the encoding Fallback to locale.getpreferredencoding(False) like open() on Python3N r#asciiF) r startswithlendecodesplit ENCODING_REsearchAssertionErrorgroupslocalegetpreferredencodingsysgetdefaultencoding)rbomencodinglineresultr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/encoding.py auto_decodes    r)codecsrrertypingrrBOM_UTF8 BOM_UTF16 BOM_UTF16_BE BOM_UTF16_LE BOM_UTF32 BOM_UTF32_BE BOM_UTF32_LErbytesstr__annotations__compilerrrrrrs PK]yk,,0utils/__pycache__/filetypes.cpython-38.opt-1.pycnu[U .e;@sLdZddlmZer ddlmZdZdZdZdefZdZ eee eZ d S) zFiletype information. )MYPY_CHECK_RUNNING)Tuplez.whl)z.tar.bz2z.tbz)z.tar.xzz.txzz.tlzz.tar.lzz .tar.lzmaz.zip)z.tar.gzz.tgzz.tarN) __doc__Zpip._internal.utils.typingrtypingrZWHEEL_EXTENSIONZBZ2_EXTENSIONSZ XZ_EXTENSIONSZZIP_EXTENSIONSZTAR_EXTENSIONSZARCHIVE_EXTENSIONSrrA/usr/lib/python3.8/site-packages/pip/_internal/utils/filetypes.pys  PK]# 2utils/__pycache__/deprecation.cpython-38.opt-1.pycnu[U .e @sdZddlmZddlZddlZddlmZddlmZ ddl m Z e rXddl m Z mZdZGd d d eZdadd d Zd dZdddZdS)zN A module that implements tooling to enable easy warnings about deprecations. )absolute_importN)parse) __version__)MYPY_CHECK_RUNNING)AnyOptionalz DEPRECATION: c@s eZdZdS)PipDeprecationWarningN)__name__ __module__ __qualname__r r C/usr/lib/python3.8/site-packages/pip/_internal/utils/deprecation.pyrsrcCsZ|dk r$tdk rVt||||||n2t|trDtd}||nt||||||dS)Nzpip._internal.deprecations)_original_showwarning issubclassrloggingZ getLoggerZwarning)messagecategoryfilenamelinenofilelineZloggerr r r _showwarning!s*   rcCs(tjdtddtdkr$tjatt_dS)NdefaultT)append)warnings simplefilterrr showwarningrr r r r install_warning_logger2srcCsh|tdf|df|df|dfg}ddd|D}|dk rTttt|krTt|tj|td d dS) aHelper to deprecate existing functionality. reason: Textual reason shown to the user about why this functionality has been deprecated. replacement: Textual suggestion shown to the user about what alternative functionality they can use. gone_in: The version of pip does this functionality should get removed in. Raises errors if pip's current version is greater than or equal to this. issue: Issue number on the tracker that would serve as a useful place for users to find related discussion and provide feedback. Always pass replacement, gone_in and issue as keyword arguments for clarity at the call site. z{}z2pip {} will remove support for this functionality.zA possible replacement is {}.zPYou can find discussion regarding this at https://github.com/pypa/pip/issues/{}. css$|]\}}|dk r||VqdS)N)format).0valtemplater r r `szdeprecated..N)r stacklevel)DEPRECATION_MSG_PREFIXjoinrcurrent_versionrrwarn)reasonZ replacementZgone_inZissueZ sentencesrr r r deprecated>s  r+)NN)N)__doc__Z __future__rrrZpip._vendor.packaging.versionrZpiprr(Zpip._internal.utils.typingrtypingrrr&Warningrrrrr+r r r r s      PK]p".".#utils/__pycache__/ui.cpython-38.pycnu[U .eR6@sxddlmZmZddlZddlZddlZddlZddlZddlm Z m Z mZddl m Z ddl mZmZddlmZmZmZddlmZddlmZdd lmZdd lmZdd lmZerdd lmZm Z m!Z!zdd l m"Z"Wne#k rdZ"YnXe$e%Z&ddZ'e'eeZ(Gddde)Z*GdddeZ+GdddeZ,Gddde)Z-Gddde)Z.Gddde.e*e-Z/Gddde/e(Z0Gddde/e+Z1Gd d!d!e/eZ2Gd"d#d#e/eZ3Gd$d%d%e/e,Z4Gd&d'd'e.e*e-eZ5e1e1fe0e5fe2e5fe3e5fe4e5fd(Z6d7d)d*Z7ej8d+d,Z9Gd-d.d.e)Z:Gd/d0d0e)Z;Gd1d2d2e;ZdS)8)absolute_importdivisionN)SIGINTdefault_int_handlersignal)six) HIDE_CURSOR SHOW_CURSOR)BarFillingCirclesBarIncrementalBar)Spinner)WINDOWS)get_indentation) format_size)MYPY_CHECK_RUNNING)AnyIteratorIO)coloramacCst|jdd}|s|St|dtt|dtg}|tt|dg7}zt||Wntk rz|YSX|SdS)NencodingZ empty_fillZfillphases)getattrfilerZ text_typelistjoinencodeUnicodeEncodeError)Z preferredZfallbackrZ charactersr:/usr/lib/python3.8/site-packages/pip/_internal/utils/ui.py_select_progress_class%s r cs4eZdZdZfddZfddZddZZS)InterruptibleMixina Helper to ensure that self.finish() gets called on keyboard interrupt. This allows downloads to be interrupted without leaving temporary state (like hidden cursors) behind. This class is similar to the progress library's existing SigIntMixin helper, but as of version 1.2, that helper has the following problems: 1. It calls sys.exit(). 2. It discards the existing SIGINT handler completely. 3. It leaves its own handler in place even after an uninterrupted finish, which will have unexpected delayed effects if the user triggers an unrelated keyboard interrupt some time after a progress-displaying download has already completed, for example. cs4tt|j||tt|j|_|jdkr0t|_dS)z= Save the original SIGINT handler for later. N)superr!__init__rr handle_sigintoriginal_handlerrselfargskwargs __class__rrr#Us zInterruptibleMixin.__init__cstt|tt|jdS)z Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. N)r"r!finishrrr%r'r*rrr,eszInterruptibleMixin.finishcCs||||dS)z Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. N)r,r%)r'Zsignumframerrrr$osz InterruptibleMixin.handle_sigint)__name__ __module__ __qualname____doc__r#r,r$ __classcell__rrr*rr!Cs  r!c@seZdZddZdS) SilentBarcCsdSNrr-rrrupdate|szSilentBar.updateN)r/r0r1r6rrrrr4zsr4c@seZdZdZdZdZdZdS) BlueEmojiBar %(percent)d%% )u🔹u🔷u🔵N)r/r0r1suffixZ bar_prefixZ bar_suffixrrrrrr7sr7csJeZdZfddZeddZeddZeddZd d d ZZ S) DownloadProgressMixincs,tt|j||dtd|j|_dS)Nr9)r"r;r#rmessager&r*rrr#szDownloadProgressMixin.__init__cCs t|jSr5)rindexr-rrr downloadedsz DownloadProgressMixin.downloadedcCs |jdkrdStd|jdS)Ngz...z/s)Zavgrr-rrrdownload_speeds z$DownloadProgressMixin.download_speedcCs|jrd|jSdS)Nzeta %s)ZetaZeta_tdr-rrr pretty_etas z DownloadProgressMixin.pretty_etar@ccs&|D]}|V||q|dSr5)nextr,)r'itnxrrriters zDownloadProgressMixin.iter)r@) r/r0r1r#propertyr?rArCrHr3rrr*rr;s    r;cseZdZfddZZS) WindowsMixincs\trjrd_ttj||trXtrXtj_fddj_fddj_ dS)NFcs jjSr5)rwrappedisattyrr-rrz'WindowsMixin.__init__..cs jjSr5)rrKflushrr-rrrMrN) rZ hide_cursorr"rJr#rZ AnsiToWin32rrLrOr&r*r-rr#s zWindowsMixin.__init__)r/r0r1r#r3rrr*rrJsrJc@seZdZejZdZdZdS)BaseDownloadProgressBarr8z0%(downloaded)s %(download_speed)s %(pretty_eta)sN)r/r0r1sysstdoutrr=r:rrrrrPsrPc@s eZdZdS)DefaultDownloadProgressBarNr/r0r1rrrrrSsrSc@s eZdZdS)DownloadSilentBarNrTrrrrrUsrUc@s eZdZdS) DownloadBarNrTrrrrrVsrVc@s eZdZdS)DownloadFillingCirclesBarNrTrrrrrWsrWc@s eZdZdS)DownloadBlueEmojiProgressBarNrTrrrrrXsrXc@s&eZdZejZdZddZddZdS)DownloadProgressSpinnerz!%(downloaded)s %(download_speed)scCs"t|dst|j|_t|jS)N_phaser)hasattr itertoolscyclerrZrDr-rrr next_phases z"DownloadProgressSpinner.next_phasecCsN|j|}|}|j|}d||r*dnd||r6dnd|g}||dS)NrBr9)r=r^r:rZwriteln)r'r=Zphaser:linerrrr6s    zDownloadProgressSpinner.updateN) r/r0r1rQrRrr:r^r6rrrrrYsrY)ZoffZonasciiZprettyZemojicCs8|dks|dkr t|djSt|d|djSdS)Nrr@)max) BAR_TYPESrH)Z progress_barrarrrDownloadProgressProvider srcc csPtr dVn@|r"ttjkr*dVn"|tz dVW5|tXdSr5) rrLloggergetEffectiveLevelloggingINFOwriterr )rrrr hidden_cursors  ric@s$eZdZddZddZddZdS) RateLimitercCs||_d|_dS)Nr)_min_update_interval_seconds _last_update)r'min_update_interval_secondsrrrr#-szRateLimiter.__init__cCst}||j}||jkSr5)timerlrk)r'ZnowZdeltarrrready2s zRateLimiter.readycCst|_dSr5)rnrlr-rrrreset8szRateLimiter.resetN)r/r0r1r#rorprrrrrj,srjc@seZdZddZddZdS)SpinnerInterfacecCs tdSr5NotImplementedErrorr-rrrspin>szSpinnerInterface.spincCs tdSr5rrr'Z final_statusrrrr,BszSpinnerInterface.finishN)r/r0r1rtr,rrrrrq=srqc@s.eZdZd ddZddZdd Zd d ZdS) InteractiveSpinnerN-\|/?cCs\||_|dkrtj}||_t||_d|_t||_ |j dt |jdd|_ dS)NFr9z ... r) _messagerQrR_filerj _rate_limiter _finishedr\r] _spin_cyclerhr_width)r'r=rZ spin_charsrmrrrr#Hs  zInteractiveSpinner.__init__cCs\|jr td|j}|j|d|j||j|t||_|j|jdS)Nr9) r|AssertionErrorr~rzrhlenrOr{rp)r'statusZbackuprrr_writeWs     zInteractiveSpinner._writecCs,|jr dS|jsdS|t|jdSr5)r|r{rorrDr}r-rrrrtcs  zInteractiveSpinner.spincCs4|jr dS|||jd|jd|_dS)N T)r|rrzrhrOrurrrr,ks    zInteractiveSpinner.finish)Nrwrx)r/r0r1r#rrtr,rrrrrvGs   rvc@s.eZdZd ddZddZddZdd Zd S) NonInteractiveSpinner<cCs$||_d|_t||_|ddS)NFZstarted)ryr|rjr{_update)r'r=rmrrrr#zs zNonInteractiveSpinner.__init__cCs(|jr t|jtd|j|dS)Nz%s: %s)r|rr{rprdinfory)r'rrrrrs  zNonInteractiveSpinner._updatecCs&|jr dS|jsdS|ddS)Nzstill running...)r|r{rorr-rrrrts  zNonInteractiveSpinner.spincCs$|jr dS|d|fd|_dS)Nzfinished with status '%s'T)r|rrurrrr,szNonInteractiveSpinner.finishN)r)r/r0r1r#rrtr,rrrrrys rc cstjr"ttjkr"t|}nt|}z t tj |VW5QRXWn>t k rj| dYn*t k r| dYn X| ddS)NZcancelederrorZdone) rQrRrLrdrerfrgrvrriKeyboardInterruptr, Exception)r=Zspinnerrrr open_spinners    r)N)?Z __future__rr contextlibr\rfrQrnrrrZ pip._vendorrZpip._vendor.progressrr Zpip._vendor.progress.barr r r Zpip._vendor.progress.spinnerr Zpip._internal.utils.compatrZpip._internal.utils.loggingrZpip._internal.utils.miscrZpip._internal.utils.typingrtypingrrrrrZ getLoggerr/rdr Z_BaseBarobjectr!r4r7r;rJrPrSrUrVrWrXrYrbrccontextmanagerrirjrqrvrrrrrrs~         7       2PK]Bm;}}(utils/__pycache__/appdirs.cpython-38.pycnu[U ʗRe@s|dZddlZddlZddlmZddlmZeedddZ dee ed d d Z dee ed d d Z eeedddZ dS)z This code wraps the vendored appdirs module to so the return values are compatible for the current pip code base. The intention is to rewrite current usages gradually, keeping the tests pass, and eventually drop this after all usages are changed. N)List) platformdirs)appnamereturncCstj|ddS)NF) appauthor)_appdirsuser_cache_dir)rr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/appdirs.pyrsrT)rroamingrcCsBtj|d|d}tj|r |Sd}|r6tj||}tj|S)NFrr z ~/.config/)r user_data_dirospathisdirjoin expanduser)rr rlinux_like_pathr r r _macos_user_config_dirs rcCs$tjdkrt||Stj|d|dS)NdarwinFr )sysplatformrruser_config_dir)rr r r r r"s  rcCsNtjdkrtj|dddgStj|ddd}tjdkr<|gS|tjdgS)NrFT)r multipathwin32z/etc)rrr site_data_dirsite_config_dirsplitrpathsep)rdirvalr r r site_config_dirs+s   r )T)T)__doc__rrtypingr pip._vendorrrstrrboolrrr r r r r s   PK]ߔ/utils/__pycache__/temp_dir.cpython-38.opt-1.pycnu[U .e@sddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z e r\ddl m Z eeZGdddeZGdd d eZdS) )absolute_importN)rmtree)MYPY_CHECK_RUNNING)OptionalcsVeZdZdZdfdd ZeddZdd Zd d Zd d Z ddZ ddZ Z S) TempDirectoryaMHelper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. NtempcsPtt||dkr"|dkr"d}|dkr4||}||_d|_||_||_dS)NTF)superr__init___create_path_deleteddeletekind)selfpathr r __class__@/usr/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.pyr +s zTempDirectory.__init__cCs|jSN)r rrrrr@szTempDirectory.pathcCsd|jj|jS)Nz <{} {!r}>)formatr__name__rrrrr__repr__HszTempDirectory.__repr__cCs|Srrrrrr __enter__KszTempDirectory.__enter__cCs|jr|dSr)r cleanup)rexcvaluetbrrr__exit__NszTempDirectory.__exit__cCs.tjtjd|d}td||S)zECreate a temporary directory and store its path in self.path pip-{}-prefixCreated temporary directory: {})osrrealpathtempfilemkdtemprloggerdebug)rrrrrrr Rs zTempDirectory._createcCs"d|_tj|jrt|jdS)z?Remove the temporary directory created and reset state TN)r r$rexistsr rrrrrr_szTempDirectory.cleanup)NNr) r __module__ __qualname____doc__r propertyrrrrr r __classcell__rrrrrs  rcs:eZdZdZdZd fdd ZeddZdd ZZ S) AdjacentTempDirectoryaHelper class that creates a temporary directory adjacent to a real one. Attributes: original The original directory to create a temp directory for. path After calling create() or entering, contains the full path to the temporary directory. delete Whether the directory should be deleted when exiting (when used as a contextmanager) z-~.=%0123456789Ncs"|d|_tt|j|ddS)Nz/\)r )rstriporiginalrr0r )rr2r rrrr |s zAdjacentTempDirectory.__init__ccstdt|D]D}t|j|dD],}dd|||d}||kr$|Vq$qtt|jD]8}t|j|D]$}dd||}||krt|VqtqbdS)a Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package). ~N)rangelen itertoolscombinations_with_replacement LEADING_CHARSjoin)clsnamei candidatenew_namerrr_generate_namess  z%AdjacentTempDirectory._generate_namesc Cstj|j\}}||D]b}tj||}zt|Wn0tk rl}z|jtj kr\W5d}~XYqXtj |}qqtj t j d |d}td ||S)Nr r!r#)r$rsplitr2rAr;mkdirOSErrorerrnoZEEXISTr%r&r'rr(r))rrrootr=r?rZexrrrr s  zAdjacentTempDirectory._create)N) rr+r,r-r:r classmethodrAr r/rrrrr0gs  r0)Z __future__rrEr8ZloggingZos.pathr$r&Zpip._internal.utils.miscrZpip._internal.utils.typingrtypingrZ getLoggerrr(objectrr0rrrrs     QPK]֬Drr%utils/__pycache__/urls.cpython-38.pycnu[U ʗRe@spddlZddlZddlZddlZddlmZddlmZe ee dddZ e e dd d Z e e dd d Z dS) N)Optional)WINDOWS)urlreturncCs d|kr dS|dddS)N:rr)splitlower)rr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/urls.pyget_url_scheme sr )pathrcCs.tjtj|}tjdtj|}|S)zh Convert a path to a file: URL. The path will be made absolute and have quoted path parts. file:) osr normpathabspathurllibparseurljoinrequest pathname2url)r rr r r path_to_urlsrcCs|dstd|dtj|\}}}}}|r<|dkrBd}ntrPd|}ntd|tj||}tr|st |dkr|d d kr|d t j kr|d d dkr|d d}|S)z( Convert a file: URL to a path. rz1You can only turn file: urls into filenames (not ) localhostz\\z8non-local file URIs are not supported on this platform: r/r)rz:/N) startswithAssertionErrorrrurlsplitr ValueErrorr url2pathnamelenstring ascii_letters)r_netlocr r r r url_to_paths8       r)) rr% urllib.parserurllib.requesttypingrcompatrstrr rr)r r r r s   PK]uߥV'utils/__pycache__/typing.cpython-38.pycnu[U .ee@s dZdZdS)aBFor neatly implementing static typing in pip. `mypy` - the static type analysis tool we use - uses the `typing` module, which provides core functionality fundamental to mypy's functioning. Generally, `typing` would be imported at runtime and used in that fashion - it acts as a no-op at runtime and does not have any run-time overhead by design. As it turns out, `typing` is not vendorable - it uses separate sources for Python 2/Python 3. Thus, this codebase can not expect it to be present. To work around this, mypy allows the typing import to be behind a False-y optional to prevent it from running at runtime and type-comments can be used to remove the need for the types to be accessible directly during runtime. This module provides the False-y guard in a nicely named fashion so that a curious maintainer can reach here to read this. In pip, all static-typing related imports should be guarded as follows: from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ... Ref: https://github.com/python/mypy/issues/3216 FN)__doc__ZMYPY_CHECK_RUNNINGrr>/usr/lib/python3.8/site-packages/pip/_internal/utils/typing.pysPK]QdC/utils/__pycache__/__init__.cpython-38.opt-1.pycnu[U .e@sdS)Nrrr@/usr/lib/python3.8/site-packages/pip/_internal/utils/__init__.pyPK]5zff'utils/__pycache__/hashes.cpython-38.pycnu[U ʗRe@sddlZddlmZmZmZmZmZddlmZm Z m Z ddl m Z er`ddlm Z ddlmZdZddd gZGd d d ZGd d d eZdS)N) TYPE_CHECKINGBinaryIODictIterableList) HashMismatch HashMissingInstallationError) read_chunks)_Hash)NoReturnsha256sha384sha512c@seZdZdZd#eeeefddddZdddddZe e d d d Z eee d d dZ eeddddZeedfddddZeddddZeddddZe d ddZee ddd Ze d d!d"ZdS)$HasheszaA wrapper that builds multiple hashes at once and checks them against known-good values N)hashesreturncCs4i}|dk r*|D]\}}t|||<q||_dS)zo :param hashes: A dict of algorithm names pointing to lists of allowed hex digests N)itemssorted_allowed)selfrallowedalgkeysr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/hashes.py__init__s zHashes.__init__)otherrcsbt|tstS|sSs|Si}|jD],\}jkr@q,fdd|D|<q,t|S)Ncsg|]}|jkr|qSr)r).0vrrrr ;sz"Hashes.__and__..) isinstancerNotImplementedrr)rrnewvaluesrr r__and__+s  zHashes.__and__rcCstdd|jDS)Ncss|]}t|VqdSN)len)rdigestsrrr @sz&Hashes.digest_count..)sumrr%rrrr digest_count>szHashes.digest_count) hash_name hex_digestrcCs||j|gkS)z/Return whether the given hex digest is allowed.)rget)rr/r0rrris_hash_allowedBszHashes.is_hash_allowed)chunksrc Csi}|jD]>}zt|||<Wqttfk rJtd|YqXq|D]}|D]}||q^qR| D] \}}| |j|krxdSqx| |dS)zCheck good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. zUnknown hash name: N) rrhashlibr$ ValueError TypeErrorr r%updater hexdigest_raise)rr3gotsr/chunkhashgotrrrcheck_against_chunksFs zHashes.check_against_chunksr r r:rcCst|j|dSr()rrrr:rrrr9]sz Hashes._raise)filercCs|t|S)zaCheck good hashes against a file-like object Raise HashMismatch if none match. )r>r )rrArrrcheck_against_file`szHashes.check_against_file)pathrc Cs,t|d}||W5QRSQRXdS)Nrb)openrB)rrCrArrrcheck_against_pathhs zHashes.check_against_pathcCs t|jS)z,Return whether I know any known-good hashes.)boolrr-rrr__bool__lszHashes.__bool__cCst|tstS|j|jkSr()r"rr#r)rrrrr__eq__ps z Hashes.__eq__cCs"tdtdd|jDS)N,css*|]"\}}|D]}d||fVqqdS):N)join)rr digest_listdigestrrrr+xsz"Hashes.__hash__..)r<rLrrrr-rrr__hash__uszHashes.__hash__)N)__name__ __module__ __qualname____doc__rstrrrr&propertyintr.rGr2rbytesr>r9rrBrFrHobjectrIrOrrrrrs rcs>eZdZdZddfdd Zeedfddd d ZZS) MissingHasheszA workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. Nr'cstjtgiddS)z!Don't offer the ``hashes`` kwarg.)rN)superr FAVORITE_HASHr- __class__rrrszMissingHashes.__init__r r r?cCst|tdSr()rr[r8r@rrrr9szMissingHashes._raise) rPrQrRrSrrrTr9 __classcell__rrr\rrYsrY)r4typingrrrrrpip._internal.exceptionsrrr pip._internal.utils.miscr r r r[ STRONG_HASHESrrYrrrrs    hPK]TT+utils/__pycache__/subprocess.cpython-38.pycnu[U ʗRe#@sxddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z ddl mZddlmZmZddlmZddlmZmZddlmZerddlmZe e eefZe eeefed d d Ze e eefed d d Ze e eefe ed ddZde e eefee ede ee e e eefe eee ee ee eeed ddZ!eeddddZ"dS)N) TYPE_CHECKINGAnyCallableIterableListMappingOptionalUnion)escape)SpinnerInterface open_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger) HiddenText)Literal)argsreturncGs2g}|D]$}t|tr"||q||q|S)z& Create a CommandArgs object. ) isinstancelistextendappend)r command_argsargr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py make_command s    rcCsddd|DS)z/ Format command arguments for display.  css0|](}t|trtt|nt|VqdS)N)rrshlexquotestr.0rrrr :sz&format_command_args..)joinrrrrformat_command_args1s r&cCsdd|DS)z= Return the arguments in their raw, unredacted form. cSs g|]}t|tr|jn|qSr)rrsecretr!rrr Dsz'reveal_command_args..rr%rrrreveal_command_args@sr)FraiseTz"Literal["raise", "warn", "ignore"]) cmd show_stdoutcwd on_returncodeextra_ok_returncodes extra_environ unset_environspinnerlog_failed_cmd stdout_only command_descrc  Cs|dkr g}|dkrg}|r*tj} tj} n tj} t} t| k} | oL|dk }| d| tj }|rp| ||D]}| |dqtz0t j t|t jt j| st jnt j||dd}Wn6tk r}z|rtd|| W5d}~XYnXg}| s|jst|jst|j|j}|s.qh|}||d| ||r|s\t|qz |W5|jr|jXd|}nT|\}}|D]}| |q|||D]}| |q|||}|jo|j|k}|r(|s t|r| dn | d |r|d krt!| |j| sJ|ndd }|rt"d |tjd t#t$|ddidtjdt#|pdddid|n8|dkrt%d| |j|n|dkrnt&d||S)a Args: show_stdout: if true, use INFO to log the subprocess's stderr and stdout streams. Otherwise, use DEBUG. Defaults to False. extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. unset_environ: an iterable of environment variable names to unset prior to calling subprocess.Popen(). log_failed_cmd: if false, failed commands are not logged, only raised. stdout_only: if true, return only stdout, else return both. When true, logging of both stdout and stderr occurs when the subprocess has terminated, else logging occurs as subprocess output is produced. NzRunning command %sbackslashreplace)stdinstdoutstderrr-enverrorsz#Error %s while executing command %s errordoner*)command_description exit_code output_linesz[present-rich] %sz*[bold magenta]full command[/]: [blue]%s[/]markupT)extraz[bold magenta]cwd[/]: %sz [inherit]warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=)'rinfologgingINFOverbosergetEffectiveLevelosenvironcopyupdatepop subprocessPopenr)PIPESTDOUT Exceptioncriticalr8AssertionErrorr7closereadlinerstriprspinwaitr$ communicate splitlines returncodefinishr r>r r&warning ValueError)r+r,r-r.r/r0r1r2r3r4r5log_subprocess used_levelshowing_subprocess use_spinnerr:nameprocexc all_outputlineoutputouterrout_lineerr_lineproc_had_errorr>rrrcall_subprocessGs                               rr).N)messagercs2dttttttttfddfdd }|S)zProvide a subprocess_runner that shows a spinner message. Intended for use with for pep517's Pep517HookCaller. Thus, the runner has an API that matches what's expected by Pep517HookCaller.subprocess_runner. N)r+r-r0rc s*t}t||||dW5QRXdS)N)r5r-r0r2)r rr)r+r-r0r2rsrrrunners z+runner_with_spinner_message..runner)NN)rr rrr)rsrurrtrrunner_with_spinner_messages rv) FNr*NNNNTF)#rHrLrrQtypingrrrrrrrr Zpip._vendor.rich.markupr pip._internal.cli.spinnersr r pip._internal.exceptionsr pip._internal.utils.loggingrrpip._internal.utils.miscrrr CommandArgsrr&r)boolintrrrvrrrrsP(        )PK]6HH*utils/__pycache__/packaging.cpython-38.pycnu[U ʗRe<@sddlZddlZddlZddlmZmZmZmZddlm Z m Z ddl m Z ede ZeeZee eedfeddd Zejd d e e d d dZe edddZdS)N)NewTypeOptionalTuplecast) specifiersversion RequirementNormalizedExtra.)requires_python version_inforeturncCs4|dkr dSt|}tdtt|}||kS)a Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return `False`. :raises InvalidSpecifier: If `requires_python` has an invalid format. NT.)r SpecifierSetrparsejoinmapstr)r r requires_python_specifierpython_versionr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/packaging.pycheck_requires_pythons  ri)maxsize) req_stringr cCst|S)z5Construct a packaging.Requirement object with cachingr)rrrrget_requirement%sr)extrar cCstttdd|S)aDConvert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. This function is duplicated from ``pkg_resources``. Note that this is not the same to either ``canonicalize_name`` or ``_egg_link_name``. z[^A-Za-z0-9.-]+_)rr resublower)rrrr safe_extra0s r!) functoolsloggingrtypingrrrrZpip._vendor.packagingrr"pip._vendor.packaging.requirementsr rr getLogger__name__loggerintboolr lru_cacherr!rrrrs       PK]Yi)utils/__pycache__/temp_dir.cpython-38.pycnu[U ʗRe@s$UddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZeeZedddZedd d d Zdae eed <ee d dddZGdddZdae eed<ee eddfdddZGdddZeZGdddZ Gddde Z!dS)N) ExitStackcontextmanager)AnyDict GeneratorOptionalTypeVarUnion)enumrmtree_T TempDirectory)boundz build-envzephem-wheel-cachez req-build) BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILD_tempdir_manager)NNNreturnc cs2t"}t|}az dVW5|aXW5QRXdSN)rr)stackold_tempdir_managerr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.pyglobal_tempdir_managers   rc@s@eZdZdZddddZeeddddZeed d d ZdS) TempDirectoryTypeRegistryzManages temp directory behaviorNrcCs i|_dSr_should_deleteselfrrr__init__*sz"TempDirectoryTypeRegistry.__init__)kindvaluercCs||j|<dS)z[Indicate whether a TempDirectory of the given kind should be auto-deleted. Nr)rr!r"rrr set_delete-sz$TempDirectoryTypeRegistry.set_deleter!rcCs|j|dS)z^Get configured auto-delete flag for a given TempDirectory type, default True. T)rget)rr!rrr get_delete3sz$TempDirectoryTypeRegistry.get_delete) __name__ __module__ __qualname____doc__r strboolr#r&rrrrr'sr_tempdir_registryccs t}taz tVW5|aXdS)zuProvides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. N)r-r)old_tempdir_registryrrrtempdir_registry=s  r/c@s eZdZdS)_DefaultN)r'r(r)rrrrr0Ksr0cseZdZdZdeddfeeeede feedfdd Z e edd d Z edd d Z eed ddZeeeddddZeedddZddddZZS)r aMHelper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. NtempF)pathdeleter!globally_managedcslt|tkr$|dk r d}nd}|dkr6||}||_d|_||_||_|rhtdk s^t t |dS)NF) superr _default_create_path_deletedr3r!rAssertionError enter_context)rr2r3r!r4 __class__rrr gs   zTempDirectory.__init__rcCs|jrtd|j|jS)Nz"Attempted to access deleted path: )r9r:r8rrrrr2szTempDirectory.pathcCsd|jjd|jdS)N< >)r=r'r2rrrr__repr__szTempDirectory.__repr__)rrcCs|Srrrrrr __enter__szTempDirectory.__enter__)excr"tbrcCs8|jdk r|j}ntr$t|j}nd}|r4|dS)NT)r3r-r&r!cleanup)rrCr"rDr3rrr__exit__s zTempDirectory.__exit__r$cCs,tjtjd|dd}td||S)zs4     ^PK];[utils/filesystem.pynu[import fnmatch import os import os.path import random import shutil import stat import sys from contextlib import contextmanager from tempfile import NamedTemporaryFile from typing import Any, BinaryIO, Iterator, List, Union, cast from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed from pip._internal.utils.compat import get_path_uid from pip._internal.utils.misc import format_size def check_path_owner(path: str) -> bool: # If we don't have a way to check the effective uid of this process, then # we'll just assume that we own the directory. if sys.platform == "win32" or not hasattr(os, "geteuid"): return True assert os.path.isabs(path) previous = None while path != previous: if os.path.lexists(path): # Check if path is writable by current user. if os.geteuid() == 0: # Special handling for root user in order to handle properly # cases where users use sudo without -H flag. try: path_uid = get_path_uid(path) except OSError: return False return path_uid == 0 else: return os.access(path, os.W_OK) else: previous, path = path, os.path.dirname(path) return False # assume we don't own the path def copy2_fixed(src: str, dest: str) -> None: """Wrap shutil.copy2() but map errors copying socket files to SpecialFileError as expected. See also https://bugs.python.org/issue37700. """ try: shutil.copy2(src, dest) except OSError: for f in [src, dest]: try: is_socket_file = is_socket(f) except OSError: # An error has already occurred. Another error here is not # a problem and we can ignore it. pass else: if is_socket_file: raise shutil.SpecialFileError(f"`{f}` is a socket") raise def is_socket(path: str) -> bool: return stat.S_ISSOCK(os.lstat(path).st_mode) @contextmanager def adjacent_tmp_file(path: str, **kwargs: Any) -> Iterator[BinaryIO]: """Return a file-like object pointing to a tmp file next to path. The file is created securely and is ensured to be written to disk after the context reaches its end. kwargs will be passed to tempfile.NamedTemporaryFile to control the way the temporary file will be opened. """ with NamedTemporaryFile( delete=False, dir=os.path.dirname(path), prefix=os.path.basename(path), suffix=".tmp", **kwargs, ) as f: result = cast(BinaryIO, f) try: yield result finally: result.flush() os.fsync(result.fileno()) # Tenacity raises RetryError by default, explicitly raise the original exception _replace_retry = retry(reraise=True, stop=stop_after_delay(1), wait=wait_fixed(0.25)) replace = _replace_retry(os.replace) # test_writable_dir and _test_writable_dir_win are copied from Flit, # with the author's agreement to also place them under pip's license. def test_writable_dir(path: str) -> bool: """Check if a directory is writable. Uses os.access() on POSIX, tries creating files on Windows. """ # If the directory doesn't exist, find the closest parent that does. while not os.path.isdir(path): parent = os.path.dirname(path) if parent == path: break # Should never get here, but infinite loops are bad path = parent if os.name == "posix": return os.access(path, os.W_OK) return _test_writable_dir_win(path) def _test_writable_dir_win(path: str) -> bool: # os.access doesn't work on Windows: http://bugs.python.org/issue2528 # and we can't use tempfile: http://bugs.python.org/issue22107 basename = "accesstest_deleteme_fishfingers_custard_" alphabet = "abcdefghijklmnopqrstuvwxyz0123456789" for _ in range(10): name = basename + "".join(random.choice(alphabet) for _ in range(6)) file = os.path.join(path, name) try: fd = os.open(file, os.O_RDWR | os.O_CREAT | os.O_EXCL) except FileExistsError: pass except PermissionError: # This could be because there's a directory with the same name. # But it's highly unlikely there's a directory called that, # so we'll assume it's because the parent dir is not writable. # This could as well be because the parent dir is not readable, # due to non-privileged user access. return False else: os.close(fd) os.unlink(file) return True # This should never be reached raise OSError("Unexpected condition testing for writable directory") def find_files(path: str, pattern: str) -> List[str]: """Returns a list of absolute paths of files beneath path, recursively, with filenames which match the UNIX-style shell glob pattern.""" result: List[str] = [] for root, _, files in os.walk(path): matches = fnmatch.filter(files, pattern) result.extend(os.path.join(root, f) for f in matches) return result def file_size(path: str) -> Union[int, float]: # If it's a symlink, return 0. if os.path.islink(path): return 0 return os.path.getsize(path) def format_file_size(path: str) -> str: return format_size(file_size(path)) def directory_size(path: str) -> Union[int, float]: size = 0.0 for root, _dirs, files in os.walk(path): for filename in files: file_path = os.path.join(root, filename) size += file_size(file_path) return size def format_directory_size(path: str) -> str: return format_size(directory_size(path)) PK]R=U& & utils/glibc.pynu[# The following comment should be removed at some point in the future. # mypy: strict-optional=False import os import sys from typing import Optional, Tuple def glibc_version_string() -> Optional[str]: "Returns glibc version string, or None if not using glibc." return glibc_version_string_confstr() or glibc_version_string_ctypes() def glibc_version_string_confstr() -> Optional[str]: "Primary implementation of glibc_version_string using os.confstr." # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely # to be broken or missing. This strategy is used in the standard library # platform module: # https://github.com/python/cpython/blob/fcf1d003bf4f0100c9d0921ff3d70e1127ca1b71/Lib/platform.py#L175-L183 if sys.platform == "win32": return None try: # os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17": _, version = os.confstr("CS_GNU_LIBC_VERSION").split() except (AttributeError, OSError, ValueError): # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... return None return version def glibc_version_string_ctypes() -> Optional[str]: "Fallback implementation of glibc_version_string using ctypes." try: import ctypes except ImportError: return None # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen # manpage says, "If filename is NULL, then the returned handle is for the # main program". This way we can let the linker do the work to figure out # which libc our process is actually using. process_namespace = ctypes.CDLL(None) try: gnu_get_libc_version = process_namespace.gnu_get_libc_version except AttributeError: # Symbol doesn't exist -> therefore, we are not linked to # glibc. return None # Call gnu_get_libc_version, which returns a string like "2.5" gnu_get_libc_version.restype = ctypes.c_char_p version_str = gnu_get_libc_version() # py2 / py3 compatibility: if not isinstance(version_str, str): version_str = version_str.decode("ascii") return version_str # platform.libc_ver regularly returns completely nonsensical glibc # versions. E.g. on my computer, platform says: # # ~$ python2.7 -c 'import platform; print(platform.libc_ver())' # ('glibc', '2.7') # ~$ python3.5 -c 'import platform; print(platform.libc_ver())' # ('glibc', '2.9') # # But the truth is: # # ~$ ldd --version # ldd (Debian GLIBC 2.22-11) 2.22 # # This is unfortunate, because it means that the linehaul data on libc # versions that was generated by pip 8.1.2 and earlier is useless and # misleading. Solution: instead of using platform, use our code that actually # works. def libc_ver() -> Tuple[str, str]: """Try to determine the glibc version Returns a tuple of strings (lib, version) which default to empty strings in case the lookup fails. """ glibc_version = glibc_version_string() if glibc_version is None: return ("", "") else: return ("glibc", glibc_version) PK]жŎ++utils/deprecation.pynu[""" A module that implements tooling to enable easy warnings about deprecations. """ import logging import warnings from typing import Any, Optional, TextIO, Type, Union from pip._vendor.packaging.version import parse from pip import __version__ as current_version # NOTE: tests patch this name. DEPRECATION_MSG_PREFIX = "DEPRECATION: " class PipDeprecationWarning(Warning): pass _original_showwarning: Any = None # Warnings <-> Logging Integration def _showwarning( message: Union[Warning, str], category: Type[Warning], filename: str, lineno: int, file: Optional[TextIO] = None, line: Optional[str] = None, ) -> None: if file is not None: if _original_showwarning is not None: _original_showwarning(message, category, filename, lineno, file, line) elif issubclass(category, PipDeprecationWarning): # We use a specially named logger which will handle all of the # deprecation messages for pip. logger = logging.getLogger("pip._internal.deprecations") logger.warning(message) else: _original_showwarning(message, category, filename, lineno, file, line) def install_warning_logger() -> None: # Enable our Deprecation Warnings warnings.simplefilter("default", PipDeprecationWarning, append=True) global _original_showwarning if _original_showwarning is None: _original_showwarning = warnings.showwarning warnings.showwarning = _showwarning def deprecated( *, reason: str, replacement: Optional[str], gone_in: Optional[str], feature_flag: Optional[str] = None, issue: Optional[int] = None, ) -> None: """Helper to deprecate existing functionality. reason: Textual reason shown to the user about why this functionality has been deprecated. Should be a complete sentence. replacement: Textual suggestion shown to the user about what alternative functionality they can use. gone_in: The version of pip does this functionality should get removed in. Raises an error if pip's current version is greater than or equal to this. feature_flag: Command-line flag of the form --use-feature={feature_flag} for testing upcoming functionality. issue: Issue number on the tracker that would serve as a useful place for users to find related discussion and provide feedback. """ # Determine whether or not the feature is already gone in this version. is_gone = gone_in is not None and parse(current_version) >= parse(gone_in) message_parts = [ (reason, f"{DEPRECATION_MSG_PREFIX}{{}}"), ( gone_in, "pip {} will enforce this behaviour change." if not is_gone else "Since pip {}, this is no longer supported.", ), ( replacement, "A possible replacement is {}.", ), ( feature_flag, "You can use the flag --use-feature={} to test the upcoming behaviour." if not is_gone else None, ), ( issue, "Discussion can be found at https://github.com/pypa/pip/issues/{}", ), ] message = " ".join( format_str.format(value) for value, format_str in message_parts if format_str is not None and value is not None ) # Raise as an error if this behaviour is deprecated. if is_gone: raise PipDeprecationWarning(message) warnings.warn(message, category=PipDeprecationWarning, stacklevel=2) PK]7#*Q*Q utils/misc.pynu[# The following comment should be removed at some point in the future. # mypy: strict-optional=False import contextlib import errno import getpass import hashlib import io import logging import os import posixpath import shutil import stat import sys import urllib.parse from io import StringIO from itertools import filterfalse, tee, zip_longest from types import TracebackType from typing import ( Any, BinaryIO, Callable, ContextManager, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, TypeVar, cast, ) from pip._vendor.pkg_resources import Distribution from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed from pip import __version__ from pip._internal.exceptions import CommandError from pip._internal.locations import get_major_minor_version, site_packages, user_site from pip._internal.locations import get_scheme from pip._internal.utils.compat import WINDOWS from pip._internal.utils.egg_link import egg_link_path_from_location from pip._internal.utils.virtualenv import running_under_virtualenv __all__ = [ "rmtree", "display_path", "backup_dir", "ask", "splitext", "format_size", "is_installable_dir", "normalize_path", "renames", "get_prog", "captured_stdout", "ensure_dir", "remove_auth_from_url", ] logger = logging.getLogger(__name__) T = TypeVar("T") ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] VersionInfo = Tuple[int, int, int] NetlocTuple = Tuple[str, Tuple[Optional[str], Optional[str]]] def get_pip_version() -> str: pip_pkg_dir = os.path.join(os.path.dirname(__file__), "..", "..") pip_pkg_dir = os.path.abspath(pip_pkg_dir) return "pip {} from {} (python {})".format( __version__, pip_pkg_dir, get_major_minor_version(), ) def normalize_version_info(py_version_info: Tuple[int, ...]) -> Tuple[int, int, int]: """ Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None). """ if len(py_version_info) < 3: py_version_info += (3 - len(py_version_info)) * (0,) elif len(py_version_info) > 3: py_version_info = py_version_info[:3] return cast("VersionInfo", py_version_info) def ensure_dir(path: str) -> None: """os.path.makedirs without EEXIST.""" try: os.makedirs(path) except OSError as e: # Windows can raise spurious ENOTEMPTY errors. See #6426. if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY: raise def get_prog() -> str: try: prog = os.path.basename(sys.argv[0]) if prog in ("__main__.py", "-c"): return f"{sys.executable} -m pip" else: return prog except (AttributeError, TypeError, IndexError): pass return "pip" # Retry every half second for up to 3 seconds # Tenacity raises RetryError by default, explicitly raise the original exception @retry(reraise=True, stop=stop_after_delay(3), wait=wait_fixed(0.5)) def rmtree(dir: str, ignore_errors: bool = False) -> None: shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler) def rmtree_errorhandler(func: Callable[..., Any], path: str, exc_info: ExcInfo) -> None: """On Windows, the files in .svn are read-only, so when rmtree() tries to remove them, an exception is thrown. We catch that here, remove the read-only attribute, and hopefully continue without problems.""" try: has_attr_readonly = not (os.stat(path).st_mode & stat.S_IWRITE) except OSError: # it's equivalent to os.path.exists return if has_attr_readonly: # convert to read/write os.chmod(path, stat.S_IWRITE) # use the original function to repeat the operation func(path) return else: raise def display_path(path: str) -> str: """Gives the display value for a given path, making it relative to cwd if possible.""" path = os.path.normcase(os.path.abspath(path)) if path.startswith(os.getcwd() + os.path.sep): path = "." + path[len(os.getcwd()) :] return path def backup_dir(dir: str, ext: str = ".bak") -> str: """Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc)""" n = 1 extension = ext while os.path.exists(dir + extension): n += 1 extension = ext + str(n) return dir + extension def ask_path_exists(message: str, options: Iterable[str]) -> str: for action in os.environ.get("PIP_EXISTS_ACTION", "").split(): if action in options: return action return ask(message, options) def _check_no_input(message: str) -> None: """Raise an error if no input is allowed.""" if os.environ.get("PIP_NO_INPUT"): raise Exception( f"No input was expected ($PIP_NO_INPUT set); question: {message}" ) def ask(message: str, options: Iterable[str]) -> str: """Ask the message interactively, with the given possible responses""" while 1: _check_no_input(message) response = input(message) response = response.strip().lower() if response not in options: print( "Your response ({!r}) was not one of the expected responses: " "{}".format(response, ", ".join(options)) ) else: return response def ask_input(message: str) -> str: """Ask for input interactively.""" _check_no_input(message) return input(message) def ask_password(message: str) -> str: """Ask for a password interactively.""" _check_no_input(message) return getpass.getpass(message) def strtobool(val: str) -> int: """Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. """ val = val.lower() if val in ("y", "yes", "t", "true", "on", "1"): return 1 elif val in ("n", "no", "f", "false", "off", "0"): return 0 else: raise ValueError(f"invalid truth value {val!r}") def format_size(bytes: float) -> str: if bytes > 1000 * 1000: return "{:.1f} MB".format(bytes / 1000.0 / 1000) elif bytes > 10 * 1000: return "{} kB".format(int(bytes / 1000)) elif bytes > 1000: return "{:.1f} kB".format(bytes / 1000.0) else: return "{} bytes".format(int(bytes)) def tabulate(rows: Iterable[Iterable[Any]]) -> Tuple[List[str], List[int]]: """Return a list of formatted rows and a list of column sizes. For example:: >>> tabulate([['foobar', 2000], [0xdeadbeef]]) (['foobar 2000', '3735928559'], [10, 4]) """ rows = [tuple(map(str, row)) for row in rows] sizes = [max(map(len, col)) for col in zip_longest(*rows, fillvalue="")] table = [" ".join(map(str.ljust, row, sizes)).rstrip() for row in rows] return table, sizes def is_installable_dir(path: str) -> bool: """Is path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which are already covered by the pyproject.toml check. """ if not os.path.isdir(path): return False if os.path.isfile(os.path.join(path, "pyproject.toml")): return True if os.path.isfile(os.path.join(path, "setup.py")): return True return False def read_chunks(file: BinaryIO, size: int = io.DEFAULT_BUFFER_SIZE) -> Iterator[bytes]: """Yield pieces of data from a file-like object until EOF.""" while True: chunk = file.read(size) if not chunk: break yield chunk def normalize_path(path: str, resolve_symlinks: bool = True) -> str: """ Convert a path to its canonical, case-normalized, absolute version. """ path = os.path.expanduser(path) if resolve_symlinks: path = os.path.realpath(path) else: path = os.path.abspath(path) return os.path.normcase(path) def splitext(path: str) -> Tuple[str, str]: """Like os.path.splitext, but take off .tar too""" base, ext = posixpath.splitext(path) if base.lower().endswith(".tar"): ext = base[-4:] + ext base = base[:-4] return base, ext def renames(old: str, new: str) -> None: """Like os.renames(), but handles renaming across devices.""" # Implementation borrowed from os.renames(). head, tail = os.path.split(new) if head and tail and not os.path.exists(head): os.makedirs(head) shutil.move(old, new) head, tail = os.path.split(old) if head and tail: try: os.removedirs(head) except OSError: pass def is_local(path: str) -> bool: """ Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path. """ if not running_under_virtualenv(): return True return path.startswith(normalize_path(sys.prefix)) def dist_is_local(dist: Distribution) -> bool: """ Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv. """ return is_local(dist_location(dist)) def dist_in_usersite(dist: Distribution) -> bool: """ Return True if given Distribution is installed in user site. """ return dist_location(dist).startswith(normalize_path(user_site)) def dist_in_site_packages(dist: Distribution) -> bool: """ Return True if given Distribution is installed in sysconfig.get_python_lib(). """ return dist_location(dist).startswith(normalize_path(site_packages)) def dist_in_install_path(dist): """ Return True if given Distribution is installed in path matching distutils_scheme layout. """ norm_path = normalize_path(dist_location(dist)) return norm_path.startswith(normalize_path( get_scheme("").purelib.split('python')[0])) def get_distribution(req_name: str) -> Optional[Distribution]: """Given a requirement name, return the installed Distribution object. This searches from *all* distributions available in the environment, to match the behavior of ``pkg_resources.get_distribution()``. Left for compatibility until direct pkg_resources uses are refactored out. """ from pip._internal.metadata import get_default_environment from pip._internal.metadata.pkg_resources import Distribution as _Dist dist = get_default_environment().get_distribution(req_name) if dist is None: return None return cast(_Dist, dist)._dist def dist_location(dist: Distribution) -> str: """ Get the site-packages location of this distribution. Generally this is dist.location, except in the case of develop-installed packages, where dist.location is the source code location, and we want to know where the egg-link file is. The returned location is normalized (in particular, with symlinks removed). """ egg_link = egg_link_path_from_location(dist.project_name) if egg_link: return normalize_path(egg_link) return normalize_path(dist.location) def write_output(msg: Any, *args: Any) -> None: logger.info(msg, *args) class StreamWrapper(StringIO): orig_stream: TextIO = None @classmethod def from_stream(cls, orig_stream: TextIO) -> "StreamWrapper": cls.orig_stream = orig_stream return cls() # compileall.compile_dir() needs stdout.encoding to print to stdout # https://github.com/python/mypy/issues/4125 @property def encoding(self): # type: ignore return self.orig_stream.encoding @contextlib.contextmanager def captured_output(stream_name: str) -> Iterator[StreamWrapper]: """Return a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo. """ orig_stdout = getattr(sys, stream_name) setattr(sys, stream_name, StreamWrapper.from_stream(orig_stdout)) try: yield getattr(sys, stream_name) finally: setattr(sys, stream_name, orig_stdout) def captured_stdout() -> ContextManager[StreamWrapper]: """Capture the output of sys.stdout: with captured_stdout() as stdout: print('hello') self.assertEqual(stdout.getvalue(), 'hello\n') Taken from Lib/support/__init__.py in the CPython repo. """ return captured_output("stdout") def captured_stderr() -> ContextManager[StreamWrapper]: """ See captured_stdout(). """ return captured_output("stderr") # Simulates an enum def enum(*sequential: Any, **named: Any) -> Type[Any]: enums = dict(zip(sequential, range(len(sequential))), **named) reverse = {value: key for key, value in enums.items()} enums["reverse_mapping"] = reverse return type("Enum", (), enums) def build_netloc(host: str, port: Optional[int]) -> str: """ Build a netloc from a host-port pair """ if port is None: return host if ":" in host: # Only wrap host with square brackets when it is IPv6 host = f"[{host}]" return f"{host}:{port}" def build_url_from_netloc(netloc: str, scheme: str = "https") -> str: """ Build a full URL from a netloc. """ if netloc.count(":") >= 2 and "@" not in netloc and "[" not in netloc: # It must be a bare IPv6 address, so wrap it with brackets. netloc = f"[{netloc}]" return f"{scheme}://{netloc}" def parse_netloc(netloc: str) -> Tuple[str, Optional[int]]: """ Return the host-port pair from a netloc. """ url = build_url_from_netloc(netloc) parsed = urllib.parse.urlparse(url) return parsed.hostname, parsed.port def split_auth_from_netloc(netloc: str) -> NetlocTuple: """ Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). """ if "@" not in netloc: return netloc, (None, None) # Split from the right because that's how urllib.parse.urlsplit() # behaves if more than one @ is present (which can be checked using # the password attribute of urlsplit()'s return value). auth, netloc = netloc.rsplit("@", 1) pw: Optional[str] = None if ":" in auth: # Split from the left because that's how urllib.parse.urlsplit() # behaves if more than one : is present (which again can be checked # using the password attribute of the return value) user, pw = auth.split(":", 1) else: user, pw = auth, None user = urllib.parse.unquote(user) if pw is not None: pw = urllib.parse.unquote(pw) return netloc, (user, pw) def redact_netloc(netloc: str) -> str: """ Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com" """ netloc, (user, password) = split_auth_from_netloc(netloc) if user is None: return netloc if password is None: user = "****" password = "" else: user = urllib.parse.quote(user) password = ":****" return "{user}{password}@{netloc}".format( user=user, password=password, netloc=netloc ) def _transform_url( url: str, transform_netloc: Callable[[str], Tuple[Any, ...]] ) -> Tuple[str, NetlocTuple]: """Transform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1. """ purl = urllib.parse.urlsplit(url) netloc_tuple = transform_netloc(purl.netloc) # stripped url url_pieces = (purl.scheme, netloc_tuple[0], purl.path, purl.query, purl.fragment) surl = urllib.parse.urlunsplit(url_pieces) return surl, cast("NetlocTuple", netloc_tuple) def _get_netloc(netloc: str) -> NetlocTuple: return split_auth_from_netloc(netloc) def _redact_netloc(netloc: str) -> Tuple[str]: return (redact_netloc(netloc),) def split_auth_netloc_from_url(url: str) -> Tuple[str, str, Tuple[str, str]]: """ Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password)) """ url_without_auth, (netloc, auth) = _transform_url(url, _get_netloc) return url_without_auth, netloc, auth def remove_auth_from_url(url: str) -> str: """Return a copy of url with 'username:password@' removed.""" # username/pass params are passed to subversion through flags # and are not recognized in the url. return _transform_url(url, _get_netloc)[0] def redact_auth_from_url(url: str) -> str: """Replace the password in a given url with ****.""" return _transform_url(url, _redact_netloc)[0] class HiddenText: def __init__(self, secret: str, redacted: str) -> None: self.secret = secret self.redacted = redacted def __repr__(self) -> str: return "".format(str(self)) def __str__(self) -> str: return self.redacted # This is useful for testing. def __eq__(self, other: Any) -> bool: if type(self) != type(other): return False # The string being used for redaction doesn't also have to match, # just the raw, original string. return self.secret == other.secret def hide_value(value: str) -> HiddenText: return HiddenText(value, redacted="****") def hide_url(url: str) -> HiddenText: redacted = redact_auth_from_url(url) return HiddenText(url, redacted=redacted) def protect_pip_from_modification_on_windows(modifying_pip: bool) -> None: """Protection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... """ pip_names = [ "pip.exe", "pip{}.exe".format(sys.version_info[0]), "pip{}.{}.exe".format(*sys.version_info[:2]), ] # See https://github.com/pypa/pip/issues/1299 for more discussion should_show_use_python_msg = ( modifying_pip and WINDOWS and os.path.basename(sys.argv[0]) in pip_names ) if should_show_use_python_msg: new_command = [sys.executable, "-m", "pip"] + sys.argv[1:] raise CommandError( "To modify pip, please run the following command:\n{}".format( " ".join(new_command) ) ) def is_console_interactive() -> bool: """Is this console interactive?""" return sys.stdin is not None and sys.stdin.isatty() def hash_file(path: str, blocksize: int = 1 << 20) -> Tuple[Any, int]: """Return (hash, length) for path using hashlib.sha256()""" h = hashlib.sha256() length = 0 with open(path, "rb") as f: for block in read_chunks(f, size=blocksize): length += len(block) h.update(block) return h, length def is_wheel_installed() -> bool: """ Return whether the wheel package is installed. """ try: import wheel # noqa: F401 except ImportError: return False return True def pairwise(iterable: Iterable[Any]) -> Iterator[Tuple[Any, Any]]: """ Return paired elements. For example: s -> (s0, s1), (s2, s3), (s4, s5), ... """ iterable = iter(iterable) return zip_longest(iterable, iterable) def partition( pred: Callable[[T], bool], iterable: Iterable[T], ) -> Tuple[Iterable[T], Iterable[T]]: """ Use a predicate to partition entries into false entries and true entries, like partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 """ t1, t2 = tee(iterable) return filterfalse(pred, t1), filter(pred, t2) PK]; utils/models.pynu["""Utilities for defining models """ import operator from typing import Any, Callable, Type class KeyBasedCompareMixin: """Provides comparison capabilities that is based on a key""" __slots__ = ["_compare_key", "_defining_class"] def __init__(self, key: Any, defining_class: Type["KeyBasedCompareMixin"]) -> None: self._compare_key = key self._defining_class = defining_class def __hash__(self) -> int: return hash(self._compare_key) def __lt__(self, other: Any) -> bool: return self._compare(other, operator.__lt__) def __le__(self, other: Any) -> bool: return self._compare(other, operator.__le__) def __gt__(self, other: Any) -> bool: return self._compare(other, operator.__gt__) def __ge__(self, other: Any) -> bool: return self._compare(other, operator.__ge__) def __eq__(self, other: Any) -> bool: return self._compare(other, operator.__eq__) def _compare(self, other: Any, method: Callable[[Any, Any], bool]) -> bool: if not isinstance(other, self._defining_class): return NotImplemented return method(self._compare_key, other._compare_key) PK]Pgutils/hashes.pynu[import hashlib from typing import TYPE_CHECKING, BinaryIO, Dict, Iterator, List from pip._internal.exceptions import HashMismatch, HashMissing, InstallationError from pip._internal.utils.misc import read_chunks if TYPE_CHECKING: from hashlib import _Hash # NoReturn introduced in 3.6.2; imported only for type checking to maintain # pip compatibility with older patch versions of Python 3.6 from typing import NoReturn # The recommended hash algo of the moment. Change this whenever the state of # the art changes; it won't hurt backward compatibility. FAVORITE_HASH = "sha256" # Names of hashlib algorithms allowed by the --hash option and ``pip hash`` # Currently, those are the ones at least as collision-resistant as sha256. STRONG_HASHES = ["sha256", "sha384", "sha512"] class Hashes: """A wrapper that builds multiple hashes at once and checks them against known-good values """ def __init__(self, hashes: Dict[str, List[str]] = None) -> None: """ :param hashes: A dict of algorithm names pointing to lists of allowed hex digests """ allowed = {} if hashes is not None: for alg, keys in hashes.items(): # Make sure values are always sorted (to ease equality checks) allowed[alg] = sorted(keys) self._allowed = allowed def __and__(self, other: "Hashes") -> "Hashes": if not isinstance(other, Hashes): return NotImplemented # If either of the Hashes object is entirely empty (i.e. no hash # specified at all), all hashes from the other object are allowed. if not other: return self if not self: return other # Otherwise only hashes that present in both objects are allowed. new = {} for alg, values in other._allowed.items(): if alg not in self._allowed: continue new[alg] = [v for v in values if v in self._allowed[alg]] return Hashes(new) @property def digest_count(self) -> int: return sum(len(digests) for digests in self._allowed.values()) def is_hash_allowed(self, hash_name: str, hex_digest: str) -> bool: """Return whether the given hex digest is allowed.""" return hex_digest in self._allowed.get(hash_name, []) def check_against_chunks(self, chunks: Iterator[bytes]) -> None: """Check good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. """ gots = {} for hash_name in self._allowed.keys(): try: gots[hash_name] = hashlib.new(hash_name) except (ValueError, TypeError): raise InstallationError(f"Unknown hash name: {hash_name}") for chunk in chunks: for hash in gots.values(): hash.update(chunk) for hash_name, got in gots.items(): if got.hexdigest() in self._allowed[hash_name]: return self._raise(gots) def _raise(self, gots: Dict[str, "_Hash"]) -> "NoReturn": raise HashMismatch(self._allowed, gots) def check_against_file(self, file: BinaryIO) -> None: """Check good hashes against a file-like object Raise HashMismatch if none match. """ return self.check_against_chunks(read_chunks(file)) def check_against_path(self, path: str) -> None: with open(path, "rb") as file: return self.check_against_file(file) def __bool__(self) -> bool: """Return whether I know any known-good hashes.""" return bool(self._allowed) def __eq__(self, other: object) -> bool: if not isinstance(other, Hashes): return NotImplemented return self._allowed == other._allowed def __hash__(self) -> int: return hash( ",".join( sorted( ":".join((alg, digest)) for alg, digest_list in self._allowed.items() for digest in digest_list ) ) ) class MissingHashes(Hashes): """A workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. """ def __init__(self) -> None: """Don't offer the ``hashes`` kwarg.""" # Pass our favorite hash in to generate a "gotten hash". With the # empty list, it will never match, so an error will always raise. super().__init__(hashes={FAVORITE_HASH: []}) def _raise(self, gots: Dict[str, "_Hash"]) -> "NoReturn": raise HashMissing(gots[FAVORITE_HASH].hexdigest()) PK]~ utils/urls.pynu[import os import string import urllib.parse import urllib.request from typing import Optional from .compat import WINDOWS def get_url_scheme(url: str) -> Optional[str]: if ":" not in url: return None return url.split(":", 1)[0].lower() def path_to_url(path: str) -> str: """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urllib.parse.urljoin("file:", urllib.request.pathname2url(path)) return url def url_to_path(url: str) -> str: """ Convert a file: URL to a path. """ assert url.startswith( "file:" ), f"You can only turn file: urls into filenames (not {url!r})" _, netloc, path, _, _ = urllib.parse.urlsplit(url) if not netloc or netloc == "localhost": # According to RFC 8089, same as empty authority. netloc = "" elif WINDOWS: # If we have a UNC path, prepend UNC share notation. netloc = "\\\\" + netloc else: raise ValueError( f"non-local file URIs are not supported on this platform: {url!r}" ) path = urllib.request.url2pathname(netloc + path) # On Windows, urlsplit parses the path as something like "/C:/Users/foo". # This creates issues for path-related functions like io.open(), so we try # to detect and strip the leading slash. if ( WINDOWS and not netloc # Not UNC. and len(path) >= 3 and path[0] == "/" # Leading slash to strip. and path[1] in string.ascii_letters # Drive letter. and path[2:4] in (":", ":/") # Colon + end of string, or colon + absolute path. ): path = path[1:] return path PK]ɘJ'J'utils/subprocess.pynu[import logging import os import shlex import subprocess from typing import ( TYPE_CHECKING, Any, Callable, Iterable, List, Mapping, Optional, Union, ) from pip._internal.cli.spinners import SpinnerInterface, open_spinner from pip._internal.exceptions import InstallationSubprocessError from pip._internal.utils.logging import VERBOSE, subprocess_logger from pip._internal.utils.misc import HiddenText if TYPE_CHECKING: # Literal was introduced in Python 3.8. # # TODO: Remove `if TYPE_CHECKING` when dropping support for Python 3.7. from typing import Literal CommandArgs = List[Union[str, HiddenText]] LOG_DIVIDER = "----------------------------------------" def make_command(*args: Union[str, HiddenText, CommandArgs]) -> CommandArgs: """ Create a CommandArgs object. """ command_args: CommandArgs = [] for arg in args: # Check for list instead of CommandArgs since CommandArgs is # only known during type-checking. if isinstance(arg, list): command_args.extend(arg) else: # Otherwise, arg is str or HiddenText. command_args.append(arg) return command_args def format_command_args(args: Union[List[str], CommandArgs]) -> str: """ Format command arguments for display. """ # For HiddenText arguments, display the redacted form by calling str(). # Also, we don't apply str() to arguments that aren't HiddenText since # this can trigger a UnicodeDecodeError in Python 2 if the argument # has type unicode and includes a non-ascii character. (The type # checker doesn't ensure the annotations are correct in all cases.) return " ".join( shlex.quote(str(arg)) if isinstance(arg, HiddenText) else shlex.quote(arg) for arg in args ) def reveal_command_args(args: Union[List[str], CommandArgs]) -> List[str]: """ Return the arguments in their raw, unredacted form. """ return [arg.secret if isinstance(arg, HiddenText) else arg for arg in args] def make_subprocess_output_error( cmd_args: Union[List[str], CommandArgs], cwd: Optional[str], lines: List[str], exit_status: int, ) -> str: """ Create and return the error message to use to log a subprocess error with command output. :param lines: A list of lines, each ending with a newline. """ command = format_command_args(cmd_args) # We know the joined output value ends in a newline. output = "".join(lines) msg = ( # Use a unicode string to avoid "UnicodeEncodeError: 'ascii' # codec can't encode character ..." in Python 2 when a format # argument (e.g. `output`) has a non-ascii character. "Command errored out with exit status {exit_status}:\n" " command: {command_display}\n" " cwd: {cwd_display}\n" "Complete output ({line_count} lines):\n{output}{divider}" ).format( exit_status=exit_status, command_display=command, cwd_display=cwd, line_count=len(lines), output=output, divider=LOG_DIVIDER, ) return msg def call_subprocess( cmd: Union[List[str], CommandArgs], show_stdout: bool = False, cwd: Optional[str] = None, on_returncode: 'Literal["raise", "warn", "ignore"]' = "raise", extra_ok_returncodes: Optional[Iterable[int]] = None, command_desc: Optional[str] = None, extra_environ: Optional[Mapping[str, Any]] = None, unset_environ: Optional[Iterable[str]] = None, spinner: Optional[SpinnerInterface] = None, log_failed_cmd: Optional[bool] = True, stdout_only: Optional[bool] = False, ) -> str: """ Args: show_stdout: if true, use INFO to log the subprocess's stderr and stdout streams. Otherwise, use DEBUG. Defaults to False. extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. unset_environ: an iterable of environment variable names to unset prior to calling subprocess.Popen(). log_failed_cmd: if false, failed commands are not logged, only raised. stdout_only: if true, return only stdout, else return both. When true, logging of both stdout and stderr occurs when the subprocess has terminated, else logging occurs as subprocess output is produced. """ if extra_ok_returncodes is None: extra_ok_returncodes = [] if unset_environ is None: unset_environ = [] # Most places in pip use show_stdout=False. What this means is-- # # - We connect the child's output (combined stderr and stdout) to a # single pipe, which we read. # - We log this output to stderr at DEBUG level as it is received. # - If DEBUG logging isn't enabled (e.g. if --verbose logging wasn't # requested), then we show a spinner so the user can still see the # subprocess is in progress. # - If the subprocess exits with an error, we log the output to stderr # at ERROR level if it hasn't already been displayed to the console # (e.g. if --verbose logging wasn't enabled). This way we don't log # the output to the console twice. # # If show_stdout=True, then the above is still done, but with DEBUG # replaced by INFO. if show_stdout: # Then log the subprocess output at INFO level. log_subprocess = subprocess_logger.info used_level = logging.INFO else: # Then log the subprocess output using VERBOSE. This also ensures # it will be logged to the log file (aka user_log), if enabled. log_subprocess = subprocess_logger.verbose used_level = VERBOSE # Whether the subprocess will be visible in the console. showing_subprocess = subprocess_logger.getEffectiveLevel() <= used_level # Only use the spinner if we're not showing the subprocess output # and we have a spinner. use_spinner = not showing_subprocess and spinner is not None if command_desc is None: command_desc = format_command_args(cmd) log_subprocess("Running command %s", command_desc) env = os.environ.copy() if extra_environ: env.update(extra_environ) for name in unset_environ: env.pop(name, None) try: proc = subprocess.Popen( # Convert HiddenText objects to the underlying str. reveal_command_args(cmd), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT if not stdout_only else subprocess.PIPE, cwd=cwd, env=env, errors="backslashreplace", ) except Exception as exc: if log_failed_cmd: subprocess_logger.critical( "Error %s while executing command %s", exc, command_desc, ) raise all_output = [] if not stdout_only: assert proc.stdout assert proc.stdin proc.stdin.close() # In this mode, stdout and stderr are in the same pipe. while True: line: str = proc.stdout.readline() if not line: break line = line.rstrip() all_output.append(line + "\n") # Show the line immediately. log_subprocess(line) # Update the spinner. if use_spinner: assert spinner spinner.spin() try: proc.wait() finally: if proc.stdout: proc.stdout.close() output = "".join(all_output) else: # In this mode, stdout and stderr are in different pipes. # We must use communicate() which is the only safe way to read both. out, err = proc.communicate() # log line by line to preserve pip log indenting for out_line in out.splitlines(): log_subprocess(out_line) all_output.append(out) for err_line in err.splitlines(): log_subprocess(err_line) all_output.append(err) output = out proc_had_error = proc.returncode and proc.returncode not in extra_ok_returncodes if use_spinner: assert spinner if proc_had_error: spinner.finish("error") else: spinner.finish("done") if proc_had_error: if on_returncode == "raise": if not showing_subprocess and log_failed_cmd: # Then the subprocess streams haven't been logged to the # console yet. msg = make_subprocess_output_error( cmd_args=cmd, cwd=cwd, lines=all_output, exit_status=proc.returncode, ) subprocess_logger.error(msg) raise InstallationSubprocessError(proc.returncode, command_desc) elif on_returncode == "warn": subprocess_logger.warning( 'Command "%s" had error code %s in %s', command_desc, proc.returncode, cwd, ) elif on_returncode == "ignore": pass else: raise ValueError(f"Invalid value: on_returncode={on_returncode!r}") return output def runner_with_spinner_message(message: str) -> Callable[..., None]: """Provide a subprocess_runner that shows a spinner message. Intended for use with for pep517's Pep517HookCaller. Thus, the runner has an API that matches what's expected by Pep517HookCaller.subprocess_runner. """ def runner( cmd: List[str], cwd: Optional[str] = None, extra_environ: Optional[Mapping[str, Any]] = None, ) -> None: with open_spinner(message) as spinner: call_subprocess( cmd, cwd=cwd, extra_environ=extra_environ, spinner=spinner, ) return runner PK] int: """Get the current umask which involves having to set it temporarily.""" mask = os.umask(0) os.umask(mask) return mask def split_leading_dir(path: str) -> List[str]: path = path.lstrip("/").lstrip("\\") if "/" in path and ( ("\\" in path and path.find("/") < path.find("\\")) or "\\" not in path ): return path.split("/", 1) elif "\\" in path: return path.split("\\", 1) else: return [path, ""] def has_leading_dir(paths: Iterable[str]) -> bool: """Returns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)""" common_prefix = None for path in paths: prefix, rest = split_leading_dir(path) if not prefix: return False elif common_prefix is None: common_prefix = prefix elif prefix != common_prefix: return False return True def is_within_directory(directory: str, target: str) -> bool: """ Return true if the absolute path of target is within the directory """ abs_directory = os.path.abspath(directory) abs_target = os.path.abspath(target) prefix = os.path.commonprefix([abs_directory, abs_target]) return prefix == abs_directory def set_extracted_file_to_default_mode_plus_executable(path: str) -> None: """ Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs """ os.chmod(path, (0o777 & ~current_umask() | 0o111)) def zip_item_is_executable(info: ZipInfo) -> bool: mode = info.external_attr >> 16 # if mode and regular file and any execute permissions for # user/group/world? return bool(mode and stat.S_ISREG(mode) and mode & 0o111) def unzip_file(filename: str, location: str, flatten: bool = True) -> None: """ Unzip the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. """ ensure_dir(location) zipfp = open(filename, "rb") try: zip = zipfile.ZipFile(zipfp, allowZip64=True) leading = has_leading_dir(zip.namelist()) and flatten for info in zip.infolist(): name = info.filename fn = name if leading: fn = split_leading_dir(name)[1] fn = os.path.join(location, fn) dir = os.path.dirname(fn) if not is_within_directory(location, fn): message = ( "The zip file ({}) has a file ({}) trying to install " "outside target directory ({})" ) raise InstallationError(message.format(filename, fn, location)) if fn.endswith("/") or fn.endswith("\\"): # A directory ensure_dir(fn) else: ensure_dir(dir) # Don't use read() to avoid allocating an arbitrarily large # chunk of memory for the file's content fp = zip.open(name) try: with open(fn, "wb") as destfp: shutil.copyfileobj(fp, destfp) finally: fp.close() if zip_item_is_executable(info): set_extracted_file_to_default_mode_plus_executable(fn) finally: zipfp.close() def untar_file(filename: str, location: str) -> None: """ Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. """ ensure_dir(location) if filename.lower().endswith(".gz") or filename.lower().endswith(".tgz"): mode = "r:gz" elif filename.lower().endswith(BZ2_EXTENSIONS): mode = "r:bz2" elif filename.lower().endswith(XZ_EXTENSIONS): mode = "r:xz" elif filename.lower().endswith(".tar"): mode = "r" else: logger.warning( "Cannot determine compression type for file %s", filename, ) mode = "r:*" tar = tarfile.open(filename, mode, encoding="utf-8") try: leading = has_leading_dir([member.name for member in tar.getmembers()]) for member in tar.getmembers(): fn = member.name if leading: fn = split_leading_dir(fn)[1] path = os.path.join(location, fn) if not is_within_directory(location, path): message = ( "The tar file ({}) has a file ({}) trying to install " "outside target directory ({})" ) raise InstallationError(message.format(filename, path, location)) if member.isdir(): ensure_dir(path) elif member.issym(): try: # https://github.com/python/typeshed/issues/2673 tar._extract_member(member, path) # type: ignore except Exception as exc: # Some corrupt tar files seem to produce this # (specifically bad symlinks) logger.warning( "In the tar file %s the member %s is invalid: %s", filename, member.name, exc, ) continue else: try: fp = tar.extractfile(member) except (KeyError, AttributeError) as exc: # Some corrupt tar files seem to produce this # (specifically bad symlinks) logger.warning( "In the tar file %s the member %s is invalid: %s", filename, member.name, exc, ) continue ensure_dir(os.path.dirname(path)) assert fp is not None with open(path, "wb") as destfp: shutil.copyfileobj(fp, destfp) fp.close() # Update the timestamp (useful for cython compiled files) tar.utime(member, path) # member have any execute permissions for user/group/world? if member.mode & 0o111: set_extracted_file_to_default_mode_plus_executable(path) finally: tar.close() def unpack_file( filename: str, location: str, content_type: Optional[str] = None, ) -> None: filename = os.path.realpath(filename) if ( content_type == "application/zip" or filename.lower().endswith(ZIP_EXTENSIONS) or zipfile.is_zipfile(filename) ): unzip_file(filename, location, flatten=not filename.endswith(".whl")) elif ( content_type == "application/x-gzip" or tarfile.is_tarfile(filename) or filename.lower().endswith(TAR_EXTENSIONS + BZ2_EXTENSIONS + XZ_EXTENSIONS) ): untar_file(filename, location) else: # FIXME: handle? # FIXME: magic signatures? logger.critical( "Cannot unpack file %s (downloaded from %s, content-type: %s); " "cannot detect archive format", filename, location, content_type, ) raise InstallationError(f"Cannot determine archive format of {location}") PK]rButils/appdirs.pynu[""" This code wraps the vendored appdirs module to so the return values are compatible for the current pip code base. The intention is to rewrite current usages gradually, keeping the tests pass, and eventually drop this after all usages are changed. """ import os import sys from typing import List from pip._vendor import platformdirs as _appdirs def user_cache_dir(appname: str) -> str: return _appdirs.user_cache_dir(appname, appauthor=False) def _macos_user_config_dir(appname: str, roaming: bool = True) -> str: # Use ~/Application Support/pip, if the directory exists. path = _appdirs.user_data_dir(appname, appauthor=False, roaming=roaming) if os.path.isdir(path): return path # Use a Linux-like ~/.config/pip, by default. linux_like_path = "~/.config/" if appname: linux_like_path = os.path.join(linux_like_path, appname) return os.path.expanduser(linux_like_path) def user_config_dir(appname: str, roaming: bool = True) -> str: if sys.platform == "darwin": return _macos_user_config_dir(appname, roaming) return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming) # for the discussion regarding site_config_dir locations # see def site_config_dirs(appname: str) -> List[str]: if sys.platform == "darwin": return [_appdirs.site_data_dir(appname, appauthor=False, multipath=True)] dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True) if sys.platform == "win32": return [dirval] # Unix-y system. Look in /etc as well. return dirval.split(os.pathsep) + ["/etc"] PK] R6R6 utils/ui.pynu[# The following comment should be removed at some point in the future. # mypy: strict-optional=False # mypy: disallow-untyped-defs=False from __future__ import absolute_import, division import contextlib import itertools import logging import sys import time from signal import SIGINT, default_int_handler, signal from pip._vendor import six from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar from pip._vendor.progress.spinner import Spinner from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import get_indentation from pip._internal.utils.misc import format_size from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Any, Iterator, IO try: from pip._vendor import colorama # Lots of different errors can come from this, including SystemError and # ImportError. except Exception: colorama = None logger = logging.getLogger(__name__) def _select_progress_class(preferred, fallback): encoding = getattr(preferred.file, "encoding", None) # If we don't know what encoding this file is in, then we'll just assume # that it doesn't support unicode and use the ASCII bar. if not encoding: return fallback # Collect all of the possible characters we want to use with the preferred # bar. characters = [ getattr(preferred, "empty_fill", six.text_type()), getattr(preferred, "fill", six.text_type()), ] characters += list(getattr(preferred, "phases", [])) # Try to decode the characters we're using for the bar using the encoding # of the given file, if this works then we'll assume that we can use the # fancier bar and if not we'll fall back to the plaintext bar. try: six.text_type().join(characters).encode(encoding) except UnicodeEncodeError: return fallback else: return preferred _BaseBar = _select_progress_class(IncrementalBar, Bar) # type: Any class InterruptibleMixin(object): """ Helper to ensure that self.finish() gets called on keyboard interrupt. This allows downloads to be interrupted without leaving temporary state (like hidden cursors) behind. This class is similar to the progress library's existing SigIntMixin helper, but as of version 1.2, that helper has the following problems: 1. It calls sys.exit(). 2. It discards the existing SIGINT handler completely. 3. It leaves its own handler in place even after an uninterrupted finish, which will have unexpected delayed effects if the user triggers an unrelated keyboard interrupt some time after a progress-displaying download has already completed, for example. """ def __init__(self, *args, **kwargs): """ Save the original SIGINT handler for later. """ super(InterruptibleMixin, self).__init__(*args, **kwargs) self.original_handler = signal(SIGINT, self.handle_sigint) # If signal() returns None, the previous handler was not installed from # Python, and we cannot restore it. This probably should not happen, # but if it does, we must restore something sensible instead, at least. # The least bad option should be Python's default SIGINT handler, which # just raises KeyboardInterrupt. if self.original_handler is None: self.original_handler = default_int_handler def finish(self): """ Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. """ super(InterruptibleMixin, self).finish() signal(SIGINT, self.original_handler) def handle_sigint(self, signum, frame): """ Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. """ self.finish() self.original_handler(signum, frame) class SilentBar(Bar): def update(self): pass class BlueEmojiBar(IncrementalBar): suffix = "%(percent)d%%" bar_prefix = " " bar_suffix = " " phases = (u"\U0001F539", u"\U0001F537", u"\U0001F535") # type: Any class DownloadProgressMixin(object): def __init__(self, *args, **kwargs): super(DownloadProgressMixin, self).__init__(*args, **kwargs) self.message = (" " * (get_indentation() + 2)) + self.message @property def downloaded(self): return format_size(self.index) @property def download_speed(self): # Avoid zero division errors... if self.avg == 0.0: return "..." return format_size(1 / self.avg) + "/s" @property def pretty_eta(self): if self.eta: return "eta %s" % self.eta_td return "" def iter(self, it, n=1): for x in it: yield x self.next(n) self.finish() class WindowsMixin(object): def __init__(self, *args, **kwargs): # The Windows terminal does not support the hide/show cursor ANSI codes # even with colorama. So we'll ensure that hide_cursor is False on # Windows. # This call needs to go before the super() call, so that hide_cursor # is set in time. The base progress bar class writes the "hide cursor" # code to the terminal in its init, so if we don't set this soon # enough, we get a "hide" with no corresponding "show"... if WINDOWS and self.hide_cursor: self.hide_cursor = False super(WindowsMixin, self).__init__(*args, **kwargs) # Check if we are running on Windows and we have the colorama module, # if we do then wrap our file with it. if WINDOWS and colorama: self.file = colorama.AnsiToWin32(self.file) # The progress code expects to be able to call self.file.isatty() # but the colorama.AnsiToWin32() object doesn't have that, so we'll # add it. self.file.isatty = lambda: self.file.wrapped.isatty() # The progress code expects to be able to call self.file.flush() # but the colorama.AnsiToWin32() object doesn't have that, so we'll # add it. self.file.flush = lambda: self.file.wrapped.flush() class BaseDownloadProgressBar(WindowsMixin, InterruptibleMixin, DownloadProgressMixin): file = sys.stdout message = "%(percent)d%%" suffix = "%(downloaded)s %(download_speed)s %(pretty_eta)s" # NOTE: The "type: ignore" comments on the following classes are there to # work around https://github.com/python/typing/issues/241 class DefaultDownloadProgressBar(BaseDownloadProgressBar, _BaseBar): pass class DownloadSilentBar(BaseDownloadProgressBar, SilentBar): # type: ignore pass class DownloadBar(BaseDownloadProgressBar, # type: ignore Bar): pass class DownloadFillingCirclesBar(BaseDownloadProgressBar, # type: ignore FillingCirclesBar): pass class DownloadBlueEmojiProgressBar(BaseDownloadProgressBar, # type: ignore BlueEmojiBar): pass class DownloadProgressSpinner(WindowsMixin, InterruptibleMixin, DownloadProgressMixin, Spinner): file = sys.stdout suffix = "%(downloaded)s %(download_speed)s" def next_phase(self): if not hasattr(self, "_phaser"): self._phaser = itertools.cycle(self.phases) return next(self._phaser) def update(self): message = self.message % self phase = self.next_phase() suffix = self.suffix % self line = ''.join([ message, " " if message else "", phase, " " if suffix else "", suffix, ]) self.writeln(line) BAR_TYPES = { "off": (DownloadSilentBar, DownloadSilentBar), "on": (DefaultDownloadProgressBar, DownloadProgressSpinner), "ascii": (DownloadBar, DownloadProgressSpinner), "pretty": (DownloadFillingCirclesBar, DownloadProgressSpinner), "emoji": (DownloadBlueEmojiProgressBar, DownloadProgressSpinner) } def DownloadProgressProvider(progress_bar, max=None): if max is None or max == 0: return BAR_TYPES[progress_bar][1]().iter else: return BAR_TYPES[progress_bar][0](max=max).iter ################################################################ # Generic "something is happening" spinners # # We don't even try using progress.spinner.Spinner here because it's actually # simpler to reimplement from scratch than to coerce their code into doing # what we need. ################################################################ @contextlib.contextmanager def hidden_cursor(file): # type: (IO) -> Iterator[None] # The Windows terminal does not support the hide/show cursor ANSI codes, # even via colorama. So don't even try. if WINDOWS: yield # We don't want to clutter the output with control characters if we're # writing to a file, or if the user is running with --quiet. # See https://github.com/pypa/pip/issues/3418 elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO: yield else: file.write(HIDE_CURSOR) try: yield finally: file.write(SHOW_CURSOR) class RateLimiter(object): def __init__(self, min_update_interval_seconds): # type: (float) -> None self._min_update_interval_seconds = min_update_interval_seconds self._last_update = 0 # type: float def ready(self): # type: () -> bool now = time.time() delta = now - self._last_update return delta >= self._min_update_interval_seconds def reset(self): # type: () -> None self._last_update = time.time() class SpinnerInterface(object): def spin(self): # type: () -> None raise NotImplementedError() def finish(self, final_status): # type: (str) -> None raise NotImplementedError() class InteractiveSpinner(SpinnerInterface): def __init__(self, message, file=None, spin_chars="-\\|/", # Empirically, 8 updates/second looks nice min_update_interval_seconds=0.125): self._message = message if file is None: file = sys.stdout self._file = file self._rate_limiter = RateLimiter(min_update_interval_seconds) self._finished = False self._spin_cycle = itertools.cycle(spin_chars) self._file.write(" " * get_indentation() + self._message + " ... ") self._width = 0 def _write(self, status): assert not self._finished # Erase what we wrote before by backspacing to the beginning, writing # spaces to overwrite the old text, and then backspacing again backup = "\b" * self._width self._file.write(backup + " " * self._width + backup) # Now we have a blank slate to add our status self._file.write(status) self._width = len(status) self._file.flush() self._rate_limiter.reset() def spin(self): # type: () -> None if self._finished: return if not self._rate_limiter.ready(): return self._write(next(self._spin_cycle)) def finish(self, final_status): # type: (str) -> None if self._finished: return self._write(final_status) self._file.write("\n") self._file.flush() self._finished = True # Used for dumb terminals, non-interactive installs (no tty), etc. # We still print updates occasionally (once every 60 seconds by default) to # act as a keep-alive for systems like Travis-CI that take lack-of-output as # an indication that a task has frozen. class NonInteractiveSpinner(SpinnerInterface): def __init__(self, message, min_update_interval_seconds=60): # type: (str, float) -> None self._message = message self._finished = False self._rate_limiter = RateLimiter(min_update_interval_seconds) self._update("started") def _update(self, status): assert not self._finished self._rate_limiter.reset() logger.info("%s: %s", self._message, status) def spin(self): # type: () -> None if self._finished: return if not self._rate_limiter.ready(): return self._update("still running...") def finish(self, final_status): # type: (str) -> None if self._finished: return self._update("finished with status '%s'" % (final_status,)) self._finished = True @contextlib.contextmanager def open_spinner(message): # type: (str) -> Iterator[SpinnerInterface] # Interactive spinner goes directly to sys.stdout rather than being routed # through the logging system, but it acts like it has level INFO, # i.e. it's only displayed if we're at level INFO or better. # Non-interactive spinner goes through the logging system, so it is always # in sync with logging configuration. if sys.stdout.isatty() and logger.getEffectiveLevel() <= logging.INFO: spinner = InteractiveSpinner(message) # type: SpinnerInterface else: spinner = NonInteractiveSpinner(message) try: with hidden_cursor(sys.stdout): yield spinner except KeyboardInterrupt: spinner.finish("canceled") raise except Exception: spinner.finish("error") raise else: spinner.finish("done") PK]9YYutils/setuptools_build.pynu[import sys from typing import List, Optional, Sequence # Shim to wrap setup.py invocation with setuptools # # We set sys.argv[0] to the path to the underlying setup.py file so # setuptools / distutils don't take the path to the setup.py to be "-c" when # invoking via the shim. This avoids e.g. the following manifest_maker # warning: "warning: manifest_maker: standard file '-c' not found". _SETUPTOOLS_SHIM = ( "import io, os, sys, setuptools, tokenize; sys.argv[0] = {0!r}; __file__={0!r};" "f = getattr(tokenize, 'open', open)(__file__) " "if os.path.exists(__file__) " "else io.StringIO('from setuptools import setup; setup()');" "code = f.read().replace('\\r\\n', '\\n');" "f.close();" "exec(compile(code, __file__, 'exec'))" ) def make_setuptools_shim_args( setup_py_path: str, global_options: Sequence[str] = None, no_user_config: bool = False, unbuffered_output: bool = False, ) -> List[str]: """ Get setuptools command arguments with shim wrapped setup file invocation. :param setup_py_path: The path to setup.py to be wrapped. :param global_options: Additional global options. :param no_user_config: If True, disables personal user configuration. :param unbuffered_output: If True, adds the unbuffered switch to the argument list. """ args = [sys.executable] if unbuffered_output: args += ["-u"] args += ["-c", _SETUPTOOLS_SHIM.format(setup_py_path)] if global_options: args += global_options if no_user_config: args += ["--no-user-cfg"] return args def make_setuptools_bdist_wheel_args( setup_py_path: str, global_options: Sequence[str], build_options: Sequence[str], destination_dir: str, ) -> List[str]: # NOTE: Eventually, we'd want to also -S to the flags here, when we're # isolating. Currently, it breaks Python in virtualenvs, because it # relies on site.py to find parts of the standard library outside the # virtualenv. args = make_setuptools_shim_args( setup_py_path, global_options=global_options, unbuffered_output=True ) args += ["bdist_wheel", "-d", destination_dir] args += build_options return args def make_setuptools_clean_args( setup_py_path: str, global_options: Sequence[str], ) -> List[str]: args = make_setuptools_shim_args( setup_py_path, global_options=global_options, unbuffered_output=True ) args += ["clean", "--all"] return args def make_setuptools_develop_args( setup_py_path: str, global_options: Sequence[str], install_options: Sequence[str], no_user_config: bool, prefix: Optional[str], home: Optional[str], use_user_site: bool, ) -> List[str]: assert not (use_user_site and prefix) args = make_setuptools_shim_args( setup_py_path, global_options=global_options, no_user_config=no_user_config, ) args += ["develop", "--no-deps"] args += install_options if prefix: args += ["--prefix", prefix] if home is not None: args += ["--install-dir", home] if use_user_site: args += ["--user", "--prefix="] return args def make_setuptools_egg_info_args( setup_py_path: str, egg_info_dir: Optional[str], no_user_config: bool, ) -> List[str]: args = make_setuptools_shim_args(setup_py_path, no_user_config=no_user_config) args += ["egg_info"] if egg_info_dir: args += ["--egg-base", egg_info_dir] return args def make_setuptools_install_args( setup_py_path: str, global_options: Sequence[str], install_options: Sequence[str], record_filename: str, root: Optional[str], prefix: Optional[str], header_dir: Optional[str], home: Optional[str], use_user_site: bool, no_user_config: bool, pycompile: bool, ) -> List[str]: assert not (use_user_site and prefix) assert not (use_user_site and root) args = make_setuptools_shim_args( setup_py_path, global_options=global_options, no_user_config=no_user_config, unbuffered_output=True, ) args += ["install", "--record", record_filename] args += ["--single-version-externally-managed"] if root is not None: args += ["--root", root] if prefix is not None: args += ["--prefix", prefix] if home is not None: args += ["--home", home] if use_user_site: args += ["--user", "--prefix="] if pycompile: args += ["--compile"] else: args += ["--no-compile"] if header_dir: args += ["--install-headers", header_dir] args += install_options return args PK]f=O utils/packaging.pynu[import functools import logging from email.message import Message from email.parser import FeedParser from typing import Optional, Tuple from pip._vendor import pkg_resources from pip._vendor.packaging import specifiers, version from pip._vendor.packaging.requirements import Requirement from pip._vendor.pkg_resources import Distribution from pip._internal.exceptions import NoneMetadataError from pip._internal.utils.misc import display_path logger = logging.getLogger(__name__) def check_requires_python( requires_python: Optional[str], version_info: Tuple[int, ...] ) -> bool: """ Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return `False`. :raises InvalidSpecifier: If `requires_python` has an invalid format. """ if requires_python is None: # The package provides no information return True requires_python_specifier = specifiers.SpecifierSet(requires_python) python_version = version.parse(".".join(map(str, version_info))) return python_version in requires_python_specifier def get_metadata(dist: Distribution) -> Message: """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ metadata_name = "METADATA" if isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata( metadata_name ): metadata = dist.get_metadata(metadata_name) elif dist.has_metadata("PKG-INFO"): metadata_name = "PKG-INFO" metadata = dist.get_metadata(metadata_name) else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = "" if metadata is None: raise NoneMetadataError(dist, metadata_name) feed_parser = FeedParser() # The following line errors out if with a "NoneType" TypeError if # passed metadata=None. feed_parser.feed(metadata) return feed_parser.close() def get_installer(dist: Distribution) -> str: if dist.has_metadata("INSTALLER"): for line in dist.get_metadata_lines("INSTALLER"): if line.strip(): return line.strip() return "" @functools.lru_cache(maxsize=512) def get_requirement(req_string: str) -> Requirement: """Construct a packaging.Requirement object with caching""" # Parsing requirement strings is expensive, and is also expected to happen # with a low diversity of different arguments (at least relative the number # constructed). This method adds a cache to requirement object creation to # minimize repeated parsing of the same string to construct equivalent # Requirement objects. return Requirement(req_string) PK]ck\\utils/compat.pynu["""Stuff that differs in different Python versions and platform distributions.""" import logging import os import sys __all__ = ["get_path_uid", "stdlib_pkgs", "WINDOWS"] logger = logging.getLogger(__name__) def has_tls() -> bool: try: import _ssl # noqa: F401 # ignore unused return True except ImportError: pass from pip._vendor.urllib3.util import IS_PYOPENSSL return IS_PYOPENSSL def get_path_uid(path: str) -> int: """ Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read. """ if hasattr(os, "O_NOFOLLOW"): fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) file_uid = os.fstat(fd).st_uid os.close(fd) else: # AIX and Jython # WARNING: time of check vulnerability, but best we can do w/o NOFOLLOW if not os.path.islink(path): # older versions of Jython don't have `os.fstat` file_uid = os.stat(path).st_uid else: # raise OSError for parity with os.O_NOFOLLOW above raise OSError(f"{path} is a symlink; Will not return uid for symlinks") return file_uid # packages in the stdlib that may have installation metadata, but should not be # considered 'installed'. this theoretically could be determined based on # dist.location (py27:`sysconfig.get_paths()['stdlib']`, # py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may # make this ineffective, so hard-coding stdlib_pkgs = {"python", "wsgiref", "argparse"} # windows detection, covers cpython and ironpython WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt") PK]Z' utils/virtualenv.pynu[import logging import os import re import site import sys from typing import List, Optional logger = logging.getLogger(__name__) _INCLUDE_SYSTEM_SITE_PACKAGES_REGEX = re.compile( r"include-system-site-packages\s*=\s*(?Ptrue|false)" ) def _running_under_venv() -> bool: """Checks if sys.base_prefix and sys.prefix match. This handles PEP 405 compliant virtual environments. """ return sys.prefix != getattr(sys, "base_prefix", sys.prefix) def _running_under_regular_virtualenv() -> bool: """Checks if sys.real_prefix is set. This handles virtual environments created with pypa's virtualenv. """ # pypa/virtualenv case return hasattr(sys, "real_prefix") def running_under_virtualenv() -> bool: """Return True if we're running inside a virtualenv, False otherwise.""" return _running_under_venv() or _running_under_regular_virtualenv() def _get_pyvenv_cfg_lines() -> Optional[List[str]]: """Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines Returns None, if it could not read/access the file. """ pyvenv_cfg_file = os.path.join(sys.prefix, "pyvenv.cfg") try: # Although PEP 405 does not specify, the built-in venv module always # writes with UTF-8. (pypa/pip#8717) with open(pyvenv_cfg_file, encoding="utf-8") as f: return f.read().splitlines() # avoids trailing newlines except OSError: return None def _no_global_under_venv() -> bool: """Check `{sys.prefix}/pyvenv.cfg` for system site-packages inclusion PEP 405 specifies that when system site-packages are not supposed to be visible from a virtual environment, `pyvenv.cfg` must contain the following line: include-system-site-packages = false Additionally, log a warning if accessing the file fails. """ cfg_lines = _get_pyvenv_cfg_lines() if cfg_lines is None: # We're not in a "sane" venv, so assume there is no system # site-packages access (since that's PEP 405's default state). logger.warning( "Could not access 'pyvenv.cfg' despite a virtual environment " "being active. Assuming global site-packages is not accessible " "in this environment." ) return True for line in cfg_lines: match = _INCLUDE_SYSTEM_SITE_PACKAGES_REGEX.match(line) if match is not None and match.group("value") == "false": return True return False def _no_global_under_regular_virtualenv() -> bool: """Check if "no-global-site-packages.txt" exists beside site.py This mirrors logic in pypa/virtualenv for determining whether system site-packages are visible in the virtual environment. """ site_mod_dir = os.path.dirname(os.path.abspath(site.__file__)) no_global_site_packages_file = os.path.join( site_mod_dir, "no-global-site-packages.txt", ) return os.path.exists(no_global_site_packages_file) def virtualenv_no_global() -> bool: """Returns a boolean, whether running in venv with no system site-packages.""" # PEP 405 compliance needs to be checked first since virtualenv >=20 would # return True for both checks, but is only able to use the PEP 405 config. if _running_under_venv(): return _no_global_under_venv() if _running_under_regular_virtualenv(): return _no_global_under_regular_virtualenv() return False PK]Eutils/temp_dir.pynu[import errno import itertools import logging import os.path import tempfile from contextlib import ExitStack, contextmanager from typing import Any, Dict, Iterator, Optional, TypeVar, Union from pip._internal.utils.misc import enum, rmtree logger = logging.getLogger(__name__) _T = TypeVar("_T", bound="TempDirectory") # Kinds of temporary directories. Only needed for ones that are # globally-managed. tempdir_kinds = enum( BUILD_ENV="build-env", EPHEM_WHEEL_CACHE="ephem-wheel-cache", REQ_BUILD="req-build", ) _tempdir_manager: Optional[ExitStack] = None @contextmanager def global_tempdir_manager() -> Iterator[None]: global _tempdir_manager with ExitStack() as stack: old_tempdir_manager, _tempdir_manager = _tempdir_manager, stack try: yield finally: _tempdir_manager = old_tempdir_manager class TempDirectoryTypeRegistry: """Manages temp directory behavior""" def __init__(self) -> None: self._should_delete: Dict[str, bool] = {} def set_delete(self, kind: str, value: bool) -> None: """Indicate whether a TempDirectory of the given kind should be auto-deleted. """ self._should_delete[kind] = value def get_delete(self, kind: str) -> bool: """Get configured auto-delete flag for a given TempDirectory type, default True. """ return self._should_delete.get(kind, True) _tempdir_registry: Optional[TempDirectoryTypeRegistry] = None @contextmanager def tempdir_registry() -> Iterator[TempDirectoryTypeRegistry]: """Provides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. """ global _tempdir_registry old_tempdir_registry = _tempdir_registry _tempdir_registry = TempDirectoryTypeRegistry() try: yield _tempdir_registry finally: _tempdir_registry = old_tempdir_registry class _Default: pass _default = _Default() class TempDirectory: """Helper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. """ def __init__( self, path: Optional[str] = None, delete: Union[bool, None, _Default] = _default, kind: str = "temp", globally_managed: bool = False, ): super().__init__() if delete is _default: if path is not None: # If we were given an explicit directory, resolve delete option # now. delete = False else: # Otherwise, we wait until cleanup and see what # tempdir_registry says. delete = None # The only time we specify path is in for editables where it # is the value of the --src option. if path is None: path = self._create(kind) self._path = path self._deleted = False self.delete = delete self.kind = kind if globally_managed: assert _tempdir_manager is not None _tempdir_manager.enter_context(self) @property def path(self) -> str: assert not self._deleted, f"Attempted to access deleted path: {self._path}" return self._path def __repr__(self) -> str: return f"<{self.__class__.__name__} {self.path!r}>" def __enter__(self: _T) -> _T: return self def __exit__(self, exc: Any, value: Any, tb: Any) -> None: if self.delete is not None: delete = self.delete elif _tempdir_registry: delete = _tempdir_registry.get_delete(self.kind) else: delete = True if delete: self.cleanup() def _create(self, kind: str) -> str: """Create a temporary directory and store its path in self.path""" # We realpath here because some systems have their default tmpdir # symlinked to another directory. This tends to confuse build # scripts, so we canonicalize the path by traversing potential # symlinks here. path = os.path.realpath(tempfile.mkdtemp(prefix=f"pip-{kind}-")) logger.debug("Created temporary directory: %s", path) return path def cleanup(self) -> None: """Remove the temporary directory created and reset state""" self._deleted = True if not os.path.exists(self._path): return rmtree(self._path) class AdjacentTempDirectory(TempDirectory): """Helper class that creates a temporary directory adjacent to a real one. Attributes: original The original directory to create a temp directory for. path After calling create() or entering, contains the full path to the temporary directory. delete Whether the directory should be deleted when exiting (when used as a contextmanager) """ # The characters that may be used to name the temp directory # We always prepend a ~ and then rotate through these until # a usable name is found. # pkg_resources raises a different error for .dist-info folder # with leading '-' and invalid metadata LEADING_CHARS = "-~.=%0123456789" def __init__(self, original: str, delete: Optional[bool] = None) -> None: self.original = original.rstrip("/\\") super().__init__(delete=delete) @classmethod def _generate_names(cls, name: str) -> Iterator[str]: """Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package). """ for i in range(1, len(name)): for candidate in itertools.combinations_with_replacement( cls.LEADING_CHARS, i - 1 ): new_name = "~" + "".join(candidate) + name[i:] if new_name != name: yield new_name # If we make it this far, we will have to make a longer name for i in range(len(cls.LEADING_CHARS)): for candidate in itertools.combinations_with_replacement( cls.LEADING_CHARS, i ): new_name = "~" + "".join(candidate) + name if new_name != name: yield new_name def _create(self, kind: str) -> str: root, name = os.path.split(self.original) for candidate in self._generate_names(name): path = os.path.join(root, candidate) try: os.mkdir(path) except OSError as ex: # Continue if the name exists already if ex.errno != errno.EEXIST: raise else: path = os.path.realpath(path) break else: # Final fallback on the default behavior. path = os.path.realpath(tempfile.mkdtemp(prefix=f"pip-{kind}-")) logger.debug("Created temporary directory: %s", path) return path PK]^77utils/marker_files.pynu[# The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False import os.path DELETE_MARKER_MESSAGE = '''\ This file is placed here by pip to indicate the source was put here by pip. Once this package is successfully installed this source code will be deleted (unless you remove this file). ''' PIP_DELETE_MARKER_FILENAME = 'pip-delete-this-directory.txt' def has_delete_marker_file(directory): return os.path.exists(os.path.join(directory, PIP_DELETE_MARKER_FILENAME)) def write_delete_marker_file(directory): # type: (str) -> None """ Write the pip delete marker file into this directory. """ filepath = os.path.join(directory, PIP_DELETE_MARKER_FILENAME) with open(filepath, 'w') as marker_fp: marker_fp.write(DELETE_MARKER_MESSAGE) PK]O-utils/filetypes.pynu["""Filetype information. """ from typing import Tuple from pip._internal.utils.misc import splitext WHEEL_EXTENSION = ".whl" BZ2_EXTENSIONS: Tuple[str, ...] = (".tar.bz2", ".tbz") XZ_EXTENSIONS: Tuple[str, ...] = ( ".tar.xz", ".txz", ".tlz", ".tar.lz", ".tar.lzma", ) ZIP_EXTENSIONS: Tuple[str, ...] = (".zip", WHEEL_EXTENSION) TAR_EXTENSIONS: Tuple[str, ...] = (".tar.gz", ".tgz", ".tar") ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS def is_archive_file(name: str) -> bool: """Return True if `name` is a considered as an archive file.""" ext = splitext(name)[1].lower() if ext in ARCHIVE_EXTENSIONS: return True return False PK]utils/__init__.pynu[PK]autils/encoding.pynu[import codecs import locale import re import sys from typing import List, Tuple BOMS: List[Tuple[bytes, str]] = [ (codecs.BOM_UTF8, "utf-8"), (codecs.BOM_UTF16, "utf-16"), (codecs.BOM_UTF16_BE, "utf-16-be"), (codecs.BOM_UTF16_LE, "utf-16-le"), (codecs.BOM_UTF32, "utf-32"), (codecs.BOM_UTF32_BE, "utf-32-be"), (codecs.BOM_UTF32_LE, "utf-32-le"), ] ENCODING_RE = re.compile(br"coding[:=]\s*([-\w.]+)") def auto_decode(data: bytes) -> str: """Check a bytes string for a BOM to correctly detect the encoding Fallback to locale.getpreferredencoding(False) like open() on Python3""" for bom, encoding in BOMS: if data.startswith(bom): return data[len(bom) :].decode(encoding) # Lets check the first two lines as in PEP263 for line in data.split(b"\n")[:2]: if line[0:1] == b"#" and ENCODING_RE.search(line): result = ENCODING_RE.search(line) assert result is not None encoding = result.groups()[0].decode("ascii") return data.decode(encoding) return data.decode( locale.getpreferredencoding(False) or sys.getdefaultencoding(), ) PK]utils/inject_securetransport.pynu["""A helper module that injects SecureTransport, on import. The import should be done as early as possible, to ensure all requests and sessions (or whatever) are created after injecting SecureTransport. Note that we only do the injection on macOS, when the linked OpenSSL is too old to handle TLSv1.2. """ import sys def inject_securetransport() -> None: # Only relevant on macOS if sys.platform != "darwin": return try: import ssl except ImportError: return # Checks for OpenSSL 1.0.1 if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100F: return try: from pip._vendor.urllib3.contrib import securetransport except (ImportError, OSError): return securetransport.inject_into_urllib3() inject_securetransport() PK]_4 && build_env.pynu["""Build Environment used for isolation during sdist building """ import contextlib import logging import os import pathlib import sys import textwrap import zipfile from collections import OrderedDict from sysconfig import get_paths from types import TracebackType from typing import TYPE_CHECKING, Iterable, Iterator, List, Optional, Set, Tuple, Type from pip._vendor.certifi import where from pip._vendor.packaging.requirements import Requirement from 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_prefixed_libs, get_purelib from pip._internal.metadata import get_environment from pip._internal.utils.subprocess import call_subprocess from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds if TYPE_CHECKING: from pip._internal.index.package_finder import PackageFinder logger = logging.getLogger(__name__) class _Prefix: def __init__(self, path: str) -> None: self.path = path self.setup = False self.bin_dir = get_paths( "nt" if os.name == "nt" else "posix_prefix", vars={"base": path, "platbase": path}, )["scripts"] self.lib_dirs = get_prefixed_libs(path) @contextlib.contextmanager def _create_standalone_pip() -> Iterator[str]: """Create a "standalone pip" zip file. The zip file's content is identical to the currently-running pip. It will be used to install requirements into the build environment. """ source = pathlib.Path(pip_location).resolve().parent # Return the current instance if `source` is not a directory. We can't build # a zip from this, and it likely means the instance is already standalone. if not source.is_dir(): yield str(source) return with TempDirectory(kind="standalone-pip") as tmp_dir: pip_zip = os.path.join(tmp_dir.path, "__env_pip__.zip") kwargs = {} if sys.version_info >= (3, 8): kwargs["strict_timestamps"] = False with zipfile.ZipFile(pip_zip, "w", **kwargs) as zf: for child in source.rglob("*"): zf.write(child, child.relative_to(source.parent).as_posix()) yield os.path.join(pip_zip, "pip") class BuildEnvironment: """Creates and manages an isolated environment to install build deps""" def __init__(self) -> None: temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV, globally_managed=True) self._prefixes = OrderedDict( (name, _Prefix(os.path.join(temp_dir.path, name))) for name in ("normal", "overlay") ) self._bin_dirs: List[str] = [] self._lib_dirs: List[str] = [] for prefix in reversed(list(self._prefixes.values())): self._bin_dirs.append(prefix.bin_dir) self._lib_dirs.extend(prefix.lib_dirs) # Customize site to: # - ensure .pth files are honored # - prevent access to system site packages system_sites = { os.path.normcase(site) for site in (get_purelib(), get_platlib()) } self._site_dir = os.path.join(temp_dir.path, "site") if not os.path.exists(self._site_dir): os.mkdir(self._site_dir) with open(os.path.join(self._site_dir, "sitecustomize.py"), "w") as fp: fp.write( textwrap.dedent( """ import os, site, sys # First, drop system-sites related paths. original_sys_path = sys.path[:] known_paths = set() for path in {system_sites!r}: site.addsitedir(path, known_paths=known_paths) system_paths = set( os.path.normcase(path) for path in sys.path[len(original_sys_path):] ) original_sys_path = [ path for path in original_sys_path if os.path.normcase(path) not in system_paths ] sys.path = original_sys_path # Second, add lib directories. # ensuring .pth file are processed. for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) """ ).format(system_sites=system_sites, lib_dirs=self._lib_dirs) ) def __enter__(self) -> None: self._save_env = { name: os.environ.get(name, None) for name in ("PATH", "PYTHONNOUSERSITE", "PYTHONPATH") } path = self._bin_dirs[:] old_path = self._save_env["PATH"] if old_path: path.extend(old_path.split(os.pathsep)) pythonpath = [self._site_dir] os.environ.update( { "PATH": os.pathsep.join(path), "PYTHONNOUSERSITE": "1", "PYTHONPATH": os.pathsep.join(pythonpath), } ) def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: for varname, old_value in self._save_env.items(): if old_value is None: os.environ.pop(varname, None) else: os.environ[varname] = old_value def check_requirements( self, reqs: Iterable[str] ) -> Tuple[Set[Tuple[str, str]], Set[str]]: """Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs """ missing = set() conflicting = set() if reqs: env = get_environment(self._lib_dirs) for req_str in reqs: req = Requirement(req_str) dist = env.get_distribution(req.name) if not dist: missing.add(req_str) continue if isinstance(dist.version, Version): installed_req_str = f"{req.name}=={dist.version}" else: installed_req_str = f"{req.name}==={dist.version}" if dist.version not in req.specifier: conflicting.add((installed_req_str, req_str)) # FIXME: Consider direct URL? return conflicting, missing def install_requirements( self, finder: "PackageFinder", requirements: Iterable[str], prefix_as_string: str, message: str, ) -> None: prefix = self._prefixes[prefix_as_string] assert not prefix.setup prefix.setup = True if not requirements: return with contextlib.ExitStack() as ctx: # TODO: Remove this block when dropping 3.6 support. Python 3.6 # lacks importlib.resources and pep517 has issues loading files in # a zip, so we fallback to the "old" method by adding the current # pip directory to the child process's sys.path. if sys.version_info < (3, 7): pip_runnable = os.path.dirname(pip_location) else: pip_runnable = ctx.enter_context(_create_standalone_pip()) self._install_requirements( pip_runnable, finder, requirements, prefix, message, ) @staticmethod def _install_requirements( pip_runnable: str, finder: "PackageFinder", requirements: Iterable[str], prefix: _Prefix, message: str, ) -> None: args: List[str] = [ sys.executable, pip_runnable, "install", "--ignore-installed", "--no-user", "--prefix", prefix.path, "--no-warn-script-location", ] if logger.getEffectiveLevel() <= logging.DEBUG: args.append("-v") for format_control in ("no_binary", "only_binary"): formats = getattr(finder.format_control, format_control) args.extend( ( "--" + format_control.replace("_", "-"), ",".join(sorted(formats or {":none:"})), ) ) index_urls = finder.index_urls if index_urls: args.extend(["-i", index_urls[0]]) for extra_index in index_urls[1:]: args.extend(["--extra-index-url", extra_index]) else: args.append("--no-index") for link in finder.find_links: args.extend(["--find-links", link]) for host in finder.trusted_hosts: args.extend(["--trusted-host", host]) if finder.allow_all_prereleases: args.append("--pre") if finder.prefer_binary: args.append("--prefer-binary") args.append("--") args.extend(requirements) extra_environ = {"_PIP_STANDALONE_CERT": where()} with open_spinner(message) as spinner: call_subprocess(args, spinner=spinner, extra_environ=extra_environ) class NoOpBuildEnvironment(BuildEnvironment): """A no-op drop-in replacement for BuildEnvironment""" def __init__(self) -> None: pass def __enter__(self) -> None: pass def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: pass def cleanup(self) -> None: pass def install_requirements( self, finder: "PackageFinder", requirements: Iterable[str], prefix_as_string: str, message: str, ) -> None: raise NotImplementedError() PK]b=KK __init__.pynu[from typing import List, Optional import pip._internal.utils.inject_securetransport # noqa from pip._internal.utils import _log # init_logging() must be called before any call to logging.getLogger() # which happens at import of most modules. _log.init_logging() def main(args: (Optional[List[str]]) = None) -> int: """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args, _nowarn=True) PK]gself_outdated_check.pynu[import datetime import hashlib import json import logging import optparse import os.path import sys from typing import Any, Dict from pip._vendor.packaging.version import parse as parse_version from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import get_default_environment from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.network.session import PipSession from pip._internal.utils.filesystem import adjacent_tmp_file, check_path_owner, replace from pip._internal.utils.misc import ensure_dir SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ" logger = logging.getLogger(__name__) def _get_statefile_name(key: str) -> str: key_bytes = key.encode() name = hashlib.sha224(key_bytes).hexdigest() return name class SelfCheckState: def __init__(self, cache_dir: str) -> None: self.state: Dict[str, Any] = {} self.statefile_path = None # Try to load the existing state if cache_dir: self.statefile_path = os.path.join( cache_dir, "selfcheck", _get_statefile_name(self.key) ) try: with open(self.statefile_path, encoding="utf-8") as statefile: self.state = json.load(statefile) except (OSError, ValueError, KeyError): # Explicitly suppressing exceptions, since we don't want to # error out if the cache file is invalid. pass @property def key(self) -> str: return sys.prefix def save(self, pypi_version: str, current_time: datetime.datetime) -> None: # If we do not have a path to cache in, don't bother saving. if not self.statefile_path: return # Check to make sure that we own the directory if not check_path_owner(os.path.dirname(self.statefile_path)): return # Now that we've ensured the directory is owned by this user, we'll go # ahead and make sure that all our directories are created. ensure_dir(os.path.dirname(self.statefile_path)) state = { # Include the key so it's easy to tell which pip wrote the # file. "key": self.key, "last_check": current_time.strftime(SELFCHECK_DATE_FMT), "pypi_version": pypi_version, } text = json.dumps(state, sort_keys=True, separators=(",", ":")) with adjacent_tmp_file(self.statefile_path) as f: f.write(text.encode()) try: # Since we have a prefix-specific state file, we can just # overwrite whatever is there, no need to check. replace(f.name, self.statefile_path) except OSError: # Best effort. pass def was_installed_by_pip(pkg: str) -> bool: """Checks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. """ dist = get_default_environment().get_distribution(pkg) return dist is not None and "pip" == dist.installer def pip_self_version_check(session: PipSession, options: optparse.Values) -> None: """Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. """ installed_dist = get_default_environment().get_distribution("pip") if not installed_dist: return pip_version = installed_dist.version pypi_version = None try: state = SelfCheckState(cache_dir=options.cache_dir) current_time = datetime.datetime.utcnow() # Determine if we need to refresh the state if "last_check" in state.state and "pypi_version" in state.state: last_check = datetime.datetime.strptime( state.state["last_check"], SELFCHECK_DATE_FMT ) if (current_time - last_check).total_seconds() < 7 * 24 * 60 * 60: pypi_version = state.state["pypi_version"] # Refresh the version if we need to or just see if we need to warn if pypi_version is None: # Lets use PackageFinder to see what the latest pip version is link_collector = LinkCollector.create( session, options=options, suppress_no_index=True, ) # Pass allow_yanked=False so we don't suggest upgrading to a # yanked version. selection_prefs = SelectionPreferences( allow_yanked=False, allow_all_prereleases=False, # Explicitly set to False ) finder = PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, ) best_candidate = finder.find_best_candidate("pip").best_candidate if best_candidate is None: return pypi_version = str(best_candidate.version) # save that we've performed a check state.save(pypi_version, current_time) remote_version = parse_version(pypi_version) local_version_is_older = ( pip_version < remote_version and pip_version.base_version != remote_version.base_version and was_installed_by_pip("pip") ) # Determine if our pypi_version is older if not local_version_is_older: return # We cannot tell how the current pip is available in the current # command context, so be pragmatic here and suggest the command # that's always available. This does not accommodate spaces in # `sys.executable`. pip_cmd = f"{sys.executable} -m pip" logger.warning( "You are using pip version %s; however, version %s is " "available.\nYou should consider upgrading via the " "'%s install --upgrade pip' command.", pip_version, pypi_version, pip_cmd, ) except Exception: logger.debug( "There was an error checking the latest version of pip", exc_info=True, ) PK+]2@@%__pycache__/exceptions.cpython-39.pycnu[a Re1@s4dZddlZddlmZmZmZddlmZmZm Z m Z m Z ddl m Z ddlmZmZerddlmZddlmZdd lmZGd d d eZGd d d eZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZ GdddeZ!GdddeZ"Gd d!d!eZ#Gd"d#d#eZ$Gd$d%d%eZ%Gd&d'd'eZ&Gd(d)d)eZ'Gd*d+d+eZ(Gd,d-d-eZ)Gd.d/d/eZ*Gd0d1d1eZ+Gd2d3d3e+Z,Gd4d5d5e+Z-Gd6d7d7e+Z.Gd8d9d9e+Z/Gd:d;d;e+Z0Gdd?d?eZ2dS)@z"Exceptions used throughout packageN)chaingroupbyrepeat) TYPE_CHECKINGDictListOptionalUnion) Distribution)RequestResponse)_Hash)BaseDistribution)InstallRequirementc@seZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/exceptions.pyrsrc@seZdZdZdS)ConfigurationErrorz"General exception in configurationNrrrrrrsrc@seZdZdZdS)InstallationErrorz%General exception during installationNrrrrrrsrc@seZdZdZdS)UninstallationErrorz'General exception during uninstallationNrrrrrrsrc@s8eZdZdZeedfeddddZeddd ZdS) NoneMetadataErrora Raised when accessing "METADATA" or "PKG-INFO" metadata for a pip._vendor.pkg_resources.Distribution object and `dist.has_metadata('METADATA')` returns True but `dist.get_metadata('METADATA')` returns None (and similarly for "PKG-INFO"). rN)dist metadata_namereturncCs||_||_dS)z :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)rr)selfrrrrr__init__*s zNoneMetadataError.__init__rcCsd|j|jS)Nz+None {} metadata found for distribution: {})formatrrrrrr__str__7szNoneMetadataError.__str__) rrrrr r strr r$rrrrr!s   rc@seZdZdZedddZdS)UserInstallationInvalidzBA --user install is requested on an environment without user site.r!cCsdS)Nz$User base directory is not specifiedrr#rrrr$CszUserInstallationInvalid.__str__N)rrrrr%r$rrrrr&@sr&c@seZdZedddZdS)InvalidSchemeCombinationr!cCs6ddd|jddD}d|d|jddS)Nz, css|]}t|VqdSN)r%).0arrr Iz3InvalidSchemeCombination.__str__..z Cannot set z and z together)joinargs)rbeforerrrr$Hsz InvalidSchemeCombination.__str__N)rrrr%r$rrrrr'Gsr'c@seZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNrrrrrr1Msr1c@seZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nrrrrrr2Qsr2c@seZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.Nrrrrrr3Usr3c@seZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundNrrrrrr4Zsr4c@seZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsNrrrrrr5^sr5c@seZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNrrrrrr6bsr6cs<eZdZdZd eeeddfdd ZedddZZ S) NetworkConnectionErrorzHTTP connection errorN) error_msgresponserequestrcsJ||_||_||_|jdur6|js6t|dr6|jj|_t|||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. Nr:)r9r:r8hasattrsuperr )rr8r9r: __class__rrr is zNetworkConnectionError.__init__r!cCs t|jSr()r%r8r#rrrr${szNetworkConnectionError.__str__)NN) rrrrr%r r r r$ __classcell__rrr=rr7fsr7c@seZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.Nrrrrrr@sr@c@seZdZdZdS)UnsupportedWheelzUnsupported wheel.NrrrrrrAsrAc@s4eZdZdZdeeeddddZeddd ZdS) MetadataInconsistentzBuilt metadata contains inconsistent information. This is raised when the metadata contains values (e.g. name and version) that do not match the information previously obtained from sdist filename or user-supplied ``#egg=`` value. rN)ireqfieldf_valm_valrcCs||_||_||_||_dSr()rCrDrErF)rrCrDrErFrrrr szMetadataInconsistent.__init__r!cCsd}||j|j|j|jS)NzJRequested {} has inconsistent {}: filename has {!r}, but metadata has {!r})r"rCrDrErF)rtemplaterrrr$szMetadataInconsistent.__str__)rrrrr%r r$rrrrrBs  rBc@s0eZdZdZeeddddZedddZdS) InstallationSubprocessErrorz-A subprocess call failed during installation.N) returncode descriptionrcCs||_||_dSr()rIrJ)rrIrJrrrr sz$InstallationSubprocessError.__init__r!cCsd|j|jS)NzSCommand errored out with exit status {}: {} Check the logs for full command output.)r"rIrJr#rrrr$sz#InstallationSubprocessError.__str__)rrrrintr%r r$rrrrrHsrHc@sJeZdZdZddddZddddd Zedd d Zedd d Z dS) HashErrorsz:Multiple HashError instances rolled into one for reportingNr!cCs g|_dSr()errorsr#rrrr szHashErrors.__init__ HashError)errorrcCs|j|dSr()rMappend)rrOrrrrPszHashErrors.appendcCsbg}|jjdddt|jddD](\}}||j|dd|Dq&|r^d|SdS) NcSs|jSr()ordererrrr,z$HashErrors.__str__..)keycSs|jSr(r=rRrrrrTr,css|]}|VqdSr()bodyr)rSrrrr+r,z%HashErrors.__str__.. )rMsortrrPheadextendr.)rlinescls errors_of_clsrrrr$s  zHashErrors.__str__cCs t|jSr()boolrMr#rrr__bool__szHashErrors.__bool__) rrrrr rPr%r$r`rarrrrrLs  rLc@s\eZdZUdZdZeded<dZdZe ed<e dd d Z e dd d Z e dd dZ dS)rNa A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. NrreqrYr-rQr!cCsd|S)a=Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with its link already populated by the resolver's _populate_link(). z )_requirement_namer#rrrrVs zHashError.bodycCs|jd|S)NrX)r[rVr#rrrr$szHashError.__str__cCs|jrt|jSdS)zReturn a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers unknown package)rbr%r#rrrrcszHashError._requirement_name)rrrrrbr__annotations__r[rQrKr%rVr$rcrrrrrNs   rNc@seZdZdZdZdZdS)VcsHashUnsupporteduA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.rzlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:NrrrrrQr[rrrrrfsrfc@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedrgzUCan't verify hashes for these file:// requirements because they point to directories:Nrhrrrrrisric@s6eZdZdZdZdZeddddZedd d ZdS) HashMissingz2A hash was needed for a requirement but is absent.awHashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded archives actually had. Add lines like these to your requirements files to prevent tampering. (If you did not enable --require-hashes manually, note that it turns on automatically when any package has a hash.)N) gotten_hashrcCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N)rm)rrmrrrr szHashMissing.__init__r!cCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p>d||jS)Nr) FAVORITE_HASHrbz {} --hash={}:{}rd)pip._internal.utils.hashesrnrb original_linkgetattrr"rm)rrnpackagerrrrVs    zHashMissing.body) rrrrrQr[r%r rVrrrrrks  rkc@seZdZdZdZdZdS) HashUnpinnedzPA requirement had a hash specified but was not pinned to a specific version.zaIn --require-hashes mode, all requirements must have their versions pinned with ==. These do not:Nrhrrrrrs2srsc@sZeZdZdZdZdZeeeefeedfddddZ ed d d Z ed d d Z dS) HashMismatchz Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. zTHESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.r N)allowedgotsrcCs||_||_dS)z :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion N)rwrx)rrwrxrrrr OszHashMismatch.__init__r!cCsd||S)Nz {}: {})r"rc_hash_comparisonr#rrrrVYszHashMismatch.bodycsltdddd}g}|jD]B\}}|||fdd|D|d|j|qd|S) aE Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef z chain[str]) hash_namercSst|gtdS)Nz or)rr)rzrrr hash_then_orhsz3HashMismatch._hash_comparison..hash_then_orc3s|]}dt|VqdS)z Expected {} {}N)r"nextrWprefixrrr+psz0HashMismatch._hash_comparison..z Got {} rX) r%rwitemsr\rPr"rx hexdigestr.)rr{r]rz expectedsrr}rry\s zHashMismatch._hash_comparison) rrrrrQr[rr%rr rVryrrrrru=s & ruc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.NrrrrrrysrcsFeZdZdZd eeeeejddfdd Zeddd Z Z S) !ConfigurationFileCouldNotBeLoadedz8When there are errors while loading a configuration filecould not be loadedN)reasonfnamerOrcs"t|||_||_||_dSr()r<r rrrO)rrrrOr=rrr s z*ConfigurationFileCouldNotBeLoaded.__init__r!cCsF|jdurd|jd}n|jdus(Jd|jd}d|j|S)Nz in .z. rXzConfiguration file )rrOr)r message_partrrrr$s  z)ConfigurationFileCouldNotBeLoaded.__str__)rNN) rrrrr%r configparserErrorr r$r?rrr=rr~s r)3rr itertoolsrrrtypingrrrrr pip._vendor.pkg_resourcesr Zpip._vendor.requests.modelsr r hashlibr pip._internal.metadatarZpip._internal.req.req_installr Exceptionrrrrrr&r'r1r2r3r4r5r6r7r@rArBrHrLrNrfrirkrsrurrrrrrsH    .  * <PK+]&t##(__pycache__/wheel_builder.cpython-39.pycnu[a Re/@sdZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZmZddlmZddlmZmZddlmZmZdd lmZdd lmZdd lm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6e7e8Z9e:dej;Ze e e&e e&fZ?e@e=dddZAe&e=e>e=dddZBe&e=dddZCe&e>e=d d!d"ZDe&e e=dd#d$ZEe&ee@d%d&d'ZFee=d(d)d*ZGe&e@dd+d,d-ZHe&e@e=e e@e e@e=e e@d.d/d0ZIe&e@e e@e e@e=e e@d1d2d3ZJe&e e@e=d4d5d6ZKe e&ee=e e@e e@e?d7d8d9ZLdS):z;Orchestrator for building wheels from InstallRequirements. N)AnyCallableIterableListOptionalTuple)canonicalize_namecanonicalize_version)InvalidVersionVersion) WheelCache)InvalidWheelFilenameUnsupportedWheel)FilesystemWheelget_wheel_distribution)Link)Wheel)build_wheel_pep517)build_wheel_editable)build_wheel_legacy)InstallRequirement) indent_log) ensure_dir hash_fileis_wheel_installed)make_setuptools_clean_args)call_subprocess) TempDirectory) path_to_url)vcsz([a-z0-9_.]+)-([a-z0-9_.!+-]+))sreturncCstt|S)zjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 )bool _egg_info_research)r r%/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/wheel_builder.py_contains_egg_info&sr')req need_wheelcheck_binary_allowedr!cCs|jr dS|jr&|r"td|jdS|r.dS|js8dS|jrF|S|jrPdS||sjtd|jdSt std|jdSdS)zBReturn whether an InstallRequirement should be built into a wheel.Fz(Skipping %s, due to already being wheel.TzCSkipping wheel build for %s, due to binaries being disabled for it.zOUsing legacy 'setup.py install' for %s, since package 'wheel' is not installed.) constraintis_wheelloggerinfoname source_direditablesupports_pyproject_editable use_pep517r)r(r)r*r%r%r& _should_build.s<r4)r(r!cCst|dtdS)NTr)r*)r4 _always_true)r(r%r%r&should_build_for_wheel_commandcsr7)r(r*r!cCst|d|dS)NFr5)r4)r(r*r%r%r& should_build_for_install_commandisr8cCs|js |jsdS|jrb|jjrb|jr(J|js2Jt|jj}|sHJ||jj|jr^dSdS|jslJ|j \}}t |rdSdS)z Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. FT) r1r0linkis_vcsrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr')r( vcs_backendbaseextr%r%r& _should_cachers    rC)r( wheel_cacher!cCs>t|j}|jsJ|r.t|r.||j}n ||j}|S)zdReturn the persistent or temporary cache directory where the built wheel need to be stored. )r" cache_dirr9rCget_path_for_linkget_ephem_path_for_link)r(rDcache_availablerEr%r%r&_get_cache_dirs     rI)_r!cCsdS)NTr%)rJr%r%r&r6sr6)r( wheel_pathr!c Cst|jp d}ttj|}t|j|kr>td||jtt ||}t |j }t |t |j krztd||j |j }|durtdz t|}Wn$tyd|}t|Yn0|tdkrt|j tstd|dS)Nz7Wheel has unexpected file name: expected {!r}, got {!r}zMissing Metadata-VersionzInvalid Metadata-Version: z1.2z6Metadata 1.2 mandates PEP 440 version, but {!r} is not)rr/rospathbasenamer formatrrstrversionr metadata_versionrr r isinstance) r(rKcanonical_namewdist dist_verstrmetadata_version_valuerSmsgr%r%r& _verify_ones<    r[)r( output_dirverify build_optionsglobal_optionsr1r!c Cs|rdnd}z t|Wn8tyP}z td||j|WYd}~dSd}~00|j t|||||}Wdn1s~0Y|r|rzt||Wn<tt fy}z td||j|WYd}~dSd}~00|S)zaBuild one wheel. :return: The filename of the built wheel, or None if the build failed. r1wheelzBuilding %s for %s failed: %sNzBuilt %s for %s is invalid: %s) rOSErrorr-warningr/ build_env_build_one_inside_envr[r r) r(r\r]r^r_r1artifacterKr%r%r& _build_ones,   "rg)r(r\r^r_r1r!c Cstddl}|jsJ|jr|js(J|js2J|rDtd|j|rVtd|j|rtt|j|j|j|jd}qt |j|j|j|jd}nt |j|j |j |||jd}|durVt j|}t j||}zPt|\} } t||td|j|| | td||WWdStyT} ztd |j| WYd} ~ n d} ~ 00|jsht||WddS1s0YdS) Nr`)kindz7Ignoring --global-option when building %s using PEP 517z6Ignoring --build-option when building %s using PEP 517)r/backendmetadata_directorytempd)r/ setup_py_pathr0r_r^rkz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)rr/r3rjpep517_backendr-rbrrNrrrlunpacked_source_directoryrMrOjoinrshutilmover. hexdigest Exception_clean_one_legacy) r(r\r^r_r1temp_dirrK wheel_name dest_path wheel_hashlengthrfr%r%r&rdst         rd)r(r_r!cCsXt|j|d}td|jzt||jdWdStyRtd|jYdS0dS)N)r_zRunning setup.py clean for %s)cwdTz Failed cleaning build dir for %sF) rrlr-r.r/rr0rserror)r(r_ clean_argsr%r%r&rt1s rt) requirementsrDr]r^r_r!c Cs|s ggfStdddd|Dtgg}}|D]p}|jsLJt||}t||||||jol|j} | rt t | |_ |j j |_ |j jsJ||q>||q>Wdn1s0Y|rtdddd |D|rtd dd d |D||fS) zBuild wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build. z*Building wheels for collected packages: %sz, css|] }|jVqdS)Nr/.0r(r%r%r& Rzbuild..NzSuccessfully built %s cSsg|] }|jqSr%r~rr%r%r& orzbuild..zFailed to build %scSsg|] }|jqSr%r~rr%r%r&rtr)r-r.rorr/rIrgr1permit_editable_wheelsrrr9 file_pathlocal_file_pathr,append) r}rDr]r^r_build_successesbuild_failuresr(rE wheel_filer%r%r&build@sH        *r)M__doc__loggingos.pathrMrerptypingrrrrrrpip._vendor.packaging.utilsrr Zpip._vendor.packaging.versionr r pip._internal.cacher pip._internal.exceptionsr rpip._internal.metadatarrpip._internal.models.linkrpip._internal.models.wheelr$pip._internal.operations.build.wheelr-pip._internal.operations.build.wheel_editabler+pip._internal.operations.build.wheel_legacyrZpip._internal.req.req_installrpip._internal.utils.loggingrpip._internal.utils.miscrrr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrpip._internal.utils.urlsrpip._internal.vcsr getLogger__name__r-compile IGNORECASEr#r"BinaryAllowedPredicate BuildResultrQr'r4r7r8rCrIr6r[rgrdrtrr%r%r%r&s                 6   !  ' GPK+]޸__pycache__/main.cpython-39.pycnu[a ReT@s.ddlmZmZdeeeedddZdS))ListOptionalN)argsreturncCsddlm}||S)zThis is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. r)_wrapper)pip._internal.utils.entrypointsr)rrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/main.pymains r )N)typingrrstrintr rrrr sPK+]Ch#%#%$__pycache__/build_env.cpython-39.pycnu[a Re&@sddZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZmZmZmZmZmZmZmZddlmZddlmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$m%Z%dd l&m'Z'ddl(m)Z)ddl*m+Z+m,Z,erddl-m.Z.e/e0Z1GdddZ2ej3ee4dddZ5GdddZ6Gddde6Z7dS)z;Build Environment used for isolation during sdist building N) OrderedDict) get_paths) TracebackType) TYPE_CHECKINGIterableIteratorListOptionalSetTupleType)where) Requirement)Version)__file__) open_spinner) get_platlibget_prefixed_libs get_purelib)get_environment)call_subprocess) TempDirectory tempdir_kinds) PackageFinderc@seZdZeddddZdS)_PrefixN)pathreturncCs@||_d|_ttjdkrdnd||ddd|_t||_dS)NFnt posix_prefix)baseplatbase)varsscripts)rsetuprosnamebin_dirrlib_dirs)selfrr)/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/build_env.py__init__"sz_Prefix.__init__)__name__ __module__ __qualname__strr+r)r)r)r*r!srrc csttj}|s&t|VdStdd}tj |j d}i}t j dkrXd|d<t j|dfi|8}|d D]}||||jqxWdn1s0Ytj |d VWdn1s0YdS) zCreate a "standalone pip" zip file. The zip file's content is identical to the currently-running pip. It will be used to install requirements into the build environment. Nzstandalone-pip)kindz__env_pip__.zip)Fstrict_timestampsw*pip)pathlibPath pip_locationresolveparentis_dirr/rr$rjoinsys version_infozipfileZipFilerglobwrite relative_toas_posix)sourcetmp_dirpip_zipkwargszfchildr)r)r*_create_standalone_pip,s   8rMc@seZdZdZddddZddddZeeeeeee ddd d Z e e e ee e e fee fd d d Zde e e e ddddZee de e ee ddddZdS)BuildEnvironmentzACreates and manages an isolated environment to install build depsNr0csttjddtfdddD|_g|_g|_tt|j D] }|j |j |j |j qDddttfD}tjjd|_tj|jst|jttj|jd d ,}|td j||jd Wdn1s0YdS) NT)r1globally_managedc3s&|]}|ttjj|fVqdSN)rr$rr>.0r%temp_dirr)r* Lsz,BuildEnvironment.__init__..)normaloverlaycSsh|]}tj|qSr))r$rnormcase)rRsiter)r)r* Zsz,BuildEnvironment.__init__..rYzsitecustomize.pyr5a import os, site, sys # First, drop system-sites related paths. original_sys_path = sys.path[:] known_paths = set() for path in {system_sites!r}: site.addsitedir(path, known_paths=known_paths) system_paths = set( os.path.normcase(path) for path in sys.path[len(original_sys_path):] ) original_sys_path = [ path for path in original_sys_path if os.path.normcase(path) not in system_paths ] sys.path = original_sys_path # Second, add lib directories. # ensuring .pth file are processed. for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) ) system_sitesr')rr BUILD_ENVr _prefixes _bin_dirs _lib_dirsreversedlistvaluesappendr&extendr'rrr$rr> _site_direxistsmkdiropenrDtextwrapdedentformat)r(prefixr[fpr)rSr*r+Is.    zBuildEnvironment.__init__cCsndddD|_|jdd}|jd}|r>||tj|jg}tjtj |dtj |ddS)NcSsi|]}|tj|dqSrP)r$environgetrQr)r)r* sz.BuildEnvironment.__enter__..)PATHPYTHONNOUSERSITE PYTHONPATHrq1) _save_envr^rdsplitr$pathseprernupdater>)r(rold_path pythonpathr)r)r* __enter__~s   zBuildEnvironment.__enter__exc_typeexc_valexc_tbrcCs:|jD]*\}}|dur*tj|dq |tj|<q dSrP)ruitemsr$rnpop)r(r}r~rvarname old_valuer)r)r*__exit__szBuildEnvironment.__exit__)reqsrc Cst}t}|rt|j}|D]t}t|}||j}|sF||qt|jt rf|jd|j}n|jd|j}|j|j vr|||fq||fS)zReturn 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs z==z===) setrr_rget_distributionr%add isinstanceversionr specifier) r(rmissing conflictingenvreq_strreqdistinstalled_req_strr)r)r*check_requirementss      z#BuildEnvironment.check_requirementsrfinder requirementsprefix_as_stringmessagercCs|j|}|jrJd|_|s"dStF}tjdkrDtjt }n | t }| |||||Wdn1sv0YdS)NT)r2) r]r# contextlib ExitStackr?r@r$rdirnamer: enter_contextrM_install_requirements)r(rrrrrlctx pip_runnabler)r)r*install_requirementss      z%BuildEnvironment.install_requirements)rrrrlrrcCshtj|dddd|jdg}ttjkr0|ddD]:}t|j |}| d| d d d t |pdd hfq4|j}|r| d |dg|ddD]} | d| gqn |d|jD]} | d| gq|jD]} | d| gq|jr|d|jr|d|d| |dti} t|} t|| | dWdn1sZ0YdS)Ninstallz--ignore-installedz --no-userz--prefixz--no-warn-script-locationz-v) no_binary only_binaryz--_-,z:none:z-irz--extra-index-urlz --no-indexz --find-linksz--trusted-hostz--prez--prefer-binary_PIP_STANDALONE_CERT)spinner extra_environ)r? executablerloggergetEffectiveLevelloggingDEBUGrcgetattrformat_controlrdreplacer>sorted index_urls find_links trusted_hostsallow_all_prereleases prefer_binaryr rr)rrrrlrargsrformatsr extra_indexlinkhostrrr)r)r*rsJ             z&BuildEnvironment._install_requirements)r,r-r.__doc__r+r{r r BaseExceptionrrrr/r r rr staticmethodrrr)r)r)r*rNFs25    rNc@sxeZdZdZddddZddddZeeeeeee ddd d Z ddd d Z d e e e e ddddZdS)NoOpBuildEnvironmentz0A no-op drop-in replacement for BuildEnvironmentNr0cCsdSrPr)r(r)r)r*r+ szNoOpBuildEnvironment.__init__cCsdSrPr)rr)r)r*r{szNoOpBuildEnvironment.__enter__r|cCsdSrPr))r(r}r~rr)r)r*rszNoOpBuildEnvironment.__exit__cCsdSrPr)rr)r)r*cleanupszNoOpBuildEnvironment.cleanuprrcCs tdSrP)NotImplementedError)r(rrrrr)r)r*rsz)NoOpBuildEnvironment.install_requirements)r,r-r.rr+r{r r rrrrrr/rr)r)r)r*r s  r)8rrrr$r8r?rirA collectionsr sysconfigrtypesrtypingrrrrr r r r pip._vendor.certifir Z"pip._vendor.packaging.requirementsrZpip._vendor.packaging.versionrr7rr:pip._internal.cli.spinnersrpip._internal.locationsrrrpip._internal.metadatarpip._internal.utils.subprocessrpip._internal.utils.temp_dirrr"pip._internal.index.package_finderr getLoggerr,rrcontextmanagerr/rMrNrr)r)r)r*s:   (          EPK+]&r$__pycache__/pyproject.cpython-39.pycnu[a Re/@sddlZddlmZddlmZmZmZddlmZddl m Z m Z ddl m Z eeddd Zeed d d Zed gdZeeeeeeedddZdS)N) namedtuple)AnyListOptional)tomli)InvalidRequirement Requirement)InstallationError)objreturncCst|totdd|DS)Ncss|]}t|tVqdS)N) isinstancestr).0itemr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/pyproject.py z"_is_list_of_str..)r listall)r rrr_is_list_of_str sr)unpacked_source_directoryr cCstj|dS)Nzpyproject.toml)ospathjoin)rrrrmake_pyproject_pathsrBuildSystemDetails)requiresbackendcheck backend_path) use_pep517pyproject_tomlsetup_pyreq_namer c Cstj|}tj|}|s.|s.t|d|rtt|dd}t|}Wdn1s^0Y|d}nd}|r|s|dur|stdd}n<|rd|vr|dur|std |dd}n |dur|}|dusJ|sdS|durd d gd d }|dusJd} d|vr0t| j|dd|d} t | sTt| j|dd| D]@} z t | Wn,t yt| j|d| dYn0qX|d} |dg} g}| durd } d d g}t | | || S)aBLoad the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing? None means the user hasn't explicitly specified. pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file req_name - The name of the requirement we're processing (for error reporting) Returns: None if we should use the legacy code path, otherwise a tuple ( requirements from pyproject.toml, name of PEP 517 backend, requirements we should check are installed after setting up the build environment directory paths to import the backend from (backend-path), relative to the project root. ) zW does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.zutf-8)encodingNz build-systemzIDisabling PEP 517 processing is invalid: project does not have a setup.pyT build-backendzbDisabling PEP 517 processing is invalid: project specifies a build backend of {} in pyproject.tomlzsetuptools>=40.8.0wheelz setuptools.build_meta:__legacy__)rr&zO{package} has a pyproject.toml file that does not comply with PEP 518: {reason}rz]it has a 'build-system' table but not 'build-system.requires' which is mandatory in the table)packagereasonz1'build-system.requires' is not a list of strings.z='build-system.requires' contains an invalid requirement: {!r}z backend-path) rrisfiler openrloadgetformatrrrr)r!r"r#r$ has_pyproject has_setupfpp_toml build_systemerror_templater requirementrr rrrrload_pyproject_tomls  (              r6)r collectionsrtypingrrr pip._vendorrZ"pip._vendor.packaging.requirementsrrpip._internal.exceptionsr boolrr rrr6rrrrs    PK+]Mܴ++(__pycache__/configuration.cpython-39.pycnu[a Rea3@s>dZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZejZe d eZerd nd Zd Zed dddddZejej ej!ej"ej#fZ$ej ejej!fZ%ee&Z'eedddZ(ee edddZ)eee efdddZ*GdddZ+dS)a Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from N)AnyDictIterableListNewTypeOptionalTuple)ConfigurationError!ConfigurationFileCouldNotBeLoaded)appdirs)WINDOWS) getLogger) ensure_direnumKindzpip.inizpip.conf)versionhelpuserglobalsiteenvzenv-var)USERGLOBALSITEENVENV_VAR)namereturncCs*|dd}|dr&|dd}|S)zAMake a name consistent regardless of source (environment or file)_-z--N)lowerreplace startswith)rr$/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/configuration.py_normalize_name2s  r&cCs&d|vrd|}t||ddS)N.zbKey does not contain dot separated section and key. Perhaps you wanted to use 'global.{}' instead?)formatr split)r error_messager$r$r%_disassemble_key:sr,rcCstddtdD}tjtjt}tjtjdt rEsz+get_configuration_files..pip~z.pip)r site_config_dirsr.r/r0sysprefixr1 expanduserr user_config_dirkindsrrr)global_config_filessite_config_filelegacy_config_filenew_config_filer$r$r%get_configuration_filesDs   r@cseZdZdZd6eeeddfdd ZddddZee dd d Z e e e e fdd d Ze e d ddZe e ddddZe dd ddZddddZddddZeee e fdddZddddZee edddZe ed d!d"Zddd#d$Ze e e e e fee e fd%d&d'Ze e e e fdd(d)Ze e eee fdd*d+Zeee e fd,d-d.Z e e efdd/d0Z!e edd1d2d3Z"e dd4d5Z#Z$S)7 ConfigurationaHandles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. N)isolated load_onlyrcsjt|dur4|tvr4tddttt||_||_ ddt D|_ ddt D|_ g|_ dS)Nz5Got invalid value for load_only - should be one of {}z, cSsi|] }|gqSr$r$r2variantr$r$r% rsz*Configuration.__init__..cSsi|] }|iqSr$r$rDr$r$r%rFus)super__init__VALID_LOAD_ONLYr r)r0mapreprrBrCOVERRIDE_ORDER_parsers_config_modified_parsers)selfrBrC __class__r$r%rHes  zConfiguration.__init__r-cCs||js|dS)zs8 $      PK+]l.__pycache__/self_outdated_check.cpython-39.pycnu[a Re@sddlZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z ddlmZddlmZddlmZddlmZddlmZdd lmZmZmZdd lmZd Zee Z!e"e"d d dZ#GdddZ$e"e%dddZ&eej'ddddZ(dS)N)AnyDict)parse) LinkCollector) PackageFinder)get_default_environment)SelectionPreferences) PipSession)adjacent_tmp_filecheck_path_ownerreplace) ensure_dirz%Y-%m-%dT%H:%M:%SZ)keyreturncCs|}t|}|SN)encodehashlibsha224 hexdigest)r key_bytesnamer/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py_get_statefile_namesrc@sBeZdZeddddZeedddZeejddd d ZdS) SelfCheckStateN) cache_dirrc Csi|_d|_|rtj|dt|j|_z>t|jdd}t ||_Wdn1sZ0YWnt t t fy~Yn0dS)N selfcheckzutf-8)encoding) statestatefile_pathospathjoinrropenjsonloadOSError ValueErrorKeyError)selfr statefilerrr__init__!s .zSelfCheckState.__init__)rcCstjSr)sysprefix)r)rrrr2szSelfCheckState.key) pypi_version current_timercCs|js dSttj|js dSttj|j|j|t|d}t j |ddd}t |j}| | Wdn1s0Yzt|j|jWntyYn0dS)N)r last_checkr.T),:) sort_keys separators)rr r r!dirnamer rstrftimeSELFCHECK_DATE_FMTr$dumpsr writerr rr&)r)r.r/rtextfrrrsave6s  , zSelfCheckState.save) __name__ __module__ __qualname__strr+propertyrdatetimer<rrrrr sr)pkgrcCst|}|duod|jkS)zChecks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. Npip)rget_distribution installer)rCdistrrrwas_installed_by_pipYs rH)sessionoptionsrcCsRtd}|sdS|j}d}z t|jd}tj}d|jvrzd|jvrztj|jdt }|| dkrz|jd}|durt j ||dd}t d d d } tj || d } | dj} | durWdSt| j}|||t|} || ko|j| jkotd} | s WdStjd }td |||Wn"tyLtjdddYn0dS)zCheck for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. rDN)rr0r.i: T)rJsuppress_no_indexF) allow_yankedallow_all_prereleases)link_collectorselection_prefsz -m pipzYou are using pip version %s; however, version %s is available. You should consider upgrading via the '%s install --upgrade pip' command.z5There was an error checking the latest version of pip)exc_info)rrEversionrrrButcnowrstrptimer7 total_secondsrcreaterrfind_best_candidatebest_candidater@r< parse_version base_versionrHr, executableloggerwarning Exceptiondebug)rIrJinstalled_dist pip_versionr.rr/r0rNrOfinderrWremote_versionlocal_version_is_olderpip_cmdrrrpip_self_version_checkcsj          re))rBrr$loggingoptparseos.pathr r,typingrrZpip._vendor.packaging.versionrrXpip._internal.index.collectorr"pip._internal.index.package_finderrpip._internal.metadatar$pip._internal.models.selection_prefsrpip._internal.network.sessionr pip._internal.utils.filesystemr r r pip._internal.utils.miscr r7 getLoggerr=r[r@rrboolrHValuesrerrrrs*        9 PK+]x''#__pycache__/__init__.cpython-39.pycnu[a ReK@sJddlmZmZddlZddlmZedeeee dddZ dS))ListOptionalN)_log)argsreturncCsddlm}||ddS)zThis is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. r)_wrapperT)_nowarn)pip._internal.utils.entrypointsr)rrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/__init__.pymain s r )N) typingrr*pip._internal.utils.inject_securetransportpipZpip._internal.utilsr init_loggingstrintr r r r r s PK+]B > __pycache__/cache.cpython-39.pycnu[a Re$@sdZddlZddlZddlZddlZddlmZmZmZm Z m Z ddl m Z m Z mZddlmZddlmZddlmZddlmZdd lmZdd lmZmZdd lmZeeZ ee!e!fe!d d dZ"GdddZ#Gddde#Z$Gddde$Z%GdddZ&Gddde#Z'dS)zCache Management N)AnyDictListOptionalSet)Taginterpreter_nameinterpreter_version)canonicalize_name)InvalidWheelFilename) FormatControl)Link)Wheel) TempDirectory tempdir_kinds) path_to_url)dreturncCs&tj|dddd}t|dS)z'Return a stable sha224 of a dictionary.T),:) sort_keys separators ensure_asciiascii)jsondumpshashlibsha224encode hexdigest)rsr!/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cache.py _hash_dictsr#cseZdZdZeeeeddfdd Zee edddZ eee e d d d Z eedd d Z eeee eedddZZS)CacheanAn abstract class - provides cache directories for data from links :param cache_dir: The root of the cache. :param format_control: An object of FormatControl class to limit binaries being read from the cache. :param allowed_formats: which formats of files the cache should store. ('binary' and 'source' are the only allowed values) N) cache_dirformat_controlallowed_formatsrcsTt|rtj|sJ|p$d|_||_||_ddh}|j||ksPJdS)Nsourcebinary) super__init__ospathisabsr%r&r'union)selfr%r&r'_valid_formats __class__r!r"r+(s  zCache.__init__linkrcCsd|ji}|jdur*|jdur*|j||j<|jr:|j|d<t|d<t|d<t|}|dd|dd|dd|ddg}|S) zs(       XF  PK+]- gšcommands/index.pynu[import logging from optparse import Values from typing import Any, Iterable, List, Optional, Union from pip._vendor.packaging.version import LegacyVersion, Version from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import IndexGroupCommand from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.commands.search import print_dist_installation_info from pip._internal.exceptions import CommandError, DistributionNotFound, PipError 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.utils.misc import write_output logger = logging.getLogger(__name__) class IndexCommand(IndexGroupCommand): """ Inspect information available from package indexes. """ usage = """ %prog versions """ def add_options(self) -> None: cmdoptions.add_target_python_options(self.cmd_opts) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.pre()) self.cmd_opts.add_option(cmdoptions.no_binary()) self.cmd_opts.add_option(cmdoptions.only_binary()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: handlers = { "versions": self.get_available_package_versions, } logger.warning( "pip index is currently an experimental command. " "It may be removed/changed in a future release " "without prior warning." ) # Determine action if not args or args[0] not in handlers: logger.error( "Need an action (%s) to perform.", ", ".join(sorted(handlers)), ) return ERROR action = args[0] # Error handling happens here, not in the action-handlers. try: handlers[action](options, args[1:]) except PipError as e: logger.error(e.args[0]) return ERROR return SUCCESS def _build_package_finder( self, options: Values, session: PipSession, target_python: Optional[TargetPython] = None, ignore_requires_python: Optional[bool] = None, ) -> PackageFinder: """ Create a package finder appropriate to the index command. """ link_collector = LinkCollector.create(session, options=options) # Pass allow_yanked=False to ignore yanked versions. selection_prefs = SelectionPreferences( allow_yanked=False, allow_all_prereleases=options.pre, ignore_requires_python=ignore_requires_python, ) return PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, target_python=target_python, ) def get_available_package_versions(self, options: Values, args: List[Any]) -> None: if len(args) != 1: raise CommandError("You need to specify exactly one argument") target_python = cmdoptions.make_target_python(options) query = args[0] with self._build_session(options) as session: finder = self._build_package_finder( options=options, session=session, target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) versions: Iterable[Union[LegacyVersion, Version]] = ( candidate.version for candidate in finder.find_all_candidates(query) ) if not options.pre: # Remove prereleases versions = ( version for version in versions if not version.is_prerelease ) versions = set(versions) if not versions: raise DistributionNotFound( "No matching distribution found for {}".format(query) ) formatted_versions = [str(ver) for ver in sorted(versions, reverse=True)] latest = formatted_versions[0] write_output("{} ({})".format(query, latest)) write_output("Available versions: {}".format(", ".join(formatted_versions))) print_dist_installation_info(query, latest) PK+]V''(commands/__pycache__/list.cpython-39.pycnu[a Re/@sdddlZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'erddl(m)Z)GdddeZ*e e*Z+e,e-Z.GdddeZ/dee eee0ee0fdddZ1dee0dddZ2dS)N)Values) TYPE_CHECKINGIteratorListOptionalSequenceTuplecastcanonicalize_name) cmdoptions)IndexGroupCommand)SUCCESS) CommandError) LinkCollector) PackageFinder)BaseDistributionget_environment)SelectionPreferences) PipSession) stdlib_pkgs)tabulate write_output)map_multithread)DistributionVersionc@s"eZdZUdZeed<eed<dS)_DistWithLatestInfozGive the distribution object a couple of extra fields. These will be populated during ``get_outdated()``. This is dirty but makes the rest of the code much cleaner. latest_versionlatest_filetypeN)__name__ __module__ __qualname____doc__r__annotations__strr$r$/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/list.pyrs rc@seZdZdZdZdZddddZeee dd d Z ee e e d d d ZdeddddZdeddddZdeddddZdeeddddZdeddddZe e e e e ddddZdS) ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. Tz %prog [options]N)returncCs*|jjdddddd|jjddddd d|jjd d ddd d|jjd ddddd|jjdddddd|jt|jjddddd|jjddddddd|jjddddd |jjd!d"d#d$d |jjd%dd#d&d'd(|jtttj|j}|jd)||jd)|jdS)*Nz-oz --outdated store_trueFzList outdated packages)actiondefaulthelpz-uz --uptodatezList uptodate packagesz-ez --editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--useruserz,Only output packages installed in user-site.)destr)r*r+z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatstore list_formatcolumns)r0freezejsonzBSelect the output format among: columns (default), freeze, or json)r)r-r*choicesr+z--not-required not_requiredz>List packages that are not dependencies of installed packages.)r)r-r+z--exclude-editable store_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)r)r-r+r*r) cmd_opts add_optionr list_path list_excludemake_option_group index_groupparserinsert_option_group)self index_optsr$r$r% add_options3s   zListCommand.add_options)optionssessionr'cCs*tj||d}td|jd}tj||dS)zK Create a package finder appropriate to this list command. )rBF) allow_yankedallow_all_prereleases)link_collectorselection_prefs)rcreaterprer)r?rBrCrFrGr$r$r%_build_package_findersz!ListCommand._build_package_finder)rBargsr'cCs|jr|jrtdt|tt}|jrB|dd|jDddt |j j |j |j |j|j|dD}|jr|||}|jr|||}n|jr|||}|||tS)Nz5Options --outdated and --uptodate cannot be combined.css|]}t|VqdSNr ).0nr$r$r% z"ListCommand.run..cSsg|]}td|qS)r)r )rMdr$r$r% sz#ListCommand.run..) local_only user_onlyeditables_onlyinclude_editablesskip)outdatedZuptodaterr check_list_path_optionsetrexcludesupdaterpathiter_installed_distributionslocalr,editabler6r4get_not_required get_outdated get_uptodateoutput_package_listingr)r?rBrKrWpackagesr$r$r%runs.      zListCommand.run_ProcessedDistsrerBr'cCsdd|||DS)NcSsg|]}|j|jkr|qSr$rversionrMdistr$r$r%rRs z,ListCommand.get_outdated..iter_packages_latest_infosr?rerBr$r$r%rbs zListCommand.get_outdatedcCsdd|||DS)NcSsg|]}|j|jkr|qSr$rirkr$r$r%rRs z,ListCommand.get_uptodate..rmror$r$r%rcs zListCommand.get_uptodatecs$dd|Dtfdd|DS)NcSs(h|] }|pdD]}t|jqqS)r$)iter_dependenciesr name)rMrldepr$r$r% sz/ListCommand.get_not_required..csh|]}|jvr|qSr$canonical_name)rMpkgZdep_keysr$r%rsrP)listror$rwr%ras zListCommand.get_not_requiredrc#sr|T}||dtddfdd }t||D]}|dur<|Vq.latest_info..) project_namewheelsdist) find_all_candidatesrurImake_candidate_evaluatorsort_best_candidaterjlinkis_wheelrr)rlZall_candidatesZ evaluatorbest_candidateremote_versiontypfinderrBr$r% latest_infos$  z;ListCommand.iter_packages_latest_infos..latest_info)_build_sessionrJrr)r?rerBrCrrlr$rr%rns  z&ListCommand.iter_packages_latest_infoscCst|ddd}|jdkr:|r:t||\}}|||n^|jdkr|D]4}|jdkrltd|j|j|jqHtd|j|jqHn|jd krtt ||dS) NcSs|jSrLrt)rlr$r$r% rPz4ListCommand.output_package_listing..)keyr0r1z %s==%s (%s)z%s==%sr2) sortedr/format_for_columnsoutput_package_listing_columnsverboserraw_namerjlocationformat_for_json)r?rerBdataheaderrlr$r$r%rds    z"ListCommand.output_package_listing)rrr'cCsbt|dkr|d|t|\}}t|dkrL|ddtdd||D] }t|qPdS)Nrr cSsd|S)N-r$)xr$r$r%r%rPz.)leninsertrjoinmapr)r?rrZ pkg_stringssizesvalr$r$r%rs    z*ListCommand.output_package_listing_columns)rrr r!ignore_require_venvusagerArrrrJrr#intrfrbrcrarrnrdrr$r$r$r%r&(s4V %    ' r&rg)pkgsrBr'cCsddg}|j}|r |ddgtdd|D}|r@|d|jdkrT|d |jdkrh|d g}|D]}|jt|jg}|r|t|j||j |r||j pd |jdkr||j pd |jdkr||j ||qp||fS) z_ Convert the package data into something usable by output_package_listing_columns. PackageVersionZLatestTypecss|] }|jVqdSrL)r`)rMrr$r$r%rO8rPz%format_for_columns..zEditable project locationrZLocationZ Installer) rXextendanyappendrrr#rjrreditable_project_locationr installer)rrBrZrunning_outdatedZ has_editablesrZprojrowr$r$r%r+s2          rrhcCsg}|D]r}|jt|jd}|jdkr@|jp0d|d<|j|d<|jr^t|j|d<|j|d<|j }|rp||d<| |qt |S) N)rqrjrrrrrrr) rr#rjrrrrXrrrrr2dumps)rerBrrlinforr$r$r%rXs     r)3r2loggingoptparsertypingrrrrrrr pip._vendor.packaging.utilsr Zpip._internal.clir pip._internal.cli.req_commandr pip._internal.cli.status_codesrpip._internal.exceptionsrpip._internal.index.collectorr"pip._internal.index.package_finderrpip._internal.metadatarr$pip._internal.models.selection_prefsrpip._internal.network.sessionrpip._internal.utils.compatrpip._internal.utils.miscrrZpip._internal.utils.parallelrZpip._internal.metadata.baserrrg getLoggerrloggerr&r#rrr$r$r$r%s8 $               -PK+]%=*commands/__pycache__/search.cpython-39.pycnu[a ReA@s|ddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z m Z mZddlmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZdd lm Z dd l!m"Z"ddl#m$Z$e rddl m%Z%Gddde%Z&e'e(Z)GdddeeZ*e e e+e+fe ddddZ,e+e+ddddZ-d e dee.ee.ddddZ/e e+e+dddZ0dS)!N) OrderedDict)Values) TYPE_CHECKINGDictListOptional)parse)Command)SessionCommandMixin)NO_MATCHES_FOUNDSUCCESS) CommandError)get_default_environment)PyPI)PipXmlrpcTransport) indent_log) write_output) TypedDictc@s*eZdZUeed<eed<eeed<dS)TransformedHitnamesummaryversionsN)__name__ __module__ __qualname__str__annotations__rrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/search.pyrs rc@s^eZdZdZdZdZddddZeee e dd d Z ee eee e e fd d d Z dS) SearchCommandz@Search for PyPI packages whose name or summary contains .z %prog [options] TN)returncCs.|jjddddtjdd|jd|jdS)Nz-iz--indexindexURLz3Base URL of Python Package Index (default %default))destmetavardefaulthelpr)cmd_opts add_optionrpypi_urlparserinsert_option_group)selfrrr add_options)s zSearchCommand.add_options)optionsargsr cCsV|s td|}|||}t|}d}tjr>td}t||d|rRt St S)Nz)Missing required argument (search query).r)terminal_width) r searchtransform_hitssysstdoutisattyshutilget_terminal_size print_resultsr r )r,r.r/queryZ pypi_hitshitsr0rrrrun5s    zSearchCommand.run)r9r.r c Cs|j}||}t||}tj||}z|||dd}WnBtjjy}z&dj|j |j d} t | WYd}~n d}~00t |t sJ|S)N)rrorz-XMLRPC request failed [code: {code}] {string})codestring)r!get_default_sessionrxmlrpcclient ServerProxyr1Faultformat faultCode faultStringr isinstancelist) r,r9r. index_urlsession transportpypir:faultmessagerrrr1Es  zSearchCommand.search)rrr__doc__usageignore_require_venvr-rrrintr;rr1rrrrr"s  r)r:r cCst}|D]n}|d}|d}|d}||vrF|||gd||<q ||d||t||dkr |||d<q t|S)z The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. rrversion)rrrr)rkeysappendhighest_versionrHvalues)r:packageshitrrrSrrrr2Xs  r2)rlatestr cCst}||}|durtT|j|kr8td|jn,td|jt|jrZtd|n td|Wdn1sx0YdS)NzINSTALLED: %s (latest)z INSTALLED: %sz=LATEST: %s (pre-release; install with `pip install --pre`)z LATEST: %s)rget_distributionrrSr parse_versionpre)rrZenvdistrrrprint_dist_installation_infots    r`)r:name_column_widthr0r c Cs|sdS|dur&tdd|Dd}|D]}|d}|dp@d}t|ddg}|dur||d }|d krt||}d d |d |}|d|d} | |d|} zt| t||Wq*tyYq*0q*dS)Nc Ss.g|]&}t|dtt|ddgqS)rr-)lenrVget).0rYrrr sz!print_results..rrrrb   z ()z - ) maxrVrdtextwrapwrapjoinrr`UnicodeEncodeError) r:rar0rYrrrZZ target_widthZ summary_linesZ name_latestlinerrrr8s6     r8)rr cCs t|tdS)N)key)ror\)rrrrrVsrV)NN)1loggingr6r3rp xmlrpc.clientr@ collectionsroptparsertypingrrrrZpip._vendor.packaging.versionrr\pip._internal.cli.base_commandr pip._internal.cli.req_commandr pip._internal.cli.status_codesr r pip._internal.exceptionsr pip._internal.metadatarpip._internal.models.indexrZpip._internal.network.xmlrpcrpip._internal.utils.loggingrpip._internal.utils.miscrrr getLoggerrloggerrrr2r`rRr8rVrrrrsB             6  &PK+]z)commands/__pycache__/index.cpython-39.pycnu[a Re@sddlZddlmZddlmZmZmZmZmZddl m Z m Z ddl m Z ddlmZddlmZmZddlmZdd lmZmZmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$e%e&Z'GdddeZ(dS)N)Values)AnyIterableListOptionalUnion) LegacyVersionVersion) cmdoptions)IndexGroupCommand)ERRORSUCCESS)print_dist_installation_info) CommandErrorDistributionNotFoundPipError) LinkCollector) PackageFinder)SelectionPreferences) TargetPython) PipSession) write_outputc@sneZdZdZdZddddZeeee ddd Z dee e e e eed d d Zeeeddd dZdS) IndexCommandz= Inspect information available from package indexes. z& %prog versions N)returncCs~t|j|jt|jt|jt|jtttj |j }|j d||j d|jdS)Nr) r add_target_python_optionscmd_opts add_optionignore_requires_pythonpre no_binary only_binarymake_option_group index_groupparserinsert_option_group)self index_optsr'/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/index.py add_optionss zIndexCommand.add_options)optionsargsrc Csd|ji}td|r$|d|vr>tddt|tS|d}z||||ddWn8ty}z t|jdtWYd}~Sd}~00t S)Nversionsztpip index is currently an experimental command. It may be removed/changed in a future release without prior warning.rzNeed an action (%s) to perform., ) get_available_package_versionsloggerwarningerrorjoinsortedr rr+r )r%r*r+handlersactioner'r'r(run/s$ zIndexCommand.run)r*session target_pythonrrcCs.tj||d}td|j|d}tj|||dS)zK Create a package finder appropriate to the index command. )r*F) allow_yankedallow_all_prereleasesr)link_collectorselection_prefsr:)rcreaterrr)r%r*r9r:rr=r>r'r'r(_build_package_finderMs z"IndexCommand._build_package_finderc Cst|dkrtdt|}|d}||}|j||||jd}dd||D}|jsndd|D}t |}|st d |d d t |d d D}|d} Wdn1s0Yt d || t d d|t|| dS)Nr.z(You need to specify exactly one argumentr)r*r9r:rcss|] }|jVqdSN)version).0 candidater'r'r( usz>IndexCommand.get_available_package_versions..css|]}|js|VqdSrA) is_prerelease)rCrBr'r'r(rE{sz%No matching distribution found for {}cSsg|] }t|qSr')str)rCverr'r'r( z?IndexCommand.get_available_package_versions..T)reversez{} ({})zAvailable versions: {}r-)lenrr make_target_python_build_sessionr@rfind_all_candidatesrsetrformatr4rr3r) r%r*r+r:queryr9finderr,Zformatted_versionsZlatestr'r'r(r/fs8   &z+IndexCommand.get_available_package_versions)NN)__name__ __module__ __qualname____doc__usager)rrrGintr8rrrboolrr@rr/r'r'r'r(rs" r))loggingoptparsertypingrrrrrZpip._vendor.packaging.versionrr Zpip._internal.clir pip._internal.cli.req_commandr pip._internal.cli.status_codesr r Zpip._internal.commands.searchrpip._internal.exceptionsrrrpip._internal.index.collectorr"pip._internal.index.package_finderr$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.network.sessionrpip._internal.utils.miscr getLoggerrTr0rr'r'r'r(s            PK+]FKxzz(commands/__pycache__/hash.cpython-39.pycnu[a Re@sddlZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZddlmZmZeeZGdd d eZeeed d d ZdS) N)Values)List)Command)ERRORSUCCESS) FAVORITE_HASH STRONG_HASHES) read_chunks write_outputc@s<eZdZdZdZdZddddZeee e dd d Z dS) HashCommandz Compute a hash of a local package archive. These can be used with --hash in a requirements file to do repeatable installs. z%prog [options] ...TN)returnc Cs:|jjdddtdtddtd|jd|jdS) Nz-az --algorithm algorithmstorez$The hash algorithm to use: one of {}z, )destchoicesactiondefaulthelpr)cmd_opts add_optionrrformatjoinparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/hash.py add_optionss zHashCommand.add_options)optionsargsr cCs>|s|jtjtS|j}|D]}td||t||q tS)Nz%s: --hash=%s:%s) r print_usagesysstderrrr r _hash_of_filer)rrrr pathrrrrun(szHashCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvrrrstrintr%rrrrr s r )r$r r cCsTt|d2}t|}t|D]}||qWdn1sB0Y|S)z!Return the hash digest of a file.rbN)openhashlibnewr update hexdigest)r$r archivehashchunkrrrr#5s    *r#)r0loggingr!optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.utils.hashesrrpip._internal.utils.miscr r getLoggerr&loggerr r,r#rrrrs    &PK+]%?::E:E+commands/__pycache__/install.cpython-39.pycnu[a Rel@sHddlZddlZddlZddlZddlZddlmZmZddlm Z m Z m Z ddl m Z ddlmZddlmZddlmZddlmZmZmZdd lmZmZdd lmZmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8m9Z9ddl:m;Z;ddlZ>ddl?m@Z@mAZAmBZBe4eCZDe#e@dddZEGdddeZFd/eGe eHe eHeGe eHe eHd d!d"ZIe eHeGeGd#d$d%ZJd0e eGe eHe eHe eHeGeGd&d'd(ZKe e*e e eHdd)d*d+ZLeMeGeGeHd,d-d.ZNdS)1N) SUPPRESS_HELPValues)IterableListOptional)canonicalize_name) WheelCache) cmdoptions)make_target_python)RequirementCommandwarn_if_run_as_root with_cleanup)ERRORSUCCESS) CommandErrorInstallationError) get_scheme)get_environment) FormatControl)ConflictDetailscheck_install_conflicts)install_given_reqs)InstallRequirement)get_requirement_tracker)WINDOWS)parse_distutils_argstest_writable_dir) getLogger) ensure_dirget_pip_version(protect_pip_from_modification_on_windows write_output) TempDirectory)running_under_virtualenvvirtualenv_no_global)BinaryAllowedPredicatebuild should_build_for_install_command)format_controlreturncsttdfdd }|S)N)reqr*cs t|jp d}|}d|vS)Nbinary)rnameget_allowed_formats)r+canonical_nameallowed_formatsr)/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/install.pycheck_binary_allowed5s z6get_check_binary_allowed..check_binary_allowed)rbool)r)r5r3r2r4get_check_binary_allowed4sr7c@szeZdZdZdZddddZeeee e ddd Z e e e dd d d Zeeeed ddZee ddddZdS)InstallCommandaI Install packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports installing from "requirements files", which provide an easy way to specify a whole environment to be installed. a% %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...N)r*cCsj|jt|jt|jt|jt|jt|jjdddddddt|j|jjddd d d |jjd dd t d |jjdddddd|jjdddddd|jt |jjdddd dd |jjdddddgdd|jjddd d d |jjd!d"d#d d$d |jt |jt |jt |jt|jt|jt|jjd%d d&d'd(d)|jjd*d d&d+d,|jjd-d d.d'd/d)|jjd0d d1d'd2d)|jt|jt|jt|jt|jtttj|j}|jd3||jd3|jdS)4Nz-tz--target target_dirdirzInstall packages into . By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.)destmetavardefaulthelpz--user use_user_site store_truezInstall to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.))r;actionr>z --no-user store_falsez--root root_pathz=Install everything relative to this alternate root directory.z--prefix prefix_pathzIInstallation prefix where lib, bin and other top-level folders are placedz-Uz --upgradeupgradezUpgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategyupgrade_strategyzonly-if-neededeageraGDetermines how dependency upgrading should be handled [default: %default]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" - are upgraded only when they do not satisfy the requirements of the upgraded package(s).)r;r=choicesr>z--force-reinstallforce_reinstallz;Reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_installedzIgnore the installed packages, overwriting them. This can break your system if the existing package is of a different version or was installed with a different package manager!z --compilecompileTz'Compile Python source files to bytecode)rAr;r=r>z --no-compilez.Do not compile Python source files to bytecode)rAr;r>z--no-warn-script-locationwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictswarn_about_conflictsz%Do not warn about broken dependenciesr)cmd_opts add_optionr requirements constraintsno_depspreeditableadd_target_python_optionsrsrcignore_requires_pythonno_build_isolation use_pep517 no_use_pep517install_optionsglobal_options no_binary only_binary prefer_binaryrequire_hashes progress_barmake_option_group index_groupparserinsert_option_group)self index_optsr3r3r4 add_optionsQs     zInstallCommand.add_options)optionsargsr*c) s.|jr|jdurtdt|d}|jr2|j}tj|dd|jpHg}t dt t |j|j |j|j|jd|_d}d}|jrd|_tj|j|_tj|jrtj|jstdtdd }|j}|||jpg}||}t|} |j||| |jd } t|j|j} |t } t|j! d dd } zx|"||| |}|D] }d|_#qLt$||j|j%| || || |jd }|j&|| || |j|j|j|j'||j(d }|)| |j*||j d}z|+d}Wnt,yd}Yn 0|j-du}t.|dt/| jfdd|j01D}t2|| dggd\}}dd|D}|r^t3d4d5||D]}|j(sbd|_6qb|7|}d}|j8 o|j9}|r|:|}|j;}|js|j rd}t<||||j||j ||j|j=d }t>|j||j|j |jd}t?|} |j@tABddg}!|D]T}"|"jC}#z(| D|#}$|$durN|#d|$jE}#WntFydYn0|!G|#q|dur|jH||I|dd 5|!}%|%rtJd!|%WnPtKy}&z6|jLd"k}'tM|&|'|j}(t jN|(|'d#tOWYd}&~&Sd}&~&00|jr$|sJ|P|j||jtQtRS)$Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT) check_targetzUsing %s)rDr9rC isolated_modez=Target path exists but is not a directory, will not continue.target)kind)risession target_pythonrWinstall)deleternglobally_managed)temp_build_dirri req_trackerrofinderr?) preparerrvri wheel_cacher?rJrWrIrFrY)check_supported_wheelspipF) modifying_pipcsg|]}t|r|qSr3)r(.0rr5r3r4 bs z&InstallCommand.run..)rxverify build_optionsr\cSsg|]}|jr|jqSr3)rYr.r|r3r3r4rrszYCould not build wheels for {}, which is required to install pyproject.toml-based projectsz, i )roothomeprefixrLr? pycompile)userrrrisolatedr.)key-)resolver_variant zSuccessfully installed %s)exc_info)Sr?r9rr check_install_build_globalrErFcheck_dist_restrictionr[loggerverboser decide_user_installrDrCrlrJospathabspathexistsisdirr# enter_contextr\get_default_sessionr _build_package_finderrWr cache_dirr)rno_cleanget_requirementspermit_editable_wheels'reject_location_related_install_optionsmake_requirement_preparer make_resolverrIrYtrace_basic_inforesolveget_requirementKeyError satisfied_byr!r7rPvaluesr'rformatjoinlegacy_install_reasonget_installation_orderignore_dependenciesrM_determine_conflictsrLrrKget_lib_location_guessesrsortoperator attrgetterr.get_distributionversion Exceptionappend_warn_about_conflictsdetermine_resolver_variantr"OSError verbositycreate_os_error_messageerrorr_handle_target_dirr r))rfrirjrFr[target_temp_dirtarget_temp_dir_pathr\rorprvrxru directoryreqsr+rwresolverrequirement_setpip_reqr{ reqs_to_build_build_failurespep517_build_failure_namesr~ to_install conflictsshould_warn_about_conflictsrL installed lib_locationsenvitemsresultiteminstalled_distinstalled_descrshow_tracebackmessager3rr4runsV                              zInstallCommand.run)r9rrEr*c sNt|g}td|jd}|j}|j}|j}tj|rB||tj|r`||kr`||tj|rv|||D]} t | D]} | |krtj || t fdd|ddDrqtj || } tj| r0|st d| qtj| r t d| qtj| r&t| n t| ttj | | | qqzdS)Nr,)rc3s|]}|VqdSN) startswith)r}sddirr3r4 z4InstallCommand._handle_target_dir..zKTarget directory %s already exists. Specify --upgrade to force replacement.zTarget directory %s already exists and is a link. pip will not automatically replace links, please remove if replacement is desired.)rrrpurelibplatlibdatarrrlistdirranyrwarningislinkrshutilrmtreeremovemove) rfr9rrE lib_dir_listscheme purelib_dir platlib_dirdata_dirlib_dirrtarget_item_dirr3rr4rsH       z!InstallCommand._handle_target_dir)rr*cCs.z t|WSty(tdYdS0dS)NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)rrr exception)rfrr3r3r4r s  z#InstallCommand._determine_conflicts)conflict_detailsrr*c Cs|\}\}}|s|sdSg}|dkr0|dn|dks.rr)allsetrrr3r3r4site_packages_writableasr )r?rDr9rCrlr*cCs|dur|stddS|rF|r*tdtr8tdtddS|dusRJ|sZ|rhtddStjs|td dSt||d rtd dStd dS) aZDetermine whether to do a user install based on the input options. If use_user_site is False, no additional checks are done. If use_user_site is True, it is checked for compatibility with other options. If use_user_site is None, the default behaviour depends on the environment, which is provided by the other arguments. Nz$Non-user install by explicit requestFzVCan not combine '--user' and '--prefix' as they imply different installation locationszZCan not perform a '--user' install. User site-packages are not visible in this virtualenv.z User install by explicit requestTz3Non-user install due to --prefix or --target optionz4Non-user install because user site-packages disabledrz0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable) rdebugrr%rsiteENABLE_USER_SITEr info)r?rDr9rCrlr3r3r4rhs8        r)rPrir*cCsttttddd}g}|D]0}|j}t|}|r |d|||q |rzt|}|rz|d|||sdStdd |dS) zIf any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. ) option_namesr*cSsdd|DS)NcSsg|]}d|ddqS)z--{}rr)rreplace)r}r.r3r3r4rrzSreject_location_related_install_options..format_options..r3)rr3r3r4format_optionssz?reject_location_related_install_options..format_optionsz {!r} from {}z{!r} from command lineNzLocation-changing options found in --install-option: {}. This is unsupported, use pip-level options like --user, --prefix, --root, and --target instead.z; ) rrrr[rrrkeysrr)rPrir offendersrr[location_optionsr3r3r4rs0 r)rrusing_user_siter*cCsg}|d|s,|d|t|n |d|dd7<|jtjkrd}d}tsz|sz||d|gn |||d tr|jtjkr|j rt |j d kr|d d | dS) zrFormat an error message for an OSError It may occur anytime during the execution of the install command. z,Could not install packages due to an OSErrorz: .rrz"Consider using the `--user` optionzCheck the permissionsz or z. izHINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths r,) rrerrnoEACCESr$extendlowerrENOENTfilenamelenrstrip)rrrruser_option_partpermissions_partr3r3r4rs>         r)FNNFN)NNNF)Orrrrr optparserrtypingrrrpip._vendor.packaging.utilsrpip._internal.cacherZpip._internal.clir Zpip._internal.cli.cmdoptionsr pip._internal.cli.req_commandr r r pip._internal.cli.status_codesrrpip._internal.exceptionsrrpip._internal.locationsrpip._internal.metadatar#pip._internal.models.format_controlrpip._internal.operations.checkrrpip._internal.reqrZpip._internal.req.req_installrpip._internal.req.req_trackerrpip._internal.utils.compatr"pip._internal.utils.distutils_argsrpip._internal.utils.filesystemrpip._internal.utils.loggingrpip._internal.utils.miscrr r!r"pip._internal.utils.temp_dirr#pip._internal.utils.virtualenvr$r%pip._internal.wheel_builderr&r'r(rrr7r8r6rrr rrrrr3r3r3r4s                   > (PK+]'%%)commands/__pycache__/debug.cpython-39.pycnu[a Re@sddlZddlZddlZddlZddlmZddlmZddlm Z m Z m Z m Z ddl ZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd l m!Z!ddl"m#Z#ddl$m%Z%e&e'Z(e)e ddddZ*ddddZ+e e)e)fdddZ,e)edddZ-e)e e)dddZ.e e)e)fddddZ/ddd d!Z0edd"d#d$Z1ee)d%d&d'Z2Gd(d)d)eZ3dS)*N)Values) ModuleType)AnyDictListOptional)where)parse)__file__) cmdoptions)Command)make_target_python)SUCCESS) Configuration)get_environment) indent_log)get_pip_version)namevaluereturncCstd||dS)Nz%s: %s)loggerinfo)rrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/debug.py show_valuesrrcCsFtdtjj}ttd|Wdn1s80YdS)Nzsys.implementation:r)rrsysimplementationrrr)implementation_namerrrshow_sys_implementations rcCsdtjtjtdd}t|"}dd|D}Wdn1sH0Ytdd|DS)N_vendorz vendor.txtcSs(g|] }d|vr|dddqS)== r)stripsplit.0linerrr -sz)create_vendor_txt_map..css|]}|ddVqdS)r!r#N)r%r&rrr 2z(create_vendor_txt_map..)ospathjoindirname pip_locationopen readlinesdict)Zvendor_txt_pathflinesrrrcreate_vendor_txt_map%s $r6) module_namercCs:|}|dkrd}td|ttddttj|S)N setuptools pkg_resourcesz pip._vendor.r)level)lower __import__globalslocalsgetattrpipr )r7rrrget_module_from_module_name5s rAcCsHt|}t|dd}|sDttj|jg}||}|rDt|j }|S)N __version__) rAr?rr,r-r/r get_distributionstrversion)r7modulerEenvdistrrrget_vendor_version_from_module@s   rI)vendor_txt_versionsrcCsZ|D]L\}}d}t|}|s*d}|}nt|t|krDd|}td|||qdS)z{Log the actual version and print extra info if there is a conflict or if the actual version could not be imported. zM (Unable to locate actual module version, using vendor.txt specified version)z5 (CONFLICT: vendor.txt suggests version should be {})z%s==%s%sN)itemsrI parse_versionformatrr)rJr7Zexpected_versionZ extra_messageZactual_versionrrrshow_actual_vendor_versionsNsrOcCsBtdt}tt|Wdn1s40YdS)Nzvendored library versions:)rrr6rrO)rJrrrshow_vendor_versionscs rP)optionsrc Csd}t|}|}|}d}|r0d|d}dt||}t||jdkrrt||krrd}|d|}nd}tB|D]}tt |q|rd j|d }t|Wdn1s0YdS) N rKz (target: )zCompatible tags: {}{}r#TFz?... [First {tag_limit} tags shown. Pass --verbose to show all.]) tag_limit) r get_tags format_givenrNlenrrverboserrD) rQrT target_pythontagsZformatted_targetsuffixmsgZ tags_limitedtagrrr show_tagsks,  r^)configrcsrt}|D]\}}||ddq|s4dSgdfdd|D}|sVdSd|vrh|dd|S) N.rz Not specified)installwheeldownloadcsg|]}|vr|qSrr)r'r:Zlevels_that_override_globalrrr)sz"ca_bundle_info..globalz, )setrLaddr%remover.)r_Zlevelskey_Zglobal_overriding_levelrrdrca_bundle_infos  rkc@s<eZdZdZdZdZddddZeee e dd d Z dS) DebugCommandz$ Display debug information. z %prog TNrcCs,t|j|jd|j|jjdS)Nr)r add_target_python_optionscmd_optsparserinsert_option_groupr_load)selfrrr add_optionss zDebugCommand.add_options)rQargsrcCstdtdttdtjtdtjtdttdttdt tdtj t td t |jjtd tjd td tjd td ttd tjjtt|tS)NzThis command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.z pip versionz sys.versionzsys.executablezsys.getdefaultencodingzsys.getfilesystemencodingzlocale.getpreferredencodingz sys.platformz'cert' config valueREQUESTS_CA_BUNDLECURL_CA_BUNDLEzpip._vendor.certifi.where()zpip._vendor.DEBUNDLED)rwarningrrrrE executablegetdefaultencodinggetfilesystemencodinglocalegetpreferredencodingplatformrrkror_r,environgetrr@r DEBUNDLEDrPr^r)rrrQrtrrrruns,     zDebugCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvrsrrrDintrrrrrrls rl)4r{loggingr,roptparsertypesrtypingrrrr pip._vendorr@pip._vendor.certifirZpip._vendor.packaging.versionr rMr r0Zpip._internal.clir pip._internal.cli.base_commandr Zpip._internal.cli.cmdoptionsr pip._internal.cli.status_codesrpip._internal.configurationrpip._internal.metadatarpip._internal.utils.loggingrpip._internal.utils.miscr getLoggerrrrDrrr6rArIrOrPr^rkrlrrrrs:                PK+]ŕ69!9!(commands/__pycache__/show.cpython-39.pycnu[a Re@sddlZddlZddlZddlmZddlmZmZmZm Z m Z ddl m Z ddl mZddlmZmZddlmZmZddlmZeeZGd d d eZGd d d eZe ed fe ed fedddZeeeedddZeeeeedddZ dS)N)Values)IteratorList NamedTupleOptionalTuplecanonicalize_name)Command)ERRORSUCCESS)BaseDistributionget_default_environment) write_outputc@s<eZdZdZdZdZddddZeee e dd d Z dS) ShowCommandzx Show information about one or more installed packages. The output is in RFC-compliant mail header format. z$ %prog [options] ...TN)returncCs,|jjddddddd|jd|jdS) Nz-fz--filesfiles store_trueFz7Show the full list of installed files for each package.)destactiondefaulthelpr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/show.py add_optionss zShowCommand.add_options)optionsargsrcCs8|stdtS|}t|}t||j|jds4tStS)Nz.ERROR: Please provide a package name or names.) list_filesverbose)loggerwarningr search_packages_info print_resultsrr#r )rr r!queryresultsrrrrun(s  zShowCommand.run) __name__ __module__ __qualname____doc__usageignore_require_venvrrrstrintr*rrrrrs  rc@seZdZUeed<eed<eed<eeed<eeed<eed<eed<eeed<eed <eed <eed <eed <eed <eeed<eeeed<dS) _PackageInfonameversionlocationrequires required_by installermetadata_version classifierssummaryhomepageauthor author_emaillicense entry_pointsrN)r+r,r-r1__annotations__rrrrrrr36s     r3.)entryinforcCs\|rD|ddkrD|r |ddkr*|d7}n |dd}|dd}qttjg||RS)aConvert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. r..)rENr1pathlibPath)rCrDrrr_convert_legacy_entryHs   rK)r(rc#st}dd|Ddd|D}tfddt||D}|rXtdd|ttt dfd d }tt tt d d d }tt tt d dd}|D],}z |}Wnt yYqYn0tdd| Dt j d} t||t j d} z|d} | jdd} Wnty.g} Yn0||p@||} | durRd}nt| }|j}t|jt |j|jpxd| | |j|jpd|dg|dd|dd|dd|dd|dd| |dVqdS)z Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. cSsi|] }|j|qSr)canonical_name.0distrrr lz(search_packages_info..cSsg|] }t|qSrr)rNr4rrr mrQz(search_packages_info..csg|]\}}|vr|qSrr)rNr4pkg installedrrrRorQzPackage(s) not found: %s, ) current_distrcsfddDS)Nc3s4|],}jdd|Dvr|jdp*dVqdS)cSsh|]}t|jqSr)r r4)rNdrrr yrQzRsearch_packages_info.._get_requiring_packages...NameUNKNOWNN)rLiter_dependenciesmetadatarMrWrr us zHsearch_packages_info.._get_requiring_packages..)valuesr^rTr^r_get_requiring_packagests z5search_packages_info.._get_requiring_packages)rOrcSs<z|d}Wnty"YdS0ddt|DS)NRECORDcss |]}tt|dVqdS)rNrH)rNrowrrrr_rQzCsearch_packages_info.._files_from_record..) read_textFileNotFoundErrorcsvreader splitlines)rOtextrrr_files_from_record|s  z0search_packages_info.._files_from_recordcsz|d}Wnty"YdS0dd|jddD}|j}|j}|dusV|durZ|Szt||Wnty|YS0j s|Sfdd|DS)Nzinstalled-files.txtcss|]}|r|VqdSNrrNprrrr_rQzCsearch_packages_info.._files_from_legacy..Fkeependsc3s"|]}tt|jjVqdSrk)rKrIrJpartsrlZinfo_relrrr_s) rdrerhr6info_directoryrIrJ relative_to ValueErrorrp)rOripathsrootrDrrqr_files_from_legacys$    z0search_packages_info.._files_from_legacycss|] }|jVqdSrk)r4)rNreqrrrr_rQz'search_packages_info..)keyzentry_points.txtFrnN ClassifierZSummaryz Home-pageZAuthorz Author-emailZLicense)r4r5r6r7r8r9r:r;r<r=r>r?r@rAr)riter_distributionssortedzipr$r%joinr rr1rKeyErrorr\lowerrdrhrer]r3raw_namer5r6r9r:get_allget)r(envZ query_namesmissingrarjrwZ query_namerOr7r8Zentry_points_textrAZ files_iterrr]rrTrr&csZ               r&) distributionsr"r#rc CsPd}t|D]<\}}d}|dkr*tdtd|jtd|jtd|jtd|jtd |jtd |jtd |jtd |j td d |j tdd |j |r td|j td|jtd|jD]}td|qtd|jD]}td|q|r td|jdur.tdq |jD]}td|q4q |S)zC Print the information from installed distributions found. FTrz---zName: %sz Version: %sz Summary: %sz Home-page: %sz Author: %szAuthor-email: %sz License: %sz Location: %sz Requires: %srVzRequired-by: %szMetadata-Version: %sz Installer: %sz Classifiers:z %sz Entry-points:zFiles:Nz+Cannot locate RECORD or installed-files.txt) enumeraterr4r5r<r=r>r?r@r6rr7r8r:r9r;rAstripr) rr"r#Zresults_printedirO classifierrClinerrrr's>                r')!rfloggingrIoptparsertypingrrrrrpip._vendor.packaging.utilsr pip._internal.cli.base_commandr pip._internal.cli.status_codesr r pip._internal.metadatar rpip._internal.utils.miscr getLoggerr+r$rr3r1rKr&boolr'rrrrs&     %"`PK+])&)commands/__pycache__/wheel.cpython-39.pycnu[a Re@sddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd lmZmZeeZ Gddde Z!dS)N)Values)List) WheelCache) cmdoptions)RequirementCommand with_cleanup)SUCCESS) CommandError)InstallRequirement)get_requirement_tracker) ensure_dirnormalize_path) TempDirectory)buildshould_build_for_wheel_commandc@s<eZdZdZdZddddZeeee e ddd Z dS) WheelCommanda Build Wheel archives for your requirements and dependencies. Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. For more details, see the wheel docs: https://wheel.readthedocs.io/en/latest/ Requirements: setuptools>=0.8, and wheel. 'pip wheel' uses the bdist_wheel setuptools extension from the wheel package to build individual wheels. z %prog [options] ... %prog [options] -r ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...N)returncCsv|jjddddtjdd|jt|jt|jt|jt|jt |jt |jt |jt |jt |jt|jt|jt|jt|jjddd d d d |jt|jt|jjd d d dd|jtttj|j}|jd||jd|jdS)Nz-wz --wheel-dir wheel_dirdirzLBuild wheels into , where the default is the current working directory.)destmetavardefaulthelpz --no-verify no_verify store_trueFz%Don't verify if built wheel is valid.)ractionrrz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.)rrrr)cmd_opts add_optionoscurdirr no_binary only_binary prefer_binaryno_build_isolation use_pep517 no_use_pep517 constraintseditable requirementssrcignore_requires_pythonno_deps progress_bar build_optionsglobal_optionsrequire_hashesmake_option_group index_groupparserinsert_option_group)self index_optsr6/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/wheel.py add_options+sV  zWheelCommand.add_options)optionsargsrc Cst|||}|||}t|j|j}t|j|_t |j| t }t |j ddd}|||||}|j||||||jdd} |j| ||||j|jd} ||| j|dd} g} | jD](} | jr| | qt| r| | qt| ||j |jp g|jpgd\}}|D]~} | jr:| jjs>J| j sJJzt!"| j |jWn@t#y}z&t$%d | j&||| WYd}~n d}~00q$t'|d krt(d t)S) NwheelT)deletekindglobally_managedF)temp_build_dirr9 req_trackersessionfinder download_dir use_user_site)preparerrBr9 wheel_cacher*r$)check_supported_wheels)rFverifyr-r.z Building wheel for %s failed: %srz"Failed to build one or more wheels)*rcheck_install_build_globalget_default_session_build_package_finderr cache_dirformat_controlr rr enter_contextr rno_cleanget_requirementsmake_requirement_preparer make_resolverr*r$trace_basic_inforesolver(valuesis_wheelsave_linked_requirementrappendrrr-r.linklocal_file_pathshutilcopyOSErrorloggerwarningnamelenr r)r4r9r:rArBrFr@ directoryreqsrEresolverrequirement_set reqs_to_buildreqbuild_successesbuild_failureser6r6r7runesx             $zWheelCommand.run) __name__ __module__ __qualname____doc__usager8rrrstrintrkr6r6r6r7rs :r)"loggingrr[optparsertypingrpip._internal.cacherZpip._internal.clirpip._internal.cli.req_commandrrpip._internal.cli.status_codesrpip._internal.exceptionsr Zpip._internal.req.req_installr pip._internal.req.req_trackerr pip._internal.utils.miscr r pip._internal.utils.temp_dirrpip._internal.wheel_builderrr getLoggerrlr^rr6r6r6r7s           PK+]9>>(commands/__pycache__/help.cpython-39.pycnu[a Rel@sPddlmZddlmZddlmZddlmZddlm Z GdddeZ dS) )Values)List)Command)SUCCESS) CommandErrorc@s.eZdZdZdZdZeeee dddZ dS) HelpCommandzShow help for commandsz %prog T)optionsargsreturnc Csddlm}m}m}z |d}Wnty6tYS0||vrz||}d|dg}|rl|d|dtd|||} | j tS)Nr) commands_dictcreate_commandget_similar_commandszunknown command ""zmaybe you meant "z - ) pip._internal.commandsr r r IndexErrorrappendrjoinparser print_help) selfrr r r r cmd_nameguessmsgcommandr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/help.pyruns    zHelpCommand.runN) __name__ __module__ __qualname____doc__usageignore_require_venvrrstrintrrrrrr srN) optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrpip._internal.exceptionsrrrrrrs     PK+]gIr r *commands/__pycache__/freeze.cpython-39.pycnu[a Re @sxddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZhd ZGd d d eZdS) N)Values)List) cmdoptions)Command)SUCCESS)freeze) stdlib_pkgs> setuptoolswheelZ distributepipc@s<eZdZdZdZdZddddZeee e dd d Z dS) FreezeCommandzx Output installed packages in requirements format. packages are listed in a case-insensitive sorted order. z %prog [options])ext://sys.stderrr N)returnc Cs|jjddddgddd|jjdd d d d d d|jjddd d dd|jt|jjddd ddtd|jjddd dd|jt|j d|jdS)Nz-rz --requirement requirementsappendfilez}Use the order in the given requirements file and its comments when generating output. This option can be used multiple times.)destactiondefaultmetavarhelpz-lz--locallocal store_trueFzUIf in a virtualenv that has global access, do not output globally-installed packages.)rrrrz--useruserz,Only output packages installed in user-site.z--all freeze_allz,Do not skip these packages in the output: {}z, )rrrz--exclude-editableexclude_editablez%Exclude editable package from output.r) cmd_opts add_optionr list_pathformatjoinDEV_PKGS list_excludeparserinsert_option_group)selfr&/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/freeze.py add_optionssR   zFreezeCommand.add_options)optionsargsrc Csptt}|js|t|jr*||jt|t|j |j |j |j |j ||jdD]}tj|dqVtS)N) requirement local_only user_onlypathsisolatedskipr )setrrupdater!excludesrcheck_list_path_optionrrrrpath isolated_modersysstdoutwriter)r%r)r*r0liner&r&r'runMs"    zFreezeCommand.run) __name__ __module__ __qualname____doc__usage log_streamsr(rrstrintr<r&r&r&r'r s 4r )r8optparsertypingrZpip._internal.clirpip._internal.cli.base_commandrpip._internal.cli.status_codesrZpip._internal.operations.freezerpip._internal.utils.compatrr!r r&r&r&r's       PK+]B B -commands/__pycache__/uninstall.cpython-39.pycnu[a Re @sddlZddlmZddlmZddlmZddlmZddl m Z m Z ddl m Z ddlmZdd lmZdd lmZmZdd lmZeeZGd d d ee ZdS)N)Values)List)canonicalize_name)Command)SessionCommandMixinwarn_if_run_as_root)SUCCESS)InstallationError)parse_requirements)install_req_from_line#install_req_from_parsed_requirement)(protect_pip_from_modification_on_windowsc@s8eZdZdZdZddddZeeee ddd Z dS) UninstallCommandaB Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: - Pure distutils packages installed with ``python setup.py install``, which leave behind no metadata to determine what files were installed. - Script wrappers installed by ``python setup.py develop``. zU %prog [options] ... %prog [options] -r ...N)returnc CsD|jjddddgddd|jjdd d d d d |jd|jdS)Nz-rz --requirement requirementsappendfilezjUninstall all the packages listed in the given requirements file. This option can be used multiple times.)destactiondefaultmetavarhelpz-yz--yesyes store_truez2Don't ask for confirmation of uninstall deletions.)rrrr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py add_options$s" zUninstallCommand.add_options)optionsargsrc Cs||}i}|D]4}t||jd}|jr:||t|j<qtd|q|jD]:}t|||dD]&}t ||jd}|jr`||t|j<q`qN|st d|jd|jdt d|vd| D]&}|j |j|jd kd } | r| qttS) N)isolatedzSInvalid requirement: %r ignored - the uninstall command expects named requirements.)r"sessionz*You must give at least one requirement to z (see "pip help z")pip) modifying_pipr) auto_confirmverbose)get_default_sessionr isolated_modenamerloggerwarningrr r r r values uninstallr verbositycommitrr) rr"r#r%Zreqs_to_uninstallr,reqfilename parsed_reqZuninstall_pathsetrrr run;sP      zUninstallCommand.run) __name__ __module__ __qualname____doc__usager!rrstrintr6rrrr rs r)loggingoptparsertypingrpip._vendor.packaging.utilsrpip._internal.cli.base_commandrpip._internal.cli.req_commandrrpip._internal.cli.status_codesrpip._internal.exceptionsr pip._internal.reqr pip._internal.req.constructorsr r pip._internal.utils.miscr getLoggerr7r-rrrrr s         PK+]M̦ 1commands/__pycache__/configuration.cpython-39.pycnu[a Re"@sddlZddlZddlZddlmZddlmZmZmZddl m Z ddl m Z m Z ddlmZmZmZmZddlmZddlmZdd lmZmZeeZGd d d e ZdS) N)Values)AnyListOptional)Command)ERRORSUCCESS) ConfigurationKindget_configuration_fileskinds)PipError) indent_log)get_prog write_outputc@s*eZdZdZdZdZddddZeee e dd d Z ee e ed d d Zeee ddddZeee ddddZeee ddddZeee ddddZeee ddddZeddddZddddZeee ddddZee e e edd d!Zddd"d#Zee d$d%d&ZdS)'ConfigurationCommandaa Manage local and global configuration. Subcommands: - list: List the active configuration (or from the file specified) - edit: Edit the configuration file in an editor - get: Get the value associated with name - set: Set the name=value - unset: Unset the value associated with name - debug: List the configuration files and values defined under them If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen to the user file by default. Ta %prog [] list %prog [] [--editor ] edit %prog [] get name %prog [] set name value %prog [] unset name %prog [] debug N)returncCsl|jjdddddd|jjdddd d d|jjd d dd d d|jjdddd dd|jd|jdS)Nz--editoreditorstorez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)destactiondefaulthelpz--global global_file store_trueFz+Use the system-wide configuration file onlyz--user user_filez$Use the user configuration file onlyz--site site_filez3Use the current environment configuration file onlyr)cmd_opts add_optionparserinsert_option_groupselfr#/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/configuration.py add_options4s: z ConfigurationCommand.add_options)optionsargsrc Cs|j|j|j|j|j|jd}|r.|d|vrHtddt |t S|d}z|j ||dvd}Wn8t y}z t|j dt WYd}~Sd}~00t|j|d|_|jz||||ddWn:t y}z t|j dt WYd}~Sd}~00tS) N)listeditgetsetunsetdebugrzNeed an action (%s) to perform.z, )r*r+r,r)) need_value)isolated load_only) list_valuesopen_in_editorget_nameset_name_value unset_namelist_config_valuesloggererrorjoinsortedr_determine_filer r'r isolated_mode configurationloadr)r"r&r'handlersrr0er#r#r$runZs>    zConfigurationCommand.run)r&r.rcCsddtj|jftj|jftj|jffD}|s`|s8dStddttjDrXtjStjSnt |dkrt|dSt ddS)NcSsg|]\}}|r|qSr#r#).0keyvaluer#r#r$ sz8ConfigurationCommand._determine_file..css|]}tj|VqdS)N)ospathexists)rCsite_config_filer#r#r$ sz7ConfigurationCommand._determine_file..r1rzLNeed exactly one file to operate upon (--user, --site, --global) to perform.) r USERrGLOBALrSITEranyr lenr )r"r&r.Z file_optionsr#r#r$r<s&      z$ConfigurationCommand._determine_filecCs8|j|dddt|jD]\}}td||qdS)Nr(rn%s=%r) _get_n_argsr;r>itemsrr"r&r'rDrEr#r#r$r2sz ConfigurationCommand.list_valuescCs*|j|ddd}|j|}td|dS)Nz get [name]r1rQz%s)rTr> get_valuerrVr#r#r$r4s zConfigurationCommand.get_namecCs.|j|ddd\}}|j|||dS)Nzset [name] [value]rQ)rTr> set_value_save_configurationrVr#r#r$r5sz#ConfigurationCommand.set_name_valuecCs(|j|ddd}|j||dS)Nz unset [name]r1rQ)rTr> unset_valuerZ)r"r&r'rDr#r#r$r6s zConfigurationCommand.unset_namec Cs|j|ddd|t|jD]h\}}td||D]P}t6tj |}td|||rn| |Wdq<1s0Yqiter_config_filesrrrGrHrIprint_config_file_values)r"r&r'variantfilesfnameZ file_existsr#r#r$r7s   z'ConfigurationCommand.list_config_values)r`rc CsP|j|D]:\}}ttd||Wdq1s@0YqdS)z.Get key-value pairs from the file of a variantz%s: %sN)r>get_values_in_configrUrr)r"r`namerEr#r#r$r_sz-ConfigurationCommand.print_config_file_valuescCsftddtBt|jD]"\}}d|}td||q Wdn1sX0YdS)z5Get key-values pairs present as environment variablesr\env_varPIP_rSN)rrr;r>get_environ_varsupper)r"rDrErer#r#r$r]s  z)ConfigurationCommand.print_env_var_valuesc Csr||}|j}|dur$tdzt||gWn6tjyl}ztd|jWYd}~n d}~00dS)Nz%Could not determine appropriate file.z*Editor Subprocess exited with exit code {}) _determine_editorr>get_file_to_editr subprocess check_callCalledProcessErrorformat returncode)r"r&r'rrbrAr#r#r$r3s   z#ConfigurationCommand.open_in_editor)r'examplerRrcCs<t||kr$d|t|}t||dkr4|dS|SdS)zAHelper to make sure the command got the right number of argumentszJGot unexpected number of arguments, expected {}. (example: "{} config {}")r1rN)rPrnrr )r"r'rprRmsgr#r#r$rTs z ConfigurationCommand._get_n_argscCs8z|jWn$ty2tdtdYn0dS)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)r>save Exceptionr8 exceptionr r!r#r#r$rZs z(ConfigurationCommand._save_configuration)r&rcCsD|jdur|jSdtjvr$tjdSdtjvr8tjdStddS)NZVISUALZEDITORz"Could not determine editor to use.)rrGenvironr )r"r&r#r#r$ris     z&ConfigurationCommand._determine_editor)__name__ __module__ __qualname____doc__ignore_require_venvusager%rrstrintrBboolrr r<r2r4r5r6r7r_r]r3rrTrZrir#r#r#r$rs" &- r)loggingrGrkoptparsertypingrrrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.configurationr r r r pip._internal.exceptionsr pip._internal.utils.loggingrpip._internal.utils.miscrr getLoggerrvr8rr#r#r#r$s     PK+],commands/__pycache__/download.cpython-39.pycnu[a Re(@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZddlmZdd lmZmZmZdd lmZeeZGd d d e ZdS) N)Values)List) cmdoptions)make_target_python)RequirementCommand with_cleanup)SUCCESS)get_requirement_tracker) ensure_dirnormalize_path write_output) TempDirectoryc@s<eZdZdZdZddddZeeee e ddd Z dS) DownloadCommandaL Download packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports downloading from "requirements files", which provide an easy way to specify a whole environment to be downloaded. a %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ... %prog [options] ... %prog [options] ...N)returnc CsL|jt|jt|jt|jt|jt|jt|jt |jt |jt |jt |jt |jt|jt|jt|jt|jjddddddtjddt|jttj|j}|jd ||jd |jdS) Nz-dz--destz--destination-dirz--destination-directory download_dirdirzDownload packages into .)destmetavardefaulthelpr)cmd_opts add_optionr constraints requirementsno_depsglobal_options no_binary only_binary prefer_binarysrcprerequire_hashes progress_barno_build_isolation use_pep517 no_use_pep517ignore_requires_pythonoscurdiradd_target_python_optionsmake_option_group index_groupparserinsert_option_group)self index_optsr0/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/download.py add_options%s@ zDownloadCommand.add_options)optionsargsrc Cs&d|_g|_t|t|j|_t|j||}t|}|j ||||j d}| t }t |j ddd}|||||}|j||||||jdd} |j| |||j |jd} ||| j|dd} g} | jD]2} | jdur| jdusJ| | | | jq| r"td d | tS) NT)r3session target_pythonr&download)deletekindglobally_managedF)temp_build_dirr3 req_trackerr5finderr use_user_site)preparerr=r3r&py_version_info)check_supported_wheelszSuccessfully downloaded %s )ignore_installed editablesrcheck_dist_restrictionr rr get_default_sessionr_build_package_finderr& enter_contextr r no_cleanget_requirementsmake_requirement_preparer make_resolverpython_versiontrace_basic_inforesolvervalues satisfied_bynamesave_linked_requirementappendr joinr)r.r3r4r5r6r=r< directoryreqsr?resolverrequirement_set downloadedreqr0r0r1runKs^         zDownloadCommand.run) __name__ __module__ __qualname____doc__usager2rrrstrintr\r0r0r0r1rs  &r)loggingr'optparsertypingrZpip._internal.clirZpip._internal.cli.cmdoptionsrpip._internal.cli.req_commandrrpip._internal.cli.status_codesrpip._internal.req.req_trackerr pip._internal.utils.miscr r r pip._internal.utils.temp_dirr getLoggerr]loggerrr0r0r0r1s        PK+]A[  ,commands/__pycache__/__init__.cpython-39.pycnu[a Re@s$UdZddlZddlmZddlmZmZmZddlm Z eddZ e dd d e d d d e ddde ddde ddde ddde ddde ddde d d!d"e d#d$d%e d&d'd(e d)d*d+e d,d-d.e d/d0d1e d2d3d4e d5d6d7d8Z ee e fe d9<e ee d:d;d<Ze ee d=d>d?ZdS)@z% Package containing all pip commands N) namedtuple)AnyDictOptional)Command CommandInfoz module_path, class_name, summaryzpip._internal.commands.installInstallCommandzInstall packages.zpip._internal.commands.downloadDownloadCommandzDownload packages.z pip._internal.commands.uninstallUninstallCommandzUninstall packages.zpip._internal.commands.freeze FreezeCommandz1Output installed packages in requirements format.zpip._internal.commands.list ListCommandzList installed packages.zpip._internal.commands.show ShowCommandz*Show information about installed packages.zpip._internal.commands.check CheckCommandz7Verify installed packages have compatible dependencies.z$pip._internal.commands.configurationConfigurationCommandz&Manage local and global configuration.zpip._internal.commands.search SearchCommandzSearch PyPI for packages.zpip._internal.commands.cache CacheCommandz%Inspect and manage pip's wheel cache.zpip._internal.commands.index IndexCommandz3Inspect information available from package indexes.zpip._internal.commands.wheel WheelCommandz$Build wheels from your requirements.zpip._internal.commands.hash HashCommandz#Compute hashes of package archives.z!pip._internal.commands.completionCompletionCommandz-A helper command used for command completion.zpip._internal.commands.debug DebugCommandz&Show information useful for debugging.zpip._internal.commands.help HelpCommandzShow help for commands.)installdownload uninstallfreezelistshowcheckconfigsearchcacheindexwheelhash completiondebughelp commands_dict)namekwargsreturncKs:t|\}}}t|}t||}|f||d|}|S)zF Create an instance of the Command class with the given name. )r)summary)r( importlib import_modulegetattr)r)r* module_path class_namer,module command_classcommandr5/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/__init__.pycreate_commandhs   r7)r)r+cCs6ddlm}|}||t}|r.|dSdSdS)zCommand name auto-correct.r)get_close_matchesN)difflibr8lowerr(keys)r)r8close_commandsr5r5r6get_similar_commandsts  r=)__doc__r- collectionsrtypingrrrpip._internal.cli.base_commandrrr(str__annotations__r7r=r5r5r5r6s   T PK+]ZGp4DD)commands/__pycache__/check.cpython-39.pycnu[a Re@svddlZddlmZddlmZddlmZddlmZm Z ddl m Z m Z ddl mZeeZGdd d eZdS) N)Values)List)Command)ERRORSUCCESS)check_package_set!create_package_set_from_installed) write_outputc@s*eZdZdZdZeeeedddZ dS) CheckCommandz7Verify installed packages have compatible dependencies.z %prog [options])optionsargsreturnc Cst\}}t|\}}|D].}||j}||D]} td||| dq0q|D]4}||j}||D]\} } } td||| | | qdqN|s|s|rtStdtSdS)Nz*%s %s requires %s, which is not installed.rz-%s %s has requirement %s, but you have %s %s.zNo broken requirements found.)rrversionr rr) selfr r package_setZ parsing_probsmissing conflicting project_namer dependencydep_name dep_versionreqr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/check.pyruns4      zCheckCommand.runN) __name__ __module__ __qualname____doc__usagerrstrintrrrrrr sr )loggingoptparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.operations.checkrrpip._internal.utils.miscr getLoggerrloggerr rrrrs     PK+]i i .commands/__pycache__/completion.cpython-39.pycnu[a Re @spddlZddlZddlmZddlmZddlmZddlm Z ddl m Z dZ dd d d Z Gd d d eZdS)N)Values)List)Command)SUCCESS)get_progzD # pip {shell} completion start{script}# pip {shell} completion end a _pip_completion() {{ COMPREPLY=( $( COMP_WORDS="${{COMP_WORDS[*]}}" \ COMP_CWORD=$COMP_CWORD \ PIP_AUTO_COMPLETE=1 $1 2>/dev/null ) ) }} complete -o default -F _pip_completion {prog} aM function _pip_completion {{ local words cword read -Ac words read -cn cword reply=( $( COMP_WORDS="$words[*]" \ COMP_CWORD=$(( cword-1 )) \ PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) }} compctl -K _pip_completion {prog} au function __fish_complete_pip set -lx COMP_WORDS (commandline -o) "" set -lx COMP_CWORD ( \ math (contains -i -- (commandline -t) $COMP_WORDS)-1 \ ) set -lx PIP_AUTO_COMPLETE 1 string split \ -- (eval $COMP_WORDS[1]) end complete -fa "(__fish_complete_pip)" -c {prog} )bashzshfishc@s8eZdZdZdZddddZeeee ddd Z dS) CompletionCommandz3A helper command to be used for command completion.TN)returncCs\|jjddddddd|jjdd dd dd d|jjd d ddddd|jd|jdS)Nz--bashz-b store_constrshellzEmit completion code for bash)actionconstdesthelpz--zshz-zrzEmit completion code for zshz--fishz-fr zEmit completion code for fishr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/completion.py add_options6s2 zCompletionCommand.add_options)optionsargsr cCszt}ddt|D}|j|vrZtt|jdjtd}t t j||jdt St j dd|t SdS) z-Prints the completion code of the given shellcSsg|] }d|qS)z--r).0r rrr Uz)CompletionCommand.run..)prog)scriptr zERROR: You must pass {} z or N)COMPLETION_SCRIPTSkeyssortedr textwrapdedentgetformatrprintBASE_COMPLETIONrsysstderrwritejoin)rrrZshellsZ shell_optionsr!rrrrunRs zCompletionCommand.run) __name__ __module__ __qualname____doc__ignore_require_venvrrrstrintr/rrrrr 1sr )r+r%optparsertypingrpip._internal.cli.base_commandrpip._internal.cli.status_codesrpip._internal.utils.miscrr*r"r rrrrs       #PK+]ՅGG)commands/__pycache__/cache.cpython-39.pycnu[a Red@sddlZddlZddlmZddlmZmZddlmm m Z ddl m Z ddl mZmZddlmZmZddlmZeeZGdd d e ZdS) N)Values)AnyList)Command)ERRORSUCCESS) CommandErrorPipError) getLoggerc@seZdZdZdZdZddddZeee e dd d Z eee ddd d Z eee ddd dZeee ddddZee ddddZee ddddZeee ddddZeee ddddZee e dddZeee dddZee ee d d!d"ZdS)# CacheCommandaw Inspect and manage pip's wheel cache. Subcommands: - dir: Show the cache directory. - info: Show information about the cache. - list: List filenames of packages stored in the cache. - remove: Remove one or more package from the cache. - purge: Remove all items from the cache. ```` can be a glob expression or a package name. Tz %prog dir %prog info %prog list [] [--format=[human, abspath]] %prog remove %prog purge N)returncCs,|jjddddddd|jd|jdS) Nz--formatstore list_formathuman)rabspathz:Select the output format among: human (default) or abspath)actiondestdefaultchoiceshelpr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/commands/cache.py add_options's zCacheCommand.add_options)optionsargsr c Cs|j|j|j|j|jd}|js.tdtS|r>|d|vrXtdd t |tS|d}z||||ddWn8t y}z t|j dtWYd}~Sd}~00t S)N)dirinfolistremovepurgezrEr,warningrNunlinkverboser!)rrrrKZno_matching_msgrTrrrr)s    zCacheCommand.remove_cache_itemscCs|r td||dgS)Nr3r5)rr)r4rrrr*szCacheCommand.purge_cache)rsubdirr cCstj|j|S)N)rNrOr.r+)rrrZrrrr@szCacheCommand._cache_dir)rr cCs||d}t|dS)Nr6r5r@rA find_files)rrZhttp_dirrrrr>s zCacheCommand._find_http_files)rrJr cCs,||d}|d|vrdnd}t||S)Nr7-z*.whlz-*.whlr[)rrrJ wheel_dirrrrr?s zCacheCommand._find_wheels)__name__ __module__ __qualname____doc__ignore_require_venvusagerrrstrintr2rr&r'r(rHrIr)r*r@r>r?rrrrr s  $  r )rNrCoptparsertypingrrpip._internal.utils.filesystem _internalutilsrApip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.exceptionsrr pip._internal.utils.loggingr r_r,r rrrrs   PK+]8ddcommands/cache.pynu[import os import textwrap from optparse import Values from typing import Any, List import pip._internal.utils.filesystem as filesystem 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.logging import getLogger logger = getLogger(__name__) class CacheCommand(Command): """ Inspect and manage pip's wheel cache. Subcommands: - dir: Show the cache directory. - info: Show information about the cache. - list: List filenames of packages stored in the cache. - remove: Remove one or more package from the cache. - purge: Remove all items from the cache. ```` can be a glob expression or a package name. """ ignore_require_venv = True usage = """ %prog dir %prog info %prog list [] [--format=[human, abspath]] %prog remove %prog purge """ def add_options(self) -> None: self.cmd_opts.add_option( "--format", action="store", dest="list_format", default="human", choices=("human", "abspath"), help="Select the output format among: human (default) or abspath", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: handlers = { "dir": self.get_cache_dir, "info": self.get_cache_info, "list": self.list_cache_items, "remove": self.remove_cache_items, "purge": self.purge_cache, } if not options.cache_dir: logger.error("pip cache commands can not function since cache is disabled.") return ERROR # Determine action if not args or args[0] not in handlers: logger.error( "Need an action (%s) to perform.", ", ".join(sorted(handlers)), ) return ERROR action = args[0] # Error handling happens here, not in the action-handlers. try: handlers[action](options, args[1:]) except PipError as e: logger.error(e.args[0]) return ERROR return SUCCESS def get_cache_dir(self, options: Values, args: List[Any]) -> None: if args: raise CommandError("Too many arguments") logger.info(options.cache_dir) def get_cache_info(self, options: Values, args: List[Any]) -> None: if args: raise CommandError("Too many arguments") num_http_files = len(self._find_http_files(options)) num_packages = len(self._find_wheels(options, "*")) http_cache_location = self._cache_dir(options, "http") wheels_cache_location = self._cache_dir(options, "wheels") http_cache_size = filesystem.format_directory_size(http_cache_location) wheels_cache_size = filesystem.format_directory_size(wheels_cache_location) message = ( textwrap.dedent( """ Package index page cache location: {http_cache_location} Package index page cache size: {http_cache_size} Number of HTTP files: {num_http_files} Wheels location: {wheels_cache_location} Wheels size: {wheels_cache_size} Number of wheels: {package_count} """ ) .format( http_cache_location=http_cache_location, http_cache_size=http_cache_size, num_http_files=num_http_files, wheels_cache_location=wheels_cache_location, package_count=num_packages, wheels_cache_size=wheels_cache_size, ) .strip() ) logger.info(message) def list_cache_items(self, options: Values, args: List[Any]) -> None: if len(args) > 1: raise CommandError("Too many arguments") if args: pattern = args[0] else: pattern = "*" files = self._find_wheels(options, pattern) if options.list_format == "human": self.format_for_human(files) else: self.format_for_abspath(files) def format_for_human(self, files: List[str]) -> None: if not files: logger.info("Nothing cached.") return results = [] for filename in files: wheel = os.path.basename(filename) size = filesystem.format_file_size(filename) results.append(f" - {wheel} ({size})") logger.info("Cache contents:\n") logger.info("\n".join(sorted(results))) def format_for_abspath(self, files: List[str]) -> None: if not files: return results = [] for filename in files: results.append(filename) logger.info("\n".join(sorted(results))) def remove_cache_items(self, options: Values, args: List[Any]) -> None: if len(args) > 1: raise CommandError("Too many arguments") if not args: raise CommandError("Please provide a pattern") files = self._find_wheels(options, args[0]) no_matching_msg = "No matching packages" if args[0] == "*": # Only fetch http files if no specific pattern given files += self._find_http_files(options) else: # Add the pattern to the log message no_matching_msg += ' for pattern "{}"'.format(args[0]) if not files: logger.warning(no_matching_msg) for filename in files: os.unlink(filename) logger.verbose("Removed %s", filename) logger.info("Files removed: %s", len(files)) def purge_cache(self, options: Values, args: List[Any]) -> None: if args: raise CommandError("Too many arguments") return self.remove_cache_items(options, ["*"]) def _cache_dir(self, options: Values, subdir: str) -> str: return os.path.join(options.cache_dir, subdir) def _find_http_files(self, options: Values) -> List[str]: http_dir = self._cache_dir(options, "http") return filesystem.find_files(http_dir, "*") def _find_wheels(self, options: Values, pattern: str) -> List[str]: wheel_dir = self._cache_dir(options, "wheels") # The wheel filename format, as specified in PEP 427, is: # {distribution}-{version}(-{build})?-{python}-{abi}-{platform}.whl # # Additionally, non-alphanumeric values in the distribution are # normalized to underscores (_), meaning hyphens can never occur # before `-{version}`. # # Given that information: # - If the pattern we're given contains a hyphen (-), the user is # providing at least the version. Thus, we can just append `*.whl` # to match the rest of it. # - If the pattern we're given doesn't contain a hyphen (-), the # user is only providing the name. Thus, we append `-*.whl` to # match the hyphen before the version, followed by anything else. # # PEP 427: https://www.python.org/dev/peps/pep-0427/ pattern = pattern + ("*.whl" if "-" in pattern else "-*.whl") return filesystem.find_files(wheel_dir, pattern) PK+]c ҈II,req/__pycache__/req_uninstall.cpython-39.pycnu[a Re\@sddlZddlZddlZddlZddlZddlmZddlmZm Z m Z m Z m Z m Z mZmZmZddlmZddlmZddlmZddlmZmZddlmZdd lmZdd lmZm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(dd l)m*Z*m+Z+ee,Z-ee.e/e e.d ddZ0e de efe de efdddZ1e1ee e.dddZ2e e.ee.dddZ3e e.ee.dddZ4e e.eee.ee.fdddZ5GdddZ6Gd d!d!Z7Gd"d#d#Z8dS)$N)cache_from_source) AnyCallableDictIterableIteratorListOptionalSetTuple) pkg_resources) Distribution)UninstallationError)get_bin_prefix get_bin_user)WINDOWS)egg_link_path_from_location) getLogger indent_log)askdist_in_usersite dist_is_localis_localnormalize_pathrenamesrmtree)AdjacentTempDirectory TempDirectory)dist script_nameis_guireturncCspt|rt}nt}tj||}|g}trl||d||d|r^||dn||d|S)zCreate the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names z.exez .exe.manifestz -script.pywz -script.py)rrrospathjoinrappend)rrr bin_direxe_namepaths_to_remover)/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py _script_namessr+.)fnr!cs(tttttdfdd }|S)N)argskwr!c?s6t}|i|D]}||vr|||VqdSN)setadd)r-r.seenitemr,r)r*unique5s  z_unique..unique) functoolswrapsrr)r,r5r)r4r*_unique4sr8rr!c cs8zt|d}Wnty}zdj|d}z$t|d}|rL|dkrRtWn6tttfyd|j |j }|d|7}Yn0|d|7}t ||WYd }~n d }~00|D]t}t j |j|d }|V|d rt j |\}} | d d } t j || d }|Vt j || d}|Vqd S)a Yield all the uninstallation paths for dist based on RECORD-without-.py[co] Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc and .pyo in the same directory. UninstallPathSet.add() takes care of the __pycache__ .py[co]. If RECORD is not found, raises UninstallationError, with possible information from the INSTALLER file. https://packaging.python.org/specifications/recording-installed-packages/ RECORDz/Cannot uninstall {dist}, RECORD file not found.)r INSTALLERpipz{}=={}zZ You might be able to recover from this via: 'pip install --force-reinstall --no-deps {}'.z' Hint: The package was installed by {}.Nr.py.pyc.pyo)csvreaderget_metadata_linesFileNotFoundErrorformatnext ValueErrorOSError StopIteration project_nameversionrr"r#r$locationendswithsplit) rrmissing_record_exceptionmsg installerdeprowr#dnr,baser)r)r*uninstallation_paths@s6       rW)pathsr!csJtjjt}t|tdD]*tfdd|D}|s|q|S)zCompact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.keyc3s:|]2}|do0t|dkVqdS)*N) startswithrstriplen).0 shortpathr#sepr)r* uszcompact..)r"r#rbr0sortedr^anyr1)rX short_paths should_skipr)rar*compactls rhc sdd|D}t|}tdd|Dtd}t}ttddd|D]tfd d |DrfqJt}t}tD]B\}}|fd d |D|fd d |Dq|||sJ| || tj qJtt |j ||BS) zReturns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. cSsi|]}tj||qSr))r"r#normcaser_pr)r)r* z'compress_for_rename..cSsh|]}tj|dqS)r)r"r#rNrjr)r)r* rmz&compress_for_rename..rY)ar!cWstjtjj|Sr/)r"r#rir$)ror)r)r* norm_joinsz&compress_for_rename..norm_joinc3s |]}tj|VqdSr/)r"r#rir\)r_w)rootr)r*rcrmz&compress_for_rename..c3s|]}|VqdSr/r))r_ddirnamerprrr)r*rcrmc3s|]}|VqdSr/r))r_frtr)r*rcrm)r0rdvaluesr^strrer"walkupdatedifference_updater1rbmap __getitem__) rXcase_map remaining unchecked wildcards all_files all_subdirssubdirsfilesr)rtr*compress_for_renames" rc Cst|}t}t}t}|D]>}|dr.q|ds@d|vrR|tj|||qtttjj|}t|}|D]d}t |D]T\}} } | D]D} | drqtj || } tj | rtj| |vr|| qqq||dd|DB}||fS)asReturns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are removed. The second set contains files that would have been skipped in the above folders. r?z __init__.py .dist-infocSsh|]}tj|dqS)r[)r"r#r$)r_folderr)r)r*rnrmz.compress_for_output_listing..) r0rMr1r"r#rur|rirhryr$isfile) rX will_remove will_skipfoldersrr#_normcased_filesrdirpath_dirfilesfnamefile_r)r)r*compress_for_output_listings2     rc@s|eZdZdZddddZeedddZeedd d Zeedd d Zddd dZ ddddZ e e dddZ dS)StashedUninstallPathSetzWA set of file rename operations to stash files while tentatively uninstalling them.Nr!cCsi|_g|_dSr/) _save_dirs_movesselfr)r)r*__init__sz StashedUninstallPathSet.__init__r#r!cCsBz t|}Wnty(tdd}Yn0||jtj|<|jS)zStashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir. uninstallkind)rrHrrr"r#ri)rr#save_dirr)r)r*_get_directory_stashs   z,StashedUninstallPathSet._get_directory_stashcCstj|}tj|d}}d}||krdz|j|}WqWntyNYn0tj||}}q"tj|}tdd}||j|<tj||}|r|tjjkrtj |j|S|jS)zStashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.Nrr) r"r#rirurKeyErrorrrelpathcurdirr$)rr#headold_headrrr)r)r*_get_file_stashs"      z'StashedUninstallPathSet._get_file_stashcCsltj|otj| }|r*||}n ||}|j||f|r^tj|r^t|t |||S)zStashes the directory or file and returns its new location. Handle symlinks as files to avoid modifying the symlink targets. ) r"r#isdirislinkrrrr%rmdirr)rr# path_is_dirnew_pathr)r)r*stashs    zStashedUninstallPathSet.stashcCs,|jD]\}}|q g|_i|_dS)z0Commits the uninstall by removing stashed files.N)ritemscleanupr)rrrr)r)r*commits zStashedUninstallPathSet.commitc Cs|jD]}tjdg|Rq|jD]\}}zTtd||tj|sTtj|r`t|ntj |rtt |t ||Wq$t y}z$t d|td|WYd}~q$d}~00q$|dS)z2Undoes the uninstall by moving stashed files back.zMoving to %s from %szReplacing %s from %szFailed to restore %sz Exception: %sN)rloggerinfodebugr"r#rrunlinkrrrrHerrorr)rrkrr#exr)r)r*rollback$s    $z StashedUninstallPathSet.rollbackcCs t|jSr/)boolrrr)r)r* can_rollback7sz$StashedUninstallPathSet.can_rollback)__name__ __module__ __qualname____doc__rrxrrrrrpropertyrrr)r)r)r*rsrc@seZdZdZeddddZeedddZeddd d Z eedd d d Z deeddddZ eedddZ ddddZ ddddZeeddddZdS)UninstallPathSetzMA set of file paths to be removed in the uninstallation of a requirement.Nr9cCs(t|_t|_i|_||_t|_dSr/)r0rX_refusepthrr _moved_paths)rrr)r)r*r@s zUninstallPathSet.__init__rcCst|S)zs Return True if the given path is one we are permitted to remove/modify, False otherwise. )r)rr#r)r)r* _permittedGszUninstallPathSet._permittedcCstj|\}}tjt|tj|}tj|s:dS||rR|j |n |j |tj |ddkr| t |dS)Nr=) r"r#rNr$rriexistsrrXr1rsplitextr)rr#rtailr)r)r*r1Os   zUninstallPathSet.add)pth_fileentryr!cCsLt|}||r<||jvr*t||j|<|j||n |j|dSr/)rrrUninstallPthEntriesr1r)rrrr)r)r*add_pthbs   zUninstallPathSet.add_pthF) auto_confirmverboser!cCs|jstd|jjdS|jjd|jj}td|tz|sP||r|j}t |j}t t |D]}| |t d|ql|jD] }|qtd|Wdn1s0YdS)z[Remove paths in ``self.paths`` with confirmation (unless ``auto_confirm`` is True).z7Can't uninstall '%s'. No files were found to uninstall.N-zUninstalling %s:zRemoving file or directory %szSuccessfully uninstalled %s)rXrrrrJrKr_allowed_to_proceedrrrdrhrrrrwremove)rrrdist_name_versionmoved for_renamer#rr)r)r*rks$    zUninstallPathSet.remove)rr!cCs|tttdddd}|s*t|j\}}nt|j}t}|d||d||d|j|rn|dt|jtd d d kS) z@Display which files would be deleted and prompt for confirmationN)rQrXr!cSsX|sdSt|t,tt|D]}t|q&Wdn1sJ0YdSr/)rrrrdrh)rQrXr#r)r)r*_displays  z6UninstallPathSet._allowed_to_proceed.._displayz Would remove:z+Would not remove (might be manually added):z%Would not remove (outside of prefix):zWill actually move:zProceed (Y/n)? )ynr)rxrrrXr0rrr)rrrrrr)r)r*rs     z$UninstallPathSet._allowed_to_proceedrcCsR|jjstd|jjdStd|jj|j|j D] }|q@dS)z1Rollback the changes previously made by remove().z'Can't roll back %s; was not uninstalledNzRolling back uninstall of %s) rrrrrrJrrrrw)rrr)r)r*rs zUninstallPathSet.rollbackcCs|jdS)z?Remove temporary save dir: rollback will no longer be possible.N)rrrr)r)r*rszUninstallPathSet.commitcst|j}t|s.td|j|tj||S|ddt dt dhDvrhtd|j|||S||}t |j }d t |j }|jotj|j}t|jdd}|r|jd r|j|s||j|d r |d D]&}tjtj|j|} || qn|d r|d rD|d ngfd d|d DD]J} tj|j| } || || d|| d|| dqdnF|rtd |j n,|jdr$||jtj|jd} tjtj|jd} || d| n|rT|jdrTt |D]} || q@n|rt!|$} tj"| #$}Wdn1s0Y||jksJd ||j |j||tjtj|d} || |jnt%d||j|drn|&drn|'dD]P}t(|r2t)}nt*}|tj||t+r|tj||dqg}|j,dd}|-D]}|.t/||dq|j,dd}|-D]}|.t/||d q|D]}||q|S)!Nz1Not uninstalling %s at %s, outside environment %scSsh|] }|r|qSr)r)rjr)r)r*rnsz-UninstallPathSet.from_dist..stdlib platstdlibzs z.UninstallPathSet.from_dist..r=r?r@zCannot uninstall {!r}. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.z.eggrzeasy-install.pthz./rz;Egg-link {} does not match installed location of {} (at {})z)Not sure how to uninstall: %s - Check: %sscriptsz.batconsole_scripts)groupF gui_scriptsT)0rrLrrrrZsysprefix sysconfigget_pathrrJrEr to_filenameegg_infor"r#rgetattr _providerrMr1 has_metadata get_metadata splitlinesnormpathr$rrNrurrWopenrireadlinestriprmetadata_isdirmetadata_listdirrrrr get_entry_mapkeysextendr+)clsr dist_pathr(develop_egg_linkdevelop_egg_link_egg_infoegg_info_existsdistutils_egg_infoinstalled_filer# top_level_pkgeasy_install_eggeasy_install_pthfh link_pointerscriptr&_scripts_to_removernamersr)rr* from_dists                 4        zUninstallPathSet.from_dist)FF)rrrrr rrxrrr1rrrrr classmethodrr)r)r)r*r<s  rc@sHeZdZeddddZeddddZddd d Zedd d ZdS) rN)rr!cCs||_t|_d|_dSr/)filer0entries _saved_lines)rrr)r)r*rCszUninstallPthEntries.__init__)rr!cCs<tj|}tr,tj|ds,|dd}|j|dS)Nr\/)r"r#rir splitdrivereplacerr1)rrr)r)r*r1Hs  zUninstallPthEntries.addrc Cs2td|jtj|js.td|jdSt|jd}|}||_ Wdn1s^0Yt dd|Drd}nd}|r|d | d s|d| d |d<|j D]<}z$td |||| d WqtyYq0qt|jd }||Wdn1s$0YdS) NzRemoving pth entries from %s:z.Cannot remove entries from nonexistent file %srbcss|]}d|vVqdS)s Nr))r_liner)r)r*rcbrmz-UninstallPthEntries.remove..z  zutf-8zRemoving entry: %swb)rrrr"r#rwarningr readlinesrrerMencoderrrG writelines)rrlinesendlinerr)r)r*rWs($   zUninstallPthEntries.removecCsf|jdurtd|jdStd|jt|jd}||jWdn1sX0YdS)Nz.Cannot roll back changes to %s, none were madeFz!Rolling %s back to previous staterT)rrrrrrr)rrr)r)r*rrs *zUninstallPthEntries.rollback) rrrrxrr1rrrr)r)r)r*rBsr)9rAr6r"rrimportlib.utilrtypingrrrrrrr r r pip._vendorr pip._vendor.pkg_resourcesr pip._internal.exceptionsrpip._internal.locationsrrpip._internal.utils.compatrpip._internal.utils.egg_linkrpip._internal.utils.loggingrrpip._internal.utils.miscrrrrrrrpip._internal.utils.temp_dirrrrrrxrr+r8rWrhrrrrrr)r)r)r*s8 ,     $ ( +"$2iPK+]Ž[\d4d4'req/__pycache__/req_file.cpython-39.pycnu[a Re D@sUdZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZmZddlmZddlmZmZddlmZddlmZdd lmZdd lmZdd lm Z e rdd lm!Z!dd l"m#Z#dgZ$e ee%e&fZ'e e&gee&effZ(e)dej*Z+e)dZ,e)dZ-ej.ej/ej0ej1ej2ej3ej4ej5ej6ej7ej8ej9ej:ej;gZd<ej?ej@ejAgZBee dej=fe>d<ddeBDZCGdddZDGdddZEdBe&eedeejeFeeDdddZGe&e'dd d!ZHdCeEeejeDd"d#d$ZIdDee&e%edeejeedd%d&d'ZJdEeEeejedeeeeDd(d)d*ZKGd+d,d,ZLede(d-d.d/ZMe&ee&e&fd0d1d2ZNGd3d4d4eOZPejQd5d6d7ZRe'e'd8d9d:ZSe'e'd8d;d<ZTe'e'd8d=d>ZUe&eee&e&fd?d@dAZVdS)Fz Requirements file parsing N)Values) TYPE_CHECKINGAnyCallableDictIterableIteratorListOptionalTuple) cmdoptions)InstallationErrorRequirementsFileParseError) SearchScope) PipSession)raise_for_status) auto_decode)get_url_scheme)NoReturn) PackageFinderparse_requirementsz^(http|https|file):z (^|\s+)#.*$z#(?P\$\{(?P[A-Z0-9_]+)\}).SUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQcCsg|]}t|jqS)strdest).0orr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/req_file.py Nrc @s8eZdZdeeeeeeeefeeddddZdS)ParsedRequirementN) requirement is_editable comes_from constraintoptions line_sourcereturncCs(||_||_||_||_||_||_dSN)r"r#r$r&r%r')selfr"r#r$r%r&r'rrr__init__Rs zParsedRequirement.__init__)NN) __name__ __module__ __qualname__rboolr rrr+rrrrr!Qsr!c@s$eZdZeeeeeddddZdS) ParsedLineN)filenamelinenoargsoptsr%r(cCsZ||_||_||_||_|r0d|_d|_||_n&|jrPd|_d|_|jd|_nd|_dS)NTFr)r1r2r4r%is_requirementr#r" editables)r*r1r2r3r4r%rrrr+dszParsedLine.__init__)r,r-r.rintrr/r+rrrrr0csr0Fr)r1sessionfinderr&r%r(c csFt|}t||}|||D]"}t||||d}|dur|VqdS)aqParse a requirements file and yield ParsedRequirement instances. :param filename: Path or url of requirements file. :param session: PipSession instance. :param finder: Instance of pip.index.PackageFinder. :param options: cli options. :param constraint: If true, parsing a constraint file rather than requirements file. )r&r9r8N)get_line_parserRequirementsFileParserparse handle_line) r1r8r9r&r% line_parserparser parsed_line parsed_reqrrrr~s )contentr(cCs,t|dd}t|}t|}t|}|S)zxSplit, filter, and join lines, and return a line iterator :param content: the content of the requirements file )start) enumerate splitlines join_linesignore_commentsexpand_env_variables)rB lines_enumrrr preprocesss rK)liner&r(cCsd|jrdnd|j|j}|js&J|jrBt|j|j||jdS|rTt ||j i}t D],}||j j vr\|j j |r\|j j |||<q\d|jd|j}t|j|j||j||dSdS)Nz{} {} (line {})z-cz-r)r"r#r$r%line  of )r"r#r$r%r&r') formatr%r1r2r5r#r!r"r check_install_build_globalr4SUPPORTED_OPTIONS_REQ_DEST__dict__)rLr&line_comes_from req_optionsrr'rrrhandle_requirement_lines8  rU)r4r1r2r9r&r8r(cs8r4|jr|j_|jr4jfdd|jD|r4|j}|j}|jrT|jg}|jdurbg}|jrt||j|jr|jd}tj tj |} tj | |} tj | r| }|||r||t||d} | |_|jr||jr||r4|jp gD]$} d|d|} |j| | dqdS) Nc3s|]}|jvr|VqdSr))features_enabled)rfr&rr sz%handle_option_line..Tr) find_links index_urlsrMrN)source)require_hashesrVextendrZr[ index_urlno_indexextra_index_urlsospathdirnameabspathjoinexistsappendupdate_index_urlsr search_scopepreset_allow_all_prereleases prefer_binaryset_prefer_binary trusted_hostsadd_trusted_host)r4r1r2r9r&r8rZr[valuereq_dirrelative_to_reqs_filerjhostr\rrXrhandle_option_linesL       ru)rLr&r9r8r(cCs4|jrt||}|St|j|j|j|||dSdS)aHandle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The session - updated by non-requirement lines. Returns a ParsedRequirement object if the line is a requirement line, otherwise returns None. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder. N)r5rUrur4r1r2)rLr&r9r8rArrrr=s r=c@s`eZdZeeddddZeeee dddZ eeee ddd Z eeee dd d Z dS) r;N)r8r>r(cCs||_||_dSr))_session _line_parser)r*r8r>rrrr+<szRequirementsFileParser.__init__)r1r%r(ccs|||EdHdS)z*Parse a given file, yielding parsed lines.N)_parse_and_recurse)r*r1r%rrrr<DszRequirementsFileParser.parseccs|||D]}|js|jjs&|jjr|jjr@|jjd}d}n|jjd}d}t|rjtj ||}n t|st j t j ||}|||EdHq |Vq dS)NrFT) _parse_filer5r4 requirements constraints SCHEME_REsearchurllibr<urljoinrbrcrfrdrx)r*r1r%rLreq_pathnested_constraintrrrrxHs(     z)RequirementsFileParser._parse_and_recursec cst||j\}}t|}|D]l\}}z||\}} Wn>tyt} z&d|d| j} t| WYd} ~ n d} ~ 00t|||| |VqdS)NzInvalid requirement:  )get_file_contentrvrKrwOptionParsingErrormsgrr0) r*r1r%_rBrJ line_numberrLargs_strr4errrrrygs z"RequirementsFileParser._parse_file) r,r-r.r LineParserr+rr/rr0r<rxryrrrrr;;s  r;)r9r(cs ttttfdfdd }|S)NrLr(csJt}|}d|_r j|_t|\}}|t||\}}||fSr)) build_parserget_default_valuesr_format_controlbreak_args_options parse_argsshlexsplit)rLr?defaultsr options_strr4rr9rr parse_line~s z#get_line_parser..parse_line)rr r)r9rrrrr:}sr:rcCsf|d}g}|dd}|D]2}|ds6|dr<qRq|||dqd|d|fS)zBreak up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.  N-z--r)r startswithrhpoprf)rLtokensr3r&tokenrrrrs    rc@seZdZeddddZdS)rN)rr(cCs ||_dSr))rr*rrrrr+szOptionParsingError.__init__)r,r-r.rr+rrrrrsr)r(cCsJtjdd}tt}|D]}|}||qttdddd}||_|S)z7 Return a parser for parsing requirement lines F)add_help_optionr)r*rr(cSs t|dSr))rrrrr parser_exitsz!build_parser..parser_exit)optparse OptionParserrr add_optionrrexit)r?option_factoriesoption_factoryoptionrrrrrs  r)rJr(ccsd}g}|D]\}}|dr(t|rvt|r:d|}|rj|||dusTJ|d|fVg}q||fVq |s~|}||dq |r|dusJ|d|fVdS)zJoins a line ending in '' with the previous line (except when following comments). The joined line takes on the index of the first line. N\r)endswith COMMENT_REmatchrhrfstrip)rJprimary_line_numbernew_linerrLrrrrGs$      rGccs4|D]*\}}td|}|}|r||fVqdS)z1 Strips comments and filter empty lines. rN)rsubr)rJrrLrrrrHs   rHccsL|D]B\}}t|D]$\}}t|}|s.q|||}q||fVqdS)aReplace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. These points are the result of a discussion on the `github pull request #3514 `_. Valid characters in variable names follow the `POSIX standard `_ and are limited to uppercase letter, digits and the `_` (underscore). N) ENV_VAR_REfindallrbgetenvreplace)rJrrLenv_varvar_namerqrrrrIs  rI)urlr8r(c Cst|}|dvr.||}t||j|jfSz:t|d}t|}Wdn1s\0YWn2ty}zt d|WYd}~n d}~00||fS)aGets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance. )httphttpsfilerbNz"Could not open requirements file: ) rgetrrtextopenrreadOSErrorr )rr8schemeresprWrBexcrrrrs   .$r)NNF)N)NNN)NNN)W__doc__rrbrer urllib.parser~rtypingrrrrrrr r r Zpip._internal.clir pip._internal.exceptionsr r!pip._internal.models.search_scoperpip._internal.network.sessionrpip._internal.network.utilsrpip._internal.utils.encodingrpip._internal.utils.urlsrr"pip._internal.index.package_finderr__all__r7r ReqFileLinesrcompileIr|rrr_extra_index_urlr`r{rzeditablerZ no_binary only_binaryrmr]rk trusted_hostuse_new_featurerOption__annotations__install_optionsglobal_optionshashrrQr!r0r/rrKrUrur=r;r:r ExceptionrrrrGrHrIrrrrrs ,            1 ? ,B PK+]nX,X,+req/__pycache__/constructors.cpython-39.pycnu[a Re; @sdZddlZddlZddlZddlmZmZmZmZm Z m Z ddl m Z ddl mZmZddlmZddlmZmZddlmZdd lmZmZdd lmZdd lmZdd lmZdd l m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+m,Z,gdZ-e.e/Z0ej12Z3e4e e4ee4fdddZ5ee4ee4dddZ6e4e ee4e4ee4fdddZ7e4e4dddZ8Gd d!d!Z9e4e9dd"d#Z:d=e4ee e!e4fee;e;eee4efe;e;e;e!d% d&d'Ze4ee4e9d.d/d0Z?d>e4ee e4e!fee;e;eee4efe;ee4e;e!d1 d2d3Z@d?e4ee!e;ee;e;e!d4d5d6ZAd@ee;ee;e;e!d7d8d9ZBee!e!d:d;d<ZCdS)Aa~Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used elsewhere within pip to create instances of InstallRequirement. N)AnyDictOptionalSetTupleUnion)Marker)InvalidRequirement Requirement) Specifier)RequirementParseErrorparse_requirements)InstallationError)PyPITestPyPI)Link)Wheel)ParsedRequirement)InstallRequirement)is_archive_file)is_installable_dir)get_requirement) path_to_url)is_urlvcs)install_req_from_editableinstall_req_from_lineparse_editable)pathreturncCs6td|}d}|r*|d}|d}n|}||fS)Nz^(.+)(\[[^\]]+\])$)rematchgroup)rmextraspath_no_extrasr(/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/constructors.py _strip_extras+s   r*)r&rcCs|s tStd|jS)N placeholder)setrlowerr&)r&r(r(r)convert_extras7sr.) editable_reqrcCs|}t|\}}tj|r$t|}|drdt|j}|rX||t d|j fS||t fSt D]*}||drh|d|}qqht|}|j sdt j}t|d|d|j}|std|||t fS) aParses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir .[some_extra] zfile:r+:+z, zq is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with z).zZCould not detect requirement name for '{}', please specify one with #egg=your_package_name)r*osrisdirrr- startswithr egg_fragmentrr&r,ris_vcsjoin all_schemesrformat)r/url url_no_extrasr& package_nameversion_controllinkbackendsr(r(r)r=s@      r)reqrcCsd}tj|rd}zJt|.}tt||d|7}Wdn1sR0YWqtyt j d|ddYq0n|d|d 7}|S) zReturns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path z The path does exist. zThe argument you provided ({}) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.Nz&Cannot parse '%s' as requirements fileT)exc_infoz File 'z' does not exist.) r2rexistsopennextr readr9r loggerdebug)r@msgfpr(r(r)deduce_helpful_msgts  ( rKc@s0eZdZeeeeeeeedddZ dS)RequirementParts requirementr>markersr&cCs||_||_||_||_dSNrM)selfrNr>rOr&r(r(r)__init__szRequirementParts.__init__N) __name__ __module__ __qualname__rr rrrstrrRr(r(r(r)rLs rLcCsbt|\}}}|durHz t|}WqLtyDtd|dYqL0nd}t|}t||d|S)NInvalid requirement: '')rr r rrrL)r/namer:extras_overrider@r>r(r(r)parse_req_from_editables  r[F) r/ comes_from use_pep517isolatedoptions constraint user_suppliedpermit_editable_wheelsrc Cs`t|}t|j||d||j||||r0|dgng|rB|dgng|rT|dini|jd S)NTinstall_optionsglobal_optionshashes) r\raeditablerbr>r`r]r^rcrd hash_optionsr&)r[rrNr>getr&) r/r\r]r^r_r`rarbpartsr(r(r)rs r)rYrcCs>tjj|vrdStjjdur,tjj|vr,dS|dr:dSdS)akChecks whether the string "looks like" a path on the filesystem. This does not check whether the target actually exists, only judge from the appearance. Returns true if any of the following conditions is true: * a path separator is found (either os.path.sep or os.path.altsep); * a dot is found (which represents the current directory). TN.F)r2rsepaltsepr4)rYr(r(r)_looks_like_paths  rm)rrYrcCst|r4tj|r4t|r$t|Std|dt|s@dStj|rTt|S| dd}t |dkr|t|ds|dSt d|t|S) aK First, it checks whether a provided path is an installable directory. If it is, returns the path. If false, check if the path is an archive file (such as a .whl). The function checks if the path is a file. If false, if the path has an @, it will treat it as a PEP 440 URL requirement and return the path. z Directory zC is not installable. Neither 'setup.py' nor 'pyproject.toml' found.N@r r!rzARequirement %r looks like a filename, but the file does not exist) rmr2rr3rrrrisfilesplitlenrGwarning)rrY urlreq_partsr(r(r)_get_url_from_paths$    rt)rY line_sourcercsnt|rd}nd}||vrF||d\}}|}|s.with_source) req_as_stringrcsz t}Wntytjjvr8d}|t7}n(dvr\tfddtDs\d}nd}d}|r|d|7}t|Yn40|j D]*}t |}| d rd |d }t|q|S) NzIt looks like a path.=c3s|]}|vVqdSrPr().0opr{r(r) @szAparse_req_from_line.._parse_req_string..z,= is not a valid operator. Did you mean == ?rAzInvalid requirement: z Hint: ]zExtras after version 'z'.) rr r2rrkrKany operatorsr specifierrVendswith)r{r@add_msgrIspecspec_str)rzrr)_parse_req_string9s*       z.parse_req_from_line.._parse_req_string)rrpstriprr2rnormpathabspathrr*rtschemer"searchr:ris_wheelrfilenamerYversionr5r.rVr rL)rYru marker_sepmarkers_as_stringrOr{rr>extras_as_stringpr:wheelr&rr@r()rurzr)parse_req_from_linesH       r) rYr\r]r^r_r`rurarc Csbt||}t|j||j|j|||r.|dgng|r@|dgng|rR|dini||j|d S)aCreates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. :param line_source: An optional string describing where the line is from, for logging purposes in case of an error. rcrdre) r>rOr]r^rcrdrgr`r&ra)rrrNr>rOrhr&) rYr\r]r^r_r`rurarir(r(r)r^s r) req_stringr\r^r]rarcCs|z t|}Wn"ty.td|dYn0tjtjg}|jrj|rj|jrj|jj|vrjtd |j |t |||||dS)NrWrXzkPackages installed from PyPI cannot depend on packages which are not also hosted on PyPI. {} depends on {} )r^r]ra) rr rrfile_storage_domainrr:r>netlocr9rYr)rr\r^r]rar@domains_not_allowedr(r(r)install_req_from_req_strings6   r) parsed_reqr^r]rarc CsH|jr"t|j|j||j||d}n"t|j|j|||j|j|j|d}|S)N)r\r]r`r^ra)r\r]r^r_r`rura) is_editablerrNr\r`rr_ru)rr^r]rar@r(r(r)#install_req_from_parsed_requirements(  r)r>ireqrc Cs.t|j|j|j||j|j|j|j|j|j d S)N) r@r\rfr>rOr]r^rcrdrg) rr@r\rfrOr]r^rcrdrg)r>rr(r(r)install_req_from_link_and_ireqsr)NNFNFFF)NNFNFNF)NFNF)FNF)D__doc__loggingr2r"typingrrrrrrZpip._vendor.packaging.markersrZ"pip._vendor.packaging.requirementsr r Z pip._vendor.packaging.specifiersr pip._vendor.pkg_resourcesr r pip._internal.exceptionsrpip._internal.models.indexrrpip._internal.models.linkrpip._internal.models.wheelrZpip._internal.req.req_filerZpip._internal.req.req_installrpip._internal.utils.filetypesrpip._internal.utils.miscrpip._internal.utils.packagingrpip._internal.utils.urlsrpip._internal.vcsrr__all__ getLoggerrSrG _operatorskeysrrVr*r.rrKrLr[boolrrmrtrrrrrr(r(r(r)s                "7 "\ $ ( PK+]&,,&req/__pycache__/req_set.cpython-39.pycnu[a Re@sddlZddlmZddlmZmZmZmZmZddl m Z ddl m Z ddl mZddlmZddlmZeeZGd d d ZdS) N) OrderedDict)DictIterableListOptionalTuple)canonicalize_name)InstallationError)Wheel)InstallRequirement)compatibility_tagsc@seZdZdeddddZedddZedd d Zedd d d Z edd ddZ dee ee e ee eee efdddZeedddZeedddZeeedddZdS)RequirementSetTN)check_supported_wheelsreturncCst|_||_g|_dS)zCreate a RequirementSet.N)r requirementsrunnamed_requirements)selfrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/req_set.py__init__szRequirementSet.__init__)rcCs4tdd|jDddd}ddd|DS)Ncss|]}|js|VqdSN) comes_from.0reqrrr z)RequirementSet.__str__..cSst|jp dSNrnamerrrrrz(RequirementSet.__str__..key css|]}t|jVqdSrstrrrrrrrr)sortedrvaluesjoin)rrrrr__str__s zRequirementSet.__str__cCsBt|jddd}d}|j|jjt|ddd|DdS) NcSst|jp dSrrr!rrrr""rz)RequirementSet.__repr__..r#z4<{classname} object; {count} requirement(s): {reqs}>z, css|]}t|jVqdSrr&rrrrr)rz*RequirementSet.__repr__..) classnamecountreqs)r(rr)format __class____name__lenr*)rr format_stringrrr__repr__szRequirementSet.__repr__) install_reqrcCs|jr J|j|dSr)r rappend)rr5rrradd_unnamed_requirement,s z&RequirementSet.add_unnamed_requirementcCs"|js Jt|j}||j|<dSr)r rr)rr5 project_namerrradd_named_requirement0s  z$RequirementSet.add_named_requirement)r5parent_req_nameextras_requestedrc Cs||s$td|j|jgdfS|jrf|jjrft|jj}t }|j rf| |sft d|j|jr||dus|Jd|js|||gdfSz||j}Wntyd}Yn0|duo|o|j o|j|jko|jo|jo|jj|jjk}|rt d|||j|s.|||g|fS|js>|jsFg|fS|jof|jod|jj|jjk }|r~t d|jd|_|jrd|_ttt|jt|jB|_td ||j|g|fS) a&Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside the Requirements set. parent_req must already be added. Note that None implies that this is a user supplied requirement, vs an inferred one. :param extras_requested: an iterable of extras used to evaluate the environment markers. :return: Additional requirements to scan. That is either [] if the requirement is not applicable, or [install_req] if the requirement is applicable and has just been added. z6Ignoring %s: markers '%s' don't match your environmentNz-{} is not a supported wheel on this platform.z+a user supplied req shouldn't have a parentz7Double requirement given: {} (already in {}, name={!r})zhCould not satisfy constraints for '{}': installation from path or url cannot be constrained to a versionFTzSetting %s extras to: %s) match_markersloggerinfor markerslinkis_wheelr filenamer get_supportedr supportedr r/ user_suppliedr7get_requirementKeyError constraintextrasr specifierr9pathtupler(setdebug) rr5r:r;wheeltags existing_reqhas_conflicting_requirementdoes_not_satisfy_constraintrrradd_requirement6s          zRequirementSet.add_requirement)r rcCs t|}||jvo|j|j Sr)rrrHrr r8rrrhas_requirements  zRequirementSet.has_requirementcCs.t|}||jvr|j|Std|dS)NzNo project with the name )rrrGrUrrrrFs  zRequirementSet.get_requirementcCs|jt|jSr)rlistrr))rrrrall_requirementsszRequirementSet.all_requirements)T)NN)r1 __module__ __qualname__boolrr'r+r4r r7r9rrrrrTrVrFpropertyrXrrrrr s"    ur )logging collectionsrtypingrrrrrpip._vendor.packaging.utilsrpip._internal.exceptionsr pip._internal.models.wheelr Zpip._internal.req.req_installr Zpip._internal.utilsr getLoggerr1r=r rrrrs       PK+];5Y5Y*req/__pycache__/req_install.cpython-39.pycnu[a ReJ@s@ddlZddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZddlmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$dd l%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m,Z0ddl1m2Z3ddl4m5Z5ddl4m6Z7ddl8m9Z9ddl:m;Z;mZ>ddl?m@Z@ddlAmBZBmCZCddlDmEZEddlFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOddlPmQZQddlRmSZSddlTmUZUmVZVddlWmXZXdd lYmZZZe[e\Z]e^e!d!d"d#Z_Gd$d%d%Z`e`e^d&d'd(ZadS))N)Any CollectionDictIterableListOptionalSequenceUnion) pkg_resources)Marker) Requirement) SpecifierSet)canonicalize_name)Version)parse)Pep517HookCaller) Distribution)BuildEnvironmentNoOpBuildEnvironment)InstallationError) get_scheme)Link)generate_metadata)generate_editable_metadata)install_editable)LegacyInstallFailure)install) install_wheel)load_pyproject_tomlmake_pyproject_path)UninstallPathSet) deprecated)direct_url_for_editabledirect_url_from_link)Hashes) ask_path_exists backup_dir display_pathdist_in_install_pathdist_in_site_packagesdist_in_usersiteget_distributionhide_urlredact_auth_from_url) get_metadata)runner_with_spinner_message) TempDirectory tempdir_kinds)running_under_virtualenv)vcs)metadata_directoryreturncCs|tj}tj|\}}t||}|drJtj}tj |d}n.|dsXJtj }tj |ddd}||||dS)zQReturn a pkg_resources.Distribution for the provided metadata directory. z .egg-inforz .dist-info-) project_namemetadata) rstriposseppathsplitr PathMetadataendswithrsplitextDistInfoDistribution)r4dist_dirbase_dir dist_dir_namer8dist_cls dist_namerG/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/req_install.py _get_distBs   rIc@seZdZdZdSeeeeedfeee ee eeeee eee eee ee efee eeeddddZedd d Zedd d Zedd dZeeedddZeedddZeedddZeedddZdTeeeedddZeedddZdUeedddZeedd d!Zeeeed"d#d$Z ddd%d&Z!ddd'd(Z"edd)d*d+Z#eedd,d-Z$eedd.d/Z%eedd0d1Z&eedd2d3Z'eedd4d5Z(ddd6d7Z)ddd8d9Z*ddd:d;Z+ee,ddd?Z/ddd@dAZ0dVeeeddBdCdDZ1dddEdFZ2dWeeee3dGdHdIZ4eeeedJdKdLZ5eeddMdNdOZ6dXe eee7eeeeeeeeeeddP dQdRZ8dS)YInstallRequirementz Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. FNrG)req comes_fromeditablelinkmarkers use_pep517isolatedinstall_optionsglobal_options hash_options constraintextras user_suppliedpermit_editable_wheelsr5cCs|dust|tsJ|||_||_| |_||_||_d|_d|_|jrp|sRJ|j rpt j t j |j|_|dur|r|jrt|j}||_|_d|_d|_|jr|jj r|jj|_| r| |_n |rdd|jD|_nt|_|dur|r|j}||_d|_d|_d|_d|_|r"|ng|_| r2| ng|_| rB| ni|_d|_ | |_!||_"t#|_$d|_%d|_&g|_'d|_(||_)d|_*dS)NFcSsh|]}t|qSrG)r safe_extra.0extrarGrGrH z.InstallRequirement.__init__..)+ isinstancer rKrLrUrMrXlegacy_install_reason source_diris_filer:r<normpathabspath file_pathurlrrN original_linkoriginal_link_is_in_wheel_cachelocal_file_pathrVsetmarkerrO satisfied_byshould_reinstall_temp_build_dirinstall_succeededrRrSrTpreparedrWrQr build_envr4pyproject_requiresrequirements_to_checkpep517_backendrPneeds_more_preparation)selfrKrLrMrNrOrPrQrRrSrTrUrVrWrXrGrGrH__init__csX    zInstallRequirement.__init__)r5cCs|jr.t|j}|jrF|dt|jj7}n|jrBt|jj}nd}|jdurf|dt|jj7}|j rt |j tr|j }n |j }|r|d|d7}|S)Nz from {}zz in {}z (from )) rKstrrNformatr-rfrlr'locationrLr_ from_pathrvsrLrGrGrH__str__s     zInstallRequirement.__str__cCsd|jjt||jS)Nz<{} object: {} editable={!r}>)rz __class____name__ryrMrvrGrGrH__repr__szInstallRequirement.__repr__cs>t|t}fddt|D}dj|jjd|dS)z5An un-tested helper for getting state, for debugging.c3s|]}d||VqdS)z{}={!r}N)rz)r[attr attributesrGrH r^z2InstallRequirement.format_debug..z<{name} object: {{{state}}}>z, )namestate)varssortedrzrrjoin)rvnamesrrGrrH format_debugszInstallRequirement.format_debugcCs|jdurdSt|jjSN)rKr safe_namerrrGrGrHrs zInstallRequirement.namec Cs|js dS|jsJ|j`td}|j|,d|jvWdWdS1sb0YWdn1s0YdS)NFz1Checking if build backend supports build_editablebuild_editable)rPrtrqr/subprocess_runner_supported_features)rvrunnerrGrGrHsupports_pyproject_editables z.InstallRequirement.supports_pyproject_editablecCs|jjSr)rK specifierrrGrGrHrszInstallRequirement.specifiercCs$|j}t|dko"tt|jdvS)zReturn whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. >=====)rlennextiteroperator)rv specifiersrGrGrH is_pinnedszInstallRequirement.is_pinned)extras_requestedr5cs0|sd}jdur(tfdd|DSdSdS)N)c3s|]}jd|iVqdS)r\N)rOevaluaterZrrGrHrsz3InstallRequirement.match_markers..T)rOany)rvrrGrrH match_markerss  z InstallRequirement.match_markerscCs t|jS)zReturn whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. )boolrTrrGrGrHhas_hash_optionssz#InstallRequirement.has_hash_optionsT)trust_internetr5cCsB|j}|r|jn|j}|r:|jr:||jg|jt|S)aReturn a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() ) rTcopyrNrghash setdefault hash_nameappendr$)rvr good_hashesrNrGrGrHhashes's   zInstallRequirement.hashescCsP|jdurdSt|j}|jrLt|jtr2|j}n |j}|rL|d|7}|S)z8Format a nice indicator to show where this "comes from" Nz->)rKryrLr_r|r}rGrGrHr|<s     zInstallRequirement.from_path) build_dir autodeleteparallel_buildsr5cCs|dus J|jdur*|jjs"J|jjS|jdurLttjdd|_|jjSt|j}|rn|dt j }t j |st d|t |t j||}|rdnd}t||tjddjS)NT)kindglobally_managed_zCreating directory %sF)r<deleterr)rnr<rKr0r1 REQ_BUILDrruuiduuid4hexr:existsloggerdebugmakedirsr)rvrrrdir_nameactual_build_dir delete_argrGrGrHensure_build_locationJs.         z(InstallRequirement.ensure_build_locationcCsn|jdusJ|jdusJ|jdus*Jtt|jdtrDd}nd}td|jd||jdg|_dS)z*Set requirement after generating metadata.NrrrrName)rKr8rar_ parse_versionrr r)rvoprGrGrH_set_requirementusz#InstallRequirement._set_requirementcCsDt|jd}t|jj|kr"dStd|j||jt||_dS)NrzeGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.)rr8rKrrwarningr )rv metadata_namerGrGrHwarn_on_mismatching_namesz+InstallRequirement.warn_on_mismatching_name) use_user_siter5cCs|jdurdSt|jj}|s"dS|j}|duo@|jjj|dd}|sd|_|rt|r`d|_qt rt |rt d |j |jqt|rd|_n|jrd|_d|_n||_dS)zFind an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. NT) prereleaseszVWill not install to the user site because it will lack sys.path precedence to {} in {})rKr+rversionrcontainsrlr*rmr2r)rrzr7r{r(rM)rvr existing_distexisting_versionversion_compatiblerGrGrHcheck_if_existss8  z"InstallRequirement.check_if_existscCs|js dS|jjS)NF)rNis_wheelrrGrGrHrszInstallRequirement.is_wheelcCstj|j|jr|jjpdS)Nr)r:r<rrarNsubdirectory_fragmentrrGrGrHunpacked_source_directorysz,InstallRequirement.unpacked_source_directorycCs(|jsJd|tj|jd}|S)NNo source dir for zsetup.pyrar:r<rr)rvsetup_pyrGrGrH setup_py_pathsz InstallRequirement.setup_py_pathcCs(|jsJd|tj|jd}|S)Nrz setup.cfgr)rv setup_cfgrGrGrHsetup_cfg_pathsz!InstallRequirement.setup_cfg_pathcCs|jsJd|t|jS)Nr)rarrrrGrGrHpyproject_toml_pathsz&InstallRequirement.pyproject_toml_pathcCs^t|j|j|jt|}|dur*d|_dSd|_|\}}}}||_||_t|j||d|_ dS)aALoad the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we should follow the PEP 517 or legacy (setup.py) code path. NFT) backend_path) rrPrrryrsrrrrrt)rvpyproject_toml_datarequiresbackendcheckrrGrGrHrs z&InstallRequirement.load_pyproject_tomlcCsD|jr@|jr@|s@tj|js@tj|js@td|ddS)zCheck that an editable requirement if valid for use with PEP 517/518. This verifies that an editable that has a pyproject.toml either supports PEP 660 or as a setup.py or a setup.cfg zProject z has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.N) rMrPrr:r<isfilerrrrrGrGrHisolated_editable_sanity_checks   z1InstallRequirement.isolated_editable_sanity_checkcCs|js J|jrZ|jdusJ|jrF|jrF|rFt|j|jd|_qt |j|jd|_n*t |j|j |j |j |jp|d|jd|_|js|n||dS)zEnsure that project metadata is available. Under PEP 517 and PEP 660, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. N)rqrzfrom )rqrrarQdetails)rarPrtrMrXrrrqr4rgenerate_metadata_legacyrrrQrrNrrassert_source_matches_versionrrGrGrHprepare_metadatas8     z#InstallRequirement.prepare_metadatacCst|dst||_|jS)N _metadata)hasattrr.get_distrrrGrGrHr8Bs zInstallRequirement.metadatacCs t|jSr)rIr4rrGrGrHrIszInstallRequirement.get_distcCsR|js J|jd}|jjr8||jjvr8td||ntdt|j||dS)Nrz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s)rar8rKrrrrr')rvrrGrGrHrLs  z0InstallRequirement.assert_source_matches_version) parent_dirrrr5cCs |jdur|j|||d|_dS)aAEnsure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir N)rr)rar)rvrrrrGrGrHensure_has_source_dir^s  z(InstallRequirement.ensure_has_source_dircCs|jstd|jdS|js"J|js,J|jjdkrCannot update repository at %s; repository location is unknownfilezUnsupported VCS URL )rf) rNrrrarMschemer3get_backend_for_schemerfr,obtain)rv vcs_backend hidden_urlrGrGrHupdate_editableus    z"InstallRequirement.update_editable) auto_confirmverboser5cCsR|js Jt|jj}|s,td|jdStd|t|}||||S)a Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. z#Skipping %s as it is not installed.NzFound existing installation: %s) rKr+rrrinfor from_distremove)rvrrdistuninstalled_pathsetrGrGrH uninstalls     zInstallRequirement.uninstall)r< parentdirrootdirr5cCs8tttddd}tj||}|||}|jd|S)N)rprefixr5cSsN||tjjs&Jd|d||t|dd}|tjjd}|S)Nzname z doesn't start with prefix r/) startswithr:r<r;rreplace)rrrGrGrH_clean_zip_names z=InstallRequirement._get_archive_name.._clean_zip_namer)ryr:r<rr)rvr<rrrrrGrGrH_get_archive_names z$InstallRequirement._get_archive_name)rr5cCs|js J|durdSd}d|j|jd}tj||}tj|rtdt |d}|dkrjd}nj|d krt d t |t |nF|d krt |}t d t |t |t||n|d krtd|sdStj|d tjdd}|tjtj|j}t|D]~\} } } | D]6} |j| | |d} t| d}d|_||dq$| D]0}|j|| |d}tj| |}|||q`qWdn1s0Yt dt |dS)z}Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. NTz {}-{}.ziprz8The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)bort )iwbarFrz Deleting %srzBacking up %s to %sr) allowZip64)rrrirzSaved %s)rarzrr8r:r<rrr%r'rrrr&shutilmovesysexitzipfileZipFile ZIP_DEFLATEDnormcaserdrwalkrZipInfo external_attrwritestrwriter)rvrcreate_archive archive_name archive_pathresponse dest_file zip_outputdirdirpathdirnames filenamesdirname dir_arcnamezipdirfilename file_arcnamerGrGrHarchivesr    4zInstallRequirement.archive) rRrSroothomerwarn_script_locationr pycompiler5c Cst|j||||j|d} |dur$|ng}|jrd|jsdt||||||j|j|j|j|jd d|_ dS|jr|j stJd} |jrt |j} n|j rt |j |j|j} t|j|j | t|j||| |jdd|_ dSt||j}t||j}z8t|||||||| |j|j|j|j|jt|jd} WnLtyV} zd|_ | jWYd} ~ n$d} ~ 0typd|_ Yn0| |_ | r|jdkrtd|jd ddd dS) N)userr&r%rQr)rr&rrrrQrqrT)rreq_descriptionr(r' direct_url requested)rRrSr%r&rrr(rrrQreq_namerqrr*Fi zg{} was installed using the legacy 'setup.py install' method, because a wheel could not be built for it.z+to fix the wheel build issue reported abovereason replacementgone_inissue)rrrQrMrinstall_editable_legacyrrqrrorir"rgr#rarhrryrKrWlistrSrRinstall_legacyr __cause__ Exceptionr`r!rz) rvrRrSr%r&rr'rr(rr+successexcrGrGrHrs         zInstallRequirement.install) FNNNFNNNFrGFF)N)T)FF)FF)NNNNTFT)9r __module__ __qualname____doc__rr r ryrrr rrrrwrrrpropertyr functools lru_cacherr rrrrrr$rr|rrrrrrrrrrrrrr8rrrrrr rrr$rrrGrGrGrHrJ\s    j     +.)   F rJ)rKr5cCs>d}|jsd}n|jrd}n |jr&d}|r:tddddd|S) Nrz3Unnamed requirements are not allowed as constraintsz4Editable requirements are not allowed as constraintszConstraints cannot have extrasaConstraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms.z+replacing the constraint with a requirementi r.)rrMrVr!)rKproblemrGrGrHcheck_invalid_constraint_typebsrA)br>loggingr:rr rr typingrrrrrrrr pip._vendorr Zpip._vendor.packaging.markersr Z"pip._vendor.packaging.requirementsr Z pip._vendor.packaging.specifiersr pip._vendor.packaging.utilsrZpip._vendor.packaging.versionrrrZpip._vendor.pep517.wrappersrpip._vendor.pkg_resourcesrpip._internal.build_envrrpip._internal.exceptionsrpip._internal.locationsrpip._internal.models.linkr'pip._internal.operations.build.metadatar0pip._internal.operations.build.metadata_editabler.pip._internal.operations.build.metadata_legacyr0pip._internal.operations.install.editable_legacyrr3'pip._internal.operations.install.legacyrrr5&pip._internal.operations.install.wheelrpip._internal.pyprojectrrpip._internal.req.req_uninstallr pip._internal.utils.deprecationr!&pip._internal.utils.direct_url_helpersr"r#pip._internal.utils.hashesr$pip._internal.utils.miscr%r&r'r(r)r*r+r,r-pip._internal.utils.packagingr.pip._internal.utils.subprocessr/pip._internal.utils.temp_dirr0r1pip._internal.utils.virtualenvr2pip._internal.vcsr3 getLoggerrrryrIrJrArGrGrGrHs`(                      ,      PK+]D*req/__pycache__/req_tracker.cpython-39.pycnu[a Re@sddlZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z ddl mZddlmZddlmZeeZejeedddd Zejed d d d ZGdd d ZdS)N) TracebackType)DictIteratorOptionalSetTypeUnion)Link)InstallRequirement) TempDirectory)changesreturnc kstj}t}i}|D]<\}}z||||<WntyJ|||<Yn0|||<qzBdVW|D].\}}||ur||=qht|tsJ|||<qhn:|D].\}}||ur||=qt|tsJ|||<q0dSN)osenvironobjectitemsKeyError isinstancestr)r targetnon_existent_marker saved_valuesname new_valueoriginal_valuer/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/req_tracker.pyupdate_env_context_managers*   rRequirementTrackerr c cstjd}tt}|durL|tddj}|t|dt d|t |}|VWdn1sp0YWdn1s0YdS)NPIP_REQ_TRACKERz req-tracker)kind)r!z Initialized build tracking at %s) rrget contextlib ExitStack enter_contextr pathrloggerdebugr)rootctxtrackerrrrget_requirement_tracker)s    r-c@seZdZeddddZddddZeeeeeee ddd d Z e ed d d Z e ddddZe ddddZddddZeje eddddZdS)rN)r*r cCs ||_t|_td|jdS)NzCreated build tracker: %s)_rootset_entriesr(r))selfr*rrr__init__7szRequirementTracker.__init__r cCstd|j|S)NzEntered build tracker: %s)r(r)r.)r1rrr __enter__<szRequirementTracker.__enter__)exc_typeexc_valexc_tbr cCs |dSr)cleanup)r1r4r5r6rrr__exit__@szRequirementTracker.__exit__)linkr cCs$t|j}tj|j|Sr) hashlibsha224url_without_fragmentencode hexdigestrr'joinr.)r1r9hashedrrr _entry_pathHszRequirementTracker._entry_path)reqr cCs|js J||j}z4t|}|}Wdn1s>0YWnty\Yn0d|j|}t|||jvsJt|ddd}|t |Wdn1s0Y|j |t d||j dS)z,Add an InstallRequirement to build tracking.Nz{} is already being built: {}wzutf-8)encodingzAdded %s to build tracker %r)r9rAopenreadFileNotFoundErrorformat LookupErrorr0writeraddr(r)r.)r1rB entry_pathfpcontentsmessagerrrrKLs   * , zRequirementTracker.addcCs<|js Jt||j|j|td||jdS)z1Remove an InstallRequirement from build tracking.z Removed %s from build tracker %rN) r9runlinkrAr0remover(r)r.r1rBrrrrQhs  zRequirementTracker.removecCs,t|jD]}||q td|jdS)NzRemoved build tracker: %r)r/r0rQr(r)r.rRrrrr7rs zRequirementTracker.cleanupccs||dV||dSr)rKrQrRrrrtrackxs zRequirementTracker.track)__name__ __module__ __qualname__rr2r3rr BaseExceptionrr8r rAr rKrQr7r$contextmanagerrrSrrrrr6s   )r$r:loggingrtypesrtypingrrrrrrpip._internal.models.linkr Zpip._internal.req.req_installr pip._internal.utils.temp_dirr getLoggerrTr(rXrrr-rrrrrs       PK+]0a" " 'req/__pycache__/__init__.cpython-39.pycnu[a Re @sddlZddlZddlmZmZmZmZmZddlm Z ddl m Z ddl m Z ddlmZgdZeeZGd d d Zee eeee fd d d Zee eeeeeeeeeeeeeeed ddZdS)N)IteratorListOptionalSequenceTuple) indent_log)parse_requirements)InstallRequirement)RequirementSet)r r r install_given_reqsc@s*eZdZeddddZedddZdS)InstallationResultN)namereturncCs ||_dS)Nr)selfrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/req/__init__.py__init__szInstallationResult.__init__)rcCsd|jdS)NzInstallationResult(name=)r)rrrr__repr__szInstallationResult.__repr__)__name__ __module__ __qualname__strrrrrrrr sr ) requirementsrccs.|D]$}|jsJd||j|fVqdS)Nz%invalid to-be-installed requirement: r)rreqrrr_validate_requirementssr) rinstall_optionsglobal_optionsroothomeprefixwarn_script_location use_user_site pycompilerc  Cstt|} | r(tdd| g} t| D]\} } | j rtd| t| j dd} Wdq1s~0Ynd} z| j ||||||||dWn&t y| r| j s| Yn0| r| j r| | t| qs.       PK+]_//wheel_builder.pynu["""Orchestrator for building wheels from InstallRequirements. """ import logging import os.path import re import shutil from typing import Any, Callable, Iterable, List, Optional, Tuple from pip._vendor.packaging.utils import canonicalize_name, canonicalize_version from pip._vendor.packaging.version import InvalidVersion, Version from pip._internal.cache import WheelCache from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel from pip._internal.metadata import FilesystemWheel, get_wheel_distribution from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.operations.build.wheel import build_wheel_pep517 from pip._internal.operations.build.wheel_editable import build_wheel_editable from pip._internal.operations.build.wheel_legacy import build_wheel_legacy from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ensure_dir, hash_file, is_wheel_installed from pip._internal.utils.setuptools_build import make_setuptools_clean_args from pip._internal.utils.subprocess import call_subprocess from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.urls import path_to_url from pip._internal.vcs import vcs logger = logging.getLogger(__name__) _egg_info_re = re.compile(r"([a-z0-9_.]+)-([a-z0-9_.!+-]+)", re.IGNORECASE) BinaryAllowedPredicate = Callable[[InstallRequirement], bool] BuildResult = Tuple[List[InstallRequirement], List[InstallRequirement]] def _contains_egg_info(s: str) -> bool: """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s)) def _should_build( req: InstallRequirement, need_wheel: bool, check_binary_allowed: BinaryAllowedPredicate, ) -> bool: """Return whether an InstallRequirement should be built into a wheel.""" if req.constraint: # never build requirements that are merely constraints return False if req.is_wheel: if need_wheel: logger.info( "Skipping %s, due to already being wheel.", req.name, ) return False if need_wheel: # i.e. pip wheel, not pip install return True # From this point, this concerns the pip install command only # (need_wheel=False). if not req.source_dir: return False if req.editable: # we only build PEP 660 editable requirements return req.supports_pyproject_editable() if req.use_pep517: return True if not check_binary_allowed(req): logger.info( "Skipping wheel build for %s, due to binaries being disabled for it.", req.name, ) return False if not is_wheel_installed(): # we don't build legacy requirements if wheel is not installed logger.info( "Using legacy 'setup.py install' for %s, " "since package 'wheel' is not installed.", req.name, ) return False return True def should_build_for_wheel_command( req: InstallRequirement, ) -> bool: return _should_build(req, need_wheel=True, check_binary_allowed=_always_true) def should_build_for_install_command( req: InstallRequirement, check_binary_allowed: BinaryAllowedPredicate, ) -> bool: return _should_build( req, need_wheel=False, check_binary_allowed=check_binary_allowed ) def _should_cache( req: InstallRequirement, ) -> Optional[bool]: """ Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. """ if req.editable or not req.source_dir: # never cache editable requirements return False if req.link and req.link.is_vcs: # VCS checkout. Do not cache # unless it points to an immutable commit hash. assert not req.editable assert req.source_dir vcs_backend = vcs.get_backend_for_scheme(req.link.scheme) assert vcs_backend if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir): return True return False assert req.link base, ext = req.link.splitext() if _contains_egg_info(base): return True # Otherwise, do not cache. return False def _get_cache_dir( req: InstallRequirement, wheel_cache: WheelCache, ) -> str: """Return the persistent or temporary cache directory where the built wheel need to be stored. """ cache_available = bool(wheel_cache.cache_dir) assert req.link if cache_available and _should_cache(req): cache_dir = wheel_cache.get_path_for_link(req.link) else: cache_dir = wheel_cache.get_ephem_path_for_link(req.link) return cache_dir def _always_true(_: Any) -> bool: return True def _verify_one(req: InstallRequirement, wheel_path: str) -> None: canonical_name = canonicalize_name(req.name or "") w = Wheel(os.path.basename(wheel_path)) if canonicalize_name(w.name) != canonical_name: raise InvalidWheelFilename( "Wheel has unexpected file name: expected {!r}, " "got {!r}".format(canonical_name, w.name), ) dist = get_wheel_distribution(FilesystemWheel(wheel_path), canonical_name) dist_verstr = str(dist.version) if canonicalize_version(dist_verstr) != canonicalize_version(w.version): raise InvalidWheelFilename( "Wheel has unexpected file name: expected {!r}, " "got {!r}".format(dist_verstr, w.version), ) metadata_version_value = dist.metadata_version if metadata_version_value is None: raise UnsupportedWheel("Missing Metadata-Version") try: metadata_version = Version(metadata_version_value) except InvalidVersion: msg = f"Invalid Metadata-Version: {metadata_version_value}" raise UnsupportedWheel(msg) if metadata_version >= Version("1.2") and not isinstance(dist.version, Version): raise UnsupportedWheel( "Metadata 1.2 mandates PEP 440 version, " "but {!r} is not".format(dist_verstr) ) def _build_one( req: InstallRequirement, output_dir: str, verify: bool, build_options: List[str], global_options: List[str], editable: bool, ) -> Optional[str]: """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ artifact = "editable" if editable else "wheel" try: ensure_dir(output_dir) except OSError as e: logger.warning( "Building %s for %s failed: %s", artifact, req.name, e, ) return None # Install build deps into temporary directory (PEP 518) with req.build_env: wheel_path = _build_one_inside_env( req, output_dir, build_options, global_options, editable ) if wheel_path and verify: try: _verify_one(req, wheel_path) except (InvalidWheelFilename, UnsupportedWheel) as e: logger.warning("Built %s for %s is invalid: %s", artifact, req.name, e) return None return wheel_path def _build_one_inside_env( req: InstallRequirement, output_dir: str, build_options: List[str], global_options: List[str], editable: bool, ) -> Optional[str]: with TempDirectory(kind="wheel") as temp_dir: assert req.name if req.use_pep517: assert req.metadata_directory assert req.pep517_backend if global_options: logger.warning( "Ignoring --global-option when building %s using PEP 517", req.name ) if build_options: logger.warning( "Ignoring --build-option when building %s using PEP 517", req.name ) if editable: wheel_path = build_wheel_editable( name=req.name, backend=req.pep517_backend, metadata_directory=req.metadata_directory, tempd=temp_dir.path, ) else: wheel_path = build_wheel_pep517( name=req.name, backend=req.pep517_backend, metadata_directory=req.metadata_directory, tempd=temp_dir.path, ) else: wheel_path = build_wheel_legacy( name=req.name, setup_py_path=req.setup_py_path, source_dir=req.unpacked_source_directory, global_options=global_options, build_options=build_options, tempd=temp_dir.path, ) if wheel_path is not None: wheel_name = os.path.basename(wheel_path) dest_path = os.path.join(output_dir, wheel_name) try: wheel_hash, length = hash_file(wheel_path) shutil.move(wheel_path, dest_path) logger.info( "Created wheel for %s: filename=%s size=%d sha256=%s", req.name, wheel_name, length, wheel_hash.hexdigest(), ) logger.info("Stored in directory: %s", output_dir) return dest_path except Exception as e: logger.warning( "Building wheel for %s failed: %s", req.name, e, ) # Ignore return, we can't do anything else useful. if not req.use_pep517: _clean_one_legacy(req, global_options) return None def _clean_one_legacy(req: InstallRequirement, global_options: List[str]) -> bool: clean_args = make_setuptools_clean_args( req.setup_py_path, global_options=global_options, ) logger.info("Running setup.py clean for %s", req.name) try: call_subprocess(clean_args, cwd=req.source_dir) return True except Exception: logger.error("Failed cleaning build dir for %s", req.name) return False def build( requirements: Iterable[InstallRequirement], wheel_cache: WheelCache, verify: bool, build_options: List[str], global_options: List[str], ) -> BuildResult: """Build wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build. """ if not requirements: return [], [] # Build the wheels. logger.info( "Building wheels for collected packages: %s", ", ".join(req.name for req in requirements), # type: ignore ) with indent_log(): build_successes, build_failures = [], [] for req in requirements: assert req.name cache_dir = _get_cache_dir(req, wheel_cache) wheel_file = _build_one( req, cache_dir, verify, build_options, global_options, req.editable and req.permit_editable_wheels, ) if wheel_file: # Update the link for this. req.link = Link(path_to_url(wheel_file)) req.local_file_path = req.link.file_path assert req.link.is_wheel build_successes.append(req) else: build_failures.append(req) # notify success/failure if build_successes: logger.info( "Successfully built %s", " ".join([req.name for req in build_successes]), # type: ignore ) if build_failures: logger.info( "Failed to build %s", " ".join([req.name for req in build_failures]), # type: ignore ) # Return a list of requirements that failed to build return build_successes, build_failures PK+]Y%%)locations/__pycache__/base.cpython-39.pycnu[a Re+@sUddlZddlZddlZddlZddlZddlZddlmZddlm Z e dZ e dZ ejeed<eddd Zedd d ZzeZejeed <WneyejZYn0ejdd edddZdS)N)appdirs)running_under_virtualenvpippurelib site_packages)returncCs djtjS)ze Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". z{}.{})formatsys version_infor r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/locations/base.pyget_major_minor_versionsr cCsXtrtjtjd}n4ztjtd}WntyJtdYn0tj |S)Nsrcz=The folder you are executing pip from can no longer be found.) rospathjoinr prefixgetcwdOSErrorexitabspath) src_prefixr r r get_src_prefixs r user_site)maxsizecCsttdS)NPYTHONFRAMEWORK)bool sysconfigget_config_varr r r r is_osx_framework2sr) functoolsrsiter rtypingZpip._internal.utilsrpip._internal.utils.virtualenvruser_cache_dirUSER_CACHE_DIRget_pathrOptionalstr__annotations__r rgetusersitepackagesrAttributeError USER_SITE lru_cacherrr r r r s"       PK+]{;/locations/__pycache__/_sysconfig.cpython-39.pycnu[a Re @s\ddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z m Z ddl mZddlmZmZeeZeeZeeddZedd d Zedd d Zedd dZedddZgdZ e!ddure "dd eeej#eej#eeej#ee dddZ$edddZ%edddZ&edddZ'eej(eefdddZ)dS)!N)InvalidSchemeCombinationUserInstallationInvalid) SCHEME_KEYSScheme)running_under_virtualenv)get_major_minor_versionis_osx_frameworkZget_preferred_scheme)returncCsdtvot otS)aCheck for Apple's ``osx_framework_library`` scheme. Python distributed by Apple's Command Line Tools has this special scheme that's used when: * This is a framework build. * We are installing into the system prefix. This does not account for ``pip install --prefix`` (also means we're not installing to the system prefix), which should use ``posix_prefix``, but logic here means ``_infer_prefix()`` outputs ``osx_framework_library``. But since ``prefix`` is not available for ``sysconfig.get_default_scheme()``, which is the stdlib replacement for ``_infer_prefix()``, presumably Apple wouldn't be able to magically switch between ``osx_framework_library`` and ``posix_prefix``. ``_infer_prefix()`` returning ``osx_framework_library`` means its behavior is consistent whether we use the stdlib implementation or our own, and we deal with this special case in ``get_scheme()`` instead. osx_framework_library)_AVAILABLE_SCHEMESrr r r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/locations/_sysconfig.py _should_use_osx_framework_prefixs rcCsvtr tdStrdStjjdtj}|tvr6|StjjtvrJtjjStjd}|tvrb|StjtvrrtjSdS)a!Try to find a prefix scheme for the current platform. This tries: * A special ``osx_framework_library`` for Python distributed by Apple's Command Line Tools, when not running in a virtual environment. * Implementation + OS, used by PyPy on Windows (``pypy_nt``). * Implementation without OS, used by PyPy on POSIX (``pypy``). * OS + "prefix", used by CPython on POSIX (``posix_prefix``). * Just the OS name, used by CPython on Windows (``nt``). If none of the above works, fall back to ``posix_prefix``. prefixr __prefix posix_prefix)_PREFERRED_SCHEME_APIrsysimplementationnameosr )implementation_suffixedsuffixedr r r _infer_prefix8s   rcCsHtr tdStrtsd}n tjd}|tvr6|SdtvrDtdS)z3Try to find a user scheme for the current platform.userosx_framework_user_user posix_user)rr rrrr rrr r r _infer_userWs  r!cCs(tr tdStjd}|tvr$|SdS)z,Try to find a home for the current platform.home_home posix_home)rrrr r r r r _infer_homefs  r%)installed_basebaseinstalled_platbaseplatbaser exec_prefixuserbaseF) dist_namerr"rootisolatedrr csb|rrtddr$r$tdddur4t}n|r@t}nt}durZ|dkrZd}durvfddtD}n durfd dtD}ni}tj||d }tr|r|d t j } n|d t j } d t } t j | dd| |d<n|sd}t|d|dt j |d||d|dd} |dur^tD]&} tj|t| | } t| | | q6| S)a\ Get the "scheme" corresponding to the input parameters. :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme :param root: root under which other directories are re-based :param isolated: ignored, but kept for distutils compatibility (where this controls whether the user-site pydistutils.cfg is honored) :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same z--userz--prefixz--homeNr rcsi|] }|qSr r .0k)r"r r zget_scheme..csi|] }|qSr r r/)rr rr2r3)schemevarsr+r'pythonincludesiteUNKNOWNplatlibpurelibscriptsdata)r:r;headersr<r=)rr%r!r _HOME_KEYS sysconfig get_pathsrgetrrrrpathjoinrr distutilsutil change_rootgetattrsetattr)r,rr"r-r.r scheme_name variablespathsr' python_xyr4keyvaluer )r"rr get_scheme}sJ    rPcCs4tjdddkr(tjdddkr(dStdS)Ndarwinz/System/Library/z/usr/local/binr<)rplatformrr@rAr r r rget_bin_prefixs$rUcCs tdS)Nr;r@rAr r r r get_purelibsrWcCs tdS)Nr:rVr r r r get_platlibsrX)rr cCs"tj||dd}|d|dfS)N)r'r))r5r;r:rV)rrLr r rget_prefixed_libssrY)FNNFN)*distutils.utilrEloggingrrr@typingpip._internal.exceptionsrrpip._internal.models.schemerrpip._internal.utils.virtualenvrr'rr getLogger__name__loggersetget_scheme_namesr rHrboolrstrrr!r%r?get_config_varappendOptionalrPrUrWrXTuplerYr r r rsJ      MPK+]``/locations/__pycache__/_distutils.cpython-39.pycnu[a Re @s@dZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl mZmZmZmZmZmZddlmZdd lmZdd lmZd d lmZeeZdd dee eee ee eeefdddZ!d ee eeeee eeedddZ"edddZ#edddZ$edddZ%eeeefdddZ&dS)!z7Locations where we look for configs, install stuff, etcN)Command) SCHEME_KEYS)installget_python_lib)DictListOptionalTupleUnioncast)Scheme)WINDOWS)running_under_virtualenv)get_major_minor_versionF)ignore_config_files) dist_nameuserhomerootisolatedprefixrreturnc Csddlm}d|i}|r"dg|d<||} |srz | Wn6typ| } tdddd | DYn0d } | jd d d } | d usJt t | } |r|rJd|d||r|rJd|d||p| j | _ |s|rd| _ |p| j | _ |p| j | _ |p| j| _| i} tD]}t| d|| |<q$d| d vrd| t| j| jdtr|rx|}n|r| j}n| j }tj|dddt|| d<|d urtjtj| dd}tj||dd | d<| S)z+ Return a distutils install scheme r) Distributionnamez --no-user-cfg script_argsz6Ignore distutils configs in %s due to encoding errors.z, css|]}tj|VqdS)N)ospathbasename).0pr"/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py 4z#distutils_scheme..NrT)createzuser=z prefix=zhome=install_ install_lib)purelibplatlibincludesitepythonheadersr)distutils.distrparse_config_filesUnicodeDecodeErrorfind_config_filesloggerwarningjoinget_command_objr distutils_install_commandrrrrfinalize_optionsrgetattrget_option_dictupdatedictr)rinstall_userbaserrr splitdriveabspath)rrrrrrrr dist_argsdpathsobjischemekey path_no_driver"r"r#distutils_schemesb           rI)rrrrrrrcCs8t||||||}t|d|d|d|d|ddS)a; Get the "scheme" corresponding to the input parameters. The distutils documentation provides the context for the available schemes: https://docs.python.org/3/install/index.html#alternate-installation :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme and provides the base directory for the same :param root: root under which other directories are re-based :param isolated: equivalent to --no-user-cfg, i.e. do not consider ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for scheme paths :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same r+r*r/scriptsdata)r+r*r/rJrK)rIr )rrrrrrrFr"r"r# get_schemeisrL)rcCsrtjtj}tr>tj|d}tj|s:tj|d}|Stjdddkrd|dddkrddStj|dS)NScriptsbindarwinz/System/Library/z/usr/local/bin) rrnormpathsysrrr6existsplatform)rbin_pyr"r"r#get_bin_prefixs "rWcCs tddS)NF plat_specificrr"r"r"r# get_purelibsrZcCs tddS)NTrXrr"r"r"r# get_platlibsr[)rrcCstd|dtd|dfS)NF)rYrTr)rr"r"r#get_prefixed_libss  r\)FNNFN)FNNFN)'__doc__loggingrrS distutils.cmdrDistutilsCommanddistutils.command.installrrr8distutils.sysconfigrtypingrrr r r r pip._internal.models.schemer pip._internal.utils.compatrpip._internal.utils.virtualenvrbaser getLogger__name__r4strboolrIrLrWrZr[r\r"r"r"r#s`           S #PK+]z6))-locations/__pycache__/__init__.cpython-39.pycnu[a Rel8 @sUddlZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZdd lmZmZmZmZmZmZgd Z e!e"Z#ej$%d rej&Z'nej(Z'e)ed d Z*e+e,d<ej-dkZ.e/dddZ0ee+e+fe/dddZ1ej2dde/dddZ3ej2dde/dddZ4ej2dde/dddZ5ej2dde/dddZ6e e+e e+dd d!Z7ej2ddej8ej8e+dd"d#d$Z9ej8ej8e+e/d"d%d&Z:ej2ddd'dddd(e/e e+e e+e e+dd)d*d+Z;d@e+e/e e+e e+e/e e+ed,d-d.Ze+e/d3d4d5Z?e+dd6d7Z@e+dd8d9ZAe+e+e e+d:d;d<ZBe+e e+d=d>d?ZCdS)AN)AnyDictIteratorListOptionalTuple) SCHEME_KEYSScheme)WINDOWS) deprecated)running_under_virtualenv) _distutils _sysconfig)USER_CACHE_DIRget_major_minor_versionget_src_prefixis_osx_framework site_packages user_site) rget_bin_prefix get_bin_userr get_platlibget_prefixed_libs get_purelib get_schemerrrZ"_PIP_LOCATIONS_NO_WARN_ON_MISMATCH platlibdirlib _PLATLIBDIR) )returncCs:ddlm}z|dd}Wnty0YdS0|dkS)zsThe resolution to bpo-44860 will change this incorrect platlib. See . rINSTALL_SCHEMES unix_userplatlibFz $usersite)distutils.command.installr#KeyError)r#unix_user_platlibr)/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/locations/__init__.py_looks_like_bpo_448603s   r+)schemer!cCs\|d}d|vr0ttdr0|ddtjd}d|vrSsz*_looks_like_red_hat_lib..) unix_prefix unix_home)r&r#allr)r)r"r*_looks_like_red_hat_libKs  r=cCsddlm}d|vod|vS)z#Debian adds two additional schemes.rr" deb_system unix_local)r&r#r"r)r)r*_looks_like_debian_schemeZs r@cCs^ddlm}ddlm}||}||jtjt jdko\|j tjt j dkS)a\Red Hat patches ``sys.prefix`` and ``sys.exec_prefix``. Red Hat's ``00251-change-user-install-location.patch`` changes the install command's ``prefix`` and ``exec_prefix`` to append ``"/local"``. This is (fortunately?) done quite unconditionally, so we create a default command object without any configuration to detect this. r)install) Distributionz/local) r&rAdistutils.distrBfinalize_options exec_prefixospathnormpathr0prefix)rArBcmdr)r)r*_looks_like_red_hat_schemebs   rKcs.tjdddtddfdddDDS)aMSYS2 patches distutils and sysconfig to use a UNIX-like scheme. However, MSYS2 incorrectly patches sysconfig ``nt`` scheme. The fix is likely going to be included in their 3.10 release, so we ignore the warning. See msys2/MINGW-packages#9319. MSYS2 MINGW's patch uses lowercase ``"lib"`` instead of the usual uppercase, and is missing the final ``"site-packages"``. ntF)expandcss*|]"}d|vo d|vo |d VqdS)Librz site-packagesN)endswith)r7pr)r)r*r9sz1_looks_like_msys2_mingw_scheme..c3s|]}|VqdSr5r))r7keypathsr)r*r9r%r.) sysconfig get_pathsr<r)r)rRr*_looks_like_msys2_mingw_schemevs rX)partsr!ccshtd}ttdd}|r(|r(||s6|EdHdS|D](}||r\|ddt|}|Vq:dS)N LDVERSIONabiflagsr)rVget_config_vargetattrr0rOlen)rY ldversionr[partr)r)r* _fix_abiflagss    ra)oldnewrQr!cCs d}d}tt|||||dS)Nz(https://github.com/pypa/pip/issues/10151zSValue for %s does not match. Please report this to <%s> distutils: %s sysconfig: %s)loggerlog_MISMATCH_LEVEL)rbrcrQ issue_urlmessager)r)r*_warn_mismatchedsricCs||kr dSt|||ddS)NFrQT)ri)rbrcrQr)r)r*_warn_if_mismatchsrkFuserhomerootrI)rmrnrorIr!cCs&gd}ttd|||||dS)N)zAdditional context:z user = %rz home = %rz root = %rz prefix = %r )rdrerfjoin)rmrnrorIrYr)r)r* _log_contextsrr) dist_namermrnroisolatedrIr!c stj||||||d}tr|Stj||||||dg}tD]}tt|} tt||} | | krlq.zConfiguring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621)reason replacementgone_inrjrl)#rr_USE_SYSCONFIGrrpathlibPathr]r0implementationnameparent startswithrr=r version_inforr+r rYr^rKr@tuplerarXrVis_python_buildappenddistutils_schemeanyr rirr)rsrmrnrortrIrcwarning_contextsr8old_vnew_vskip_pypy_special_case$skip_osx_framework_user_special_caseskip_bpo_44860skip_linux_system_special_caseskip_sysconfig_abiflag_bugskip_msys2_mingw_bugskip_cpython_buildrQr)rr*rs              rcCs<t}tr|St}tt|t|ddr8t|S)N bin_prefixrj)rrrrrkrrrrrcrbr)r)r*rdsrcCstjdddjS)NT)rm)rrscriptsr)r)r)r*rosr)valuer!cCsts dS|dkrdSdS)aCheck if the value is Debian's APT-controlled dist-packages. Debian's ``distutils.sysconfig.get_python_lib()`` implementation returns the default package path controlled by APT, but does not patch ``sysconfig`` to do the same. This is similar to the bug worked around in ``get_scheme()``, but here the default is ``deb_system`` instead of ``unix_local``. Ultimately we can't do anything about this Debian bug, and this detection allows us to skip the warning when needed. Fz/usr/lib/python3/dist-packagesT)r@)rr)r)r*$_looks_like_deb_system_dist_packagesss rcCsHt}tr|St}t|r$|Stt|t|ddrDt|S)z,Return the default pure-Python lib location.r.rj) rrrrrrkrrrrrr)r)r*rsrcCsHt}tr|St}t|r$|Stt|t|ddrDt|S)z0Return the default platform-shared lib location.r%rj) rrrrrrkrrrrrr)r)r*rsr)v1v2r!cCs||kr|gS||gS)zDeduplicate values from a list.r))rrr)r)r* _deduplicatedsr)rIr!cCszt|\}}trt||St|\}}tt|t|ddtt|t|ddg}t|rpt |dt||S)z*Return the lib locations under ``prefix``.zprefixed-purelibrjzprefixed-platlib)rI) rrrrrrkrrrrr)rInew_purenew_platold_pureold_platwarnedr)r)r*rs$   r)FNNFN)D functoolsloggingrFrr0rVtypingrrrrrrpip._internal.models.schemerr pip._internal.utils.compatr pip._internal.utils.deprecationr pip._internal.utils.virtualenvr rrrbaserrrrrr__all__ getLogger__name__rdenvirongetDEBUGrfWARNINGr]rstr__annotations__rrboolr+r3 lru_cacher=r@rKrXrarrirkrrrrrrrrrrr)r)r)r*s                 ( PK+]8 zlocations/_sysconfig.pynu[import distutils.util # FIXME: For change_root. import logging import os import sys import sysconfig import typing from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.virtualenv import running_under_virtualenv from .base import get_major_minor_version, is_osx_framework logger = logging.getLogger(__name__) # Notes on _infer_* functions. # Unfortunately ``get_default_scheme()`` didn't exist before 3.10, so there's no # way to ask things like "what is the '_prefix' scheme on this platform". These # functions try to answer that with some heuristics while accounting for ad-hoc # platforms not covered by CPython's default sysconfig implementation. If the # ad-hoc implementation does not fully implement sysconfig, we'll fall back to # a POSIX scheme. _AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names()) _PREFERRED_SCHEME_API = getattr(sysconfig, "get_preferred_scheme", None) def _should_use_osx_framework_prefix() -> bool: """Check for Apple's ``osx_framework_library`` scheme. Python distributed by Apple's Command Line Tools has this special scheme that's used when: * This is a framework build. * We are installing into the system prefix. This does not account for ``pip install --prefix`` (also means we're not installing to the system prefix), which should use ``posix_prefix``, but logic here means ``_infer_prefix()`` outputs ``osx_framework_library``. But since ``prefix`` is not available for ``sysconfig.get_default_scheme()``, which is the stdlib replacement for ``_infer_prefix()``, presumably Apple wouldn't be able to magically switch between ``osx_framework_library`` and ``posix_prefix``. ``_infer_prefix()`` returning ``osx_framework_library`` means its behavior is consistent whether we use the stdlib implementation or our own, and we deal with this special case in ``get_scheme()`` instead. """ return ( "osx_framework_library" in _AVAILABLE_SCHEMES and not running_under_virtualenv() and is_osx_framework() ) def _infer_prefix() -> str: """Try to find a prefix scheme for the current platform. This tries: * A special ``osx_framework_library`` for Python distributed by Apple's Command Line Tools, when not running in a virtual environment. * Implementation + OS, used by PyPy on Windows (``pypy_nt``). * Implementation without OS, used by PyPy on POSIX (``pypy``). * OS + "prefix", used by CPython on POSIX (``posix_prefix``). * Just the OS name, used by CPython on Windows (``nt``). If none of the above works, fall back to ``posix_prefix``. """ if _PREFERRED_SCHEME_API: return _PREFERRED_SCHEME_API("prefix") if _should_use_osx_framework_prefix(): return "osx_framework_library" implementation_suffixed = f"{sys.implementation.name}_{os.name}" if implementation_suffixed in _AVAILABLE_SCHEMES: return implementation_suffixed if sys.implementation.name in _AVAILABLE_SCHEMES: return sys.implementation.name suffixed = f"{os.name}_prefix" if suffixed in _AVAILABLE_SCHEMES: return suffixed if os.name in _AVAILABLE_SCHEMES: # On Windows, prefx is just called "nt". return os.name return "posix_prefix" def _infer_user() -> str: """Try to find a user scheme for the current platform.""" if _PREFERRED_SCHEME_API: return _PREFERRED_SCHEME_API("user") if is_osx_framework() and not running_under_virtualenv(): suffixed = "osx_framework_user" else: suffixed = f"{os.name}_user" if suffixed in _AVAILABLE_SCHEMES: return suffixed if "posix_user" not in _AVAILABLE_SCHEMES: # User scheme unavailable. raise UserInstallationInvalid() return "posix_user" def _infer_home() -> str: """Try to find a home for the current platform.""" if _PREFERRED_SCHEME_API: return _PREFERRED_SCHEME_API("home") suffixed = f"{os.name}_home" if suffixed in _AVAILABLE_SCHEMES: return suffixed return "posix_home" # Update these keys if the user sets a custom home. _HOME_KEYS = [ "installed_base", "base", "installed_platbase", "platbase", "prefix", "exec_prefix", ] if sysconfig.get_config_var("userbase") is not None: _HOME_KEYS.append("userbase") def get_scheme( dist_name: str, user: bool = False, home: typing.Optional[str] = None, root: typing.Optional[str] = None, isolated: bool = False, prefix: typing.Optional[str] = None, ) -> Scheme: """ Get the "scheme" corresponding to the input parameters. :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme :param root: root under which other directories are re-based :param isolated: ignored, but kept for distutils compatibility (where this controls whether the user-site pydistutils.cfg is honored) :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same """ if user and prefix: raise InvalidSchemeCombination("--user", "--prefix") if home and prefix: raise InvalidSchemeCombination("--home", "--prefix") if home is not None: scheme_name = _infer_home() elif user: scheme_name = _infer_user() else: scheme_name = _infer_prefix() # Special case: When installing into a custom prefix, use posix_prefix # instead of osx_framework_library. See _should_use_osx_framework_prefix() # docstring for details. if prefix is not None and scheme_name == "osx_framework_library": scheme_name = "posix_prefix" if home is not None: variables = {k: home for k in _HOME_KEYS} elif prefix is not None: variables = {k: prefix for k in _HOME_KEYS} else: variables = {} paths = sysconfig.get_paths(scheme=scheme_name, vars=variables) # Logic here is very arbitrary, we're doing it for compatibility, don't ask. # 1. Pip historically uses a special header path in virtual environments. # 2. If the distribution name is not known, distutils uses 'UNKNOWN'. We # only do the same when not running in a virtual environment because # pip's historical header path logic (see point 1) did not do this. if running_under_virtualenv(): if user: base = variables.get("userbase", sys.prefix) else: base = variables.get("base", sys.prefix) python_xy = f"python{get_major_minor_version()}" paths["include"] = os.path.join(base, "include", "site", python_xy) elif not dist_name: dist_name = "UNKNOWN" scheme = Scheme( platlib=paths["platlib"], purelib=paths["purelib"], headers=os.path.join(paths["include"], dist_name), scripts=paths["scripts"], data=paths["data"], ) if root is not None: for key in SCHEME_KEYS: value = distutils.util.change_root(root, getattr(scheme, key)) setattr(scheme, key, value) return scheme def get_bin_prefix() -> str: # Forcing to use /usr/local/bin for standard macOS framework installs. if sys.platform[:6] == "darwin" and sys.prefix[:16] == "/System/Library/": return "/usr/local/bin" return sysconfig.get_paths()["scripts"] def get_purelib() -> str: return sysconfig.get_paths()["purelib"] def get_platlib() -> str: return sysconfig.get_paths()["platlib"] def get_prefixed_libs(prefix: str) -> typing.Tuple[str, str]: paths = sysconfig.get_paths(vars={"base": prefix, "platbase": prefix}) return (paths["purelib"], paths["platlib"]) PK+]Y++locations/base.pynu[import functools import os import site import sys import sysconfig import typing from pip._internal.utils import appdirs from pip._internal.utils.virtualenv import running_under_virtualenv # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") # FIXME doesn't account for venv linked to global site-packages site_packages: typing.Optional[str] = sysconfig.get_path("purelib") def get_major_minor_version() -> str: """ Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". """ return "{}.{}".format(*sys.version_info) def get_src_prefix() -> str: if running_under_virtualenv(): src_prefix = os.path.join(sys.prefix, "src") else: # FIXME: keep src in cwd for now (it is not a temporary folder) try: src_prefix = os.path.join(os.getcwd(), "src") except OSError: # In case the current working directory has been renamed or deleted sys.exit("The folder you are executing pip from can no longer be found.") # under macOS + virtualenv sys.prefix is not properly resolved # it is something like /path/to/python/bin/.. return os.path.abspath(src_prefix) try: # Use getusersitepackages if this is present, as it ensures that the # value is initialised properly. user_site: typing.Optional[str] = site.getusersitepackages() except AttributeError: user_site = site.USER_SITE @functools.lru_cache(maxsize=None) def is_osx_framework() -> bool: return bool(sysconfig.get_config_var("PYTHONFRAMEWORK")) PK+]őkl8l8locations/__init__.pynu[import functools import logging import os import pathlib import sys import sysconfig from typing import Any, Dict, Iterator, List, Optional, Tuple from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.compat import WINDOWS from pip._internal.utils.deprecation import deprecated from pip._internal.utils.virtualenv import running_under_virtualenv from . import _distutils, _sysconfig from .base import ( USER_CACHE_DIR, get_major_minor_version, get_src_prefix, is_osx_framework, site_packages, user_site, ) __all__ = [ "USER_CACHE_DIR", "get_bin_prefix", "get_bin_user", "get_major_minor_version", "get_platlib", "get_prefixed_libs", "get_purelib", "get_scheme", "get_src_prefix", "site_packages", "user_site", ] logger = logging.getLogger(__name__) if os.environ.get("_PIP_LOCATIONS_NO_WARN_ON_MISMATCH"): _MISMATCH_LEVEL = logging.DEBUG else: _MISMATCH_LEVEL = logging.WARNING _PLATLIBDIR: str = getattr(sys, "platlibdir", "lib") _USE_SYSCONFIG = sys.version_info >= (3, 10) def _looks_like_bpo_44860() -> bool: """The resolution to bpo-44860 will change this incorrect platlib. See . """ from distutils.command.install import INSTALL_SCHEMES # type: ignore try: unix_user_platlib = INSTALL_SCHEMES["unix_user"]["platlib"] except KeyError: return False return unix_user_platlib == "$usersite" def _looks_like_red_hat_patched_platlib_purelib(scheme: Dict[str, str]) -> bool: platlib = scheme["platlib"] if "/$platlibdir/" in platlib and hasattr(sys, "platlibdir"): platlib = platlib.replace("/$platlibdir/", f"/{sys.platlibdir}/") if "/lib64/" not in platlib: return False unpatched = platlib.replace("/lib64/", "/lib/") return unpatched.replace("$platbase/", "$base/") == scheme["purelib"] @functools.lru_cache(maxsize=None) def _looks_like_red_hat_lib() -> bool: """Red Hat patches platlib in unix_prefix and unix_home, but not purelib. This is the only way I can see to tell a Red Hat-patched Python. """ from distutils.command.install import INSTALL_SCHEMES # type: ignore return all( k in INSTALL_SCHEMES and _looks_like_red_hat_patched_platlib_purelib(INSTALL_SCHEMES[k]) for k in ("unix_prefix", "unix_home") ) @functools.lru_cache(maxsize=None) def _looks_like_debian_scheme() -> bool: """Debian adds two additional schemes.""" from distutils.command.install import INSTALL_SCHEMES # type: ignore return "deb_system" in INSTALL_SCHEMES and "unix_local" in INSTALL_SCHEMES @functools.lru_cache(maxsize=None) def _looks_like_red_hat_scheme() -> bool: """Red Hat patches ``sys.prefix`` and ``sys.exec_prefix``. Red Hat's ``00251-change-user-install-location.patch`` changes the install command's ``prefix`` and ``exec_prefix`` to append ``"/local"``. This is (fortunately?) done quite unconditionally, so we create a default command object without any configuration to detect this. """ from distutils.command.install import install from distutils.dist import Distribution cmd: Any = install(Distribution()) cmd.finalize_options() return ( cmd.exec_prefix == f"{os.path.normpath(sys.exec_prefix)}/local" and cmd.prefix == f"{os.path.normpath(sys.prefix)}/local" ) @functools.lru_cache(maxsize=None) def _looks_like_msys2_mingw_scheme() -> bool: """MSYS2 patches distutils and sysconfig to use a UNIX-like scheme. However, MSYS2 incorrectly patches sysconfig ``nt`` scheme. The fix is likely going to be included in their 3.10 release, so we ignore the warning. See msys2/MINGW-packages#9319. MSYS2 MINGW's patch uses lowercase ``"lib"`` instead of the usual uppercase, and is missing the final ``"site-packages"``. """ paths = sysconfig.get_paths("nt", expand=False) return all( "Lib" not in p and "lib" in p and not p.endswith("site-packages") for p in (paths[key] for key in ("platlib", "purelib")) ) def _fix_abiflags(parts: Tuple[str]) -> Iterator[str]: ldversion = sysconfig.get_config_var("LDVERSION") abiflags: str = getattr(sys, "abiflags", None) # LDVERSION does not end with sys.abiflags. Just return the path unchanged. if not ldversion or not abiflags or not ldversion.endswith(abiflags): yield from parts return # Strip sys.abiflags from LDVERSION-based path components. for part in parts: if part.endswith(ldversion): part = part[: (0 - len(abiflags))] yield part @functools.lru_cache(maxsize=None) def _warn_mismatched(old: pathlib.Path, new: pathlib.Path, *, key: str) -> None: issue_url = "https://github.com/pypa/pip/issues/10151" message = ( "Value for %s does not match. Please report this to <%s>" "\ndistutils: %s" "\nsysconfig: %s" ) logger.log(_MISMATCH_LEVEL, message, key, issue_url, old, new) def _warn_if_mismatch(old: pathlib.Path, new: pathlib.Path, *, key: str) -> bool: if old == new: return False _warn_mismatched(old, new, key=key) return True @functools.lru_cache(maxsize=None) def _log_context( *, user: bool = False, home: Optional[str] = None, root: Optional[str] = None, prefix: Optional[str] = None, ) -> None: parts = [ "Additional context:", "user = %r", "home = %r", "root = %r", "prefix = %r", ] logger.log(_MISMATCH_LEVEL, "\n".join(parts), user, home, root, prefix) def get_scheme( dist_name: str, user: bool = False, home: Optional[str] = None, root: Optional[str] = None, isolated: bool = False, prefix: Optional[str] = None, ) -> Scheme: new = _sysconfig.get_scheme( dist_name, user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) if _USE_SYSCONFIG: return new old = _distutils.get_scheme( dist_name, user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) warning_contexts = [] for k in SCHEME_KEYS: old_v = pathlib.Path(getattr(old, k)) new_v = pathlib.Path(getattr(new, k)) if old_v == new_v: continue # distutils incorrectly put PyPy packages under ``site-packages/python`` # in the ``posix_home`` scheme, but PyPy devs said they expect the # directory name to be ``pypy`` instead. So we treat this as a bug fix # and not warn about it. See bpo-43307 and python/cpython#24628. skip_pypy_special_case = ( sys.implementation.name == "pypy" and home is not None and k in ("platlib", "purelib") and old_v.parent == new_v.parent and old_v.name.startswith("python") and new_v.name.startswith("pypy") ) if skip_pypy_special_case: continue # sysconfig's ``osx_framework_user`` does not include ``pythonX.Y`` in # the ``include`` value, but distutils's ``headers`` does. We'll let # CPython decide whether this is a bug or feature. See bpo-43948. skip_osx_framework_user_special_case = ( user and is_osx_framework() and k == "headers" and old_v.parent.parent == new_v.parent and old_v.parent.name.startswith("python") ) if skip_osx_framework_user_special_case: continue # On Red Hat and derived Linux distributions, distutils is patched to # use "lib64" instead of "lib" for platlib. if k == "platlib" and _looks_like_red_hat_lib(): continue # On Python 3.9+, sysconfig's posix_user scheme sets platlib against # sys.platlibdir, but distutils's unix_user incorrectly coninutes # using the same $usersite for both platlib and purelib. This creates a # mismatch when sys.platlibdir is not "lib". skip_bpo_44860 = ( user and k == "platlib" and not WINDOWS and sys.version_info >= (3, 9) and _PLATLIBDIR != "lib" and _looks_like_bpo_44860() ) if skip_bpo_44860: continue # Both Debian and Red Hat patch Python to place the system site under # /usr/local instead of /usr. Debian also places lib in dist-packages # instead of site-packages, but the /usr/local check should cover it. skip_linux_system_special_case = ( not (user or home or prefix or running_under_virtualenv()) and old_v.parts[1:3] == ("usr", "local") and len(new_v.parts) > 1 and new_v.parts[1] == "usr" and (len(new_v.parts) < 3 or new_v.parts[2] != "local") and (_looks_like_red_hat_scheme() or _looks_like_debian_scheme()) ) if skip_linux_system_special_case: continue # On Python 3.7 and earlier, sysconfig does not include sys.abiflags in # the "pythonX.Y" part of the path, but distutils does. skip_sysconfig_abiflag_bug = ( sys.version_info < (3, 8) and not WINDOWS and k in ("headers", "platlib", "purelib") and tuple(_fix_abiflags(old_v.parts)) == new_v.parts ) if skip_sysconfig_abiflag_bug: continue # MSYS2 MINGW's sysconfig patch does not include the "site-packages" # part of the path. This is incorrect and will be fixed in MSYS. skip_msys2_mingw_bug = ( WINDOWS and k in ("platlib", "purelib") and _looks_like_msys2_mingw_scheme() ) if skip_msys2_mingw_bug: continue # CPython's POSIX install script invokes pip (via ensurepip) against the # interpreter located in the source tree, not the install site. This # triggers special logic in sysconfig that's not present in distutils. # https://github.com/python/cpython/blob/8c21941ddaf/Lib/sysconfig.py#L178-L194 skip_cpython_build = ( sysconfig.is_python_build(check_home=True) and not WINDOWS and k in ("headers", "include", "platinclude") ) if skip_cpython_build: continue warning_contexts.append((old_v, new_v, f"scheme.{k}")) if not warning_contexts: return old # Check if this path mismatch is caused by distutils config files. Those # files will no longer work once we switch to sysconfig, so this raises a # deprecation message for them. default_old = _distutils.distutils_scheme( dist_name, user, home, root, isolated, prefix, ignore_config_files=True, ) if any(default_old[k] != getattr(old, k) for k in SCHEME_KEYS): deprecated( reason=( "Configuring installation scheme with distutils config files " "is deprecated and will no longer work in the near future. If you " "are using a Homebrew or Linuxbrew Python, please see discussion " "at https://github.com/Homebrew/homebrew-core/issues/76621" ), replacement=None, gone_in=None, ) return old # Post warnings about this mismatch so user can report them back. for old_v, new_v, key in warning_contexts: _warn_mismatched(old_v, new_v, key=key) _log_context(user=user, home=home, root=root, prefix=prefix) return old def get_bin_prefix() -> str: new = _sysconfig.get_bin_prefix() if _USE_SYSCONFIG: return new old = _distutils.get_bin_prefix() if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="bin_prefix"): _log_context() return old def get_bin_user() -> str: return _sysconfig.get_scheme("", user=True).scripts def _looks_like_deb_system_dist_packages(value: str) -> bool: """Check if the value is Debian's APT-controlled dist-packages. Debian's ``distutils.sysconfig.get_python_lib()`` implementation returns the default package path controlled by APT, but does not patch ``sysconfig`` to do the same. This is similar to the bug worked around in ``get_scheme()``, but here the default is ``deb_system`` instead of ``unix_local``. Ultimately we can't do anything about this Debian bug, and this detection allows us to skip the warning when needed. """ if not _looks_like_debian_scheme(): return False if value == "/usr/lib/python3/dist-packages": return True return False def get_purelib() -> str: """Return the default pure-Python lib location.""" new = _sysconfig.get_purelib() if _USE_SYSCONFIG: return new old = _distutils.get_purelib() if _looks_like_deb_system_dist_packages(old): return old if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="purelib"): _log_context() return old def get_platlib() -> str: """Return the default platform-shared lib location.""" new = _sysconfig.get_platlib() if _USE_SYSCONFIG: return new old = _distutils.get_platlib() if _looks_like_deb_system_dist_packages(old): return old if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="platlib"): _log_context() return old def _deduplicated(v1: str, v2: str) -> List[str]: """Deduplicate values from a list.""" if v1 == v2: return [v1] return [v1, v2] def get_prefixed_libs(prefix: str) -> List[str]: """Return the lib locations under ``prefix``.""" new_pure, new_plat = _sysconfig.get_prefixed_libs(prefix) if _USE_SYSCONFIG: return _deduplicated(new_pure, new_plat) old_pure, old_plat = _distutils.get_prefixed_libs(prefix) warned = [ _warn_if_mismatch( pathlib.Path(old_pure), pathlib.Path(new_pure), key="prefixed-purelib", ), _warn_if_mismatch( pathlib.Path(old_plat), pathlib.Path(new_plat), key="prefixed-platlib", ), ] if any(warned): _log_context(prefix=prefix) return _deduplicated(old_pure, old_plat) PK+]ڝlocations/_distutils.pynu["""Locations where we look for configs, install stuff, etc""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False import logging import os import sys from distutils.cmd import Command as DistutilsCommand from distutils.command.install import SCHEME_KEYS from distutils.command.install import install as distutils_install_command from distutils.sysconfig import get_python_lib from typing import Dict, List, Optional, Tuple, Union, cast from pip._internal.models.scheme import Scheme from pip._internal.utils.compat import WINDOWS from pip._internal.utils.virtualenv import running_under_virtualenv from .base import get_major_minor_version logger = logging.getLogger(__name__) def distutils_scheme( dist_name: str, user: bool = False, home: str = None, root: str = None, isolated: bool = False, prefix: str = None, *, ignore_config_files: bool = False, ) -> Dict[str, str]: """ Return a distutils install scheme """ from distutils.dist import Distribution dist_args: Dict[str, Union[str, List[str]]] = {"name": dist_name} if isolated: dist_args["script_args"] = ["--no-user-cfg"] d = Distribution(dist_args) if not ignore_config_files: try: d.parse_config_files() except UnicodeDecodeError: # Typeshed does not include find_config_files() for some reason. paths = d.find_config_files() # type: ignore logger.warning( "Ignore distutils configs in %s due to encoding errors.", ", ".join(os.path.basename(p) for p in paths), ) obj: Optional[DistutilsCommand] = None obj = d.get_command_obj("install", create=True) assert obj is not None i = cast(distutils_install_command, obj) # NOTE: setting user or home has the side-effect of creating the home dir # or user base for installations during finalize_options() # ideally, we'd prefer a scheme class that has no side-effects. assert not (user and prefix), f"user={user} prefix={prefix}" assert not (home and prefix), f"home={home} prefix={prefix}" i.user = user or i.user if user or home: i.prefix = "" i.prefix = prefix or i.prefix i.home = home or i.home i.root = root or i.root i.finalize_options() scheme = {} for key in SCHEME_KEYS: scheme[key] = getattr(i, "install_" + key) # install_lib specified in setup.cfg should install *everything* # into there (i.e. it takes precedence over both purelib and # platlib). Note, i.install_lib is *always* set after # finalize_options(); we only want to override here if the user # has explicitly requested it hence going back to the config if "install_lib" in d.get_option_dict("install"): scheme.update(dict(purelib=i.install_lib, platlib=i.install_lib)) if running_under_virtualenv(): if home: prefix = home elif user: prefix = i.install_userbase # type: ignore else: prefix = i.prefix scheme["headers"] = os.path.join( prefix, "include", "site", f"python{get_major_minor_version()}", dist_name, ) if root is not None: path_no_drive = os.path.splitdrive(os.path.abspath(scheme["headers"]))[1] scheme["headers"] = os.path.join(root, path_no_drive[1:]) return scheme def get_scheme( dist_name: str, user: bool = False, home: Optional[str] = None, root: Optional[str] = None, isolated: bool = False, prefix: Optional[str] = None, ) -> Scheme: """ Get the "scheme" corresponding to the input parameters. The distutils documentation provides the context for the available schemes: https://docs.python.org/3/install/index.html#alternate-installation :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme and provides the base directory for the same :param root: root under which other directories are re-based :param isolated: equivalent to --no-user-cfg, i.e. do not consider ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for scheme paths :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same """ scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix) return Scheme( platlib=scheme["platlib"], purelib=scheme["purelib"], headers=scheme["headers"], scripts=scheme["scripts"], data=scheme["data"], ) def get_bin_prefix() -> str: # XXX: In old virtualenv versions, sys.prefix can contain '..' components, # so we need to call normpath to eliminate them. prefix = os.path.normpath(sys.prefix) if WINDOWS: bin_py = os.path.join(prefix, "Scripts") # buildout uses 'bin' on Windows too? if not os.path.exists(bin_py): bin_py = os.path.join(prefix, "bin") return bin_py # Forcing to use /usr/local/bin for standard macOS framework installs # Also log to ~/Library/Logs/ for use with the Console.app log viewer if sys.platform[:6] == "darwin" and prefix[:16] == "/System/Library/": return "/usr/local/bin" return os.path.join(prefix, "bin") def get_purelib() -> str: return get_python_lib(plat_specific=False) def get_platlib() -> str: return get_python_lib(plat_specific=True) def get_prefixed_libs(prefix: str) -> Tuple[str, str]: return ( get_python_lib(plat_specific=False, prefix=prefix), get_python_lib(plat_specific=True, prefix=prefix), ) PK+]Jdistributions/sdist.pynu[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: from pip._internal.metadata.pkg_resources import Distribution as _Dist return _Dist(self.req.get_dist()) def prepare_distribution_metadata( self, finder: PackageFinder, build_isolation: 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) 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", "Installing 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", "Installing 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) PK+]sΗLL2distributions/__pycache__/installed.cpython-39.pycnu[a Re@s8ddlmZddlmZddlmZGdddeZdS))AbstractDistribution) PackageFinder)BaseDistributionc@s0eZdZdZedddZeeddddZdS) InstalledDistributionzRepresents an installed package. This does not need any preparation as the required information has already been computed. )returncCs,ddlm}|jjdus Jd||jjS)Nr) Distributionznot actually installed)$pip._internal.metadata.pkg_resourcesrreq satisfied_by)self_Distr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/distributions/installed.pyget_metadata_distribution s z/InstalledDistribution.get_metadata_distributionN)finderbuild_isolationrcCsdS)Nr )r rrr r rprepare_distribution_metadatasz3InstalledDistribution.prepare_distribution_metadata) __name__ __module__ __qualname____doc__rrrboolrr r r rrs rN) pip._internal.distributions.baser"pip._internal.index.package_finderrpip._internal.metadatarrr r r rs   PK+]ޡWuu-distributions/__pycache__/base.cpython-39.pycnu[a Re@sDddlZddlmZddlmZddlmZGdddejdZdS)N) PackageFinder)BaseDistribution)InstallRequirementcsTeZdZdZeddfdd ZejedddZ eje e dd d d Z Z S) AbstractDistributiona 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. N)reqreturncst||_dSN)super__init__r)selfr __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/distributions/base.pyr s zAbstractDistribution.__init__)rcCs tdSrNotImplementedError)r rrrget_metadata_distributionsz.AbstractDistribution.get_metadata_distribution)finderbuild_isolationrcCs tdSrr)r rrrrrprepare_distribution_metadata sz2AbstractDistribution.prepare_distribution_metadata)__name__ __module__ __qualname____doc__rr abcabstractmethodrrrboolr __classcell__rrr rrsr) metaclass) r"pip._internal.index.package_finderrZpip._internal.metadata.baserpip._internal.reqrABCMetarrrrrs   PK+]`bb.distributions/__pycache__/wheel.cpython-39.pycnu[a Re[@sLddlmZddlmZddlmZddlmZmZm Z GdddeZ dS))canonicalize_name)AbstractDistribution) PackageFinder)BaseDistributionFilesystemWheelget_wheel_distributionc@s0eZdZdZedddZeeddddZdS) WheelDistributionzqRepresents a wheel distribution. This does not need any preparation as wheels can be directly unpacked. )returncCs>|jjsJd|jjs Jdt|jj}t|t|jjS)zLoads the metadata from the wheel file into memory and returns a Distribution that uses it, not relying on the wheel file or requirement. z*Set as part of preparation during downloadzWheels are never unnamed)reqlocal_file_pathnamerrr)selfwheelr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/distributions/wheel.pyget_metadata_distributions z+WheelDistribution.get_metadata_distributionN)finderbuild_isolationr cCsdS)Nr)r rrrrrprepare_distribution_metadatasz/WheelDistribution.prepare_distribution_metadata) __name__ __module__ __qualname____doc__rrrboolrrrrrr s  rN) pip._vendor.packaging.utilsr pip._internal.distributions.baser"pip._internal.index.package_finderrpip._internal.metadatarrrrrrrrs   PK+]5OJJ.distributions/__pycache__/sdist.cpython-39.pycnu[a Re@sddlZddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl mZddlmZeeZGd d d eZdS) N)IterableSetTuple)BuildEnvironment)AbstractDistribution)InstallationError) PackageFinder)BaseDistribution)runner_with_spinner_messagec@seZdZdZedddZeeddddZedd d d Z e e dd d Z e e dddZ edd ddZe eee e fddddZdS)SourceDistributionzRepresents 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`. )returncCsddlm}||jS)Nr) Distribution)$pip._internal.metadata.pkg_resourcesr reqget_dist)self_Distr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/distributions/sdist.pyget_metadata_distributions z,SourceDistribution.get_metadata_distributionN)finderbuild_isolationr cCsF|j|jjo|}|r8|||j|||jdS)N)rload_pyproject_toml use_pep517_prepare_build_backendisolated_editable_sanity_check_install_build_reqsprepare_metadata)rrrshould_isolaterrrprepare_distribution_metadatas     z0SourceDistribution.prepare_distribution_metadata)rr c Cs|jj}|dusJt|j_|jj||dd|jj|jj\}}|rX|d||rt d|jt dd t t t |dS)NoverlayzInstalling build dependenciesz"PEP 517/518 supported requirementsz4Missing build requirements in pyproject.toml for %s.z`The project does not specify a build backend, and pip cannot fall back to setuptools without %s.z and )rpyproject_requiresr build_envinstall_requirementscheck_requirementsrequirements_to_check_raise_conflictsloggerwarningjoinmapreprsorted)rrr! conflictingmissingrrrr3s(   z)SourceDistribution._prepare_build_backendc Cs|jjltd}|jj}|dus&J||&|WdWdS1s\0YWdn1sz0YdS)Nz#Getting requirements to build wheel)rr"r pep517_backendsubprocess_runnerget_requires_for_build_wheelrrunnerbackendrrr_get_build_requires_wheelMs    z,SourceDistribution._get_build_requires_wheelc Cs|jjltd}|jj}|dus&J||&|WdWdS1s\0YWdn1sz0YdS)Nz&Getting requirements to build editable)rr"r r/r0get_requires_for_build_editabler2rrr_get_build_requires_editableUs   z/SourceDistribution._get_build_requires_editablecCsf|jjr$|jjr$|jr$|}n|}|jj|\}}|rN|d||jj ||dddS)Nzthe backend dependenciesnormalzInstalling backend dependencies) reditablepermit_editable_wheelssupports_pyproject_editabler7r5r"r$r&r#)rr build_reqsr-r.rrrr_s  z&SourceDistribution._install_build_reqs)conflicting_withconflicting_reqsr cCs6d}|j|j|dddt|Dd}t|dS)NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}.z, css |]\}}|d|VqdS)z is incompatible with Nr).0 installedwantedrrr |sz6SourceDistribution._raise_conflicts..) requirementr= description)formatrr)r,r)rr=r> format_string error_messagerrrr&rs z#SourceDistribution._raise_conflicts)__name__ __module__ __qualname____doc__r rrboolrrrstrr5r7rrrr&rrrrr s  r )loggingtypingrrrpip._internal.build_envr pip._internal.distributions.baserpip._internal.exceptionsr"pip._internal.index.package_finderrpip._internal.metadatar pip._internal.utils.subprocessr getLoggerrHr'r rrrrs       PK+]TBB1distributions/__pycache__/__init__.cpython-39.pycnu[a ReZ@sDddlmZddlmZddlmZddlmZeedddZdS) )AbstractDistribution)SourceDistribution)WheelDistribution)InstallRequirement) install_reqreturncCs$|jrt|S|jrt|St|S)z7Returns a Distribution for the given InstallRequirement)editableris_wheelr)rr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/distributions/__init__.py)make_distribution_for_install_requirements r N) pip._internal.distributions.baser!pip._internal.distributions.sdistr!pip._internal.distributions.wheelrZpip._internal.req.req_installrr r r r r s    PK+]0%%%,operations/__pycache__/freeze.cpython-39.pycnu[a Re*& @s"ddlZddlZddlZddlmZmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZmZddlmZmZddlmZmZddlmZdd lmZeeZGd d d e Z de ee!e"e"e ee!e"e"ee!ee!dddZ#ee!dddZ$ee dddZ%GdddZ&dS)N) ContainerDictIterableIteratorList NamedTupleOptionalSet)canonicalize_name)Version) BadCommandInstallationError)BaseDistributionget_environment)install_req_from_editableinstall_req_from_line) COMMENT_RE)%direct_url_as_pep440_direct_referencec@s"eZdZUeed<eeed<dS) _EditableInfo requirementcommentsN)__name__ __module__ __qualname__str__annotations__rrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/freeze.pyrs rFr)r local_only user_onlypathsisolatedexclude_editableskipreturnc csni}t|j|d|d}|D]$} t| } |r6| jr6q| || j<q|r4t} tt } |D]} t | p}|D]X}| r| ds| dr| }|| vrr| ||Vqr| ds| dr| dr|dd }n|tdd d}t||d }nttd | |d }|jsRtd | | td qrt|j}||vr| |jstd | td | |jn| |j| qrt|| V||=| |j| qrWdq\1s0Yq\| D]4\}}t|dkrtd|dtt|qdVt|dddD] }|j|vrHt| VqHdS)Nr)rr#r#) z-rz --requirementz-fz --find-linksz-iz --index-urlz--prez--trusted-hostz--process-dependency-linksz--extra-index-urlz --use-featurez-ez --editable=)r!zWSkipping line in requirement file [%s] because it's not clear what it would install: %sz9 (add #egg=PackageName to the URL to avoid this warning)zBRequirement file [%s] contains %s, but package %r is not installedz+Requirement %s included multiple times [%s]z, z7## The following requirements were added by pip freeze:cSs |jSN)namelower)xrrrzfreeze..)key) riter_installed_distributionsFrozenRequirement from_disteditablecanonical_nameset collections defaultdictlistopenstrip startswithrstripaddlenlstriprrrsubr+loggerinfor warningappendritemsjoinsortedvalues)rrrr r!r"r#Z installationsdistsdistreqZemitted_optionsZ req_filesZ req_file_pathreq_filelineZline_reqZline_req_canonical_namer+filesZ installationrrrfreezes              4 rPrKr$cCs0t|jtr|jd|jS|jd|jS)Nz==z===) isinstanceversionr raw_name)rKrrr_format_as_name_versions rUc Cs|j}|sJtjtj|}ddlm}m}m}| |}|durtt |}t d||t |d|dgdSt|j}z|||j} Wn|yt |}t |d|d |dgdYS|y} zs@(        yBPK+]^("c9c9-operations/__pycache__/prepare.cpython-39.pycnu[a Re]@sRdZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZddlmZdd lmZdd lmZdd lmZdd l m!Z!m"Z"dd l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9ddl:m;Z;ddle?Z@e)e+eeAedddZBeeCddddZDGdddZEd3ee"e eCe e/eEd d!d"ZFeCeCdd#d$d%ZGeCeCdd&d'd(ZHd4ee eCe e/eEd)d*d+ZId5eeCe"e eCe e/e eEd,d-d.ZJeeCe e/e eCd)d/d0ZKGd1d2d2ZLdS)6z)Prepares a distribution for installation N)DictIterableListOptional)canonicalize_name))make_distribution_for_install_requirement)InstalledDistribution)DirectoryUrlHashUnsupported HashMismatch HashUnpinnedInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorVcsHashUnsupported) PackageFinder)BaseDistribution)Link)Wheel)BatchDownloader Downloader)HTTPRangeRequestUnsupporteddist_from_wheel_url) PipSession)InstallRequirement)RequirementTracker) copy2_fixed)Hashes MissingHashes) indent_log) display_pathhide_urlis_installable_dirrmtree) TempDirectory) unpack_file)vcs)req req_trackerfinderbuild_isolationreturncCsFt|}|||||Wdn1s40Y|S)z(Prepare a distribution for installation.N)rtrackprepare_distribution_metadataget_metadata_distribution)r&r'r(r) abstract_distr//builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/prepare.py_get_prepared_distribution1s *r1)linklocationr*cCs0t|j}|dusJ|j|t|jddS)N)url)r%get_backend_for_schemeschemeunpackr r4)r2r3 vcs_backendr/r/r0unpack_vcs_link>s  r9c@s"eZdZeeeddddZdS)FileN)path content_typer*cCs*||_|dur t|d|_n||_dS)Nr)r; mimetypes guess_typer<)selfr;r<r/r/r0__init__Esz File.__init__)__name__ __module__ __qualname__strrr@r/r/r/r0r:Dsr:)r2download download_dirhashesr*cCsVtddd}d}|r t|||}|r.|}d}n|||j\}}|rL||t||S)Nr7Tkindglobally_managed)r#_check_download_dirr;check_against_pathr:)r2rErFrGtemp_diralready_downloaded_path from_pathr<r/r/r0 get_http_urlMs   rP)srcdestr*c CsNzt||Wn:tjyH}z tdt|||WYd}~n d}~00dS)zCopying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. z>Ignoring special file error '%s' encountered copying %s to %s.N)rshutilSpecialFileErrorloggerwarningrD)rQrRer/r/r0_copy2_ignoring_special_filesesrX)sourcetargetr*cs^tj|}tj|tj|tttttdfdd }tj||dt ddS)N)dnamesr*cs6g}|kr|ddg7}tj|kr2|g7}|S)Nz.toxz.nox)osr;abspath)r[r\skippedrYtarget_basenametarget_dirnamer/r0ignore~s   z!_copy_source_tree..ignoreT)rcsymlinks copy_function) r]r;r^basenamedirnamerDrrScopytreerX)rYrZtarget_abspathrcr/r`r0_copy_source_treeys   "rj)r2rFrGr*cCs<d}|rt|||}|r|}n|j}|r2||t|dS)z'Get file and optionally check its hash.N)rK file_pathrLr:)r2rFrGrNrOr/r/r0 get_file_urls  rl)r2r3rErFrGr*cCs|jrt||dS|r@tj|r0t|t|j|dS|j rVt |||d}nt ||||d}|j s|t |j||j|S)a_Unpack link into location, downloading if required. :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. N)rG)is_vcsr9is_existing_dirr]r;isdirr"rjrkis_filerlrPis_wheelr$r<)r2r3rErFrGfiler/r/r0 unpack_urls&     rscCsntj||j}tj|s dStd||rjz||Wn*tyht d|t |YdS0|S)zCheck download_dir for previously downloaded file with correct hash If a correct file is found return its path else None NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.) r]r;joinfilenameexistsrUinforLr rVunlink)r2rFrG download_pathr/r/r0rKs    rKcseZdZdZeeeeeeeee eeeedd fdd Z e ddddZ e edd d d Z e edd d ZeeedddZd#ee eddddZd$e eed ddZd%ee eddddZe eed ddZe ddddZe edddZe eed d!d"ZZS)&RequirementPreparerzPrepares a RequirementN) build_dirrFsrc_dirr)r'session progress_barr(require_hashes use_user_site lazy_wheel in_tree_buildr*c stt||_||_||_||_t|||_t|||_ ||_ ||_ ||_ | |_ | |_| |_| |_i|_d|_dS)N)r)superr@r|r{r'_sessionr _downloadr_batch_downloadr(rFr)rruse_lazy_wheelr _downloaded_previous_requirement_header) r?r{rFr|r)r'r}r~r(rrrr __class__r/r0r@s    zRequirementPreparer.__init__)r&r*cCs|jjr$|js$d}tt|jj}nd}t|jp2|}||f|jkrZ||f|_t |||jrt t d|jj Wdn1s0YdS)z3Provide context for the requirement being prepared.z Processing %sz Collecting %szUsing cached %sN) r2rporiginal_link_is_in_wheel_cacherDrrkr&rrUrwrru)r?r&message informationr/r/r0_log_preparing_link3s  z'RequirementPreparer._log_preparing_link)r&parallel_buildsr*cCsj|jjr dS|jdusJ|jr8|jr8|jj|_dS|j|jd|dt|jrft d ||jdS)z1Ensure source_dir of a linked InstallRequirement.NT) autodeleterzpip can't proceed with requirements '{}' due to apre-existing build directory ({}). This is likely due to a previous installation that failed . pip is being responsible and not assuming it can delete this. Please delete it and try again.) r2rq source_dirrnrrkensure_has_source_dirr{r!rformat)r?r&rr/r/r0_ensure_link_req_src_dirDs"  z,RequirementPreparer._ensure_link_req_src_dircCsX|js|jddS|jjr t|jr0t|jdurF|jsFt |jddpVt S)NT)trust_internetF) rrGr2rmrrnr original_link is_pinnedr r)r?r&r/r/r0_get_linked_req_hashesis  z*RequirementPreparer._get_linked_req_hashes)r2r*cCs|js dS|jrtddS|js*|js:td|dSt|j}t|j }t d||j |j ddd}zt|||jWStytd|YdS0dS) z-Fetch metadata using lazy wheel, if possible.Nz3Lazy wheel is not used as hash checking is requiredz>Lazy wheel is not used as %r does not points to a remote wheelz+Obtaining dependency information from %s %s#rz"%s does not support range requests)rrrUdebugrprqrrurnamerwversionr4splitrrr)r?r2wheelrr4r/r/r0 _fetch_metadata_using_lazy_wheels0      z4RequirementPreparer._fetch_metadata_using_lazy_wheelF)partially_downloaded_reqsrr*c Cstdddj}i}|D]}|js$J|||j<q|||}|D](\}\}} td||||}||_qD|D]}|||qrdS)z>Download any requirements which were only fetched by metadata.r7TrHzDownloading link %s to %sN) r#r;r2rkeysrUrlocal_file_path_prepare_linked_requirement) r?rrrMlinks_to_fully_downloadr&batch_downloadr2filepath_r/r/r0_complete_partial_requirementss  z2RequirementPreparer._complete_partial_requirementscCs|js J|j}||td}|jdurP|jrP||}t|j|j|}|durh||j|jj<n*| |}|durd|_ |WdS| ||WdS1s0YdS)z3Prepare a requirement to be obtained from req.link.NT) r2rrrFrqrrKrr4rneeds_more_preparationr)r?r&rr2rkrG wheel_distr/r/r0prepare_linked_requirements    z.RequirementPreparer.prepare_linked_requirement)reqsrr*cCsdd|D}|D]L}|jdur|jjr||}t|j|j|}|dur||j|jj<d|_qg}|D]"}|jr~||qh| ||qh|j ||ddS)z,Prepare linked requirements more, if needed.cSsg|]}|jr|qSr/)r).0r&r/r/r0 zHRequirementPreparer.prepare_linked_requirements_more..NF)r) rFr2rqrrKrr4rappendrr)r?rrr&rGrkrr/r/r0 prepare_linked_requirements_mores"  z4RequirementPreparer.prepare_linked_requirements_morec Cs|js J|j}|||||}|r:|jr:d}n|j|jvrzt||j|j |j |}Wqt y}zt d |||WYd}~qd}~00n&|j|j}|r||t|dd}|r|j|_t||j|j|j}|S)NzDCould not install requirement {} because of HTTP error {} for URL {})r<)r2rrrnrr4rrsrrrFr r rrLr:r;rr1r'r(r)) r?r&rr2rG local_fileexcrkdistr/r/r0rs<       z/RequirementPreparer._prepare_linked_requirementcCs|jdusJ|jdusJ|j}|js6|rF|jrF||jdS|r^td|dS|jdurldSt j |j|j }t j |st|j|t|}td|dS)NzENot copying link to destination directory since it is a directory: %szSaved %s)rFr2rmrneditablearchiverUrrr]r;rtrurvrScopyrrw)r?r&r2download_locationryr/r/r0save_linked_requirement*s&   z+RequirementPreparer.save_linked_requirementcCs|jsJdtd|tX|jr6td|||j| t ||j |j |j }||jWdn1s~0Y|S)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablez Obtaining %szoThe editable requirement {} cannot be installed when requiring hashes, because there is no single file to hash.N)rrUrwrrr rrr|update_editabler1r'r(r)check_if_existsr)r?r&rr/r/r0prepare_editable_requirementDs&  *z0RequirementPreparer.prepare_editable_requirement)r& skip_reasonr*cCs|jsJd|dus&Jd|jtd|||jjt,|jrRtdt| WdS1sr0YdS)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNzAdid not get skip reason skipped but req.satisfied_by is set to {}zRequirement %s: %s (%s)zSince it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.) satisfied_byrrUrwrrrrrr-)r?r&rr/r/r0prepare_installed_requirementbs  z1RequirementPreparer.prepare_installed_requirement)F)F)F)rArBrC__doc__rDrboolrrrr@rrrrrrrrrrrrrrrr __classcell__r/r/rr0rzsd2 %" " !   ( rz)NN)NN)NN)Mrloggingr=r]rStypingrrrrpip._vendor.packaging.utilsrpip._internal.distributionsr%pip._internal.distributions.installedrpip._internal.exceptionsr r r r r rr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.linkrpip._internal.models.wheelrpip._internal.network.downloadrr pip._internal.network.lazy_wheelrrpip._internal.network.sessionrZpip._internal.req.req_installrpip._internal.req.req_trackerrpip._internal.utils.filesystemrpip._internal.utils.hashesrrpip._internal.utils.loggingrpip._internal.utils.miscrr r!r"pip._internal.utils.temp_dirr#pip._internal.utils.unpackingr$pip._internal.vcsr% getLoggerrArUrr1rDr9r:rPrXrjrlrsrKrzr/r/r/r0s   $                  7  PK+]RHB.operations/__pycache__/__init__.cpython-39.pycnu[a Re@sdS)Nrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/__init__.pyPK+]~+operations/__pycache__/check.cpython-39.pycnu[a Re@sxdZddlZddlmZmZmZmZmZmZm Z ddl m Z ddl m Z mZddlmZddlmZddlmZdd lmZeeZGd d d eZee efZe e e fZe e ee fZee eefZee eefZe eefZ e ee fZ!e ee"fd d dZ#deeee$ge"fe dddZ%eee!dddZ&eeeee dddZ'ee eee dddZ(dS)z'Validation of dependencies of packages N)CallableDictList NamedTupleOptionalSetTuple) Requirement)NormalizedNamecanonicalize_name))make_distribution_for_install_requirement)get_default_environment)DistributionVersion)InstallRequirementc@s"eZdZUeed<eeed<dS)PackageDetailsversion dependenciesN)__name__ __module__ __qualname__r__annotations__rr rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/check.pyrs r)returnc Csi}d}t}|jdddD]f}|j}z t|}t|j|||<Wqttfy}zt d||d}WYd}~qd}~00q||fS)z3Converts a list of distributions into a PackageSet.Fr) local_onlyskipz%Error parsing requirements for %s: %sTN) r iter_installed_distributionscanonical_namelistiter_dependenciesrrOSError ValueErrorloggerwarning) package_setproblemsenvdistnamererrr!create_package_set_from_installed"s r*)r$ should_ignorerc Csi}i}|D]\}}t}t}|r2||r2q|jD]l}t|j} | |vrzd} |jdurf|j} | r8|| |fq8|| j} |j j | dds8|| | |fq8|rt |t d||<|rt |t d||<q||fS)zCheck if a package set is consistent If should_ignore is passed, it should be a callable that takes a package name and returns a boolean. TN) prereleases)key) itemssetrr r(markerevaluateaddr specifiercontainssortedstr) r$r+missing conflicting package_namepackage_detail missing_depsconflicting_depsreqr(missedrrrrcheck_package_set3s0       r?) to_installrcs6t\}}t||}t|||t|fdddfS)zeFor checking if the dependency graph would be consistent after installing given requirements cs|vSNr)r( whitelistrroz)check_install_conflicts..)r+)r*_simulate_installation_of_create_whitelistr?)r@r$_would_be_installedrrBrcheck_install_conflicts`s    rJ)r@r$rcCsLt}|D]<}t|}|}|j}t|jt|||<||q |S)z=Computes the version of packages after installing to_install.) r/r get_metadata_distributionrrrrrr2)r@r$ installedinst_req abstract_distr'r(rrrrFts rF)rIr$rcCsLt|}|D]:}||vrq ||jD] }t|j|vr$||q q$q |SrA)r/rr r(r2)rIr$packages_affectedr9r=rrrrGs rG)N))__doc__loggingtypingrrrrrrrZ"pip._vendor.packaging.requirementsr pip._vendor.packaging.utilsr r pip._internal.distributionsr pip._internal.metadatar Zpip._internal.metadata.baserZpip._internal.req.req_installr getLoggerrr"r PackageSetMissing Conflicting MissingDictConflictingDict CheckResultConflictDetailsboolr*r6r?rJrFrGrrrrs<$           - PK+]bo:operations/build/__pycache__/wheel_editable.cpython-39.pycnu[a Re}@s`ddlZddlZddlmZddlmZmZddlmZe e Z e ee e ee dddZ dS)N)Optional) HookMissingPep517HookCaller)runner_with_spinner_message)namebackendmetadata_directorytempdreturnc Cs|dus Jztd|td|d}||fz|j||d}WnBty}z*td||WYd}~WdWdSd}~00Wdn1s0YWn tytd|YdS0tj ||S)zBuild one InstallRequirement using the PEP 660 build process. Returns path to wheel if successfully built. Otherwise, returns None. NzDestination directory: %szBuilding editable for z (pyproject.toml))rzLCannot build editable %s because the build backend does not have the %s hookzFailed building editable for %s) loggerdebugrsubprocess_runnerbuild_editablererror Exceptionospathjoin)rrrr runner wheel_nameer/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/build/wheel_editable.pybuild_wheel_editable s.     H  r)loggingrtypingrZpip._vendor.pep517.wrappersrrpip._internal.utils.subprocessr getLogger__name__r strrrrrrs   PK+]Vt;operations/build/__pycache__/metadata_legacy.cpython-39.pycnu[a Re@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZeeZeed d d Zeeeeeed d dZdS)z;Metadata generation logic for legacy source distributions. N)BuildEnvironment) open_spinner)InstallationError)make_setuptools_egg_info_args)call_subprocess) TempDirectory) directoryreturncCsRddt|D}|s&td|t|dkr@td|tj||dS)z.Find an .egg-info subdirectory in `directory`.cSsg|]}|dr|qS)z .egg-info)endswith).0fr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_legacy.py z"_find_egg_info..z No .egg-info directory found in z-More than one .egg-info directory found in {}r)oslistdirrlenformatpathjoin)r filenamesr r r_find_egg_infos r) build_env setup_py_path source_dirisolateddetailsr c Cstd||tdddj}t|||d}|Htd }t||d|dWd n1s^0YWd n1s|0Yt|S) znGenerate metadata using setup.py-based defacto mechanisms. Returns the generated metadata directory. z2Running setup.py (path:%s) egg_info for package %sz pip-egg-infoT)kindglobally_managed) egg_info_dirno_user_configzPreparing metadata (setup.py)zpython setup.py egg_info)cwd command_descspinnerN)loggerdebugrrrrrr)rrrrrr!argsr%r r rgenerate_metadata s(  Br))__doc__loggingrpip._internal.build_envrpip._internal.cli.spinnersrpip._internal.exceptionsr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrpip._internal.utils.temp_dirr getLogger__name__r&strrboolr)r r r rs"       PK+]ϳ 8operations/build/__pycache__/wheel_legacy.cpython-39.pycnu[a Re @sddlZddlZddlmZmZddlmZddlm Z ddl m Z m Z m Z eeZeeeedddZeeeeeeeeed d d Zeeeeeeeeeed d dZdS)N)ListOptional) open_spinner) make_setuptools_bdist_wheel_args) LOG_DIVIDERcall_subprocessformat_command_args) command_argscommand_outputreturncCsbt|}d|d}|s"|d7}nReturn the path to the wheel in the temporary build directory.z1Legacy build of wheel for {!r} created no files. NzZLegacy build of wheel for {!r} created more than one file. Filenames (choosing first): {} r) sortedformatrr warninglenospathjoin)rrrr r msgrrrget_legacy_build_wheel_path$s     r#)r setup_py_path source_dirglobal_options build_optionstempdr c Cst||||d}d|d}t|}td|zt|||d} Wn6tyz|dtd|YWddS0t |} t | |||| d } | WdS1s0YdS) zBuild one unpacked package using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. )r&r'destination_dirzBuilding wheel for z (setup.py)zDestination directory: %s)cwdspinnererrorzFailed building wheel for %sN)rrrr r ) rrr debugr Exceptionfinishr,rlistdirr#) rr$r%r&r'r( wheel_args spin_messager+outputr wheel_pathrrrbuild_wheel_legacy?s8         r5)ros.pathrtypingrrpip._internal.cli.spinnersr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrrr getLogger__name__r strrr#r5rrrrs2     PK+]B:1operations/build/__pycache__/wheel.cpython-39.pycnu[a Re'@s\ddlZddlZddlmZddlmZddlmZee Z e ee e ee dddZ dS)N)Optional)Pep517HookCaller)runner_with_spinner_message)namebackendmetadata_directorytempdreturncCs|dus JzXtd|td|d}|||j||d}Wdn1sX0YWn tytd|YdS0tj ||S)zBuild one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. NzDestination directory: %szBuilding wheel for z (pyproject.toml))rzFailed building wheel for %s) loggerdebugrsubprocess_runner build_wheel Exceptionerrorospathjoin)rrrrrunner wheel_namer/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/build/wheel.pybuild_wheel_pep517 s    (  r) loggingrtypingrZpip._vendor.pep517.wrappersrpip._internal.utils.subprocessr getLogger__name__r strrrrrrs    PK+]R/=operations/build/__pycache__/metadata_editable.cpython-39.pycnu[a Re@sRdZddlZddlmZddlmZddlmZddlm Z eee ddd Z dS) z4Metadata generation logic for source distributions. N)Pep517HookCaller)BuildEnvironment)runner_with_spinner_message) TempDirectory) build_envbackendreturnc Cstddd}|j}|Ltd}||||}Wdn1sJ0YWdn1sh0Ytj||S)zlGenerate metadata using mechanisms described in PEP 660. Returns the generated metadata directory. zmodern-metadataT)kindglobally_managedz,Preparing editable metadata (pyproject.toml)N)rpathrsubprocess_runner#prepare_metadata_for_build_editableosjoin)rrmetadata_tmpdir metadata_dirrunner distinfo_dirr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_editable.pygenerate_editable_metadata s  Fr) __doc__rZpip._vendor.pep517.wrappersrpip._internal.build_envrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrstrrrrrrs    PK+]T4operations/build/__pycache__/__init__.cpython-39.pycnu[a Re@sdS)Nrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/build/__init__.pyPK+]d(4operations/build/__pycache__/metadata.cpython-39.pycnu[a Re_@sRdZddlZddlmZddlmZddlmZddlm Z eee ddd Z dS) z4Metadata generation logic for source distributions. N)Pep517HookCaller)BuildEnvironment)runner_with_spinner_message) TempDirectory) build_envbackendreturnc Cstddd}|j}|Ltd}||||}Wdn1sJ0YWdn1sh0Ytj||S)zlGenerate metadata using mechanisms described in PEP 517. Returns the generated metadata directory. zmodern-metadataT)kindglobally_managedz#Preparing metadata (pyproject.toml)N)rpathrsubprocess_runner prepare_metadata_for_build_wheelosjoin)rrmetadata_tmpdir metadata_dirrunner distinfo_dirr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/build/metadata.pygenerate_metadata s  Fr) __doc__rZpip._vendor.pep517.wrappersrpip._internal.build_envrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrstrrrrrrs     PK+]j%operations/build/metadata_editable.pynu["""Metadata generation logic for source distributions. """ import os from pip._vendor.pep517.wrappers import Pep517HookCaller from pip._internal.build_env import BuildEnvironment from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory def generate_editable_metadata( build_env: BuildEnvironment, backend: Pep517HookCaller ) -> str: """Generate metadata using mechanisms described in PEP 660. Returns the generated metadata directory. """ metadata_tmpdir = TempDirectory(kind="modern-metadata", globally_managed=True) metadata_dir = metadata_tmpdir.path with build_env: # Note that Pep517HookCaller implements a fallback for # prepare_metadata_for_build_wheel/editable, so we don't have to # consider the possibility that this hook doesn't exist. runner = runner_with_spinner_message( "Preparing editable metadata (pyproject.toml)" ) with backend.subprocess_runner(runner): distinfo_dir = backend.prepare_metadata_for_build_editable(metadata_dir) return os.path.join(metadata_dir, distinfo_dir) PK+]ȇe operations/build/wheel_legacy.pynu[import logging import os.path from typing import List, Optional from pip._internal.cli.spinners import open_spinner from pip._internal.utils.setuptools_build import make_setuptools_bdist_wheel_args from pip._internal.utils.subprocess import ( LOG_DIVIDER, call_subprocess, format_command_args, ) logger = logging.getLogger(__name__) def format_command_result( command_args: List[str], command_output: str, ) -> str: """Format command information for logging.""" command_desc = format_command_args(command_args) text = f"Command arguments: {command_desc}\n" if not command_output: text += "Command output: None" elif logger.getEffectiveLevel() > logging.DEBUG: text += "Command output: [use --verbose to show]" else: if not command_output.endswith("\n"): command_output += "\n" text += f"Command output:\n{command_output}{LOG_DIVIDER}" return text def get_legacy_build_wheel_path( names: List[str], temp_dir: str, name: str, command_args: List[str], command_output: str, ) -> Optional[str]: """Return the path to the wheel in the temporary build directory.""" # Sort for determinism. names = sorted(names) if not names: msg = ("Legacy build of wheel for {!r} created no files.\n").format(name) msg += format_command_result(command_args, command_output) logger.warning(msg) return None if len(names) > 1: msg = ( "Legacy build of wheel for {!r} created more than one file.\n" "Filenames (choosing first): {}\n" ).format(name, names) msg += format_command_result(command_args, command_output) logger.warning(msg) return os.path.join(temp_dir, names[0]) def build_wheel_legacy( name: str, setup_py_path: str, source_dir: str, global_options: List[str], build_options: List[str], tempd: str, ) -> Optional[str]: """Build one unpacked package using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. """ wheel_args = make_setuptools_bdist_wheel_args( setup_py_path, global_options=global_options, build_options=build_options, destination_dir=tempd, ) spin_message = f"Building wheel for {name} (setup.py)" with open_spinner(spin_message) as spinner: logger.debug("Destination directory: %s", tempd) try: output = call_subprocess( wheel_args, cwd=source_dir, spinner=spinner, ) except Exception: spinner.finish("error") logger.error("Failed building wheel for %s", name) return None names = os.listdir(tempd) wheel_path = get_legacy_build_wheel_path( names=names, temp_dir=tempd, name=name, command_args=wheel_args, command_output=output, ) return wheel_path PK+]}}"operations/build/wheel_editable.pynu[import logging import os from typing import Optional from pip._vendor.pep517.wrappers import HookMissing, Pep517HookCaller from pip._internal.utils.subprocess import runner_with_spinner_message logger = logging.getLogger(__name__) def build_wheel_editable( name: str, backend: Pep517HookCaller, metadata_directory: str, tempd: str, ) -> Optional[str]: """Build one InstallRequirement using the PEP 660 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert metadata_directory is not None try: logger.debug("Destination directory: %s", tempd) runner = runner_with_spinner_message( f"Building editable for {name} (pyproject.toml)" ) with backend.subprocess_runner(runner): try: wheel_name = backend.build_editable( tempd, metadata_directory=metadata_directory, ) except HookMissing as e: logger.error( "Cannot build editable %s because the build " "backend does not have the %s hook", name, e, ) return None except Exception: logger.error("Failed building editable for %s", name) return None return os.path.join(tempd, wheel_name) PK+]<F''operations/build/wheel.pynu[import logging import os from typing import Optional from pip._vendor.pep517.wrappers import Pep517HookCaller from pip._internal.utils.subprocess import runner_with_spinner_message logger = logging.getLogger(__name__) def build_wheel_pep517( name: str, backend: Pep517HookCaller, metadata_directory: str, tempd: str, ) -> Optional[str]: """Build one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert metadata_directory is not None try: logger.debug("Destination directory: %s", tempd) runner = runner_with_spinner_message( f"Building wheel for {name} (pyproject.toml)" ) with backend.subprocess_runner(runner): wheel_name = backend.build_wheel( tempd, metadata_directory=metadata_directory, ) except Exception: logger.error("Failed building wheel for %s", name) return None return os.path.join(tempd, wheel_name) PK+] #operations/build/metadata_legacy.pynu["""Metadata generation logic for legacy source distributions. """ import logging import os from pip._internal.build_env import BuildEnvironment from pip._internal.cli.spinners import open_spinner from pip._internal.exceptions import InstallationError from pip._internal.utils.setuptools_build import make_setuptools_egg_info_args from pip._internal.utils.subprocess import call_subprocess from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) def _find_egg_info(directory: str) -> str: """Find an .egg-info subdirectory in `directory`.""" filenames = [f for f in os.listdir(directory) if f.endswith(".egg-info")] if not filenames: raise InstallationError(f"No .egg-info directory found in {directory}") if len(filenames) > 1: raise InstallationError( "More than one .egg-info directory found in {}".format(directory) ) return os.path.join(directory, filenames[0]) def generate_metadata( build_env: BuildEnvironment, setup_py_path: str, source_dir: str, isolated: bool, details: str, ) -> str: """Generate metadata using setup.py-based defacto mechanisms. Returns the generated metadata directory. """ logger.debug( "Running setup.py (path:%s) egg_info for package %s", setup_py_path, details, ) egg_info_dir = TempDirectory(kind="pip-egg-info", globally_managed=True).path args = make_setuptools_egg_info_args( setup_py_path, egg_info_dir=egg_info_dir, no_user_config=isolated, ) with build_env: with open_spinner("Preparing metadata (setup.py)") as spinner: call_subprocess( args, cwd=source_dir, command_desc="python setup.py egg_info", spinner=spinner, ) # Return the .egg-info directory. return _find_egg_info(egg_info_dir) PK+]Y0__operations/build/metadata.pynu["""Metadata generation logic for source distributions. """ import os from pip._vendor.pep517.wrappers import Pep517HookCaller from pip._internal.build_env import BuildEnvironment from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory def generate_metadata(build_env: BuildEnvironment, backend: Pep517HookCaller) -> str: """Generate metadata using mechanisms described in PEP 517. Returns the generated metadata directory. """ metadata_tmpdir = TempDirectory(kind="modern-metadata", globally_managed=True) metadata_dir = metadata_tmpdir.path with build_env: # Note that Pep517HookCaller implements a fallback for # prepare_metadata_for_build_wheel, so we don't have to # consider the possibility that this hook doesn't exist. runner = runner_with_spinner_message("Preparing metadata (pyproject.toml)") with backend.subprocess_runner(runner): distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir) return os.path.join(metadata_dir, distinfo_dir) PK+]operations/build/__init__.pynu[PK+]5=operations/install/__pycache__/editable_legacy.cpython-39.pycnu[a Re @sdZddlZddlmZmZmZddlmZddlm Z ddl m Z ddl m Z eeZeeeeeeeeeeeeeedd d d ZdS) z?Legacy editable installation process, i.e. `setup.py develop`. N)ListOptionalSequence)BuildEnvironment) indent_log)make_setuptools_develop_args)call_subprocess) install_optionsglobal_optionsprefixhome use_user_sitename setup_py_pathisolated build_envunpacked_source_directoryreturnc Cs|td|t|||||||d} t@|t| | dWdn1sP0YWdn1sn0YdS)z[Install a package in editable mode. Most arguments are pass-through to setuptools. zRunning setup.py develop for %s)r r no_user_configr r r )cwdN)loggerinforrr) r r r r r rrrrrargsr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/install/editable_legacy.pyinstall_editables   r)__doc__loggingtypingrrrpip._internal.build_envrpip._internal.utils.loggingr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessr getLogger__name__rstrboolrrrrrs&     PK+]΄: 4operations/install/__pycache__/legacy.cpython-39.pycnu[a Re>@s dZddlZddlZddlmZddlmZmZmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZeeZGd ddeZeeeeeddddZeeeeeeeeeee e eee ee eee dddZ!dS)z6Legacy installation process, i.e. `setup.py install`. N) change_root)ListOptionalSequence)BuildEnvironment)InstallationError)Scheme) indent_log) ensure_dir)make_setuptools_install_args)runner_with_spinner_message) TempDirectoryc@s eZdZdS)LegacyInstallFailureN)__name__ __module__ __qualname__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/install/legacy.pyrsr) record_linesrootreq_descriptionreturnc sttdfdd }|D]&}tj|}|dr||}qRqd|}t|g}|D]<}|} tj| r~| tjj 7} | tj || |qZ| t |tj|d} t| d$} | d|dWdn1s0YdS) N)pathrcs&dustj|s|St|SdS)N)osrisabsr)rrrr prepend_rootszBwrite_installed_files_from_setuptools_record..prepend_rootz .egg-infoz{} did not indicate that it installed an .egg-info directory. Only setup.py projects generating .egg-info directories are supported.zinstalled-files.txtw )strrrdirnameendswithformatrstripisdirsepappendrelpathsortr joinopenwrite) rrrrline directory egg_info_dirmessage new_linesfilenameinst_files_pathfrrr,write_installed_files_from_setuptools_records,     r4)install_optionsglobal_optionsrhomeprefix use_user_site pycompilescheme setup_py_pathisolatedreq_name build_envunpacked_source_directoryrrcCsf|j}tdd2}ztj|jd}t|||||||||| |d }td| }t@| ||| dWdn1s0YWdn1s0Ytj|st d|WWddSWn*t y}zt |WYd}~n d}~00t |}|}Wdn1s,0YWdn1sL0Yt||| d S) Nrecord)kindzinstall-record.txt) r6r5record_filenamerr8 header_dirr7r9no_user_configr:zRunning setup.py install for )cmdcwdzRecord file %s not foundFT)headersr rrr)r r r existsloggerdebug Exceptionrr*read splitlinesr4)r5r6rr7r8r9r:r;r<r=r>r?r@rrDtemp_dirrC install_argsrunnerer3rrrrinstall>sDB   L rS)"__doc__loggingrdistutils.utilrtypingrrrpip._internal.build_envrpip._internal.exceptionsrpip._internal.models.schemerpip._internal.utils.loggingr pip._internal.utils.miscr $pip._internal.utils.setuptools_buildr pip._internal.utils.subprocessr pip._internal.utils.temp_dirr getLoggerrrJrLrrr4boolrSrrrrsF           &PK+] R R3operations/install/__pycache__/wheel.cpython-39.pycnu[a Rek @sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZddlmZmZmZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'm(Z(ddl)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0dd l1m2Z2dd l3m4Z4m5Z5m6Z6ddl7m8Z8m9Z9ddl:m;Z;mZ>m?Z?ddl@mAZAmBZBmCZCmDZDddlEmFZFmGZGmHZHmIZIddlJmKZKerddlmLZLGdddeLZMeNeOZPedeQZRe#eReQe$eSeQffZTdPeQeSe#eQeQfdddZUeQeeQefdddZVeQeWdd d!ZXeeWd"d#d$ZYe4e#eeQeQfeeQeQffd%d&d'ZZe!eQe eQd(d)d*Z[eeTee#eQeQeQfd+d,d-Z\eReQd.d/d0Z]dQeQe eQeRd1d2d3Z^eeeQeeReRfe"eReeQeQeeTd4d5d6Z_eeQeQfeeQd7d8d9Z`Gd:d;d;ZaGdd?d?e0ZceQdd@dAdBZdGdCdDdDe*ZedReQe'eQeWddStjt }d|tj d}| }Wdn1s~0Yt|d$}| || |Wdn1s0YdS) zQReplace #!python with #!/path/to/python Return True if file was changed. rbs#!pythonNFs#!asciiwbT) osrEisfileopenreadline startswithsys executableencodegetfilesystemencodinglinesepreadwrite)rEscript firstlineexenamerestr9r9r< fix_script]s  &  (ri)metadatar7cCs|dddkS)NzRoot-Is-PurelibrPtrue)getlower)rjr9r9r<wheel_root_is_purelibqsrn)distr7cCsLi}i}|D]2}|jdkr,|j||j<q|jdkr|j||j<q||fS)Nconsole_scripts gui_scripts)iter_entry_pointsgroupvaluename)rorprq entry_pointr9r9r<get_entrypointsus   rw)scriptsr7c s|sdStt}|D]*}tj|}tj|}|||qddtj dd tj D tj tjtjfdd|D}|sdSg}|D]b\}}t|}t|dkrd |d } n$d d |dd d|d } | d| |qd} t|dkr0| | dn| | dtddtj dd tj D} | rxd} | | d|S)zDetermine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. NcSs g|]}tj|tjqSr9)rYrEnormcaserKsep.0ir9r9r< sz5message_about_scripts_not_on_PATH..PATHrPcs&i|]\}}tj|vr||qSr9)rYrEry)r| parent_dirrx not_warn_dirsr9r< sz5message_about_scripts_not_on_PATH..z script {} isrzscripts {} are, z and z.The {} installed in '{}' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriescss|]}|r|ddkVqdS)r~Nr9r{r9r9r< sz4message_about_scripts_not_on_PATH..ziNOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications. ) collections defaultdictsetrYrEdirnamebasenameaddenvironrlsplitpathsepappendryr^r_itemssortedlenformatjoinany) rxgrouped_by_dirdestfiler script_namewarn_for msg_lines dir_scriptssorted_scripts start_text last_line_fmtwarn_for_tildetilde_warning_msgr9rr<!message_about_scripts_not_on_PATHsT      r)outrowsr7cCstdd|DS)aNormalize the given rows of a RECORD file. Items in each row are converted into str. Rows are then sorted to make the value more predictable for tests. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. css"|]\}}}||t|fVqdSr8)rB)r| record_pathhash_sizer9r9r<rsz&_normalized_outrows..)r)rr9r9r<_normalized_outrowssrrr7cCs|Sr8r9)rr9r9r<_record_to_fs_pathsr)rE relative_tor7cCsX|dur>tj|dtj|dkr>tj||}|tjjd}td|S)Nr/r2)rYrE splitdrivermrelpathr&rzr)rErr9r9r<_fs_to_record_pathsr) old_csv_rows installedr5 generatedlib_dirr7cCsg}|D]}t|dkr$td|td|d}|||}||vrXtt|\} } n0t|dkrl|dnd} t|dkr|dnd} ||| | fq|D]*} t| |} t| \} } || | | fq| D]} || ddfq|S)z_ :param installed: A map from archive RECORD path to installation RECORD path. z,RECORD line has more than three elements: %sr2rrrP) rloggerwarningrpoprNrrrvalues)rrr5rrinstalled_rowsrowold_record_pathnew_record_pathrIrMfrEinstalled_record_pathr9r9r<get_csv_rows_for_installeds$       r)consoler7cCs|}g}|dd}|rdtjvr4|d|tjdddkr^|dtjd||dt d |d d |D}|D] }||=q|d d}|rdtjvr|d ||dt |dd |D}|D] }||=q| t dj| |S)zk Given the mapping from entrypoint name to callable, return the relevant console script specs. pipNENSUREPIP_OPTIONSzpip = rP altinstallz pip{} = {}rz = cSsg|]}td|r|qS)zpip(\d(\.\d)?)?$rematchr|kr9r9r<r~Jz,get_console_script_specs.. easy_installzeasy_install = zeasy_install-{} = {}cSsg|]}td|r|qS)zeasy_install(-\d\.\d)?$rrr9r9r<r~Xs{} = {}) copyrrYrrrlrr^ version_inforextendrr)rscripts_to_generate pip_scriptpip_epreasy_install_scripteasy_install_epr9r9r<get_console_script_specss<#    rc@s<eZdZeeeddddZedddZdddd Z dS) ZipBackedFileN)r3r4zip_filer7cCs||_||_||_d|_dSNF)r3r4 _zip_filer5)r;r3r4rr9r9r<__init__eszZipBackedFile.__init__r6cCs|j|jSr8)rgetinfor3r:r9r9r<_getinfomszZipBackedFile._getinfoc Cstj|j}t|tj|jr0t|j|}|j |H}t |jd}t ||Wdn1st0YWdn1s0Yt |rt |jdS)NrX)rYrErr4r(existsunlinkrrr[shutil copyfileobjr.r-)r;rzipinfordestr9r9r<r=ps  HzZipBackedFile.save) r>r?r@r2rBrrrrr=r9r9r9r<rds  rc@s*eZdZdddddZddddZdS) ScriptFiler1Nfiler7cCs$||_|jj|_|jj|_d|_dSr)_filer3r4r5)r;rr9r9r<rs  zScriptFile.__init__r6cCs|jt|j|_dSr8)rr=rir4r5r:r9r9r<r=s zScriptFile.save)r>r?r@rr=r9r9r9r<rsrcs$eZdZeddfdd ZZS)MissingCallableSuffixN)rvr7cstd|dS)NzInvalid script entry point: {} - A callable suffix is required. Cf https://packaging.python.org/specifications/entry-points/#use-for-scripts for more information.)superrr)r;rv __class__r9r<rs zMissingCallableSuffix.__init__)r>r?r@rBr __classcell__r9r9rr<rsr) specificationr7cCs*t|}|dur&|jdur&tt|dSr8)rsuffixrrB)rentryr9r9r<_raise_for_invalid_entrypointsrcs4eZdZdeeeefeedfdd ZZS)PipScriptMakerN)roptionsr7cst|t||Sr8)rrmake)r;rrrr9r<rszPipScriptMaker.make)N) r>r?r@rBr r rrrr9r9rr<rsrTF) ru wheel_zip wheel_pathscheme pycompilewarn_script_location direct_url requestedr7c8 st||\}} t| r|jn|jitg} d4tttddfdd } ttddd} ttdd fd d ttt tgd fd fdd } tt t tgd fdfdd }ttddd}t t t| }t| |}t||\}}| |}t||}ttddd}t||\}}|||}t||}t||}ttt|}t|\d tdfdd }t||}t||}tt|}t||}|D] }|| |j|j|jqttdfdd }ttddd} |rt}!txtd|D]V}"t j!|"d d d!}#|#r| |"}$t"j#$|$sHJt d"|$%t"j#j&d#}%| |%|$qWdn1s0YWdn1s0Yt'(|!)t*d|j+}&d |&_,d$h|&_-d |&_.t/}'t0t1d%j23}(|&4|'})| 5|)| 5|&4|(d&d i|rBt6|)}*|*durBt'7|*d't8@t9j:tt;tt<d(fd)d* }+t"j#=|},t"j#=|,d+}-|+|-}.|.>d,Wdn1s0Y| ?|-|dur(t"j#=|,t@}/|+|/$}0|0>|ABd-Wdn1s0Y| ?|/|rrt"j#=|,d.}1tC|1d/Wdn1s^0Y| ?|1|Dd0}2t0tEF|2G}3tH|3| d1}4t"j#=|,d0}5|+|5fitId2.}6tEJt d3|6}7|7KtL|4Wdn1s0YdS)5aInstall a wheel. :param name: Name of the project to install :param wheel_zip: open ZipFile for wheel being installed :param scheme: Distutils scheme dictating the install directories :param req_description: String used in place of the requirement, for logging :param pycompile: Whether to byte-compile installed Python files :param warn_script_location: Whether to check that scripts are installed into a directory on PATH :raises UnsupportedWheel: * when the directory holds an unpacked wheel with incompatible Wheel-Version * when the .dist-info dir does not match the wheel FN)srcfilermodifiedr7cs(t|}||<|r$t|dS)z6Map archive RECORD paths to installation RECORD paths.N)rr)rrrnewpath)r5rrr9r<record_installeds z(_install_wheel..record_installedrUcSs |dS)Nr)endswithrEr9r9r< is_dir_pathsz#_install_wheel..is_dir_path) dest_dir_path target_pathr7cs$t||s d}t|||dS)NzRThe wheel {!r} has a file {!r} trying to install outside the target directory {!r})r,rr)rrmessage)rr9r<assert_no_path_traversals   z0_install_wheel..assert_no_path_traversalr1)rrr7cstddfdd }|S)Nr1rcs0tj|}tj|}|t||Sr8)rYrEnormpathrr)r normed_pathr4)rrrr9r<make_root_scheme_files  zM_install_wheel..root_scheme_file_maker..make_root_scheme_file)r2)rrr )r)rrr<root_scheme_file_makersz._install_wheel..root_scheme_file_maker)rrr7cs0fddtDtddfdd }|S)Ncsi|]}|t|qSr9)getattr)r|key)rr9r<rrzB_install_wheel..data_scheme_file_maker..r1rc stj|}z|tjjd\}}}Wn&tyLd|}t|Yn0z |}Wn8tyd t }d|||}t|Yn0tj ||}||t ||S)NrzbUnexpected file in {}: {!r}. .data directory contents should be named like: '/'.rzUnknown scheme key used in {}: {} (for file {!r}). .data directory contents should be in subdirectories named with a valid scheme key ({})) rYrErrrz ValueErrorrrKeyErrorrrr) rr_ scheme_key dest_subpathr scheme_pathvalid_scheme_keysr4)r scheme_pathsrrr9r<make_data_scheme_files*     zM_install_wheel..data_scheme_file_maker..make_data_scheme_file)r#r2)rrr)rr)rrrr<data_scheme_file_makersz._install_wheel..data_scheme_file_makercSs|ddddS)Nrrr.data)rrrr9r9r<is_data_scheme_pathsz+_install_wheel..is_data_scheme_pathcSs2|dd}t|dko0|ddo0|ddkS)Nrrrrrrx)rrr)rEpartsr9r9r<is_script_scheme_path"s z-_install_wheel..is_script_scheme_pathrcsz|j}tj|}|dr.|dd}n<|drJ|dd}n |drf|dd}n|}|vpx|vS)Nz.exez -script.pyiz.pya)r4rYrErrmr)rrEru matchname)rguir9r<is_entrypoint_wrapper5s z-_install_wheel..is_entrypoint_wrapperr6c3sHttD]2}tj|}tj|s0q|ds.pyc_source_file_pathscSs tj|S)z8Return the path the pyc file would have been written to.) importlibutilcache_from_sourcerr9r9r<pyc_output_path]sz'_install_wheel..pyc_output_pathignoreT)forcequietr2rrPrri)rEkwargsr7c;sTt|fi|}|VWdn1s,0Yt|jt|j|dSr8)r%rYchmodrur&)rEr)r)generated_file_moder9r<_generate_files$z&_install_wheel.._generate_file INSTALLERspip rQ REQUESTEDrXRECORD)rr5rrwzIO[str])F)Mr/rnpurelibplatlibrr2rBrCrr r$rrnamelistrr*maprr rrrwrr=r3r4r5rr'warningscatch_warningsfilterwarnings compileall compile_filerYrErr&rzrdebuggetvaluerrxclobbervariantsset_moderlistrrr make_multiplerrrr+ contextlibcontextmanagerr r rrdrr!to_jsonr`r[ read_textcsvreader splitlinesrrTwriter writerowsr)8rurrrrrrrinfo_dirrjrrrr rrpaths file_pathsroot_scheme_pathsdata_scheme_pathsr filesrother_scheme_pathsscript_scheme_pathsrother_scheme_files distributionrscript_scheme_filesrr!r%stdoutrEsuccesspyc_pathpyc_record_pathmakerrgui_scripts_to_generategenerated_console_scriptsmsgr, dest_info_dirinstaller_pathinstaller_filedirect_url_pathdirect_url_filerequested_path record_text record_rowsrowsr record_filerHr9)rr5rr+rrrrr<_install_wheels     !              N       *   4      rg)req_descriptionr7c csPz dVWn@tyJ}z(d||jd}t||WYd}~n d}~00dS)NzFor req: {}. {}r)rrargs)rherr9r9r<req_error_contexts  rk) rurrrhrrrrr7c Cspt|ddP}t|(t||||||||dWdn1sD0YWdn1sb0YdS)NT) allowZip64)rurrrrrrr)rrkrg) rurrrhrrrrzr9r9r< install_wheels  rn)rD)N)TTNF)TTNF)j__doc__rr8rArEr"loggingos.pathrYrrr^r5base64r email.messager itertoolsrrrtypingrrr r r r r rrrrrrrrrzipfilerrpip._vendor.distlib.scriptsrZpip._vendor.distlib.utilrpip._vendor.packaging.utilsrpip._internal.exceptionsrpip._internal.locationsrpip._internal.metadatarrr pip._internal.models.direct_urlr!r"pip._internal.models.schemer#r$pip._internal.utils.filesystemr%r&pip._internal.utils.miscr'r(r)r*pip._internal.utils.unpackingr+r,r-r.pip._internal.utils.wheelr/r0r1 getLoggerr>rrBr2intInstalledCSVRowrNrTrCrirnrwrrrrrrrrrrrrgrBrkrnr9r9r9r<s  H         ( I    Q(     PK+](`++6operations/install/__pycache__/__init__.cpython-39.pycnu[a Re3@sdZdS)z,For modules related to installing packages. N)__doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/operations/install/__init__.pyPK+] >>operations/install/legacy.pynu["""Legacy installation process, i.e. `setup.py install`. """ import logging import os from distutils.util import change_root from typing import List, Optional, Sequence from pip._internal.build_env import BuildEnvironment from pip._internal.exceptions import InstallationError from pip._internal.models.scheme import Scheme from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ensure_dir from pip._internal.utils.setuptools_build import make_setuptools_install_args from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) class LegacyInstallFailure(Exception): pass def write_installed_files_from_setuptools_record( record_lines: List[str], root: Optional[str], req_description: str, ) -> None: def prepend_root(path: str) -> str: if root is None or not os.path.isabs(path): return path else: return change_root(root, path) for line in record_lines: directory = os.path.dirname(line) if directory.endswith(".egg-info"): egg_info_dir = prepend_root(directory) break else: message = ( "{} did not indicate that it installed an " ".egg-info directory. Only setup.py projects " "generating .egg-info directories are supported." ).format(req_description) raise InstallationError(message) new_lines = [] for line in record_lines: filename = line.strip() if os.path.isdir(filename): filename += os.path.sep new_lines.append(os.path.relpath(prepend_root(filename), egg_info_dir)) new_lines.sort() ensure_dir(egg_info_dir) inst_files_path = os.path.join(egg_info_dir, "installed-files.txt") with open(inst_files_path, "w") as f: f.write("\n".join(new_lines) + "\n") def install( install_options: List[str], global_options: Sequence[str], root: Optional[str], home: Optional[str], prefix: Optional[str], use_user_site: bool, pycompile: bool, scheme: Scheme, setup_py_path: str, isolated: bool, req_name: str, build_env: BuildEnvironment, unpacked_source_directory: str, req_description: str, ) -> bool: header_dir = scheme.headers with TempDirectory(kind="record") as temp_dir: try: record_filename = os.path.join(temp_dir.path, "install-record.txt") install_args = make_setuptools_install_args( setup_py_path, global_options=global_options, install_options=install_options, record_filename=record_filename, root=root, prefix=prefix, header_dir=header_dir, home=home, use_user_site=use_user_site, no_user_config=isolated, pycompile=pycompile, ) runner = runner_with_spinner_message( f"Running setup.py install for {req_name}" ) with indent_log(), build_env: runner( cmd=install_args, cwd=unpacked_source_directory, ) if not os.path.exists(record_filename): logger.debug("Record file %s not found", record_filename) # Signal to the caller that we didn't install the new package return False except Exception as e: # Signal to the caller that we didn't install the new package raise LegacyInstallFailure from e # At this point, we have successfully installed the requirement. # We intentionally do not use any encoding to read the file because # setuptools writes the file using distutils.file_util.write_file, # which does not specify an encoding. with open(record_filename) as f: record_lines = f.read().splitlines() write_installed_files_from_setuptools_record(record_lines, root, req_description) return True PK+]Z%operations/install/editable_legacy.pynu["""Legacy editable installation process, i.e. `setup.py develop`. """ import logging from typing import List, Optional, Sequence from pip._internal.build_env import BuildEnvironment from pip._internal.utils.logging import indent_log from pip._internal.utils.setuptools_build import make_setuptools_develop_args from pip._internal.utils.subprocess import call_subprocess logger = logging.getLogger(__name__) def install_editable( install_options: List[str], global_options: Sequence[str], prefix: Optional[str], home: Optional[str], use_user_site: bool, name: str, setup_py_path: str, isolated: bool, build_env: BuildEnvironment, unpacked_source_directory: str, ) -> None: """Install a package in editable mode. Most arguments are pass-through to setuptools. """ logger.info("Running setup.py develop for %s", name) args = make_setuptools_develop_args( setup_py_path, global_options=global_options, install_options=install_options, no_user_config=isolated, prefix=prefix, home=home, use_user_site=use_user_site, ) with indent_log(): with build_env: call_subprocess( args, cwd=unpacked_source_directory, ) PK+]X*kkoperations/install/wheel.pynu["""Support for installing and building the "wheel" binary package format. """ import collections import compileall import contextlib import csv import importlib import logging import os.path import re import shutil import sys import warnings from base64 import urlsafe_b64encode from email.message import Message from itertools import chain, filterfalse, starmap from typing import ( IO, TYPE_CHECKING, Any, BinaryIO, Callable, Dict, Iterable, Iterator, List, NewType, Optional, Sequence, Set, Tuple, Union, cast, ) from zipfile import ZipFile, ZipInfo from pip._vendor.distlib.scripts import ScriptMaker from pip._vendor.distlib.util import get_export_entry from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import InstallationError from pip._internal.locations import get_major_minor_version from pip._internal.metadata import ( BaseDistribution, FilesystemWheel, get_wheel_distribution, ) from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.filesystem import adjacent_tmp_file, replace from pip._internal.utils.misc import captured_stdout, ensure_dir, hash_file, partition from pip._internal.utils.unpacking import ( current_umask, is_within_directory, set_extracted_file_to_default_mode_plus_executable, zip_item_is_executable, ) from pip._internal.utils.wheel import parse_wheel if TYPE_CHECKING: from typing import Protocol class File(Protocol): src_record_path: "RecordPath" dest_path: str changed: bool def save(self) -> None: pass logger = logging.getLogger(__name__) RecordPath = NewType("RecordPath", str) InstalledCSVRow = Tuple[RecordPath, str, Union[int, str]] def rehash(path: str, blocksize: int = 1 << 20) -> Tuple[str, str]: """Return (encoded_digest, length) for path using hashlib.sha256()""" h, length = hash_file(path, blocksize) digest = "sha256=" + urlsafe_b64encode(h.digest()).decode("latin1").rstrip("=") return (digest, str(length)) def csv_io_kwargs(mode: str) -> Dict[str, Any]: """Return keyword arguments to properly open a CSV file in the given mode. """ return {"mode": mode, "newline": "", "encoding": "utf-8"} def fix_script(path: str) -> bool: """Replace #!python with #!/path/to/python Return True if file was changed. """ # XXX RECORD hashes will need to be updated assert os.path.isfile(path) with open(path, "rb") as script: firstline = script.readline() if not firstline.startswith(b"#!python"): return False exename = sys.executable.encode(sys.getfilesystemencoding()) firstline = b"#!" + exename + os.linesep.encode("ascii") rest = script.read() with open(path, "wb") as script: script.write(firstline) script.write(rest) return True def wheel_root_is_purelib(metadata: Message) -> bool: return metadata.get("Root-Is-Purelib", "").lower() == "true" def get_entrypoints(dist: BaseDistribution) -> Tuple[Dict[str, str], Dict[str, str]]: console_scripts = {} gui_scripts = {} for entry_point in dist.iter_entry_points(): if entry_point.group == "console_scripts": console_scripts[entry_point.name] = entry_point.value elif entry_point.group == "gui_scripts": gui_scripts[entry_point.name] = entry_point.value return console_scripts, gui_scripts def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> Optional[str]: """Determine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. """ if not scripts: return None # Group scripts by the path they were installed in grouped_by_dir: Dict[str, Set[str]] = collections.defaultdict(set) for destfile in scripts: parent_dir = os.path.dirname(destfile) script_name = os.path.basename(destfile) grouped_by_dir[parent_dir].add(script_name) # We don't want to warn for directories that are on PATH. not_warn_dirs = [ os.path.normcase(i).rstrip(os.sep) for i in os.environ.get("PATH", "").split(os.pathsep) ] # If an executable sits with sys.executable, we don't warn for it. # This covers the case of venv invocations without activating the venv. not_warn_dirs.append(os.path.normcase(os.path.dirname(sys.executable))) warn_for: Dict[str, Set[str]] = { parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items() if os.path.normcase(parent_dir) not in not_warn_dirs } if not warn_for: return None # Format a message msg_lines = [] for parent_dir, dir_scripts in warn_for.items(): sorted_scripts: List[str] = sorted(dir_scripts) if len(sorted_scripts) == 1: start_text = "script {} is".format(sorted_scripts[0]) else: start_text = "scripts {} are".format( ", ".join(sorted_scripts[:-1]) + " and " + sorted_scripts[-1] ) msg_lines.append( "The {} installed in '{}' which is not on PATH.".format( start_text, parent_dir ) ) last_line_fmt = ( "Consider adding {} to PATH or, if you prefer " "to suppress this warning, use --no-warn-script-location." ) if len(msg_lines) == 1: msg_lines.append(last_line_fmt.format("this directory")) else: msg_lines.append(last_line_fmt.format("these directories")) # Add a note if any directory starts with ~ warn_for_tilde = any( i[0] == "~" for i in os.environ.get("PATH", "").split(os.pathsep) if i ) if warn_for_tilde: tilde_warning_msg = ( "NOTE: The current PATH contains path(s) starting with `~`, " "which may not be expanded by all applications." ) msg_lines.append(tilde_warning_msg) # Returns the formatted multiline message return "\n".join(msg_lines) def _normalized_outrows( outrows: Iterable[InstalledCSVRow], ) -> List[Tuple[str, str, str]]: """Normalize the given rows of a RECORD file. Items in each row are converted into str. Rows are then sorted to make the value more predictable for tests. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. """ # Normally, there should only be one row per path, in which case the # second and third elements don't come into play when sorting. # However, in cases in the wild where a path might happen to occur twice, # we don't want the sort operation to trigger an error (but still want # determinism). Since the third element can be an int or string, we # coerce each element to a string to avoid a TypeError in this case. # For additional background, see-- # https://github.com/pypa/pip/issues/5868 return sorted( (record_path, hash_, str(size)) for record_path, hash_, size in outrows ) def _record_to_fs_path(record_path: RecordPath) -> str: return record_path def _fs_to_record_path(path: str, relative_to: Optional[str] = None) -> RecordPath: if relative_to is not None: # On Windows, do not handle relative paths if they belong to different # logical disks if ( os.path.splitdrive(path)[0].lower() == os.path.splitdrive(relative_to)[0].lower() ): path = os.path.relpath(path, relative_to) path = path.replace(os.path.sep, "/") return cast("RecordPath", path) def get_csv_rows_for_installed( old_csv_rows: List[List[str]], installed: Dict[RecordPath, RecordPath], changed: Set[RecordPath], generated: List[str], lib_dir: str, ) -> List[InstalledCSVRow]: """ :param installed: A map from archive RECORD path to installation RECORD path. """ installed_rows: List[InstalledCSVRow] = [] for row in old_csv_rows: if len(row) > 3: logger.warning("RECORD line has more than three elements: %s", row) old_record_path = cast("RecordPath", row[0]) new_record_path = installed.pop(old_record_path, old_record_path) if new_record_path in changed: digest, length = rehash(_record_to_fs_path(new_record_path)) else: digest = row[1] if len(row) > 1 else "" length = row[2] if len(row) > 2 else "" installed_rows.append((new_record_path, digest, length)) for f in generated: path = _fs_to_record_path(f, lib_dir) digest, length = rehash(f) installed_rows.append((path, digest, length)) for installed_record_path in installed.values(): installed_rows.append((installed_record_path, "", "")) return installed_rows def get_console_script_specs(console: Dict[str, str]) -> List[str]: """ Given the mapping from entrypoint name to callable, return the relevant console script specs. """ # Don't mutate caller's version console = console.copy() scripts_to_generate = [] # Special case pip and setuptools to generate versioned wrappers # # The issue is that some projects (specifically, pip and setuptools) use # code in setup.py to create "versioned" entry points - pip2.7 on Python # 2.7, pip3.3 on Python 3.3, etc. But these entry points are baked into # the wheel metadata at build time, and so if the wheel is installed with # a *different* version of Python the entry points will be wrong. The # correct fix for this is to enhance the metadata to be able to describe # such versioned entry points, but that won't happen till Metadata 2.0 is # available. # In the meantime, projects using versioned entry points will either have # incorrect versioned entry points, or they will not be able to distribute # "universal" wheels (i.e., they will need a wheel per Python version). # # Because setuptools and pip are bundled with _ensurepip and virtualenv, # we need to use universal wheels. So, as a stopgap until Metadata 2.0, we # override the versioned entry points in the wheel and generate the # correct ones. This code is purely a short-term measure until Metadata 2.0 # is available. # # To add the level of hack in this section of code, in order to support # ensurepip this code will look for an ``ENSUREPIP_OPTIONS`` environment # variable which will control which version scripts get installed. # # ENSUREPIP_OPTIONS=altinstall # - Only pipX.Y and easy_install-X.Y will be generated and installed # ENSUREPIP_OPTIONS=install # - pipX.Y, pipX, easy_install-X.Y will be generated and installed. Note # that this option is technically if ENSUREPIP_OPTIONS is set and is # not altinstall # DEFAULT # - The default behavior is to install pip, pipX, pipX.Y, easy_install # and easy_install-X.Y. pip_script = console.pop("pip", None) if pip_script: if "ENSUREPIP_OPTIONS" not in os.environ: scripts_to_generate.append("pip = " + pip_script) if os.environ.get("ENSUREPIP_OPTIONS", "") != "altinstall": scripts_to_generate.append( "pip{} = {}".format(sys.version_info[0], pip_script) ) scripts_to_generate.append(f"pip{get_major_minor_version()} = {pip_script}") # Delete any other versioned pip entry points pip_ep = [k for k in console if re.match(r"pip(\d(\.\d)?)?$", k)] for k in pip_ep: del console[k] easy_install_script = console.pop("easy_install", None) if easy_install_script: if "ENSUREPIP_OPTIONS" not in os.environ: scripts_to_generate.append("easy_install = " + easy_install_script) scripts_to_generate.append( "easy_install-{} = {}".format( get_major_minor_version(), easy_install_script ) ) # Delete any other versioned easy_install entry points easy_install_ep = [ k for k in console if re.match(r"easy_install(-\d\.\d)?$", k) ] for k in easy_install_ep: del console[k] # Generate the console entry points specified in the wheel scripts_to_generate.extend(starmap("{} = {}".format, console.items())) return scripts_to_generate class ZipBackedFile: def __init__( self, src_record_path: RecordPath, dest_path: str, zip_file: ZipFile ) -> None: self.src_record_path = src_record_path self.dest_path = dest_path self._zip_file = zip_file self.changed = False def _getinfo(self) -> ZipInfo: return self._zip_file.getinfo(self.src_record_path) def save(self) -> None: # directory creation is lazy and after file filtering # to ensure we don't install empty dirs; empty dirs can't be # uninstalled. parent_dir = os.path.dirname(self.dest_path) ensure_dir(parent_dir) # When we open the output file below, any existing file is truncated # before we start writing the new contents. This is fine in most # cases, but can cause a segfault if pip has loaded a shared # object (e.g. from pyopenssl through its vendored urllib3) # Since the shared object is mmap'd an attempt to call a # symbol in it will then cause a segfault. Unlinking the file # allows writing of new contents while allowing the process to # continue to use the old copy. if os.path.exists(self.dest_path): os.unlink(self.dest_path) zipinfo = self._getinfo() with self._zip_file.open(zipinfo) as f: with open(self.dest_path, "wb") as dest: shutil.copyfileobj(f, dest) if zip_item_is_executable(zipinfo): set_extracted_file_to_default_mode_plus_executable(self.dest_path) class ScriptFile: def __init__(self, file: "File") -> None: self._file = file self.src_record_path = self._file.src_record_path self.dest_path = self._file.dest_path self.changed = False def save(self) -> None: self._file.save() self.changed = fix_script(self.dest_path) class MissingCallableSuffix(InstallationError): def __init__(self, entry_point: str) -> None: super().__init__( "Invalid script entry point: {} - A callable " "suffix is required. Cf https://packaging.python.org/" "specifications/entry-points/#use-for-scripts for more " "information.".format(entry_point) ) def _raise_for_invalid_entrypoint(specification: str) -> None: entry = get_export_entry(specification) if entry is not None and entry.suffix is None: raise MissingCallableSuffix(str(entry)) class PipScriptMaker(ScriptMaker): def make(self, specification: str, options: Dict[str, Any] = None) -> List[str]: _raise_for_invalid_entrypoint(specification) return super().make(specification, options) def _install_wheel( name: str, wheel_zip: ZipFile, wheel_path: str, scheme: Scheme, pycompile: bool = True, warn_script_location: bool = True, direct_url: Optional[DirectUrl] = None, requested: bool = False, ) -> None: """Install a wheel. :param name: Name of the project to install :param wheel_zip: open ZipFile for wheel being installed :param scheme: Distutils scheme dictating the install directories :param req_description: String used in place of the requirement, for logging :param pycompile: Whether to byte-compile installed Python files :param warn_script_location: Whether to check that scripts are installed into a directory on PATH :raises UnsupportedWheel: * when the directory holds an unpacked wheel with incompatible Wheel-Version * when the .dist-info dir does not match the wheel """ info_dir, metadata = parse_wheel(wheel_zip, name) if wheel_root_is_purelib(metadata): lib_dir = scheme.purelib else: lib_dir = scheme.platlib # Record details of the files moved # installed = files copied from the wheel to the destination # changed = files changed while installing (scripts #! line typically) # generated = files newly generated during the install (script wrappers) installed: Dict[RecordPath, RecordPath] = {} changed: Set[RecordPath] = set() generated: List[str] = [] def record_installed( srcfile: RecordPath, destfile: str, modified: bool = False ) -> None: """Map archive RECORD paths to installation RECORD paths.""" newpath = _fs_to_record_path(destfile, lib_dir) installed[srcfile] = newpath if modified: changed.add(_fs_to_record_path(destfile)) def is_dir_path(path: RecordPath) -> bool: return path.endswith("/") def assert_no_path_traversal(dest_dir_path: str, target_path: str) -> None: if not is_within_directory(dest_dir_path, target_path): message = ( "The wheel {!r} has a file {!r} trying to install" " outside the target directory {!r}" ) raise InstallationError( message.format(wheel_path, target_path, dest_dir_path) ) def root_scheme_file_maker( zip_file: ZipFile, dest: str ) -> Callable[[RecordPath], "File"]: def make_root_scheme_file(record_path: RecordPath) -> "File": normed_path = os.path.normpath(record_path) dest_path = os.path.join(dest, normed_path) assert_no_path_traversal(dest, dest_path) return ZipBackedFile(record_path, dest_path, zip_file) return make_root_scheme_file def data_scheme_file_maker( zip_file: ZipFile, scheme: Scheme ) -> Callable[[RecordPath], "File"]: scheme_paths = {key: getattr(scheme, key) for key in SCHEME_KEYS} def make_data_scheme_file(record_path: RecordPath) -> "File": normed_path = os.path.normpath(record_path) try: _, scheme_key, dest_subpath = normed_path.split(os.path.sep, 2) except ValueError: message = ( "Unexpected file in {}: {!r}. .data directory contents" " should be named like: '/'." ).format(wheel_path, record_path) raise InstallationError(message) try: scheme_path = scheme_paths[scheme_key] except KeyError: valid_scheme_keys = ", ".join(sorted(scheme_paths)) message = ( "Unknown scheme key used in {}: {} (for file {!r}). .data" " directory contents should be in subdirectories named" " with a valid scheme key ({})" ).format(wheel_path, scheme_key, record_path, valid_scheme_keys) raise InstallationError(message) dest_path = os.path.join(scheme_path, dest_subpath) assert_no_path_traversal(scheme_path, dest_path) return ZipBackedFile(record_path, dest_path, zip_file) return make_data_scheme_file def is_data_scheme_path(path: RecordPath) -> bool: return path.split("/", 1)[0].endswith(".data") paths = cast(List[RecordPath], wheel_zip.namelist()) file_paths = filterfalse(is_dir_path, paths) root_scheme_paths, data_scheme_paths = partition(is_data_scheme_path, file_paths) make_root_scheme_file = root_scheme_file_maker(wheel_zip, lib_dir) files: Iterator[File] = map(make_root_scheme_file, root_scheme_paths) def is_script_scheme_path(path: RecordPath) -> bool: parts = path.split("/", 2) return len(parts) > 2 and parts[0].endswith(".data") and parts[1] == "scripts" other_scheme_paths, script_scheme_paths = partition( is_script_scheme_path, data_scheme_paths ) make_data_scheme_file = data_scheme_file_maker(wheel_zip, scheme) other_scheme_files = map(make_data_scheme_file, other_scheme_paths) files = chain(files, other_scheme_files) # Get the defined entry points distribution = get_wheel_distribution( FilesystemWheel(wheel_path), canonicalize_name(name), ) console, gui = get_entrypoints(distribution) def is_entrypoint_wrapper(file: "File") -> bool: # EP, EP.exe and EP-script.py are scripts generated for # entry point EP by setuptools path = file.dest_path name = os.path.basename(path) if name.lower().endswith(".exe"): matchname = name[:-4] elif name.lower().endswith("-script.py"): matchname = name[:-10] elif name.lower().endswith(".pya"): matchname = name[:-4] else: matchname = name # Ignore setuptools-generated scripts return matchname in console or matchname in gui script_scheme_files: Iterator[File] = map( make_data_scheme_file, script_scheme_paths ) script_scheme_files = filterfalse(is_entrypoint_wrapper, script_scheme_files) script_scheme_files = map(ScriptFile, script_scheme_files) files = chain(files, script_scheme_files) for file in files: file.save() record_installed(file.src_record_path, file.dest_path, file.changed) def pyc_source_file_paths() -> Iterator[str]: # We de-duplicate installation paths, since there can be overlap (e.g. # file in .data maps to same location as file in wheel root). # Sorting installation paths makes it easier to reproduce and debug # issues related to permissions on existing files. for installed_path in sorted(set(installed.values())): full_installed_path = os.path.join(lib_dir, installed_path) if not os.path.isfile(full_installed_path): continue if not full_installed_path.endswith(".py"): continue yield full_installed_path def pyc_output_path(path: str) -> str: """Return the path the pyc file would have been written to.""" return importlib.util.cache_from_source(path) # Compile all of the pyc files for the installed files if pycompile: with captured_stdout() as stdout: with warnings.catch_warnings(): warnings.filterwarnings("ignore") for path in pyc_source_file_paths(): success = compileall.compile_file(path, force=True, quiet=True) if success: pyc_path = pyc_output_path(path) assert os.path.exists(pyc_path) pyc_record_path = cast( "RecordPath", pyc_path.replace(os.path.sep, "/") ) record_installed(pyc_record_path, pyc_path) logger.debug(stdout.getvalue()) maker = PipScriptMaker(None, scheme.scripts) # Ensure old scripts are overwritten. # See https://github.com/pypa/pip/issues/1800 maker.clobber = True # Ensure we don't generate any variants for scripts because this is almost # never what somebody wants. # See https://bitbucket.org/pypa/distlib/issue/35/ maker.variants = {""} # This is required because otherwise distlib creates scripts that are not # executable. # See https://bitbucket.org/pypa/distlib/issue/32/ maker.set_mode = True # Generate the console and GUI entry points specified in the wheel scripts_to_generate = get_console_script_specs(console) gui_scripts_to_generate = list(starmap("{} = {}".format, gui.items())) generated_console_scripts = maker.make_multiple(scripts_to_generate) generated.extend(generated_console_scripts) generated.extend(maker.make_multiple(gui_scripts_to_generate, {"gui": True})) if warn_script_location: msg = message_about_scripts_not_on_PATH(generated_console_scripts) if msg is not None: logger.warning(msg) generated_file_mode = 0o666 & ~current_umask() @contextlib.contextmanager def _generate_file(path: str, **kwargs: Any) -> Iterator[BinaryIO]: with adjacent_tmp_file(path, **kwargs) as f: yield f os.chmod(f.name, generated_file_mode) replace(f.name, path) dest_info_dir = os.path.join(lib_dir, info_dir) # Record pip as the installer installer_path = os.path.join(dest_info_dir, "INSTALLER") with _generate_file(installer_path) as installer_file: installer_file.write(b"pip\n") generated.append(installer_path) # Record the PEP 610 direct URL reference if direct_url is not None: direct_url_path = os.path.join(dest_info_dir, DIRECT_URL_METADATA_NAME) with _generate_file(direct_url_path) as direct_url_file: direct_url_file.write(direct_url.to_json().encode("utf-8")) generated.append(direct_url_path) # Record the REQUESTED file if requested: requested_path = os.path.join(dest_info_dir, "REQUESTED") with open(requested_path, "wb"): pass generated.append(requested_path) record_text = distribution.read_text("RECORD") record_rows = list(csv.reader(record_text.splitlines())) rows = get_csv_rows_for_installed( record_rows, installed=installed, changed=changed, generated=generated, lib_dir=lib_dir, ) # Record details of all files installed record_path = os.path.join(dest_info_dir, "RECORD") with _generate_file(record_path, **csv_io_kwargs("w")) as record_file: # Explicitly cast to typing.IO[str] as a workaround for the mypy error: # "writer" has incompatible type "BinaryIO"; expected "_Writer" writer = csv.writer(cast("IO[str]", record_file)) writer.writerows(_normalized_outrows(rows)) @contextlib.contextmanager def req_error_context(req_description: str) -> Iterator[None]: try: yield except InstallationError as e: message = "For req: {}. {}".format(req_description, e.args[0]) raise InstallationError(message) from e def install_wheel( name: str, wheel_path: str, scheme: Scheme, req_description: str, pycompile: bool = True, warn_script_location: bool = True, direct_url: Optional[DirectUrl] = None, requested: bool = False, ) -> None: with ZipFile(wheel_path, allowZip64=True) as z: with req_error_context(req_description): _install_wheel( name=name, wheel_zip=z, wheel_path=wheel_path, scheme=scheme, pycompile=pycompile, warn_script_location=warn_script_location, direct_url=direct_url, requested=requested, ) PK+]{33operations/install/__init__.pynu["""For modules related to installing packages. """ PK+]Y?%*%**network/__pycache__/session.cpython-39.pycnu[a ReYA@sUdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlmZmZmZmZmZmZmZmZmZddlmZmZddlmZddlm Z m!Z!ddl"m#Z#m$Z$ddl%m&Z&dd l'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;ddle?Z@eeAeAeeeBeAffZCejDde*dgdZEeeCeFd<dZGeHdddZIeAdddZJGddde ZKGd d!d!e!ZLGd"d#d#eZMGd$d%d%ejNZOdS)&zhPipSession and supporting code, containing all pip-specific network request configuration and behavior. N) AnyDictIteratorListMappingOptionalSequenceTupleUnion)requestsurllib3)CacheControlAdapter) BaseAdapter HTTPAdapter)PreparedRequestResponse)CaseInsensitiveDict)ConnectionPool)InsecureRequestWarning) __version__)get_default_environment)Link)MultiDomainBasicAuth) SafeFileCache)has_tls)libc_ver)build_url_from_netloc parse_netloc) url_to_pathignore)category))https*r")r" localhostr")r"z 127.0.0.0/8r")r"z::1/128r")filer"N)sshr"r"SECURE_ORIGINS) BUILD_BUILDIDBUILD_IDCI PIP_IS_CIreturncCstddtDS)z? Return whether it looks like pip is running under CI. css|]}|tjvVqdSN)osenviron).0namer2/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/session.py Xz looks_like_ci..)anyCI_ENVIRONMENT_VARIABLESr2r2r2r3 looks_like_ciQsr8c Csdtdtdtid}|dddkr@t|dd<n|dddkrtj}|jd krl|d d }d d d|D|dd<nB|dddkrt|dd<n |dddkrt|dd<tjdrRddl m }| | | f}ttddtgd|}ttddtddgt}|rD||d<|rR||d<tjdrtdrdtdd|d<trt|did<trt|did<trt|d<trdd l}|j|d <td!}|d urt|j |d"<td#d urvztj d#d$gtj!d%d&}Wnt"yRYn$0|d'rv|#d(d)$|d*<t%rd+nd |d,<t&j'(d-} | d ur| |d.<d/j)|t*j+|d0d+d1d2S)3z6 Return a string representing the user agent. pip)r1versionr1) installerpythonimplementationr=CPythonr:PyPyfinalN.cSsg|] }t|qSr2)str)r0xr2r2r3 nr5zuser_agent..Jython IronPythonlinuxr)distrocSs|dSNr2rDr2r2r3}r5zuser_agent..)r1r:idcSs|dSrJr2rLr2r2r3rMr5liblibcrIdarwinmacOSsystemreleasecpuopenssl_version setuptoolssetuptools_versionrustcz --versiong?)stderrtimeoutsrustc  rK rustc_versionTciPIP_USER_AGENT_USER_DATA user_dataz9{data[installer][name]}/{data[installer][version]} {json}),:) separators sort_keys)datajson),rplatformpython_versionpython_implementationsyspypy_version_info releaseleveljoin startswith pip._vendorrIr1r:codenamedictfilterziprmac_verrS setdefaultrTmachiner_sslOPENSSL_VERSIONrget_distributionrCshutilwhich subprocess check_outputSTDOUT Exceptionsplitdecoder8r.r/getformatrfdumps) rerkrIlinux_distribution distro_infosrPsslsetuptools_dist rustc_outputr`r2r2r3 user_agent[s                rc @sreZdZd eeeeeeeeffeee feee ee e ffee e e fe dddZ dddd Z dS) LocalFSAdapterFNT)requeststreamr[verifycertproxiesr,c Cst|j}t}d|_|j|_zt|} WnTty} zzt |} t |} Wn2t y|r| | kr|dkrYq>Yn 0| | vrq>|| kr| dkr| durq>dStd||dS)N+rKr"TzThe repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host %s'.F)urllibparseurlparserCrhostnamerrsplitr ipaddress ip_address ip_network ValueErrorlowerrwarning) rrparsedorigin_protocol origin_host origin_port secure_originsecure_protocol secure_host secure_portaddrnetworkr2r2r3is_secure_origin~sJ       zPipSession.is_secure_origin)methodrrrr,cs*|d|jtj||g|Ri|S)Nr[)rur[rr)rrrrrrr2r3rszPipSession.request)NF)rrrr[rint__annotations__rrCrrrrrrr SecureOriginrrrrrrr2r2rr3rs.  M  Cr)P__doc__ email.utilsrrrrfloggingrr.rgrzr|rj urllib.parserwarningstypingrrrrrrrr r ror r pip._vendor.cachecontrolr Zpip._vendor.requests.adaptersrrZpip._vendor.requests.modelsrrZpip._vendor.requests.structuresrZ"pip._vendor.urllib3.connectionpoolrZpip._vendor.urllib3.exceptionsrr9rpip._internal.metadatarpip._internal.models.linkrpip._internal.network.authrpip._internal.network.cacherpip._internal.utils.compatrpip._internal.utils.glibcrpip._internal.utils.miscrrpip._internal.utils.urlsr getLoggerrrrCrrfilterwarningsr&rr7rr8rrrrSessionrr2r2r2r3sR,               e,  PK+]ƚ -network/__pycache__/lazy_wheel.cpython-39.pycnu[a Re@sdZddgZddlmZmZddlmZddlmZddl m Z m Z m Z m Z mZmZddlmZmZdd lmZdd lmZmZdd lmZmZmZdd lmZdd lmZm Z m!Z!Gddde"Z#e$e$eedddZ%GdddZ&dS)zLazy ZIP over HTTPHTTPRangeRequestUnsupporteddist_from_wheel_url) bisect_left bisect_right)contextmanager)NamedTemporaryFile)AnyDictIteratorListOptionalTuple) BadZipfileZipFile)canonicalize_name)CONTENT_CHUNK_SIZEResponse)BaseDistribution MemoryWheelget_wheel_distribution) PipSession)HEADERSraise_for_statusresponse_chunksc@s eZdZdS)rN)__name__ __module__ __qualname__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/lazy_wheel.pyrs)nameurlsessionreturncCsHt||*}t|j|}t|t|WdS1s:0YdS)aReturn a distribution object from the given wheel URL. This uses HTTP range requests to only fetch the potion of the wheel containing metadata, just enough for the object to be constructed. If such requests are not supported, HTTPRangeRequestUnsupported is raised. N)LazyZipOverHTTPrrrr)rr r!zfwheelrrrrs  c@szeZdZdZefeeeddddZe edddZ e edd d Z e dd d Z ddd dZe e dddZd3eedddZe dddZd4eeedddZedddZd5eeedddZe ddd Zddd!d"Zeee d#d$d%Zeeddd&d'Zddd(d)Zefeee eefe!d*d+d,Z"eeeeee#eefd-d.d/Z$eedd0d1d2Z%dS)6r#aFile-like object mapped to a ZIP file over HTTP. This uses HTTP range requests to lazily fetch the file's content, which is supposed to be fed to ZipFile. If such requests are not supported by the server, raise HTTPRangeRequestUnsupported during initialization. N)r r! chunk_sizer"cCs|j|td}t||jdks$J||||_|_|_t|jd|_ t |_ | |j g|_ g|_d|jddvrtd|dS)N)headerszContent-Lengthbytesz Accept-Rangesnonezrange request is not supported)headrr status_code_session_url _chunk_sizeintr'_lengthr_filetruncate_left_rightgetr _check_zip)selfr r!r&r+rrr__init__1s zLazyZipOverHTTP.__init__)r"cCsdS)z!Opening mode, which is always rb.rbrr8rrrmodeAszLazyZipOverHTTP.modecCs|jjS)zPath to the underlying file.)r2rr;rrrrFszLazyZipOverHTTP.namecCsdS)z9Return whether random access is supported, which is True.Trr;rrrseekableKszLazyZipOverHTTP.seekablecCs|jdS)zClose the file.N)r2closer;rrrr>OszLazyZipOverHTTP.closecCs|jjS)zWhether the file is closed.)r2closedr;rrrr?SszLazyZipOverHTTP.closed)sizer"cCs`t||j}||j}}|dkr(|n t|||}td||}|||d|j|S)zRead up to size bytes from the object and return them. As a convenience, if size is unspecified or -1, all bytes until EOF are returned. Fewer than size bytes may be returned if EOF is reached. r)maxr/tellr1min _downloadr2read)r8rA download_sizestartlengthstoprrrrGXs  zLazyZipOverHTTP.readcCsdS)z3Return whether the file is readable, which is True.Trr;rrrreadablefszLazyZipOverHTTP.readabler)offsetwhencer"cCs|j||S)a-Change stream position and return the new absolute position. Seek to offset relative position indicated by whence: * 0: Start of stream (the default). pos should be >= 0; * 1: Current position - pos may be negative; * 2: End of stream - pos usually negative. )r2seek)r8rMrNrrrrOjszLazyZipOverHTTP.seekcCs |jS)zReturn the current position.)r2rDr;rrrrDtszLazyZipOverHTTP.tellcCs |j|S)zResize the stream to the given size in bytes. If size is unspecified resize to the current position. The current stream position isn't changed. Return the new file size. )r2r3)r8rArrrr3xszLazyZipOverHTTP.truncatecCsdS)z Return False.Frr;rrrwritableszLazyZipOverHTTP.writablecCs|j|SN)r2 __enter__r;rrrrRs zLazyZipOverHTTP.__enter__)excr"cGs |jj|SrQ)r2__exit__)r8rSrrrrTszLazyZipOverHTTP.__exit__c cs.|}zdVW||n ||0dS)zyReturn a context manager keeping the position. At the end of the block, seek back to original position. N)rDrO)r8posrrr_stayszLazyZipOverHTTP._stayc Cs|jd}ttd||jD]h}||||@z t|WntyTYn0WdqWdq1sz0YqdS)z1Check and download until the file is a valid ZIP.rBrN)r1reversedranger/rFrVrr)r8endrIrrrr7s     zLazyZipOverHTTP._check_zip)rIrY base_headersr"cCs8|}d|d||d<d|d<|jj|j|ddS)z:Return HTTP response to a range request from start to end.zbytes=-Rangezno-cachez Cache-ControlT)r'stream)copyr-r6r.)r8rIrYrZr'rrr_stream_responsesz LazyZipOverHTTP._stream_response)rIrYleftrightr"c cs|j|||j||}}t|g|dd}}t|g|dd}t||D]&\}} ||krv||dfV| d}qX||kr||fV|g|g|j||<|j||<dS)a/Return an iterator of intervals to be fetched. Args: start (int): Start of needed interval end (int): End of needed interval left (int): Index of first overlapping downloaded data right (int): Index after last overlapping downloaded data NrBr@)r4r5rErCzip) r8rIrYr`ralslicersliceijkrrr_merges   zLazyZipOverHTTP._merge)rIrYr"cCs|~t|j|}t|j|}|||||D]D\}}|||}|||t ||j D]}|j |qdq2Wdn1s0YdS)z-Download bytes from start to end inclusively.N) rVrr5rr4rhr_rrOrr/r2write)r8rIrYr`raresponsechunkrrrrFs     zLazyZipOverHTTP._download)r@)r)N)&rrr__doc__rstrrr0r9propertyr<rboolr=r>r?r)rGrLrOrDr r3rPrRrrTrr rVr7rr rr_r rhrFrrrrr#(sD       r#N)'rl__all__bisectrr contextlibrtempfilertypingrr r r r r zipfilerrpip._vendor.packaging.utilsrZpip._vendor.requests.modelsrrpip._internal.metadatarrrpip._internal.network.sessionrpip._internal.network.utilsrrr Exceptionrrmrr#rrrrs     PK+]__'network/__pycache__/auth.cpython-39.pycnu[a Re/ @s*dZddlZddlmZmZmZmZmZddl m Z m Z ddl m Z mZddlmZddlmZddlmZmZmZmZmZdd lmZeeZeeeefZz ddlaWnLe ydaYn8e!yZ"z e#d ee"daWYdZ"["n dZ"["00eeeeeed d d Z$Gddde Z%dS)zNetwork Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. N)AnyDictListOptionalTuple)AuthBase HTTPBasicAuth)RequestResponse)get_netrc_auth) getLogger)ask ask_input ask_passwordremove_auth_from_urlsplit_auth_netloc_from_url)AuthInfo*Keyring is skipped due to an exception: %s)urlusernamereturnc Cs|rts dSz~z tj}Wnty*Yn40td||||}|durX|j|jfWSWdS|rtd|t||}|r||fWSWn8ty}z t dt |daWYd}~n d}~00dS)z3Return the tuple auth for a given url from keyring.Nz'Getting credentials from keyring for %sz$Getting password from keyring for %sr) keyringget_credentialAttributeErrorloggerdebugrpassword get_password Exceptionwarningstr)rrrcredrexcr#/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/auth.pyget_keyring_auth(s0      r%c@seZdZd eeeeddddZeeedddZd!eeee d d d Z ee eeeeefd ddZ e e dddZee eeeeefdddZedddZeeedddZeeddddZeeddddZdS)"MultiDomainBasicAuthTN) prompting index_urlsrcCs||_||_i|_d|_dS)N)r'r( passwords_credentials_to_save)selfr'r(r#r#r$__init__JszMultiDomainBasicAuth.__init__)rrcCsB|r |jsdS|jD](}t|dd}||r|SqdS)aReturn the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. N/)r(rrstrip startswith)r+ruprefixr#r#r$_get_index_urlWs    z#MultiDomainBasicAuth._get_index_urlF) original_url allow_netrc allow_keyringrcCst|\}}}|\}}|dur6|dur6td||S||} | rft| } | rf| \} } } td| | r| ddur| \}}|dur|durtd|| S|rt|} | rtd|| S|rt| |pt||}|rtd||S||fS)z2Find and return credentials for the specified URL.NzFound credentials in url for %szFound index url %srz%Found credentials in index url for %sz!Found credentials in netrc for %sz#Found credentials in keyring for %s)rrrr2r r%)r+r3r4r5rnetlocurl_user_passwordrr index_url index_info_index_url_user_password netrc_authkr_authr#r#r$_get_new_credentialsms>         z)MultiDomainBasicAuth._get_new_credentials)r3rc Cst|\}}}||\}}|dus,|dur^||jvr^|j|\}}|dusT||kr^||}}|dusn|dur|ptd}|p|d}||f|j|<|dur|dus|dur|dusJd||||fS)a_Return the credentials to use for the provided URL. If allowed, netrc and keyring may be used to obtain the correct credentials. Returns (url_without_credentials, username, password). Note that even if the original URL contains credentials, this function may return a different username and password. Nz%Could not load credentials from url: )rr>r)) r+r3rr6r:rrunpwr#r#r$_get_url_and_credentialss*  z-MultiDomainBasicAuth._get_url_and_credentials)reqrcCsH||j\}}}||_|dur6|dur6t|||}|d|j|S)Nresponse)rBrr register_hook handle_401)r+rCrrrr#r#r$__call__s zMultiDomainBasicAuth.__call__)r6rcCsbtd|d}|sdSt||}|rP|ddurP|ddurP|d|ddfStd}||dfS) Nz User for z: )NNFrFz Password: T)rr%r)r+r6rauthrr#r#r$_prompt_for_passwords z)MultiDomainBasicAuth._prompt_for_password)rcCstsdStdddgdkS)NFz#Save credentials to keyring [y/N]: yn)rr )r+r#r#r$ _should_save_password_to_keyringsz5MultiDomainBasicAuth._should_save_password_to_keyring)respkwargsrc Ks|jdkr|S|js|Stj|j}|j|jddd\}}d}|sZ|sZ||j\}}}d|_ |dur|dur||f|j |j<|r| r|j||f|_ |j |j t|pd|pd|j}|d|j|j r|d|j|jj|fi|}|j||S)NFT)r4r5r?rD) status_coder'urllibparseurlparserr>rJr6r*r)rMcontentraw release_connrrequestrE warn_on_401save_credentials connectionsendhistoryappend) r+rNrOparsedrrsaverCnew_respr#r#r$rFs6     zMultiDomainBasicAuth.handle_401cKs|jdkrtd|jjdS)z6Response callback to warn about incorrect credentials.rPz)401 Error, Credentials not correct for %sN)rQrrrXr)r+rNrOr#r#r$rY.s  z MultiDomainBasicAuth.warn_on_401cKsltdusJdtsdS|j}d|_|rh|jdkrhztdtj|WntyftdYn0dS)z1Response callback to save credentials on success.Nz'should never reach here without keyringizSaving credentials to keyringzFailed to save credentials)rr*rQrinfo set_passwordr exception)r+rNrOcredsr#r#r$rZ6s  z%MultiDomainBasicAuth.save_credentials)TN)TF)__name__ __module__ __qualname__boolrrr r,r2rr>rrBr rGrJrMr rrFrYrZr#r#r#r$r&Is2   9 0 6r&)&__doc__ urllib.parserRtypingrrrrrZpip._vendor.requests.authrrZpip._vendor.requests.modelsr r Zpip._vendor.requests.utilsr pip._internal.utils.loggingr pip._internal.utils.miscr rrrr pip._internal.vcs.versioncontrolrrfrr Credentialsr ImportErrorrr"rr%r&r#r#r#r$s,     !PK+]{,k(network/__pycache__/utils.cpython-39.pycnu[a Re@stUddlmZmZddlmZmZddlmZddiZee e fe d<eddd d Z efee ee d d d ZdS))DictIterator)CONTENT_CHUNK_SIZEResponse)NetworkConnectionErrorzAccept-EncodingidentityHEADERSN)respreturncCsd}t|jtrBz|jd}WqHty>|jd}YqH0n|j}d|jkr^dkr|nn|jd|d|j}n2d|jkrdkrnn|jd |d|j}|rt||d dS) Nzutf-8z iso-8859-1iiz Client Error: z for url: iXz Server Error: )response) isinstancereasonbytesdecodeUnicodeDecodeError status_codeurlr)r http_error_msgrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/utils.pyraise_for_statuss  r)r chunk_sizer ccsRz |jj|ddD] }|VqWn,tyL|j|}|s@qH|Vq.Yn0dS)z3Given a requests Response, provide the data chunks.F)decode_contentN)rawstreamAttributeErrorread)r rchunkrrrresponse_chunks9s    r)typingrrZpip._vendor.requests.modelsrrpip._internal.exceptionsrrstr__annotations__rintrrrrrrs PK+]]i+network/__pycache__/download.cpython-39.pycnu[a Re@sTdZddlZddlZddlZddlZddlmZmZmZddl m Z m Z ddl m Z ddlmZddlmZddlmZdd lmZdd lmZdd lmZmZmZdd lmZmZmZe e!Z"e ee#d ddZ$e ee%ee&dddZ'e%e%dddZ(e%e%e%dddZ)e ee%dddZ*eee dddZ+Gdd d Z,Gd!d"d"Z-dS)#z)Download files with progress indicators. N)IterableOptionalTuple)CONTENT_CHUNK_SIZEResponse)DownloadProgressProvider)NetworkConnectionError)PyPI)Link) is_from_cache) PipSession)HEADERSraise_for_statusresponse_chunks) format_sizeredact_auth_from_urlsplitext)respreturnc Cs0zt|jdWStttfy*YdS0dS)Nzcontent-length)intheaders ValueErrorKeyError TypeError)rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/download.py_get_http_response_sizesr)rlink progress_barrcCst|}|jtjkr|j}n|j}t|}|r>d|t|}t |rTt d|n t d|t t jkrtd}n*t |rd}n|sd}n|dkrd}nd}t|t}|s|St||d|S)Nz{} ({})zUsing cached %szDownloading %sFTi@)max)rnetlocr file_storage_domainshow_urlurl_without_fragmentrformatrr loggerinfogetEffectiveLevelloggingINFOrrr)rrr total_lengthurl logged_url show_progresschunksrrr_prepare_downloads.   r/)filenamercCs tj|S)zJ Sanitize the "filename" value from a Content-Disposition header. )ospathbasename)r0rrrsanitize_content_filenameGsr4)content_dispositiondefault_filenamercCs,t|\}}|d}|r$t|}|p*|S)z Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. r0)cgi parse_headergetr4)r5r6_typeparamsr0rrrparse_content_dispositionNs  r<)rrrcCs|j}|jd}|r t||}t|d}|sPt|jdd}|rP||7}|s~|j|jkr~tj |jd}|r~||7}|S)zoGet an ideal filename from the given HTTP response, falling back to the link filename if not provided. zcontent-dispositionz content-type) r0rr9r<r mimetypesguess_extensionr+r1r2)rrr0r5extrrr_get_http_response_filename\s   rB)sessionrrcCs.|jddd}|j|tdd}t||S)N#r=rT)rstream)r+splitr9r r)rCr target_urlrrrr_http_get_downloadqsrHc@s8eZdZeeddddZeeeeefdddZdS) DownloaderNrCrrcCs||_||_dSN_session _progress_barselfrCrrrr__init__yszDownloader.__init__)rlocationrc Cszt|j|}WnFtyV}z.|jdus.Jtd|jj|WYd}~n d}~00t||}tj ||}t |||j }t |d$}|D]} || qWdn1s0Y|jdd} || fS)z.Download the file given by link into location.NHTTP error %s while getting %swb Content-Typer>rHrMrresponser%critical status_coderBr1r2joinr/rNopenwriterr9) rPrrRrer0filepathr. content_filechunk content_typerrr__call__s    *zDownloader.__call__) __name__ __module__ __qualname__r strrQr rrbrrrrrIxs  rIc@sHeZdZeeddddZeeeeeeeeeffdddZ dS)BatchDownloaderNrJcCs||_||_dSrKrLrOrrrrQszBatchDownloader.__init__)linksrRrc cs|D]}zt|j|}WnFty^}z.|jdus6Jtd|jj|WYd}~n d}~00t||}tj ||}t |||j }t |d$} |D]} | | qWdn1s0Y|jdd} ||| ffVqdS)z0Download the files given by links into location.NrSrTrUr>rV) rPrhrRrrr]r0r^r.r_r`rarrrrbs&  *zBatchDownloader.__call__) rcrdrer rfrQrr rrbrrrrrgs rg).__doc__r7r(r?r1typingrrrZpip._vendor.requests.modelsrrpip._internal.cli.progress_barsrpip._internal.exceptionsrpip._internal.models.indexr pip._internal.models.linkr pip._internal.network.cacher pip._internal.network.sessionr pip._internal.network.utilsr rrpip._internal.utils.miscrrr getLoggerrcr%rrrfbytesr/r4r<rBrHrIrgrrrrs6        )PK+]<+network/__pycache__/__init__.cpython-39.pycnu[a Re2@sdZdS)z+Contains purely network-related utilities. N)__doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/__init__.pyPK+]$|&&)network/__pycache__/xmlrpc.cpython-39.pycnu[a Re@sdZddlZddlZddlZddlmZmZddl m Z ddl m Z ddl mZerdddlmZmZeeZGdd d ejjZdS) z#xmlrpclib.Transport implementation N) TYPE_CHECKINGTuple)NetworkConnectionError) PipSession)raise_for_status) _HostType _MarshallablecsJeZdZdZd eeeddfdd Zd deeee dd d d Z Z S)PipXmlrpcTransportzRProvide a `xmlrpclib.Transport` implementation via a `PipSession` object. FN) index_urlsession use_datetimereturncs*t|tj|}|j|_||_dS)N)super__init__urllibparseurlparsescheme_scheme_session)selfr r r Z index_parts __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/xmlrpc.pyrs  zPipXmlrpcTransport.__init__r)r.)hosthandler request_bodyverboser c Cst|tsJ|j||dddf}tj|}z8ddi}|jj|||dd}t|||_ | |j WSt y} z*| j s~Jtd| j j|WYd} ~ n d} ~ 00dS)Nz Content-Typeztext/xmlT)dataheadersstreamzHTTP error %s while getting %s) isinstancestrrrr urlunparserpostrrparse_responserawrresponseloggercritical status_code) rrrrrpartsurlr r(excrrrrequest s,  zPipXmlrpcTransport.request)F)F) __name__ __module__ __qualname____doc__r#rboolrbytesrr/ __classcell__rrrrr s r )r3logging urllib.parser xmlrpc.clientZxmlrpctypingrrpip._internal.exceptionsrpip._internal.network.sessionrpip._internal.network.utilsrrr getLoggerr0r)client Transportr rrrrs    PK+].q q (network/__pycache__/cache.cpython-39.pycnu[a Re4@sdZddlZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZmZdd lmZe ed d d Zeedd ddZGdddeZdS)zHTTP cache implementation. N)contextmanager)IteratorOptional) BaseCache) FileCache)Response)adjacent_tmp_filereplace) ensure_dir)responsereturncCs t|ddS)N from_cacheF)getattr)r r/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/network/cache.py is_from_cachesr)r ccs"z dVWntyYn0dS)zvIf we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. N)OSErrorrrrrsuppressed_cache_errorss  rcsneZdZdZeddfdd ZeedddZeeed d d Z eedd d dZ edd ddZ Z S) SafeFileCachezw A file based cache which is safe to use even when the target directory may not be accessible or writable. N) directoryr cs$|dusJdt||_dS)Nz!Cache directory must not be None.)super__init__r)selfr __class__rrr%s zSafeFileCache.__init__)namer cCs6t|}t|dd|g}tjj|jg|RS)N)rencodelistospathjoinr)rrhashedpartsrrr_get_cache_path*s zSafeFileCache._get_cache_path)keyr c Cst||}tPt|d&}|WdWdS1sH0YWdn1sf0YdS)Nrb)r$ropenread)rr%r frrrget2s  zSafeFileCache.get)r%valuer c Cs||}t^ttj|t|}||Wdn1sJ0Yt|j |Wdn1st0YdSN) r$rr rr dirnamerwriter r)rr%r+r r)rrrset8s   (zSafeFileCache.setcCs>||}tt|Wdn1s00YdSr,)r$rrremove)rr%r rrrdeleteBs zSafeFileCache.delete) __name__ __module__ __qualname____doc__strrr$rbytesr*r/r1 __classcell__rrrrrs  r)r5r contextlibrtypingrrZpip._vendor.cachecontrol.cacherpip._vendor.cachecontrol.cachesrZpip._vendor.requests.modelsrpip._internal.utils.filesystemrr pip._internal.utils.miscr boolrrrrrrrs      PK+]/Pnetwork/download.pynu["""Download files with progress indicators. """ import cgi import logging import mimetypes import os from typing import Iterable, Optional, Tuple from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response from pip._internal.cli.progress_bars import DownloadProgressProvider from pip._internal.exceptions import NetworkConnectionError from pip._internal.models.index import PyPI from pip._internal.models.link import Link from pip._internal.network.cache import is_from_cache from pip._internal.network.session import PipSession from pip._internal.network.utils import HEADERS, raise_for_status, response_chunks from pip._internal.utils.misc import format_size, redact_auth_from_url, splitext logger = logging.getLogger(__name__) def _get_http_response_size(resp: Response) -> Optional[int]: try: return int(resp.headers["content-length"]) except (ValueError, KeyError, TypeError): return None def _prepare_download( resp: Response, link: Link, progress_bar: str, ) -> Iterable[bytes]: total_length = _get_http_response_size(resp) if link.netloc == PyPI.file_storage_domain: url = link.show_url else: url = link.url_without_fragment logged_url = redact_auth_from_url(url) if total_length: logged_url = "{} ({})".format(logged_url, format_size(total_length)) if is_from_cache(resp): logger.info("Using cached %s", logged_url) else: logger.info("Downloading %s", logged_url) if logger.getEffectiveLevel() > logging.INFO: show_progress = False elif is_from_cache(resp): show_progress = False elif not total_length: show_progress = True elif total_length > (40 * 1000): show_progress = True else: show_progress = False chunks = response_chunks(resp, CONTENT_CHUNK_SIZE) if not show_progress: return chunks return DownloadProgressProvider(progress_bar, max=total_length)(chunks) def sanitize_content_filename(filename: str) -> str: """ Sanitize the "filename" value from a Content-Disposition header. """ return os.path.basename(filename) def parse_content_disposition(content_disposition: str, default_filename: str) -> str: """ Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. """ _type, params = cgi.parse_header(content_disposition) filename = params.get("filename") if filename: # We need to sanitize the filename to prevent directory traversal # in case the filename contains ".." path parts. filename = sanitize_content_filename(filename) return filename or default_filename def _get_http_response_filename(resp: Response, link: Link) -> str: """Get an ideal filename from the given HTTP response, falling back to the link filename if not provided. """ filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess content_disposition = resp.headers.get("content-disposition") if content_disposition: filename = parse_content_disposition(content_disposition, filename) ext: Optional[str] = splitext(filename)[1] if not ext: ext = mimetypes.guess_extension(resp.headers.get("content-type", "")) if ext: filename += ext if not ext and link.url != resp.url: ext = os.path.splitext(resp.url)[1] if ext: filename += ext return filename def _http_get_download(session: PipSession, link: Link) -> Response: target_url = link.url.split("#", 1)[0] resp = session.get(target_url, headers=HEADERS, stream=True) raise_for_status(resp) return resp class Downloader: def __init__( self, session: PipSession, progress_bar: str, ) -> None: self._session = session self._progress_bar = progress_bar def __call__(self, link: Link, location: str) -> Tuple[str, str]: """Download the file given by link into location.""" try: resp = _http_get_download(self._session, link) except NetworkConnectionError as e: assert e.response is not None logger.critical( "HTTP error %s while getting %s", e.response.status_code, link ) raise filename = _get_http_response_filename(resp, link) filepath = os.path.join(location, filename) chunks = _prepare_download(resp, link, self._progress_bar) with open(filepath, "wb") as content_file: for chunk in chunks: content_file.write(chunk) content_type = resp.headers.get("Content-Type", "") return filepath, content_type class BatchDownloader: def __init__( self, session: PipSession, progress_bar: str, ) -> None: self._session = session self._progress_bar = progress_bar def __call__( self, links: Iterable[Link], location: str ) -> Iterable[Tuple[Link, Tuple[str, str]]]: """Download the files given by links into location.""" for link in links: try: resp = _http_get_download(self._session, link) except NetworkConnectionError as e: assert e.response is not None logger.critical( "HTTP error %s while getting %s", e.response.status_code, link, ) raise filename = _get_http_response_filename(resp, link) filepath = os.path.join(location, filename) chunks = _prepare_download(resp, link, self._progress_bar) with open(filepath, "wb") as content_file: for chunk in chunks: content_file.write(chunk) content_type = resp.headers.get("Content-Type", "") yield link, (filepath, content_type) PK+]ӏV1network/utils.pynu[from typing import Dict, Iterator from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response from pip._internal.exceptions import NetworkConnectionError # The following comments and HTTP headers were originally added by # Donald Stufft in git commit 22c562429a61bb77172039e480873fb239dd8c03. # # We use Accept-Encoding: identity here because requests defaults to # accepting compressed responses. This breaks in a variety of ways # depending on how the server is configured. # - Some servers will notice that the file isn't a compressible file # and will leave the file alone and with an empty Content-Encoding # - Some servers will notice that the file is already compressed and # will leave the file alone, adding a Content-Encoding: gzip header # - Some servers won't notice anything at all and will take a file # that's already been compressed and compress it again, and set # the Content-Encoding: gzip header # By setting this to request only the identity encoding we're hoping # to eliminate the third case. Hopefully there does not exist a server # which when given a file will notice it is already compressed and that # you're not asking for a compressed file and will then decompress it # before sending because if that's the case I don't think it'll ever be # possible to make this work. HEADERS: Dict[str, str] = {"Accept-Encoding": "identity"} def raise_for_status(resp: Response) -> None: http_error_msg = "" if isinstance(resp.reason, bytes): # We attempt to decode utf-8 first because some servers # choose to localize their reason strings. If the string # isn't utf-8, we fall back to iso-8859-1 for all other # encodings. try: reason = resp.reason.decode("utf-8") except UnicodeDecodeError: reason = resp.reason.decode("iso-8859-1") else: reason = resp.reason if 400 <= resp.status_code < 500: http_error_msg = ( f"{resp.status_code} Client Error: {reason} for url: {resp.url}" ) elif 500 <= resp.status_code < 600: http_error_msg = ( f"{resp.status_code} Server Error: {reason} for url: {resp.url}" ) if http_error_msg: raise NetworkConnectionError(http_error_msg, response=resp) def response_chunks( response: Response, chunk_size: int = CONTENT_CHUNK_SIZE ) -> Iterator[bytes]: """Given a requests Response, provide the data chunks.""" try: # Special case for urllib3. for chunk in response.raw.stream( chunk_size, # We use decode_content=False here because we don't # want urllib3 to mess with the raw bytes we get # from the server. If we decompress inside of # urllib3 then we cannot verify the checksum # because the checksum will be of the compressed # file. This breakage will only occur if the # server adds a Content-Encoding header, which # depends on how the server was configured: # - Some servers will notice that the file isn't a # compressible file and will leave the file alone # and with an empty Content-Encoding # - Some servers will notice that the file is # already compressed and will leave the file # alone and will add a Content-Encoding: gzip # header # - Some servers won't notice anything at all and # will take a file that's already been compressed # and compress it again and set the # Content-Encoding: gzip header # # By setting this not to decode automatically we # hope to eliminate problems with the second case. decode_content=False, ): yield chunk except AttributeError: # Standard file-like object. while True: chunk = response.raw.read(chunk_size) if not chunk: break yield chunk PK+]wnetwork/lazy_wheel.pynu["""Lazy ZIP over HTTP""" __all__ = ["HTTPRangeRequestUnsupported", "dist_from_wheel_url"] from bisect import bisect_left, bisect_right from contextlib import contextmanager from tempfile import NamedTemporaryFile from typing import Any, Dict, Iterator, List, Optional, Tuple from zipfile import BadZipfile, ZipFile from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response from pip._internal.metadata import BaseDistribution, MemoryWheel, get_wheel_distribution from pip._internal.network.session import PipSession from pip._internal.network.utils import HEADERS, raise_for_status, response_chunks class HTTPRangeRequestUnsupported(Exception): pass def dist_from_wheel_url(name: str, url: str, session: PipSession) -> BaseDistribution: """Return a distribution object from the given wheel URL. This uses HTTP range requests to only fetch the potion of the wheel containing metadata, just enough for the object to be constructed. If such requests are not supported, HTTPRangeRequestUnsupported is raised. """ with LazyZipOverHTTP(url, session) as zf: # For read-only ZIP files, ZipFile only needs methods read, # seek, seekable and tell, not the whole IO protocol. wheel = MemoryWheel(zf.name, zf) # type: ignore # After context manager exit, wheel.name # is an invalid file by intention. return get_wheel_distribution(wheel, canonicalize_name(name)) class LazyZipOverHTTP: """File-like object mapped to a ZIP file over HTTP. This uses HTTP range requests to lazily fetch the file's content, which is supposed to be fed to ZipFile. If such requests are not supported by the server, raise HTTPRangeRequestUnsupported during initialization. """ def __init__( self, url: str, session: PipSession, chunk_size: int = CONTENT_CHUNK_SIZE ) -> None: head = session.head(url, headers=HEADERS) raise_for_status(head) assert head.status_code == 200 self._session, self._url, self._chunk_size = session, url, chunk_size self._length = int(head.headers["Content-Length"]) self._file = NamedTemporaryFile() self.truncate(self._length) self._left: List[int] = [] self._right: List[int] = [] if "bytes" not in head.headers.get("Accept-Ranges", "none"): raise HTTPRangeRequestUnsupported("range request is not supported") self._check_zip() @property def mode(self) -> str: """Opening mode, which is always rb.""" return "rb" @property def name(self) -> str: """Path to the underlying file.""" return self._file.name def seekable(self) -> bool: """Return whether random access is supported, which is True.""" return True def close(self) -> None: """Close the file.""" self._file.close() @property def closed(self) -> bool: """Whether the file is closed.""" return self._file.closed def read(self, size: int = -1) -> bytes: """Read up to size bytes from the object and return them. As a convenience, if size is unspecified or -1, all bytes until EOF are returned. Fewer than size bytes may be returned if EOF is reached. """ download_size = max(size, self._chunk_size) start, length = self.tell(), self._length stop = length if size < 0 else min(start + download_size, length) start = max(0, stop - download_size) self._download(start, stop - 1) return self._file.read(size) def readable(self) -> bool: """Return whether the file is readable, which is True.""" return True def seek(self, offset: int, whence: int = 0) -> int: """Change stream position and return the new absolute position. Seek to offset relative position indicated by whence: * 0: Start of stream (the default). pos should be >= 0; * 1: Current position - pos may be negative; * 2: End of stream - pos usually negative. """ return self._file.seek(offset, whence) def tell(self) -> int: """Return the current position.""" return self._file.tell() def truncate(self, size: Optional[int] = None) -> int: """Resize the stream to the given size in bytes. If size is unspecified resize to the current position. The current stream position isn't changed. Return the new file size. """ return self._file.truncate(size) def writable(self) -> bool: """Return False.""" return False def __enter__(self) -> "LazyZipOverHTTP": self._file.__enter__() return self def __exit__(self, *exc: Any) -> Optional[bool]: return self._file.__exit__(*exc) @contextmanager def _stay(self) -> Iterator[None]: """Return a context manager keeping the position. At the end of the block, seek back to original position. """ pos = self.tell() try: yield finally: self.seek(pos) def _check_zip(self) -> None: """Check and download until the file is a valid ZIP.""" end = self._length - 1 for start in reversed(range(0, end, self._chunk_size)): self._download(start, end) with self._stay(): try: # For read-only ZIP files, ZipFile only needs # methods read, seek, seekable and tell. ZipFile(self) # type: ignore except BadZipfile: pass else: break def _stream_response( self, start: int, end: int, base_headers: Dict[str, str] = HEADERS ) -> Response: """Return HTTP response to a range request from start to end.""" headers = base_headers.copy() headers["Range"] = f"bytes={start}-{end}" # TODO: Get range requests to be correctly cached headers["Cache-Control"] = "no-cache" return self._session.get(self._url, headers=headers, stream=True) def _merge( self, start: int, end: int, left: int, right: int ) -> Iterator[Tuple[int, int]]: """Return an iterator of intervals to be fetched. Args: start (int): Start of needed interval end (int): End of needed interval left (int): Index of first overlapping downloaded data right (int): Index after last overlapping downloaded data """ lslice, rslice = self._left[left:right], self._right[left:right] i = start = min([start] + lslice[:1]) end = max([end] + rslice[-1:]) for j, k in zip(lslice, rslice): if j > i: yield i, j - 1 i = k + 1 if i <= end: yield i, end self._left[left:right], self._right[left:right] = [start], [end] def _download(self, start: int, end: int) -> None: """Download bytes from start to end inclusively.""" with self._stay(): left = bisect_left(self._right, start) right = bisect_right(self._left, end) for start, end in self._merge(start, end, left, right): response = self._stream_response(start, end) response.raise_for_status() self.seek(start) for chunk in response_chunks(response, self._chunk_size): self._file.write(chunk) PK+]y4S...cli/__pycache__/command_context.cpython-39.pycnu[a Re@sBddlmZmZddlmZmZmZedddZGdddZdS) ) ExitStackcontextmanager)ContextManagerIteratorTypeVar_TT) covariantcsLeZdZddfdd ZeeddddZeeeddd Z Z S) CommandContextMixInN)returncstd|_t|_dS)NF)super__init___in_main_contextr _main_contextself __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/command_context.pyr s zCommandContextMixIn.__init__ccsT|jr Jd|_z6|jdVWdn1s40YWd|_nd|_0dS)NTF)r rrrrr main_context s  &z CommandContextMixIn.main_context)context_providerr cCs|js J|j|S)N)r r enter_context)rrrrrrs z!CommandContextMixIn.enter_context) __name__ __module__ __qualname__r rrrrrr __classcell__rrrrr s r N) contextlibrrtypingrrrrr rrrrs PK+]:(zLXLX)cli/__pycache__/cmdoptions.cpython-39.pycnu[a Ren@s2 UdZddlZddlZddlZddlmZddlmZmZm Z m Z m Z ddlm Z ddl mZmZmZmZmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd l m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'e ee(ddddZ)ee(efee dddZ*d(e ee ddddZ+d)e e,ddddZ-ee(e(e(ddd Z.ee(e(e(dd!d"Z/Gd#d$d$eZ0eed%d&d'd'd(d)Z1ed*efe2d+<eed,d-d.dd/d0Z3ed*efe2d-<eed1d2d.dd3d0Z4ed*efe2d2<eed4d5d6d.ded0Z5ed*efe2d7<eed8d9d:d;ddd.dd?d0Z7ed*efe2d><eed@dAdBd.dCd)Z8ed*efe2dB<eedDdEdFd;ddGd0Z9ed*efe2dF<eedHdIdJe:e;dKdLdMed*efe2dS<eedWdXd.ddYd0Z?ed*efe2dX<eedZd[d\d]d^d_Z@ed*efe2d[<eed`dadbdcddd_ZAed*efe2da<eededfdgdhdidjdkdlZBed*efe2dh<edmdndoZCee0dpdqdTdTdrdsZDed*efe2dq<ee0dtdudTddTdvdwZEed*efe2du<eedxdydzd{d|e!jFd}d~ZGed*efe2d{<edmddZHeeddd.ddd0ZIed*efe2d<edmddZJedmddZKedmddZLedmddZMedmddZNee(e(e ddddZOee0ddddddTdedeOdd ZPed*efe2d<e eedddZQee(e(e ddddZRee(e(e ddddZSedmddZTedmddZUeedddddddZVed*efe2d<e(eeeWd*fee(fdddZXee(e(e ddddZYeeddddeYd\de dd ZZed*efe2d<eedddddd~Z[ed*efe2d<eedddddddZ\ed*efe2d<e ddddZ]e e#dddZ^edmddÄZ_ee0ddeddTddǍZ`ed*efe2d<ee(e(e ddȜddʄZaeedddeadd͍Zbed*efe2d<eedddd.ddd0Zced*efe2d<eeddd.dd)Zded*efe2d<eedddddd0Zeed*efe2d<ee(e(e ddȜddބZfeeddd.ddd0Zgee2d<eedddefdedZhee2d<eeddddddZied*efe2d<eeddddddZjed*efe2d<eeddddddZked*efe2d<eedd.dddZled*efe2d<eedd.dddZmed*efe2d<eeddd.ddd0Zned*efe2d<ee(e(e ddddZoeedddeodddZped*efe2d<eeddd.ddd0Zqed*efe2d<ee0ddTdTdddZred*efe2d <e ddd d Zsee0d d dddddZted*efe2d<eeddd.ddd0Zued*efe2d<eeddddggdddZved*efe2d<eeddddgdd gd!dZwed*efe2d"<d#e1e3e4e5e6e8e9e>e?e@eAeBeCeKeDeEe`ebene7euevewgd$Zxee(efe2d%<d&eGeHeIeJgd$Zyee(efe2d'<dS(*aC shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. N)partial) SUPPRESS_HELPOption OptionGroup OptionParserValues)dedent)AnyCallableDictOptionalTuplecanonicalize_name)ConfigOptionParser) BAR_TYPES) CommandError)USER_CACHE_DIRget_src_prefix) FormatControl)PyPI) TargetPython) STRONG_HASHES) strtobool)parseroptionmsgreturncCs0|d|}td|}||dS)z Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. z error:  N)textwrapfilljoinspliterror)rrrr$/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error"s r&)grouprrcCs,t||d}|dD]}||q|S)z Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser nameoptions)r add_option)r'r option_grouprr$r$r%make_option_group0s r,)r) check_optionsrcsZdur |tttdfdd }gd}tt||rV|j}|tjddddS) zDisable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. N)nrcs t|dSN)getattr)r.r-r$r%getnameHsz+check_install_build_global..getname) build_optionsglobal_optionsinstall_optionszbDisabling all use of wheels due to the use of --build-option / --global-option / --install-option.) stacklevel) strr r anymapformat_controldisallow_binarieswarningswarn)r)r-r2namescontrolr$r1r%check_install_build_global<s rAF)r) check_targetrcCsbt|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|r^|r^|j s^t ddS)zFunction for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. z:all:zWhen restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).zQCan not use any platform or abi specific options unless installing via '--target'N) r9python_version platformsabisimplementationrsetr;ignore_dependenciesr target_dir)r)rBdist_restriction_set binary_onlysdist_dependencies_allowedr$r$r%check_dist_restrictionVs&  rM)roptvaluercCs tj|Sr/)ospath expanduserrrNrOr$r$r%_path_option_check~srTcCst|Sr/rrSr$r$r%_package_name_option_checksrUc@s0eZdZejdZejZeed<eed<dS) PipOption)rQ package_namerWrQN) __name__ __module__ __qualname__rTYPES TYPE_CHECKERcopyrUrTr$r$r$r%rVs  rVz-hz--helphelpz Show help.)destactionr^.help_z--debug debug_mode store_truezbLet unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.r_r`defaultr^z --isolated isolated_modezSRun pip in an isolated mode, ignoring environment variables and user configuration.z--require-virtualenvz--require-venv require_venvrequire_virtualenvz-vz --verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z --no-colorno_colorzSuppress colored output.z-Vz --versionversionzShow version and exit.z-qz--quietquietzGive less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).z--progress-bar progress_barchoiceonz*Specify type of progress to be displayed [|z] (default: %default))r_typechoicesrer^z--logz --log-filez --local-loglogrQz Path to a verbose appending log.)r_metavarrrr^z --no-inputno_inputzDisable prompting for input.z--proxyproxyr8z/src". The default for global installs is "/src".)r_rrrurer`rr^src)rrrcCs t||jS)zGet a format_control object.)r0r_)rrr$r$r%_get_format_controlsrcCs"t|j|}t||j|jdSr/)rrrhandle_mutual_excludes no_binary only_binaryrrrOrexistingr$r$r%_handle_no_binarys  rcCs"t|j|}t||j|jdSr/)rrrrrrrr$r$r%_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr;rr8avDo not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty the set (notice the colons), or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.r_r`rrrrer^)rrGrrr;r$r$r%rsrc Cs$ttt}tdddtd|ddS)Nz --only-binaryr;rr8aKDo not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all source packages, ":none:" to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r)rrGrrrr$r$r%rsrz --platformrDplatformrzOnly use wheels compatible with . Defaults to the platform of the running system. Use this option multiple times to specify multiple platforms supported by the target interpreter.r)rOrcCs|sdS|d}t|dkr"dSt|dkrV|d}t|dkrV|d|ddg}ztdd |D}WntyYd S0|dfS) z Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. )NN.)r$z'at most three version parts are allowedrNcss|]}t|VqdSr/)rz).0partr$r$r% 8z*_convert_python_version..)r$z$each version part must be an integer)r"lentuple ValueError)rOparts version_infor$r$r%_convert_python_version"s     rcCs:t|\}}|dur.d||}t|||d||j_dS)z3 Handle a provided --python-version value. Nz(invalid --python-version value: {!r}: {}rr)rformatr&rrC)rrrOrr error_msgrr$r$r%_handle_python_version?s rz--python-versionrCa The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). )r_rur`rrrrer^z--implementationrFzOnly use wheels compatible with Python implementation , e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels.z--abirEabiaLOnly use wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Use this option multiple times to specify multiple abis supported by the target interpreter. Generally you will need to specify --implementation, --platform, and --python-version when using this option.)cmd_optsrcCs4|t|t|t|tdSr/)r*rDrCrFrE)rr$r$r%add_target_python_optionss   r)r)rcCst|j|j|j|jd}|S)N)rDpy_version_inforErF)rrDrCrErF)r) target_pythonr$r$r%make_target_pythonsrcCstddddddS)Nz--prefer-binary prefer_binaryrcFz8Prefer older binary packages over newer source packages.rdrr$r$r$r%rsrz --cache-dir cache_dirzStore the cache data in .)r_rerurrr^)rrNrOrrc CsX|durLz t|Wn6tyJ}zt||t|dWYd}~n d}~00d|j_dS)z Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. NrF)rrr&r8rr)rrNrOrexcr$r$r%_handle_no_cache_dirs  ( rz--no-cache-dirzDisable the cache.)r_r`rr^no_cachez --no-depsz--no-dependenciesrHz#Don't install package dependencies.no_depsz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationbuild_isolation store_falseTzDisable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used.no_build_isolationcCs&|durd}t|||dd|j_dS)z Process a value provided for the --no-use-pep517 option. This is an optparse.Option callback for the no_use_pep517 option. Na0A value was passed for --no-use-pep517, probably using either the PIP_NO_USE_PEP517 environment variable or the "no-use-pep517" config file option. Use an appropriate value of the PIP_USE_PEP517 environment variable or the "use-pep517" config file option instead. rF)r&r use_pep517)rrNrOrrr$r$r%_handle_no_use_pep517s rz --use-pep517rz^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)r_r`rrer^ no_use_pep517z--install-optionr5r)a"Extra arguments to be supplied to the setup.py install command (use like --install-option="--install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.)r_r`rur^z--build-optionr3z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)r_rur`r^z--global-optionr4zcExtra global options to be supplied to the setup.py call before the install or bdist_wheel command.z --no-cleanz!Don't clean up build directories.)r`rer^no_cleanz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.prez--disable-pip-version-checkdisable_pip_version_checkz{Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.cCs|jjsi|j_z|dd\}}Wn"tyF|d|Yn0|tvrh|d|dt|jj|g |dS)zkGiven a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.:rzTArguments to {} must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N) rhashesr"rr#rrr! setdefaultr)rrrOralgodigestr$r$r%_handle_merge_hash[s"   rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)r_r`rrrr^hashz--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.z--pathz^Restrict to the specified installation path for listing packages (can be used multiple times).)r_rrr`r^ list_pathcCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')rQuserlocalr)r)r$r$r%check_list_path_optionsrz --excludeexcludespackagerWz)Exclude specified package from the output)r_r`rurrr^ list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z --use-featurefeatures_enabledfeature)z 2020-resolverz fast-depsz in-tree-buildzs              (                       $                       PK+]e&F&&%cli/__pycache__/parser.cpython-39.pycnu[a Re$*@sdZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZmZddlmZmZeeZGdd d ejZGd d d eZGd d d ejZGdddeZdS)zBase option parser setupN)suppress)AnyDictIteratorListTuple) UNKNOWN_ERROR) ConfigurationConfigurationError)redact_auth_from_url strtoboolcseZdZdZeeddfdd ZejedddZ dejeeed d d Z eedddZ eedddZ eedddZ eedddZeeedddZZS)PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.N)argskwargsreturncs:d|d<d|d<tdd|d<tj|i|dS)Nmax_help_positionindent_incrementrwidth)shutilget_terminal_sizesuper__init__)selfrr __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/parser.pyrszPrettyHelpFormatter.__init__optionrcCs ||SN)_format_option_strings)rr!rrrformat_option_stringssz)PrettyHelpFormatter.format_option_strings <{}>, )r!mvarfmtoptseprcCsg}|jr||jd|jr0||jdt|dkrH|d||r|jdus^J|jpl|j}|| |d |S)z Return a comma-separated list of option strings and metavars. :param option: tuple of (short opt, long opt), e.g: ('-f', '--format') :param mvarfmt: metavar format string :param optsep: separator rrN) _short_optsappend _long_optsleninsert takes_valuedestmetavarlowerformatjoin)rr!r'r(optsr1rrrr#s   z*PrettyHelpFormatter._format_option_strings)headingrcCs|dkr dS|dS)NOptionsr): r)rr6rrrformat_heading9sz"PrettyHelpFormatter.format_heading)usagercCsd|t|d}|S)zz Ensure there is only one newline between usage and the first heading if there is no description. z Usage: {}  )r3 indent_linestextwrapdedent)rr:msgrrr format_usage>sz PrettyHelpFormatter.format_usage) descriptionrcCsZ|rRt|jdrd}nd}|d}|}|t|d}|d|d}|SdSdS)NmainCommands Description r;r8r))hasattrparserlstriprstripr<r=r>)rrAlabelrrrformat_descriptionFs  z&PrettyHelpFormatter.format_description)epilogrcCs|r|SdSdS)Nr)r)rrLrrr format_epilogXsz!PrettyHelpFormatter.format_epilog)textindentrcs"fdd|dD}d|S)Ncsg|] }|qSrr).0linerOrr `z4PrettyHelpFormatter.indent_lines..rE)splitr4)rrNrO new_linesrrRrr<_sz PrettyHelpFormatter.indent_lines)r%r&)__name__ __module__ __qualname____doc__rroptparseOptionstrr$r#r9r@rKrMr< __classcell__rrrrr s r cs*eZdZdZejedfdd ZZS)UpdatingDefaultsHelpFormatterzCustom help formatter for use in ConfigOptionParser. This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. Also redact auth from url type options r csd}|jdurLt|jtsJ|j|jj|jdustd|q$|dd\}}||vr$||||fq$|D] }||D]\}}||fVqzqndS)Nglobalz:env:cSsi|] }|gqSrr)rPr}rrr szGConfigOptionParser._get_ordered_configuration_items..z7Ignoring configuration key '%s' as it's value is empty..r)r}r~itemsloggerdebugrUr+)roverride_order section_items section_keyrksectionrrrr _get_ordered_configuration_itemss" z3ConfigOptionParser._get_ordered_configuration_items)rdrc stj_t}D]\}ddur>qjdusLJjdvrz t |}Wn$t y d |Yn0nDjdkr"t t t |}Wdn1s0Yt t t|}Wdn1s0Yt|tr|dkrЈ d |njdkrN|}fd d |D}njd krˆjdusjJ|j}||}jpd }jpi}j||g|Ri|n|}||j<q|D]tj|<qd_|S) zUpdates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).z--N) store_true store_falsezm{} is not a valid value for {} option, please specify a boolean value like yes/no, true/false or 1/0 instead.countrz{} is not a valid value for {} option, please instead specify either a non-negative integer or a boolean value like yes/no or false/true which is equivalent to 1/0.r+csg|]}|qSr)r)rPvrr!rrrrSrTz7ConfigOptionParser._update_defaults..callbackr)r[Valuesrdvaluessetr get_optionr0actionr ValueErrorerrorr3rryrarUraddget_opt_string convert_value callback_argscallback_kwargsrgetattr)rrd late_evalrkopt_strrrrrrrcsX     & &        z#ConfigOptionParser._update_defaultsc Cs|jst|jSz|jWn4tyT}z|tt |WYd}~n d}~00| |j }| D]B}|j dusJ||j }t|t rn|}|||||j <qnt|S)zOverriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.N)process_default_valuesr[rrdr~loadr rrr]rccopy_get_all_optionsr0rerarr)rerrrdr!defaultrrrrget_default_values s &   z%ConfigOptionParser.get_default_values)r?rcCs"|tj|t|ddS)NrE) print_usagerstderrrr)rr?rrrr"s zConfigOptionParser.error)rWrXrYrZrr]boolrr[r\rrrrrrcrrrr^rrrrrbs  @rb)rZloggingr[rrr= contextlibrtypingrrrrrpip._internal.cli.status_codesrpip._internal.configurationr r pip._internal.utils.miscr r getLoggerrWrIndentedHelpFormatterr r_ OptionParserrlrbrrrrs   R PK+]k+cli/__pycache__/base_command.cpython-39.pycnu[a Ren@s<dZddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z m Z mZddlmZddlmZddlmZmZddlmZmZmZmZdd lmZmZmZmZm Z m!Z!dd l"m#Z#dd l$m%Z%m&Z&dd l'm(Z(m)Z)dd l*m+Z,ddl*m-Z-m.Z.ddl/m0Z0dgZ1e2e3Z4GdddeZ5dS)z(Base Command class, and related routinesN)Values)AnyCallableListOptionalTuple) cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERROR UNKNOWN_ERRORVIRTUALENV_NOT_FOUND) BadCommand CommandErrorInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorUninstallationError)check_path_owner)BrokenStdoutLoggingError setup_logging)get_prognormalize_path)TempDirectoryTypeRegistry)global_tempdir_managertempdir_registry)running_under_virtualenvCommandcseZdZUdZeed<dZeed<deeeddfdd Zdd d d Z e dd d dZ e e ee dddZe eee e efdddZe ee dddZe ee dddZZS)rusageFignore_require_venvN)namesummaryisolatedreturnc st||_||_t|jtd|td||j|d|_ d|_ |j d}t |j ||_ttj|j }|j ||dS)N F)r!prog formatteradd_help_optionr# descriptionr%z Options)super__init__r#r$r r!rr __doc__parserr capitalizeoptparse OptionGroupcmd_optsrmake_option_group general_groupadd_option_group add_options)selfr#r$r% optgroup_namegen_opts __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/base_command.pyr-.s*   zCommand.__init__)r&cCsdSNr=)r8r=r=r>r7LszCommand.add_options)optionsr&cCst|drJdS)zf This is a no-op so that commands by default do not do the pip version check. no_indexN)hasattr)r8r@r=r=r>handle_pip_version_checkOsz Command.handle_pip_version_check)r@argsr&cCstdSr?)NotImplementedError)r8r@rDr=r=r>runXsz Command.runrDr&cCs |j|Sr?)r/ parse_argsr8rDr=r=r>rH[szCommand.parse_argscCsXzH|$||WdWtS1s40YWtn t0dSr?) main_context_mainloggingshutdownrIr=r=r>main_s  z Command.mainc sB|t|_|t||\}}|j|j|_t|j|j|j d|j rZdt j d<|j rrd|j t j d<|jr|jststdtt|jrt|j|_t|jstd|jd|_d|jvrtd td tftd tfd fd d }z0|js||j}n|j}|||W| |S| |0dS)N) verbosityno_color user_log_file1 PIP_NO_INPUTr'PIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zThe directory '%s' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.z 2020-resolverz--use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0..)run_funcr&cs$tttdfdd }|S)NrGc sz|}t|tsJ|WSty`}z,tt|tjdddtWYd}~Sd}~0tt t t fy}z,tt|tjdddt WYd}~Sd}~0t y}z*td|tjdddt WYd}~Sd}~0ty*tdtjdtjkr"tjtjdt YStyXtdtjdddt YSty|tjdddtYS0dS) NzException information:T)exc_infoz%sz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz Exception:) isinstanceintrloggercriticalstrdebugr rrrrr rrprintsysstderrrLDEBUG traceback print_excKeyboardInterrupt BaseExceptionr)rDstatusexc) level_numberrUr=r>exc_logging_wrappersB    zLCommand._main..intercepts_unhandled_exc..exc_logging_wrapper) functoolswrapsrrY)rUrirh)rUr>intercepts_unhandled_excs+z/Command._main..intercepts_unhandled_exc)! enter_contextrrrHverbosequietrOrrPlogno_inputosenviron exists_actionjoin require_venvr"rrZr[r_exitr cache_dirrrwarningfeatures_enabledrrY debug_moderFrC)r8rDr@rmrFr=rlr>rKfsP           1   z Command._main)F)__name__ __module__ __qualname__r!r\__annotations__r"boolr-r7rrCrrYrFrrHrNrK __classcell__r=r=r;r>r*s     )6r.rjrLlogging.configr1rsr_rbrtypingrrrrrZpip._internal.clir!pip._internal.cli.command_contextr pip._internal.cli.parserr r pip._internal.cli.status_codesr r rrpip._internal.exceptionsrrrrrrpip._internal.utils.filesystemrpip._internal.utils.loggingrrpip._internal.utils.miscrrpip._internal.utils.temp_dirrTempDirRegistryrrpip._internal.utils.virtualenvr__all__ getLoggerr}rZrr=r=r=r>s.        PK+]+cli/__pycache__/status_codes.cpython-39.pycnu[a Ret@sdZdZdZdZdZdZdS)N)SUCCESSERROR UNKNOWN_ERRORVIRTUALENV_NOT_FOUNDPREVIOUS_BUILD_DIR_ERRORNO_MATCHES_FOUNDr r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/status_codes.pys PK+]S00-cli/__pycache__/autocompletion.cpython-39.pycnu[a Re@sdZddlZddlZddlZddlmZddlmZmZm Z m Z ddl m Z ddl mZmZddlmZddd d Ze eeeee ed d d ZeeeedddZdS)zBLogic that powers autocompletion installed by ``pip completion``. N)chain)AnyIterableListOptional)create_main_parser) commands_dictcreate_command)get_default_environment)returncsdtjvrdStjdddttjd}z|dWntyXdYn0t}tt}g}d}D]}||vrt|}qqt|dur|dkrt d d o|d v}|r t } fd d |j d d D}|r |D] } t| qt dt|} | jjD]8} | jtjkr| j| jD]} || | jfq:qdd d|dDfdd |D}fdd |D}t|| jj} | rt| }dd |D}|D]>}|d}|dr|ddddkr|d7}t|qndd |jD}||jt|} drf|D]$} | jtjkr>|| j| j7}q>n t||} | rtt| }tdfdd |Dt ddS)z:Entry Point for completion of main and subcommand options.PIP_AUTO_COMPLETEN COMP_WORDS COMP_CWORDhelp-)show uninstallcs0g|](}|jr|jddvr|jqS)rN)canonical_name startswith).0dist)cwordslc/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py 2s z autocomplete..T) local_onlycSsg|]}|ddqS)=r)splitrxrrrrFcs g|]\}}|vr||fqSrr)rr"v) prev_optsrrrGr#cs"g|]\}}|r||fqSrr)rkr$currentrrrIr#cSsg|] }|dfqS)rr)rpathrrrrTr#rz--rcSsg|] }|jqSr) option_list)rirrrr^r# csg|]}|r|qSrr&r!r(rrrkr#) osenvironr int IndexErrorrlistrsysexitrr loweriter_installed_distributionsprintr parseroption_list_allroptparse SUPPRESS_HELP _long_opts _short_optsappendnargsget_path_completion_typeauto_complete_paths option_groupsr,r from_iterablejoin)cwordr9 subcommandsoptionssubcommand_namewordshould_list_installedenv installedr subcommandoptopt_strcompletion_typepathsoption opt_labeloptsflattened_optsr)r)rrr%r autocompletes~                rW)rrFrUr cCs|dks||ddsdS|D]n}|jtjkr4q"t|dD]L}||ddd|krB|jrtdd|jdDrB|jSqBq"dS) aLGet the type of path completion (``file``, ``dir``, ``path`` or None) :param cwords: same as the environmental variable ``COMP_WORDS`` :param cword: same as the environmental variable ``COMP_CWORD`` :param opts: The available options to check :return: path completion type (``file``, ``dir``, ``path`` or None) r+rN/rrcss|]}|dvVqdS))r*filedirNrr!rrr sz+get_path_completion_type..)rrr;r<strr metavarany)rrFrUrOorrrrAos   rA)r)rQr c#stj|\}tj|}t|tjs.dStjfddt|D}|D]`}tj||}tjtj||}|dkrtj |r|VqVtj |rVtj|dVqVdS)aoIf ``completion_type`` is ``file`` or ``path``, list all regular files and directories starting with ``current``; otherwise only list directories starting with ``current``. :param current: The word to be completed :param completion_type: path completion type(`file`, `path` or `dir`)i :return: A generator of regular files and/or directories Nc3s$|]}tj|r|VqdS)N)r/r*normcaserr!filenamerrr[sz&auto_complete_paths..rZr) r/r*r abspathaccessR_OKr`listdirrEisfileisdir)r)rQ directory current_path file_listfrO comp_filerrarrBs     rB)__doc__r;r/r4 itertoolsrtypingrrrrpip._internal.cli.main_parserrpip._internal.commandsrr pip._internal.metadatar rWr\r1rArBrrrrs   a PK+]yy#cli/__pycache__/main.cpython-39.pycnu[a Re @sdZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZeeZd eeeed d d ZdS) z Primary application entrypoint. N)ListOptional) autocomplete) parse_command)create_command)PipError) deprecation)argsreturnc Cs|durtjdd}ttzt|\}}WnNty}z6tjd|tjt j t dWYd}~n d}~00zt t jdWn2t jy}ztd|WYd}~n d}~00t|d|vd}||S)NzERROR: z%Ignoring error %s when setting localez --isolated)isolated)sysargvrinstall_warning_loggerrrrstderrwriteoslinesepexitlocale setlocaleLC_ALLErrorloggerdebugrmain)r cmd_namecmd_argsexcecommandr"/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/main.pyr-s  "r)N)__doc__rloggingrrtypingrr pip._internal.cli.autocompletionrpip._internal.cli.main_parserrpip._internal.commandsrpip._internal.exceptionsrZpip._internal.utilsr getLogger__name__rstrintrr"r"r"r#s      PK+]X֖*cli/__pycache__/main_parser.cpython-39.pycnu[a Re6 @sdZddlZddlZddlmZmZddlmZddlm Z m Z ddl m Z m Z ddlmZddlmZmZd d gZe d d d Zeeeeeefd dd ZdS)z=A single place for constructing and exposing the main parser N)ListTuple) cmdoptions)ConfigOptionParserUpdatingDefaultsHelpFormatter) commands_dictget_similar_commands) CommandError)get_pip_versionget_progcreate_main_parser parse_command)returncCsltddtdtd}|t|_ttj|}| |d|_ dgddt D}d ||_|S) z1Creates and returns the main parser for pip's CLIz %prog [options]Fglobal)usageadd_help_option formatternameprogTcSs"g|]\}}|dd|jqS)27 )summary).0r command_infor/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py 'sz&create_main_parser.. )rrr disable_interspersed_argsr versionrmake_option_group general_groupadd_option_groupmainritemsjoin description)parsergen_optsr'rrrr s"   )argsrcCst}||\}}|jr>tj|jtjtjt|rZ|ddkrjt |dkrj| t|d}|t vrt |}d|dg}|r| d|dtd||dd}||||fS)Nrhelpzunknown command ""zmaybe you meant "z - )r parse_argsr sysstdoutwriteoslinesepexitlen print_helprrappendr r&remove)r*r(general_options args_elsecmd_nameguessmsgcmd_argsrrrr 0s&   )__doc__r2r/typingrrZpip._internal.clirpip._internal.cli.parserrrpip._internal.commandsrrpip._internal.exceptionsr pip._internal.utils.miscr r __all__r strr rrrrs  PK+]40\uu'cli/__pycache__/spinners.cpython-39.pycnu[a Re@sddlZddlZddlZddlZddlZddlmZmZddlm Z m Z ddl m Z ddl mZeeZGdddZGdd d eZGd d d eZGd d d ZejeeedddZejeeeddddZdS)N)IOIterator) HIDE_CURSOR SHOW_CURSOR)WINDOWS)get_indentationc@s*eZdZddddZeddddZdS)SpinnerInterfaceNreturncCs tdSNNotImplementedErrorselfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/spinners.pyspinszSpinnerInterface.spin final_statusr cCs tdSr r rrrrrfinishszSpinnerInterface.finish)__name__ __module__ __qualname__rstrrrrrrrsrc@sTeZdZdeeeeedddZedddd Zdd d d Zedd ddZ dS)InteractiveSpinnerN-\|/?)messagefile spin_charsmin_update_interval_secondscCs\||_|durtj}||_t||_d|_t||_ |j dt |jdd|_ dS)NF z ... r) _messagesysstdout_file RateLimiter _rate_limiter _finished itertoolscycle _spin_cyclewriter_width)rrrr r!rrr__init__s  zInteractiveSpinner.__init__statusr cCs\|jr Jd|j}|j|d|j||j|t||_|j|jdS)Nr")r)r.r&r-lenflushr(reset)rr1backuprrr_write-s     zInteractiveSpinner._writer cCs,|jr dS|jsdS|t|jdSr )r)r(readyr7nextr,rrrrr9s  zInteractiveSpinner.spinrcCs4|jr dS|||jd|jd|_dS)N T)r)r7r&r-r4rrrrr@s    zInteractiveSpinner.finish)Nrr) rrrrrfloatr/r7rrrrrrrs  rc@sNeZdZdeeddddZeddddZdd d d Zedd d dZdS)NonInteractiveSpinnerN@N)rr!r cCs$||_d|_t||_|ddS)NFstarted)r#r)r'r(_update)rrr!rrrr/Ns zNonInteractiveSpinner.__init__r0cCs(|jr J|jtd|j|dS)Nz%s: %s)r)r(r5loggerinfor#)rr1rrrr?Ts  zNonInteractiveSpinner._updater cCs&|jr dS|jsdS|ddS)Nzstill running...)r)r(r8r?rrrrrYs  zNonInteractiveSpinner.spinrcCs&|jr dS|d|dd|_dS)Nzfinished with status ''T)r)r?rrrrr`szNonInteractiveSpinner.finish)r=) rrrrr;r/r?rrrrrrr<Msr<c@s8eZdZeddddZedddZdddd ZdS) r'N)r!r cCs||_d|_dS)Nr)_min_update_interval_seconds _last_update)rr!rrrr/hszRateLimiter.__init__r cCst}||j}||jkSr )timerDrC)rnowdeltarrrr8ls zRateLimiter.readycCst|_dSr )rErDrrrrr5qszRateLimiter.reset)rrrr;r/boolr8r5rrrrr'gsr')rr ccstjr"ttjkr"t|}nt|}z4t tj|VWdn1sR0YWn:t y|| dYn(t y| dYn 0| ddS)Ncancelederrordone) r$r%isattyr@getEffectiveLevelloggingINFOrr< hidden_cursorKeyboardInterruptr Exception)rspinnerrrr open_spinnerus  (    rT)rr c csZtr dVnJ|r"ttjkr*dVn,|tzdVW|tn |t0dSr ) rrLr@rMrNrOr-rr)rrrrrPs rP) contextlibr*rNr$rEtypingrrZpip._vendor.progressrrpip._internal.utils.compatrpip._internal.utils.loggingr getLoggerrr@rrr<r'contextmanagerrrTrPrrrrs"   5PK+]q8i0i0*cli/__pycache__/req_command.cpython-39.pycnu[a ReB@sdZddlZddlZddlZddlmZddlmZddlm Z m Z m Z m Z ddl mZddlmZddlmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8ddl9m:Z:e;e<Z=GdddeZ>Gdddee>Z?e8j@e8jAe8jBgZCdddd ZDe e d!d"d#ZEGd$d%d%e?ZFdS)&aContains the Command base classes that depend on PipSession. The classes in this module are in a separate module so the commands not needing download / PackageFinder capability don't unnecessarily import the PackageFinder machinery and all its vendored dependencies, etc. N)partial)Values)AnyListOptionalTuple) WheelCache) cmdoptions)Command)CommandContextMixIn) CommandErrorPreviousBuildDirError) LinkCollector) PackageFinder)SelectionPreferences) TargetPython) PipSession)RequirementPreparer)install_req_from_editableinstall_req_from_line#install_req_from_parsed_requirementinstall_req_from_req_string)parse_requirements)InstallRequirement)RequirementTracker) BaseResolver)pip_self_version_check) deprecated) TempDirectoryTempDirectoryTypeRegistry tempdir_kinds)running_under_virtualenvcspeZdZdZddfdd Zeeeee dddZ ee dd d Z deee ee e d d d ZZS)SessionCommandMixinzE A class mixin for command classes needing _build_session(). Nreturncstd|_dSN)super__init___session)self __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/req_command.pyr'6s zSessionCommandMixin.__init__optionsr$cCsLg}t|dds*t|dd}|r*||t|dd}|rD|||pJdS)z7Return a list of index urls from user-provided options.no_indexF index_urlNextra_index_urls)getattrappendextend)clsr/ index_urlsurlurlsr,r,r-_get_index_urls:s     z#SessionCommandMixin._get_index_urlscCs0|jdur*||||_|jdus*J|jS)zGet a default-managed session.N)r( enter_context_build_session)r)r/r,r,r-get_default_sessionHs z'SessionCommandMixin.get_default_session)r/retriestimeoutr$cCs|jrtj|jsJt|jr0tj|jdnd|dur>|n|j|j||d}|j rb|j |_ |j rp|j |_ |j sz|r|dur|n|j |_ |j r|j |j d|_|j |j_|S)Nhttp)cacher> trusted_hostsr7)r@https) cache_dirospathisabsrjoinr>rBr:certverify client_certr?proxyproxiesno_inputauth prompting)r)r/r>r?sessionr,r,r-r<Rs&   z"SessionCommandMixin._build_session)NN)__name__ __module__ __qualname____doc__r' classmethodrrrstrr:rr=intr< __classcell__r,r,r*r-r"0s  r"c@s eZdZdZeddddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. Nr.cCsht|dsJ|js|jrdS|j|dtd|jd}|t||Wdn1sZ0YdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r0Nr)r>r?)hasattrdisable_pip_version_checkr0r<minr?r)r)r/rQr,r,r-handle_pip_version_checks z*IndexGroupCommand.handle_pip_version_check)rRrSrTrUrr_r,r,r,r-rZ{srZr#cCsNtr dSttdsdStjdks,tjdkr0dStdkr@dStddS)zOutput a warning for sudo users on Unix. In a virtual environment, sudo pip still writes to virtualenv. On Windows, users may run pip as Administrator without issues. This warning only applies to Unix root users outside of virtualenv. Ngetuidwin32cygwinrzRunning pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv)r!r\rEsysplatformr`loggerwarningr,r,r,r-warn_if_run_as_roots  rg)funcr$cs6tddddttttttdfdd }|S)zNDecorator for common logic related to managing temporary directories. N)registryr$cSstD]}||dqdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)ritr,r,r-configure_tempdir_registrysz0with_cleanup..configure_tempdir_registry)r)r/argsr$csP|jdusJ|jr|jz|||WStyJ|jYn0dSr%)tempdir_registryno_cleanr )r)r/rnrmrhr,r-wrappers   zwith_cleanup..wrapper)rRequirementCommandrrrrrX)rhrrr,rqr- with_cleanups  rtcseZdZeeddfdd ZeeedddZe de ee e e eeeedd d Ze dee eeeeeeeeeeeeedfed ddZeeee e eedddZee ddddZdee eeeee dddZZS)rsN)rnkwr$cs&tj|i||jtdSr%)r&r'cmd_opts add_optionr rp)r)rnrur*r,r-r'szRequirementCommand.__init__r.cCsd|jvrdSdS)zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy 2020-resolver)deprecated_features_enabledr/r,r,r-determine_resolver_variants z-RequirementCommand.determine_resolver_variant)temp_build_dirr/ req_trackerrQfinder use_user_site download_dirr$c Cs|j}|dusJ||} | dkr>d|jv} | rVtdnd} d|jvrVtdd|jv} d|jvrxtd d d d d|jvrtd dd d t||j||j |||j ||j || | d S)zQ Create a RequirementPreparer instance for the given parameters. Nryz fast-depszpip is using lazily downloaded wheels using HTTP range requests to obtain dependency information. This experimental feature is enabled through --use-feature=fast-deps and it is not ready for production.Fz;fast-deps has no effect when used with the legacy resolver.zout-of-tree-buildz in-tree-buildz#In-tree builds are now the default.z.to remove the --use-feature=in-tree-build flagz22.1)reason replacementgone_inz"Out-of-tree builds are deprecated.) build_dirsrc_dirrbuild_isolationr~rQ progress_barrrequire_hashesr lazy_wheel in_tree_build) rFr|features_enabledrerfrzrrrrrr) r6r}r/r~rQrrrtemp_build_dir_pathresolver_variantrrr,r,r-make_requirement_preparersR       z,RequirementCommand.make_requirement_preparerFTto-satisfy-only.) preparerrr/ wheel_cacherignore_installedignore_requires_pythonforce_reinstallupgrade_strategy use_pep517py_version_infor$c  Cstt|j| d} ||} | dkrTddl}|jjjjj |||| ||j |||| | d Sddl }|jjj jj |||| ||j |||| | d S)zF Create a Resolver instance for the given parameters. )isolatedrryrN) rrrmake_install_reqrignore_dependenciesrrrrr) rr isolated_moder|,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibresolverResolverr(pip._internal.resolution.legacy.resolverrx)r6rrr/rrrrrrrrrrpipr,r,r- make_resolver&sF    z RequirementCommand.make_resolver)rnr/rrQr$c CsTg}|jD]6}t|d|||dD]}t||jdd}||q q |D]$} t| d|j|jdd}||qF|jD]"} t| d|j|jd}||qr|j D]8}t||||dD]"}t||j|jdd}||qqt d d |Drd|_ |sP|jsP|j sPd |j i} |j rz6RequirementCommand.get_requirements..namezXYou must give at least one requirement to {name} (maybe you meant "pip {name} {links}"?) )linkszHYou must give at least one requirement to {name} (see "pip help {name}")) constraintsrrrr4rr editablesr requirementsanyrr find_linksr formatdictrH) r)rnr/rrQrfilename parsed_req req_to_addroptsr,r,r-get_requirementsasv         z#RequirementCommand.get_requirements)rr$cCs |j}|}|rt|dS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsreinfo)rr locationsr,r,r-trace_basic_infosz#RequirementCommand.trace_basic_info)r/rQ target_pythonrr$cCs6tj||d}td|j|j|j|d}tj|||dS)z Create a package finder appropriate to this requirement command. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. r{T) allow_yankedformat_controlallow_all_prereleases prefer_binaryr)link_collectorselection_prefsr)rcreaterrprerr)r)r/rQrrrrr,r,r-_build_package_finders z(RequirementCommand._build_package_finder)N)NFTFFrNN)NN)rRrSrTrr' staticmethodrrWr|rVrrrrboolrrrrrrXrrrrrrrrrYr,r,r*r-rssn ?< Ors)GrUloggingrErc functoolsroptparsertypingrrrrpip._internal.cacherZpip._internal.clir pip._internal.cli.base_commandr !pip._internal.cli.command_contextr pip._internal.exceptionsr r pip._internal.index.collectorr"pip._internal.index.package_finderr$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.network.sessionr pip._internal.operations.preparerpip._internal.req.constructorsrrrrZpip._internal.req.req_filerZpip._internal.req.req_installrpip._internal.req.req_trackerrpip._internal.resolution.baser!pip._internal.self_outdated_checkrpip._internal.utils.deprecationrpip._internal.utils.temp_dirrrr pip._internal.utils.virtualenvr! getLoggerrRrer"rZ BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDrjrgrtrsr,r,r,r-sH                    KPK+]9 ,cli/__pycache__/progress_bars.cpython-39.pycnu[a Rel @sUddlZddlZddlmZmZmZddlmZddlmZm Z m Z ddl m Z ddl mZddlmZddlmZzdd lmZWneydZYn0eeed d d Zee eZeed <GdddZGdddeZGddde ZGdddZGdddZGdddeeeZGdddeeZGdddeeZ GdddeeZ!Gd d!d!ee Z"Gd"d#d#eeZ#Gd$d%d%eeee Z$e e fee$fe!e$fe"e$fe#e$fd&Z%d)d'd(Z&dS)*N)SIGINTdefault_int_handlersignal)Any)BarFillingCirclesBarIncrementalBar)Spinner)WINDOWS)get_indentation) format_size)colorama) preferredfallbackreturncCsvt|jdd}|s|St|ddt|ddg}|tt|dg7}zd||Wntyl|YS0|SdS)Nencoding empty_fillfillphases)getattrfilelistjoinencodeUnicodeEncodeError)rrr charactersr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py_select_progress_classs    r_BaseBarcsDeZdZdZeeddfdd Zddfdd Zd d ZZS) InterruptibleMixina Helper to ensure that self.finish() gets called on keyboard interrupt. This allows downloads to be interrupted without leaving temporary state (like hidden cursors) behind. This class is similar to the progress library's existing SigIntMixin helper, but as of version 1.2, that helper has the following problems: 1. It calls sys.exit(). 2. It discards the existing SIGINT handler completely. 3. It leaves its own handler in place even after an uninterrupted finish, which will have unexpected delayed effects if the user triggers an unrelated keyboard interrupt some time after a progress-displaying download has already completed, for example. Nargskwargsrcs4tj|i|tt|j|_|jdur0t|_dS)z= Save the original SIGINT handler for later. N)super__init__rr handle_sigintoriginal_handlerrselfr#r$ __class__rrr&Es zInterruptibleMixin.__init__rcsttt|jdS)z Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. N)r%finishrrr(r*r+rrr.Vs zInterruptibleMixin.finishcCs||||dS)z Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. N)r.r()r*signumframerrrr'`sz InterruptibleMixin.handle_sigint) __name__ __module__ __qualname____doc__rr&r.r' __classcell__rrr+rr!3s r!c@seZdZddddZdS) SilentBarNr-cCsdSNrr/rrrupdatelszSilentBar.update)r2r3r4r9rrrrr7ksr7c@seZdZdZdZdZdZdS) BlueEmojiBar %(percent)d%% )u🔹u🔷u🔵N)r2r3r4suffix bar_prefix bar_suffixrrrrrr:psr:csdeZdZeeddfdd ZeedddZeeddd Zeedd d Z d d Z Z S)DownloadProgressMixinNr"cs,tj|i|dtd|j|_dS)Nr<)r%r&r messager)r+rrr&yszDownloadProgressMixin.__init__r-cCs t|jSr8)r indexr/rrr downloaded~sz DownloadProgressMixin.downloadedcCs |jdkrdStd|jdS)Ngz...z/s)avgr r/rrrdownload_speeds z$DownloadProgressMixin.download_speedcCs|jrd|jSdS)Nzeta r)etaeta_tdr/rrr pretty_etas z DownloadProgressMixin.pretty_etaccs*|D]}|V|t|q|dSr8)nextlenr.)r*itxrrriterszDownloadProgressMixin.iter) r2r3r4rr&propertystrrDrGrJrOr6rrr+rr@xsr@cs&eZdZeeddfdd ZZS) WindowsMixinNr"cs\trjrd_tj|i|trXtrXtj_fddj_fddj_dS)NFcs jjSr8)rwrappedisattyrr/rrz'WindowsMixin.__init__..cs jjSr8)rrSflushrr/rrrUrV) r hide_cursorr%r&r AnsiToWin32rrTrWr)r+r/rr&s zWindowsMixin.__init__)r2r3r4rr&r6rrr+rrRsrRc@seZdZejZdZdZdS)BaseDownloadProgressBarr;z0%(downloaded)s %(download_speed)s %(pretty_eta)sN)r2r3r4sysstdoutrrBr=rrrrrZsrZc@s eZdZdS)DefaultDownloadProgressBarNr2r3r4rrrrr]sr]c@s eZdZdS)DownloadSilentBarNr^rrrrr_sr_c@s eZdZdS) DownloadBarNr^rrrrr`sr`c@s eZdZdS)DownloadFillingCirclesBarNr^rrrrrasrac@s eZdZdS)DownloadBlueEmojiProgressBarNr^rrrrrbsrbc@s2eZdZejZdZedddZddddZ dS)DownloadProgressSpinnerz!%(downloaded)s %(download_speed)sr-cCs"t|dst|j|_t|jS)N_phaser)hasattr itertoolscyclerrdrKr/rrr next_phases z"DownloadProgressSpinner.next_phaseNcCsN|j|}|}|j|}d||r*dnd||r6dnd|g}||dS)Nrr<)rBrhr=rwriteln)r*rBphaser=linerrrr9s     zDownloadProgressSpinner.update) r2r3r4r[r\rr=rQrhr9rrrrrcsrc)offonasciiprettyemojicCs8|dus|dkr t|djSt|d|djSdS)NrrE)max) BAR_TYPESrO) progress_barrqrrrDownloadProgressProvidersrt)N)'rfr[rrrtypingrpip._vendor.progress.barrrrpip._vendor.progress.spinnerr pip._internal.utils.compatr pip._internal.utils.loggingr pip._internal.utils.miscr pip._vendorr Exceptionrr __annotations__r!r7r:r@rRrZr]r_r`rarbrcrrrtrrrrsF        8   PK+]O`77'cli/__pycache__/__init__.cpython-39.pycnu[a Re@sdZdS)zGSubpackage containing all of pip's command line interface related code N)__doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/__init__.pyPK+]$%cli/spinners.pynu[import contextlib import itertools import logging import sys import time from typing import IO, Iterator from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import get_indentation logger = logging.getLogger(__name__) class SpinnerInterface: def spin(self) -> None: raise NotImplementedError() def finish(self, final_status: str) -> None: raise NotImplementedError() class InteractiveSpinner(SpinnerInterface): def __init__( self, message: str, file: IO[str] = None, spin_chars: str = "-\\|/", # Empirically, 8 updates/second looks nice min_update_interval_seconds: float = 0.125, ): self._message = message if file is None: file = sys.stdout self._file = file self._rate_limiter = RateLimiter(min_update_interval_seconds) self._finished = False self._spin_cycle = itertools.cycle(spin_chars) self._file.write(" " * get_indentation() + self._message + " ... ") self._width = 0 def _write(self, status: str) -> None: assert not self._finished # Erase what we wrote before by backspacing to the beginning, writing # spaces to overwrite the old text, and then backspacing again backup = "\b" * self._width self._file.write(backup + " " * self._width + backup) # Now we have a blank slate to add our status self._file.write(status) self._width = len(status) self._file.flush() self._rate_limiter.reset() def spin(self) -> None: if self._finished: return if not self._rate_limiter.ready(): return self._write(next(self._spin_cycle)) def finish(self, final_status: str) -> None: if self._finished: return self._write(final_status) self._file.write("\n") self._file.flush() self._finished = True # Used for dumb terminals, non-interactive installs (no tty), etc. # We still print updates occasionally (once every 60 seconds by default) to # act as a keep-alive for systems like Travis-CI that take lack-of-output as # an indication that a task has frozen. class NonInteractiveSpinner(SpinnerInterface): def __init__(self, message: str, min_update_interval_seconds: float = 60.0) -> None: self._message = message self._finished = False self._rate_limiter = RateLimiter(min_update_interval_seconds) self._update("started") def _update(self, status: str) -> None: assert not self._finished self._rate_limiter.reset() logger.info("%s: %s", self._message, status) def spin(self) -> None: if self._finished: return if not self._rate_limiter.ready(): return self._update("still running...") def finish(self, final_status: str) -> None: if self._finished: return self._update(f"finished with status '{final_status}'") self._finished = True class RateLimiter: def __init__(self, min_update_interval_seconds: float) -> None: self._min_update_interval_seconds = min_update_interval_seconds self._last_update: float = 0 def ready(self) -> bool: now = time.time() delta = now - self._last_update return delta >= self._min_update_interval_seconds def reset(self) -> None: self._last_update = time.time() @contextlib.contextmanager def open_spinner(message: str) -> Iterator[SpinnerInterface]: # Interactive spinner goes directly to sys.stdout rather than being routed # through the logging system, but it acts like it has level INFO, # i.e. it's only displayed if we're at level INFO or better. # Non-interactive spinner goes through the logging system, so it is always # in sync with logging configuration. if sys.stdout.isatty() and logger.getEffectiveLevel() <= logging.INFO: spinner: SpinnerInterface = InteractiveSpinner(message) else: spinner = NonInteractiveSpinner(message) try: with hidden_cursor(sys.stdout): yield spinner except KeyboardInterrupt: spinner.finish("canceled") raise except Exception: spinner.finish("error") raise else: spinner.finish("done") @contextlib.contextmanager def hidden_cursor(file: IO[str]) -> Iterator[None]: # The Windows terminal does not support the hide/show cursor ANSI codes, # even via colorama. So don't even try. if WINDOWS: yield # We don't want to clutter the output with control characters if we're # writing to a file, or if the user is running with --quiet. # See https://github.com/pypa/pip/issues/3418 elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO: yield else: file.write(HIDE_CURSOR) try: yield finally: file.write(SHOW_CURSOR) PK+]jYd| cli/main.pynu["""Primary application entrypoint. """ import locale import logging import os import sys 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 logger = logging.getLogger(__name__) # Do not import and use main() directly! Using it directly is actively # discouraged by pip's maintainers. The name, location and behavior of # this function is subject to change, so calling it directly is not # portable across different pip versions. # In addition, running pip in-process is unsupported and unsafe. This is # elaborated in detail at # https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program. # That document also provides suggestions that should work for nearly # all users that are considering importing and using main() directly. # However, we know that certain users will still want to invoke pip # in-process. If you understand and accept the implications of using pip # in an unsupported manner, the best approach is to use runpy to avoid # depending on the exact location of this entry point. # The following example shows how to use runpy to invoke pip in that # case: # # sys.argv = ["pip", your, args, here] # runpy.run_module("pip", run_name="__main__") # # Note that this will exit the process after running, unlike a direct # call to main. As it is not safe to do any processing after calling # main, this should not be an issue in practice. def main(args: Optional[List[str]] = None) -> int: if args is None: args = sys.argv[1:] # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write(f"ERROR: {exc}") sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, "") except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) return command.main(cmd_args) PK+]sOl l cli/progress_bars.pynu[import itertools import sys from signal import SIGINT, default_int_handler, signal from typing import Any from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar from pip._vendor.progress.spinner import Spinner from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import get_indentation from pip._internal.utils.misc import format_size try: from pip._vendor import colorama # Lots of different errors can come from this, including SystemError and # ImportError. except Exception: colorama = None def _select_progress_class(preferred: Bar, fallback: Bar) -> Bar: encoding = getattr(preferred.file, "encoding", None) # If we don't know what encoding this file is in, then we'll just assume # that it doesn't support unicode and use the ASCII bar. if not encoding: return fallback # Collect all of the possible characters we want to use with the preferred # bar. characters = [ getattr(preferred, "empty_fill", ""), getattr(preferred, "fill", ""), ] characters += list(getattr(preferred, "phases", [])) # Try to decode the characters we're using for the bar using the encoding # of the given file, if this works then we'll assume that we can use the # fancier bar and if not we'll fall back to the plaintext bar. try: "".join(characters).encode(encoding) except UnicodeEncodeError: return fallback else: return preferred _BaseBar: Any = _select_progress_class(IncrementalBar, Bar) class InterruptibleMixin: """ Helper to ensure that self.finish() gets called on keyboard interrupt. This allows downloads to be interrupted without leaving temporary state (like hidden cursors) behind. This class is similar to the progress library's existing SigIntMixin helper, but as of version 1.2, that helper has the following problems: 1. It calls sys.exit(). 2. It discards the existing SIGINT handler completely. 3. It leaves its own handler in place even after an uninterrupted finish, which will have unexpected delayed effects if the user triggers an unrelated keyboard interrupt some time after a progress-displaying download has already completed, for example. """ def __init__(self, *args: Any, **kwargs: Any) -> None: """ Save the original SIGINT handler for later. """ # https://github.com/python/mypy/issues/5887 super().__init__(*args, **kwargs) # type: ignore self.original_handler = signal(SIGINT, self.handle_sigint) # If signal() returns None, the previous handler was not installed from # Python, and we cannot restore it. This probably should not happen, # but if it does, we must restore something sensible instead, at least. # The least bad option should be Python's default SIGINT handler, which # just raises KeyboardInterrupt. if self.original_handler is None: self.original_handler = default_int_handler def finish(self) -> None: """ Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. """ super().finish() # type: ignore signal(SIGINT, self.original_handler) def handle_sigint(self, signum, frame): # type: ignore """ Call self.finish() before delegating to the original SIGINT handler. This handler should only be in place while the progress display is active. """ self.finish() self.original_handler(signum, frame) class SilentBar(Bar): def update(self) -> None: pass class BlueEmojiBar(IncrementalBar): suffix = "%(percent)d%%" bar_prefix = " " bar_suffix = " " phases = ("\U0001F539", "\U0001F537", "\U0001F535") class DownloadProgressMixin: def __init__(self, *args: Any, **kwargs: Any) -> None: # https://github.com/python/mypy/issues/5887 super().__init__(*args, **kwargs) # type: ignore self.message: str = (" " * (get_indentation() + 2)) + self.message @property def downloaded(self) -> str: return format_size(self.index) # type: ignore @property def download_speed(self) -> str: # Avoid zero division errors... if self.avg == 0.0: # type: ignore return "..." return format_size(1 / self.avg) + "/s" # type: ignore @property def pretty_eta(self) -> str: if self.eta: # type: ignore return f"eta {self.eta_td}" # type: ignore return "" def iter(self, it): # type: ignore for x in it: yield x # B305 is incorrectly raised here # https://github.com/PyCQA/flake8-bugbear/issues/59 self.next(len(x)) # noqa: B305 self.finish() class WindowsMixin: def __init__(self, *args: Any, **kwargs: Any) -> None: # The Windows terminal does not support the hide/show cursor ANSI codes # even with colorama. So we'll ensure that hide_cursor is False on # Windows. # This call needs to go before the super() call, so that hide_cursor # is set in time. The base progress bar class writes the "hide cursor" # code to the terminal in its init, so if we don't set this soon # enough, we get a "hide" with no corresponding "show"... if WINDOWS and self.hide_cursor: # type: ignore self.hide_cursor = False # https://github.com/python/mypy/issues/5887 super().__init__(*args, **kwargs) # type: ignore # Check if we are running on Windows and we have the colorama module, # if we do then wrap our file with it. if WINDOWS and colorama: self.file = colorama.AnsiToWin32(self.file) # type: ignore # The progress code expects to be able to call self.file.isatty() # but the colorama.AnsiToWin32() object doesn't have that, so we'll # add it. self.file.isatty = lambda: self.file.wrapped.isatty() # The progress code expects to be able to call self.file.flush() # but the colorama.AnsiToWin32() object doesn't have that, so we'll # add it. self.file.flush = lambda: self.file.wrapped.flush() class BaseDownloadProgressBar(WindowsMixin, InterruptibleMixin, DownloadProgressMixin): file = sys.stdout message = "%(percent)d%%" suffix = "%(downloaded)s %(download_speed)s %(pretty_eta)s" class DefaultDownloadProgressBar(BaseDownloadProgressBar, _BaseBar): pass class DownloadSilentBar(BaseDownloadProgressBar, SilentBar): pass class DownloadBar(BaseDownloadProgressBar, Bar): pass class DownloadFillingCirclesBar(BaseDownloadProgressBar, FillingCirclesBar): pass class DownloadBlueEmojiProgressBar(BaseDownloadProgressBar, BlueEmojiBar): pass class DownloadProgressSpinner( WindowsMixin, InterruptibleMixin, DownloadProgressMixin, Spinner ): file = sys.stdout suffix = "%(downloaded)s %(download_speed)s" def next_phase(self) -> str: if not hasattr(self, "_phaser"): self._phaser = itertools.cycle(self.phases) return next(self._phaser) def update(self) -> None: message = self.message % self phase = self.next_phase() suffix = self.suffix % self line = "".join( [ message, " " if message else "", phase, " " if suffix else "", suffix, ] ) self.writeln(line) BAR_TYPES = { "off": (DownloadSilentBar, DownloadSilentBar), "on": (DefaultDownloadProgressBar, DownloadProgressSpinner), "ascii": (DownloadBar, DownloadProgressSpinner), "pretty": (DownloadFillingCirclesBar, DownloadProgressSpinner), "emoji": (DownloadBlueEmojiProgressBar, DownloadProgressSpinner), } def DownloadProgressProvider(progress_bar, max=None): # type: ignore if max is None or max == 0: return BAR_TYPES[progress_bar][1]().iter else: return BAR_TYPES[progress_bar][0](max=max).iter PK+]c (models/__pycache__/scheme.cpython-39.pycnu[a Re@sdZgdZGdddZdS)z For types associated with installation schemes. For a general overview of available schemes and their context, see https://docs.python.org/3/install/index.html#alternate-installation. platlibpurelibheadersscriptsdatac@s,eZdZdZeZeeeeeddddZdS)SchemeztA Scheme holds paths which are used as the base directories for artifacts associated with a Python package. N)rrrrrreturncCs"||_||_||_||_||_dS)Nr)selfrrrrrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/scheme.py__init__s zScheme.__init__)__name__ __module__ __qualname____doc__ SCHEME_KEYS __slots__strr r r r r r srN)rrrr r r r sPK+]' 0models/__pycache__/format_control.cpython-39.pycnu[a Re @s>ddlmZmZmZddlmZddlmZGdddZdS)) FrozenSetOptionalSet)canonicalize_name) CommandErrorc@seZdZdZddgZdeeeeeeddddZe e dd d Z ed d d Z e eeeeeddddZeeedddZdd ddZdS) FormatControlzBHelper for managing formats from which a package can be installed. no_binary only_binaryN)rr returncCs,|durt}|durt}||_||_dSN)setrr )selfrr r/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/format_control.py__init__ s zFormatControl.__init__)otherr cs:tjstSjjkr dStfddjDS)NFc3s"|]}t|t|kVqdSr )getattr).0krr rr !z'FormatControl.__eq__..) isinstance __class__NotImplemented __slots__all)r rrrr__eq__s   zFormatControl.__eq__)r cCsd|jj|j|jS)Nz {}({}, {}))formatr__name__rr r rrr__repr__#szFormatControl.__repr__)valuetargetrr cCs|drtd|d}d|vr`|||d|d|dd=d|vrdSq|D]2}|dkrz|qdt|}||||qddS)N-z7--no-binary / --only-binary option requires 1 argument.,:all:z:none:) startswithrsplitclearaddindexrdiscard)r"r#rnewnamerrrhandle_mutual_excludes(s&    z$FormatControl.handle_mutual_excludes)canonical_namer cCsfddh}||jvr|dn@||jvr4|dn*d|jvrJ|dnd|jvr^|dt|S)Nbinarysourcer&)r r-r frozenset)r r1resultrrrget_allowed_formats?s        z!FormatControl.get_allowed_formatscCs|d|j|jdS)Nr&)r0rr r rrrdisallow_binariesKs zFormatControl.disallow_binaries)NN)r __module__ __qualname____doc__rrrstrrobjectboolrr! staticmethodr0rr6r7rrrrrs     rN) typingrrrpip._vendor.packaging.utilsrpip._internal.exceptionsrrrrrrs  PK+]+R$5(5(&models/__pycache__/link.cpython-39.pycnu[a ReY&@s ddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZddlmZddlmZddlmZmZmZddlmZddlmZmZerddlmZeeZ d Z!Gd d d eZ"Gd d d e Z#e"e#dddZ$ej%dde"e"e&dddZ'dS)N) TYPE_CHECKINGDictList NamedTupleOptionalTupleUnion)WHEEL_EXTENSION)Hashes)redact_auth_from_urlsplit_auth_from_netlocsplitext)KeyBasedCompareMixin) path_to_url url_to_path)HTMLPage)sha1sha224sha384sha256sha512md5cs"eZdZdZgdZd>eeeedfeeeeeddfdd Z ed d d Z ed d d Z e ed ddZ e ed ddZe ed ddZe ed ddZe ed ddZe ed ddZeeefd ddZe ed ddZe ed ddZed Ze eed d!d"Zed#Ze eed d$d%Zed&jd'ed(Z e eed d)d*Z!e eed d+d,Z"e ed d-d.Z#e ed d/d0Z$ed d1d2Z%e ed d3d4Z&e ed d5d6Z'e ed d7d8Z(e ed d9d:Z)ee*ed;dr,r)r,r,r-__repr__bsz Link.__repr__cCs|jSN)rr5r,r,r-reszLink.urlcCsR|jd}t|}|s,t|j\}}|Stj|}|sNJd|j d|S)N/zURL z produced no filename) pathrstrip posixpathbasenamer netlocr$r%unquoter)r)r9namer= user_passr,r,r-filenameis   z Link.filenamecCs t|jSr7)rrr5r,r,r- file_pathwszLink.file_pathcCs|jjSr7)rschemer5r,r,r-rC{sz Link.schemecCs|jjS)z4 This can contain auth information. )rr=r5r,r,r-r=sz Link.netloccCstj|jjSr7)r$r%r>rr9r5r,r,r-r9sz Link.pathcCstt|jdS)Nr8)r r;r<r9r:r5r,r,r-r sz Link.splitextcCs |dSN)r r5r,r,r-extszLink.extcCs&|j\}}}}}tj||||dfS)Nr/)rr$r% urlunsplit)r)rCr=r9queryfragmentr,r,r-url_without_fragmentszLink.url_without_fragmentz[#&]egg=([^&]*)cCs |j|j}|sdS|dSrD)_egg_fragment_researchrgroupr)matchr,r,r- egg_fragmentszLink.egg_fragmentz[#&]subdirectory=([^&]*)cCs |j|j}|sdS|dSrD)_subdirectory_fragment_rerLrrMrNr,r,r-subdirectory_fragmentszLink.subdirectory_fragmentz({choices})=([a-f0-9]+)|)choicescCs |j|j}|r|dSdS)N_hash_rerLrrMrNr,r,r-hashs z Link.hashcCs |j|j}|r|dSdSrDrVrNr,r,r- hash_names zLink.hash_namecCs$t|jddddddS)N#rEr?)r;r<rsplitr5r,r,r-show_urlsz Link.show_urlcCs |jdkS)Nfile)rCr5r,r,r-is_filesz Link.is_filecCs|jotj|jSr7)r_osr9isdirrBr5r,r,r-is_existing_dirszLink.is_existing_dircCs |jtkSr7)rFr r5r,r,r-is_wheelsz Link.is_wheelcCsddlm}|j|jvS)Nr)vcs)pip._internal.vcsrdrC all_schemes)r)rdr,r,r-is_vcss z Link.is_vcscCs |jduSr7)rr5r,r,r- is_yankedszLink.is_yankedcCs |jduSr7)rYr5r,r,r-has_hashsz Link.has_hash)hashesr cCs@|dus|jsdS|jdus J|jdus.J|j|j|jdS)zG Return True if the link has a hash and it is allowed. NF) hex_digest)rirYrXis_hash_allowed)r)rjr,r,r-rls zLink.is_hash_allowed)NNNT)-__name__ __module__ __qualname____doc__ __slots__r1rrboolr(r3r6propertyrrArBrCr=r9rr rFrJrecompilerKrPrQrRr0join_SUPPORTED_HASHESrWrXrYr]r_rbrcrgrhrir rl __classcell__r,r,r*r-rsx .    rc@sJeZdZUdZejjed<ee e e fed<e ed<ee e fed<dS) _CleanResultaConvert link for equivalency check. This is used in the resolver to check whether two URL-specified requirements likely point to the same distribution and can be considered equivalent. This equivalency logic avoids comparing URLs literally, which can be too strict (e.g. "a=1&b=2" vs "b=2&a=1") and produce conflicts unexpecting to users. Currently this does three things: 1. Drop the basic auth part. This is technically wrong since a server can serve different content based on auth, but if it does that, it is even impossible to guarantee two URLs without auth are equivalent, since the user can input different auth information when prompted. So the practical solution is to assume the auth doesn't affect the response. 2. Parse the query to avoid the ordering issue. Note that ordering under the same key in the query are NOT cleaned; i.e. "a=1&a=2" and "a=2&a=1" are still considered different. 3. Explicitly drop most of the fragment part, except ``subdirectory=`` and hash values, since it should have no impact the downloaded content. Note that this drops the "egg=" part historically used to denote the requested project (and extras), which is wrong in the strictest sense, but too many people are supplying it inconsistently to cause superfluous resolution conflicts, so we choose to also ignore them. parsedrH subdirectoryrjN) rmrnrorpr$r% SplitResult__annotations__rr1rr,r,r,r-rys  ry)linkr c s|j}|jddd}|jdkr*|s*d}tj|jdvrLt d|zdd }Wnt t fyvd }Yn0fd d t D}t |j|d d d tj|j||dS)N@rEr^ localhosteggzIgnoring egg= fragment in %sr{rr/cs"i|]}|vr||dqS)rr,).0krIr,r- z_clean_link..)r=rHrI)rzrHr{rj)rr=rsplitrCr$r%parse_qsrIloggerdebug IndexErrorKeyErrorrwry_replacerH)r~rzr=r{rjr,rr- _clean_links$   r)maxsize)link1link2r cCst|t|kSr7)r)rrr,r,r-links_equivalentsr)( functoolsloggingr`r;rt urllib.parser$typingrrrrrrrpip._internal.utils.filetypesr pip._internal.utils.hashesr pip._internal.utils.miscr r r pip._internal.utils.modelsrpip._internal.utils.urlsrrpip._internal.index.collectorr getLoggerrmrrwrryr lru_cacherrrr,r,r,r-s*$     I  PK+]'models/__pycache__/index.cpython-39.pycnu[a Re@s2ddlZGdddZedddZedddZdS) NcsBeZdZdZgdZeeddfdd Zeeddd ZZS) PackageIndexzBRepresents a Package Index and provides easier access to endpoints)urlnetloc simple_urlpypi_urlfile_storage_domainN)rrreturncsBt||_tj|j|_|d|_|d|_ ||_ dS)Nsimplepypi) super__init__rurllibparseurlsplitr _url_for_pathrrr)selfrr __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/index.pyr s    zPackageIndex.__init__)pathrcCstj|j|S)N)r rurljoinr)rrrrrrszPackageIndex._url_for_path) __name__ __module__ __qualname____doc__ __slots__strr r __classcell__rrrrrs rzhttps://pypi.org/zfiles.pythonhosted.org)rzhttps://test.pypi.org/ztest-files.pythonhosted.org) urllib.parser rPyPITestPyPIrrrrs  PK+]ĕ+models/__pycache__/candidate.cpython-39.pycnu[a Re@s8ddlmZddlmZddlmZGdddeZdS))parse)Link)KeyBasedCompareMixincsPeZdZdZgdZeeeddfdd Zeddd Zedd d Z Z S) InstallationCandidatez4Represents a potential "candidate" for installation.)nameversionlinkN)rrrreturncs6||_t||_||_tj|j|j|jftddS)N)keydefining_class)r parse_versionrrsuper__init__r)selfrrr __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/candidate.pyr s zInstallationCandidate.__init__)r cCsd|j|j|jS)Nz)formatrrrrrrr__repr__s zInstallationCandidate.__repr__cCsd|j|j|jS)Nz!{!r} candidate (version {} at {})rrrrr__str__s zInstallationCandidate.__str__) __name__ __module__ __qualname____doc__ __slots__strrrrr __classcell__rrrrrs  rN)Zpip._vendor.packaging.versionrr pip._internal.models.linkrpip._internal.utils.modelsrrrrrrs   PK+]Chh,models/__pycache__/direct_url.cpython-39.pycnu[a Re@s<dZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z gdZ e dZdZedZGdd d eZdeeefe eee ee ed d d Zdeeefe eee eed d dZee dddddZeeeefdddZGdddZGdddZGdddZe eeefZGdddZdS) z PEP 610 N)AnyDictIterableOptionalTypeTypeVarUnion) DirectUrlDirectUrlValidationErrorDirInfo ArchiveInfoVcsInfoTzdirect_url.jsonz.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c@s eZdZdS)r N)__name__ __module__ __qualname__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/direct_url.pyr sr )d expected_typekeydefaultreturncCs4||vr |S||}t||s0td||||S)z3Get value from dictionary and verify expected type.z-{!r} has unexpected type for {} (expected {})) isinstancer formatrrrrvaluerrr_gets rcCs(t||||}|dur$t|d|S)Nz must have a value)rr rrrr _get_required)srInfoType)infosrcCsFdd|D}|stdt|dkr.td|ddus>J|dS)NcSsg|]}|dur|qSNr).0inforrr 3z#_exactly_one_of..z/missing one of archive_info, dir_info, vcs_infoz1more than one of archive_info, dir_info, vcs_infor)r len)r rrr_exactly_one_of2s r()kwargsrcKsdd|DS)z Make dict excluding None values.cSsi|]\}}|dur||qSr!r)r"kvrrr Br%z _filter_none..)items)r)rrr _filter_none@sr.c@speZdZdZd eeeeeeeeddddZeeeee feddddZ eee fd d d Z dS) r vcs_infoN)vcs commit_idrequested_revisionresolved_revisionresolved_revision_typercCs"||_||_||_||_||_dSr!r0r2r1r3r4)selfr0r1r2r3r4rrr__init__Hs zVcsInfo.__init__rrc CsF|dur dS|t|tdt|tdt|tdt|tdt|tddS)Nr0r1r2r3r4)r0r1r2r3r4)rstrrclsrrrr _from_dictVs     zVcsInfo._from_dictrcCst|j|j|j|j|jdS)Nr5)r.r0r2r1r3r4r6rrr_to_dictbszVcsInfo._to_dict)NNN) rrrnamer9rr7 classmethodrrr<r?rrrrr Es " r c@s`eZdZdZd eeddddZeeeee feddddZ eee fd d d Z dS) r archive_infoN)hashrcCs ||_dSr!rC)r6rCrrrr7oszArchiveInfo.__init__r8cCs|dur dS|t|tddS)NrCrD)rr9r:rrrr<uszArchiveInfo._from_dictr=cCs t|jdS)NrD)r.rCr>rrrr?{szArchiveInfo._to_dict)N) rrrr@rr9r7rArrr<r?rrrrr ls "r c@s\eZdZdZd eddddZeeee e fedddd Z ee e fd d d Z dS)r dir_infoFN)editablercCs ||_dSr!rF)r6rFrrrr7szDirInfo.__init__r8cCs"|dur dS|t|tddddS)NrFF)rrG)rboolr:rrrr<szDirInfo._from_dictr=cCst|jp ddS)NrG)r.rFr>rrrr?szDirInfo._to_dict)F) rrrr@rHr7rArrr9rr<r?rrrrr s "r c@seZdZdeeeeddddZeedddZeedd d Z ddd d Z e e ee fdd ddZe ee fdddZe eddddZedddZedddZdS)r N)urlr# subdirectoryrcCs||_||_||_dSr!)rIr#rJ)r6rIr#rJrrrr7szDirectUrl.__init__)netlocrcCsRd|vr |S|dd\}}t|jtr@|jjdkr@|dkr@|St|rN|S|S)N@r&git)splitrr#r r0 ENV_VAR_REmatch)r6rK user_passnetloc_no_user_passrrr_remove_auth_from_netlocs   z"DirectUrl._remove_auth_from_netlocr=cCs<tj|j}||j}tj|j||j|j |j f}|S)zurl with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL. ) urllibparseurlsplitrIrSrK urlunsplitschemepathqueryfragment)r6purlrKsurlrrr redacted_urls  zDirectUrl.redacted_urlcCs||dSr!) from_dictto_dictr>rrrvalidateszDirectUrl.validater8c CsRtt|tdt|tdttt|tdtt|tdt t|tdgdS)NrIrJrBrEr/)rIrJr#) r rr9rr(r r<dictr r r:rrrr_s  zDirectUrl.from_dictcCs&t|j|jd}|j||jj<|S)N)rIrJ)r.r^rJr#r?r@)r6resrrrr`s zDirectUrl.to_dict)srcCs|t|Sr!)r_jsonloads)r;rdrrr from_jsonszDirectUrl.from_jsoncCstj|ddS)NT) sort_keys)redumpsr`r>rrrto_jsonszDirectUrl.to_jsoncCst|jto|jjSr!)rr#r rFr>rrris_local_editableszDirectUrl.is_local_editable)N)rrrr9rrr7rSpropertyr^rarArrr_r`rgrjrHrkrrrrr s$   r )N)N)__doc__rere urllib.parserTtypingrrrrrrr__all__rDIRECT_URL_METADATA_NAMEcompilerO Exceptionr r9rrr(r.r r r rr rrrrs4$   'PK+]Tz:'models/__pycache__/wheel.cpython-39.pycnu[a Re @sJdZddlZddlmZmZmZddlmZddlm Z GdddZ dS)z`Represents a wheel file and provides access to the various parts of the name that have meaning. N)DictIterableList)Tag)InvalidWheelFilenamec@seZdZdZedejZeddddZ e eddd Z e e e d d d Ze e ee e fe d ddZee ed ddZdS)Wheelz A wheel filez^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$N)filenamereturncsj|}|st|d|_|ddd_|ddd_|d_|d d_ |d  d_ |d  d_ fd d j D_ d S)zX :raises InvalidWheelFilename: when the filename is invalid for a wheel z is not a valid wheel filename.name_-verbuildpyver.abiplatcs0h|](}jD]}jD]}t|||qqqS)abisplatsr).0xyzselfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/wheel.py (sz!Wheel.__init__..N) wheel_file_rematchrrgroupreplacer version build_tagsplit pyversionsrr file_tags)rr wheel_inforrr__init__s   zWheel.__init__)r cCstdd|jDS)z4Return the wheel's tags as a sorted list of strings.css|]}t|VqdSN)strrtagrrr .z0Wheel.get_formatted_file_tags..)sortedr&rrrrget_formatted_file_tags,szWheel.get_formatted_file_tags)tagsr cstfdd|jDS)aReturn the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. c3s |]}|vr|VqdSr))indexr+r1rrr-=r.z*Wheel.support_index_min..minr&rr1rr3rsupport_index_min0s zWheel.support_index_min)r1tag_to_priorityr cstfdd|jDS)aReturn the priority of the most preferred tag that one of the wheel's file tag combinations achieves in the given list of supported tags using the given tag_to_priority mapping, where lower priorities are more-preferred. This is used in place of support_index_min in some cases in order to avoid an expensive linear scan of a large list of tags. :param tags: the PEP 425 tags to check the wheel against. :param tag_to_priority: a mapping from tag to priority of that tag, where lower is more preferred. :raises ValueError: If none of the wheel's file tags match one of the supported tags. c3s|]}|vr|VqdSr)rr+r8rrr-Psz0Wheel.find_most_preferred_tag..r4)rr1r8rr9rfind_most_preferred_tag?s zWheel.find_most_preferred_tagcCs|j| S)zReturn whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. )r& isdisjointr6rrr supportedTszWheel.supported)__name__ __module__ __qualname____doc__recompileVERBOSErr*r(rr0rintr7rr:rboolr<rrrrr s r) r@rAtypingrrrZpip._vendor.packaging.tagsrpip._internal.exceptionsrrrrrrs   PK+]sxw w /models/__pycache__/target_python.cpython-39.pycnu[a Re@sVddlZddlmZmZmZddlmZddlmZm Z ddl m Z GdddZ dS)N)ListOptionalTuple)Tag) get_supportedversion_info_to_nodot)normalize_version_infoc@speZdZdZgdZd eeeeee dfeeeeeddddZ edd d Z ee dd d Z dS) TargetPythonzx Encapsulates the properties of a Python interpreter one is targeting for a package install, download, etc. )_given_py_version_infoabisimplementation platforms py_versionpy_version_info _valid_tagsN.)r rr r returncCsf||_|durtjdd}nt|}dtt|dd}||_||_||_ ||_ ||_ d|_ dS)a< :param platforms: A list of strings or None. If None, searches for packages that are supported by the current system. Otherwise, will find packages that can be built on the platforms passed in. These packages will only be downloaded for distribution: they will not be built locally. :param py_version_info: An optional tuple of ints representing the Python version information to use (e.g. `sys.version_info[:3]`). This can have length 1, 2, or 3 when provided. :param abis: A list of strings or None. This is passed to compatibility_tags.py's get_supported() function as is. :param implementation: A string or None. This is passed to compatibility_tags.py's get_supported() function as is. N.) r sys version_inforjoinmapstrr r r rrr)selfr rr r rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/target_python.py__init__szTargetPython.__init__)rcCsZd}|jdur$ddd|jD}d|jfd|fd|jfd|jfg}d d d|DS) zD Format the given, non-None attributes for display. Nrcss|]}t|VqdS)N)r).0partrrr Isz,TargetPython.format_given..r rr r  css(|] \}}|dur|d|VqdS)N=r)rkeyvaluerrrr Ss)r rr r r )rdisplay_version key_valuesrrr format_givenCs   zTargetPython.format_givencCsH|jdurB|j}|durd}nt|}t||j|j|jd}||_|jS)z Return the supported PEP 425 tags to check wheel candidates against. The tags are returned in order of preference (most preferred first). N)versionr r impl)rr rrr r r )rrr(tagsrrrget_tagsWs zTargetPython.get_tags)NNNN)__name__ __module__ __qualname____doc__ __slots__rrrrintrr'rr+rrrrr s    (r ) rtypingrrrZpip._vendor.packaging.tagsr&pip._internal.utils.compatibility_tagsrrpip._internal.utils.miscrr rrrrs   PK+]++*models/__pycache__/__init__.cpython-39.pycnu[a Re?@sdZdS)z8A package that contains models that represent entities. N)__doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/__init__.pyPK+] 1models/__pycache__/selection_prefs.cpython-39.pycnu[a Res@s*ddlmZddlmZGdddZdS))Optional) FormatControlc@s:eZdZdZgdZdeeeeeeeddddZdS) SelectionPreferenceszd Encapsulates the candidate selection preferences for downloading and installing files.  allow_yankedallow_all_prereleasesformat_control prefer_binaryignore_requires_pythonFN)rrrr r returncCs.|dur d}||_||_||_||_||_dS)awCreate a SelectionPreferences object. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param format_control: A FormatControl object or None. Used to control the selection of source packages / binary packages when consulting the index and links. :param prefer_binary: Whether to prefer an old, but valid, binary dist over a new source dist. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. NFr)selfrrrr r r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py__init__szSelectionPreferences.__init__)FNFN) __name__ __module__ __qualname____doc__ __slots__boolrrrr r r rrsrN)typingr#pip._internal.models.format_controlrrr r r rs  PK+]g .models/__pycache__/search_scope.cpython-39.pycnu[a Re@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZeeZGdddZdS) N)List)canonicalize_name)PyPI)has_tls)normalize_pathredact_auth_from_urlc@sreZdZdZddgZeeeeeddddZeeeedddd Z ed d d Z eeed ddZ dS) SearchScopezF Encapsulates the locations that pip is configured to search. find_links index_urls)r r returncCsg}|D]0}|dr.t|}tj|r.|}||qtsvt||D](}t j |}|j dkrLt dqvqL|||dS)zQ Create a SearchScope object after normalizing the `find_links`. ~httpszipip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.r r ) startswithrospathexistsappendr itertoolschainurllibparseurlparseschemeloggerwarning)clsr r built_find_linkslinknew_linkparsedr!/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/models/search_scope.pycreates&     zSearchScope.createNcCs||_||_dSNr)selfr r r!r!r"__init__AszSearchScope.__init__)r cCsg}g}|jrt|jtjgkrt|jD]:}t|}tj|}|jsR|jsRt d|| |q"| d d ||jr| d d dd|jDd |S)Nz:The index url "%s" seems invalid, please provide a scheme.zLooking in indexes: {}z, zLooking in links: {}css|]}t|VqdSr$)r.0urlr!r!r" hz6SearchScope.get_formatted_locations.. )r r simple_urlrrrurlsplitrnetlocrrrformatjoinr )r%linesredacted_index_urlsr)redacted_index_urlpurlr!r!r"get_formatted_locationsIs,    z#SearchScope.get_formatted_locations) project_namer cs(ttdfdd fdd|jDS)zReturns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations )r)r cs.t|tjt}|ds*|d}|S)N/) posixpathr1rrquoterendswith)r)loc)r7r!r"mkurl_pypi_urlts  z.mkurl_pypi_urlcsg|] }|qSr!r!r')r=r!r" r+z8SearchScope.get_index_urls_locations..)strr )r%r7r!)r=r7r"get_index_urls_locationsms z$SearchScope.get_index_urls_locations) __name__ __module__ __qualname____doc__ __slots__ classmethodrr?r#r&r6r@r!r!r!r"rs) $r)rloggingrr9 urllib.parsertypingrpip._vendor.packaging.utilsrpip._internal.models.indexrpip._internal.utils.compatrpip._internal.utils.miscrr getLoggerrArrr!r!r!r"s     PK+]models/scheme.pynu[""" For types associated with installation schemes. For a general overview of available schemes and their context, see https://docs.python.org/3/install/index.html#alternate-installation. """ SCHEME_KEYS = ["platlib", "purelib", "headers", "scripts", "data"] class Scheme: """A Scheme holds paths which are used as the base directories for artifacts associated with a Python package. """ __slots__ = SCHEME_KEYS def __init__( self, platlib: str, purelib: str, headers: str, scripts: str, data: str, ) -> None: self.platlib = platlib self.purelib = purelib self.headers = headers self.scripts = scripts self.data = data PK+]'TA models/wheel.pynu["""Represents a wheel file and provides access to the various parts of the name that have meaning. """ import re from typing import Dict, Iterable, List from pip._vendor.packaging.tags import Tag from pip._internal.exceptions import InvalidWheelFilename class Wheel: """A wheel file""" wheel_file_re = re.compile( r"""^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$""", re.VERBOSE, ) def __init__(self, filename: str) -> None: """ :raises InvalidWheelFilename: when the filename is invalid for a wheel """ wheel_info = self.wheel_file_re.match(filename) if not wheel_info: raise InvalidWheelFilename(f"{filename} is not a valid wheel filename.") self.filename = filename self.name = wheel_info.group("name").replace("_", "-") # we'll assume "_" means "-" due to wheel naming scheme # (https://github.com/pypa/pip/issues/1150) self.version = wheel_info.group("ver").replace("_", "-") self.build_tag = wheel_info.group("build") self.pyversions = wheel_info.group("pyver").split(".") self.abis = wheel_info.group("abi").split(".") self.plats = wheel_info.group("plat").split(".") # All the tag combinations from this file self.file_tags = { Tag(x, y, z) for x in self.pyversions for y in self.abis for z in self.plats } def get_formatted_file_tags(self) -> List[str]: """Return the wheel's tags as a sorted list of strings.""" return sorted(str(tag) for tag in self.file_tags) def support_index_min(self, tags: List[Tag]) -> int: """Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. """ return min(tags.index(tag) for tag in self.file_tags if tag in tags) def find_most_preferred_tag( self, tags: List[Tag], tag_to_priority: Dict[Tag, int] ) -> int: """Return the priority of the most preferred tag that one of the wheel's file tag combinations achieves in the given list of supported tags using the given tag_to_priority mapping, where lower priorities are more-preferred. This is used in place of support_index_min in some cases in order to avoid an expensive linear scan of a large list of tags. :param tags: the PEP 425 tags to check the wheel against. :param tag_to_priority: a mapping from tag to priority of that tag, where lower is more preferred. :raises ValueError: If none of the wheel's file tags match one of the supported tags. """ return min( tag_to_priority[tag] for tag in self.file_tags if tag in tag_to_priority ) def supported(self, tags: Iterable[Tag]) -> bool: """Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. """ return not self.file_tags.isdisjoint(tags) PK+]U=*models/direct_url.pynu[""" PEP 610 """ import json import re import urllib.parse from typing import Any, Dict, Iterable, Optional, Type, TypeVar, Union __all__ = [ "DirectUrl", "DirectUrlValidationError", "DirInfo", "ArchiveInfo", "VcsInfo", ] T = TypeVar("T") DIRECT_URL_METADATA_NAME = "direct_url.json" ENV_VAR_RE = re.compile(r"^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$") class DirectUrlValidationError(Exception): pass def _get( d: Dict[str, Any], expected_type: Type[T], key: str, default: Optional[T] = None ) -> Optional[T]: """Get value from dictionary and verify expected type.""" if key not in d: return default value = d[key] if not isinstance(value, expected_type): raise DirectUrlValidationError( "{!r} has unexpected type for {} (expected {})".format( value, key, expected_type ) ) return value def _get_required( d: Dict[str, Any], expected_type: Type[T], key: str, default: Optional[T] = None ) -> T: value = _get(d, expected_type, key, default) if value is None: raise DirectUrlValidationError(f"{key} must have a value") return value def _exactly_one_of(infos: Iterable[Optional["InfoType"]]) -> "InfoType": infos = [info for info in infos if info is not None] if not infos: raise DirectUrlValidationError( "missing one of archive_info, dir_info, vcs_info" ) if len(infos) > 1: raise DirectUrlValidationError( "more than one of archive_info, dir_info, vcs_info" ) assert infos[0] is not None return infos[0] def _filter_none(**kwargs: Any) -> Dict[str, Any]: """Make dict excluding None values.""" return {k: v for k, v in kwargs.items() if v is not None} class VcsInfo: name = "vcs_info" def __init__( self, vcs: str, commit_id: str, requested_revision: Optional[str] = None, resolved_revision: Optional[str] = None, resolved_revision_type: Optional[str] = None, ) -> None: self.vcs = vcs self.requested_revision = requested_revision self.commit_id = commit_id self.resolved_revision = resolved_revision self.resolved_revision_type = resolved_revision_type @classmethod def _from_dict(cls, d: Optional[Dict[str, Any]]) -> Optional["VcsInfo"]: if d is None: return None return cls( vcs=_get_required(d, str, "vcs"), commit_id=_get_required(d, str, "commit_id"), requested_revision=_get(d, str, "requested_revision"), resolved_revision=_get(d, str, "resolved_revision"), resolved_revision_type=_get(d, str, "resolved_revision_type"), ) def _to_dict(self) -> Dict[str, Any]: return _filter_none( vcs=self.vcs, requested_revision=self.requested_revision, commit_id=self.commit_id, resolved_revision=self.resolved_revision, resolved_revision_type=self.resolved_revision_type, ) class ArchiveInfo: name = "archive_info" def __init__( self, hash: Optional[str] = None, ) -> None: self.hash = hash @classmethod def _from_dict(cls, d: Optional[Dict[str, Any]]) -> Optional["ArchiveInfo"]: if d is None: return None return cls(hash=_get(d, str, "hash")) def _to_dict(self) -> Dict[str, Any]: return _filter_none(hash=self.hash) class DirInfo: name = "dir_info" def __init__( self, editable: bool = False, ) -> None: self.editable = editable @classmethod def _from_dict(cls, d: Optional[Dict[str, Any]]) -> Optional["DirInfo"]: if d is None: return None return cls(editable=_get_required(d, bool, "editable", default=False)) def _to_dict(self) -> Dict[str, Any]: return _filter_none(editable=self.editable or None) InfoType = Union[ArchiveInfo, DirInfo, VcsInfo] class DirectUrl: def __init__( self, url: str, info: InfoType, subdirectory: Optional[str] = None, ) -> None: self.url = url self.info = info self.subdirectory = subdirectory def _remove_auth_from_netloc(self, netloc: str) -> str: if "@" not in netloc: return netloc user_pass, netloc_no_user_pass = netloc.split("@", 1) if ( isinstance(self.info, VcsInfo) and self.info.vcs == "git" and user_pass == "git" ): return netloc if ENV_VAR_RE.match(user_pass): return netloc return netloc_no_user_pass @property def redacted_url(self) -> str: """url with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL. """ purl = urllib.parse.urlsplit(self.url) netloc = self._remove_auth_from_netloc(purl.netloc) surl = urllib.parse.urlunsplit( (purl.scheme, netloc, purl.path, purl.query, purl.fragment) ) return surl def validate(self) -> None: self.from_dict(self.to_dict()) @classmethod def from_dict(cls, d: Dict[str, Any]) -> "DirectUrl": return DirectUrl( url=_get_required(d, str, "url"), subdirectory=_get(d, str, "subdirectory"), info=_exactly_one_of( [ ArchiveInfo._from_dict(_get(d, dict, "archive_info")), DirInfo._from_dict(_get(d, dict, "dir_info")), VcsInfo._from_dict(_get(d, dict, "vcs_info")), ] ), ) def to_dict(self) -> Dict[str, Any]: res = _filter_none( url=self.redacted_url, subdirectory=self.subdirectory, ) res[self.info.name] = self.info._to_dict() return res @classmethod def from_json(cls, s: str) -> "DirectUrl": return cls.from_dict(json.loads(s)) def to_json(self) -> str: return json.dumps(self.to_dict(), sort_keys=True) def is_local_editable(self) -> bool: return isinstance(self.info, DirInfo) and self.info.editable PK+] 22(metadata/__pycache__/base.cpython-39.pycnu[a Re_+@sRddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZmZddlmZmZmZddlmZdd l m!Z!dd l"m#Z#erdd lm$Z$ne%Z$eeefZ&e'e(Z)Gd d d e$Z*Gddde$Z+GdddZ,Gddde$Z-Gddde-Z.Gddde-Z/dS)N) IO TYPE_CHECKING Collection ContainerIterableIteratorListOptionalUnion) Requirement)InvalidSpecifier SpecifierSet)NormalizedName) LegacyVersionVersion)DIRECT_URL_METADATA_NAME DirectUrlDirectUrlValidationError) stdlib_pkgs)egg_link_path_from_sys_path) url_to_path)Protocolc@sBeZdZeedddZeedddZeedddZdS) BaseEntryPointreturncCs tdSNNotImplementedErrorselfr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/metadata/base.pyname+szBaseEntryPoint.namecCs tdSrrrr r r!value/szBaseEntryPoint.valuecCs tdSrrrr r r!group3szBaseEntryPoint.groupN)__name__ __module__ __qualname__propertystrr"r#r$r r r r!r*s rc@seZdZedddZedddZeeedddZeeeddd Z eeedd d Z ee dd d Z ee dddZeeedddZeedddZeedddZeedddZeedddZeedddZeedddZeeddd Zeejjdd!d"Zeeedd#d$Zeedd%d&Z ee!dd'd(Z"d0e#eee$d*d+d,Z%eedd-d.Z&d/S)1BaseDistributionrcCs|jd|jd|jdS)N z ())raw_nameversionlocationrr r r!__repr__9szBaseDistribution.__repr__cCs|jd|jS)Nr+)r-r.rr r r!__str__<szBaseDistribution.__str__cCs tdS)aWhere the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. Nrrr r r!r/?s zBaseDistribution.locationcCs6|j}|r|r2t|jSnt|j}|r2|jSdS)zThe project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. N) direct_urlis_local_editablerurlrr-r/)rr2 egg_link_pathr r r!editable_project_locationMs  z*BaseDistribution.editable_project_locationcCs tdS)a'Location of the .[egg|dist]-info directory. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. Nrrr r r!info_directorycszBaseDistribution.info_directorycCs tdSrrrr r r!canonical_namesszBaseDistribution.canonical_namecCs tdSrrrr r r!r.wszBaseDistribution.versionc Csvz|t}Wnty"YdS0z t|WSttjtfyp}z t dt|j |WYd}~dSd}~00dS)zObtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. NzError parsing %s for %s: %s) read_textrFileNotFoundErrorr from_jsonUnicodeDecodeErrorjsonJSONDecodeErrorrloggerwarningr8)rcontenter r r!r2{s$   zBaseDistribution.direct_urlcCs tdSrrrr r r! installerszBaseDistribution.installercCs t|jSr)boolr6rr r r!editableszBaseDistribution.editablecCs tdSrrrr r r!localszBaseDistribution.localcCs tdSrrrr r r! in_usersiteszBaseDistribution.in_usersitecCs tdSrrrr r r!in_site_packagessz!BaseDistribution.in_site_packagesr"rcCs tdS)zRead a file in the .dist-info (or .egg-info) directory. Should raise ``FileNotFoundError`` if ``name`` does not exist in the metadata directory. Nrrr"r r r!r9szBaseDistribution.read_textcCs tdSrrrr r r!iter_entry_pointssz"BaseDistribution.iter_entry_pointscCs tdS)z?Metadata of distribution parsed from e.g. METADATA or PKG-INFO.Nrrr r r!metadataszBaseDistribution.metadatacCs |jdS)zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)rLgetrr r r!metadata_versionsz!BaseDistribution.metadata_versioncCs|jd|jS)z*Value of "Name:" in distribution metadata.Name)rLrMr8rr r r!r-szBaseDistribution.raw_namec Csn|jd}|durtSztt|}Wn>tyh}z&d}t||j|tWYd}~Sd}~00|S)zValue of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)rLrMr r)r r?r@r-)rr#specrBmessager r r!requires_pythons z BaseDistribution.requires_pythonr )extrasrcCs tdS)zDependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. Nr)rrSr r r!iter_dependenciessz"BaseDistribution.iter_dependenciescCs tdS)zExtras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. Nrrr r r!iter_provided_extrassz%BaseDistribution.iter_provided_extrasN)r )'r%r&r'r)r0r1r(r r/r6r7rr8DistributionVersionr.rr2rCrDrErFrGrHr9rrrKemailrQMessagerLrNr-r rRrr rTrUr r r r!r*8sH r*c@seZdZdZeddddZeeeeddddZ eedd d d Z e ddd d Z e ddddZ dedddfeeeeeee edddZdS)BaseEnvironmentz6An environment containing distributions to introspect.rcCs tdSrr)clsr r r!defaultszBaseEnvironment.default)pathsrcCs tdSrr)rZr\r r r! from_pathsszBaseEnvironment.from_pathsr*rIcCs tdS)z=Given a requirement name, return the installed distributions.NrrJr r r!get_distributionsz BaseEnvironment.get_distributioncCs tdS)aIterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. Nrrr r r!_iter_distributionssz#BaseEnvironment._iter_distributionsccsD|D]6}tjd|jtjd}|s8td|j|jq|VqdS)z(Iterate through installed distributions.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)flagsz%Ignoring invalid distribution %s (%s)N)r_rematchr8 IGNORECASEr?r@r/)rdistproject_name_validr r r!iter_distributionss z"BaseEnvironment.iter_distributionsTF) local_onlyskipinclude_editableseditables_only user_onlyrcsb|}|rdd|D}|s,dd|D}|r>dd|D}|rPdd|D}fdd|DS)aReturn a list of installed distributions. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. css|]}|jr|VqdSr)rF.0dr r r! +z?BaseEnvironment.iter_installed_distributions..css|]}|js|VqdSrrErlr r r!ro-rpcss|]}|jr|VqdSrrqrlr r r!ro/rpcss|]}|jr|VqdSr)rGrlr r r!ro1rpc3s|]}|jvr|VqdSr)r8rlrhr r!ro2rp)rf)rrgrhrirjrkitr rrr!iter_installed_distributionssz,BaseEnvironment.iter_installed_distributionsN)r%r&r'__doc__ classmethodr[r rr)r]r^rr_rfrrDrr*rtr r r r!rYs* rYc@s&eZdZUeed<ejdddZdS)Wheelr/rcCs tdSrrrr r r! as_zipfile8szWheel.as_zipfileN)r%r&r'r)__annotations__zipfileZipFilerxr r r r!rw5s rwc@s,eZdZeddddZejdddZdS)FilesystemWheelN)r/rcCs ||_dSr)r/)rr/r r r!__init__=szFilesystemWheel.__init__rcCstj|jddSNT) allowZip64)rzr{r/rr r r!rx@szFilesystemWheel.as_zipfile)r%r&r'r)r}rzr{rxr r r r!r|<sr|c@s2eZdZeeeddddZejdddZ dS) MemoryWheelN)r/streamrcCs||_||_dSr)r/r)rr/rr r r!r}EszMemoryWheel.__init__rcCstj|jddSr~)rzr{rrr r r!rxIszMemoryWheel.as_zipfile) r%r&r'r)rbytesr}rzr{rxr r r r!rDsr)0 email.messagerWr=loggingrarztypingrrrrrrrr r Z"pip._vendor.packaging.requirementsr Z pip._vendor.packaging.specifiersr r pip._vendor.packaging.utilsrZpip._vendor.packaging.versionrrpip._internal.models.direct_urlrrrpip._internal.utils.compatrpip._internal.utils.egg_linkrpip._internal.utils.urlsrrobjectrV getLoggerr%r?rr*rYrwr|rr r r r!s2,       2LPK+]V1metadata/__pycache__/pkg_resources.cpython-39.pycnu[a Re@sddlZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z ddlmZmZddlmZddlmZddlmZmZdd lmZd d lmZmZmZmZm Z e!e"Z#Gd d d eZ$GdddeZ%GdddeZ&dS)N) CollectionIterableIteratorList NamedTupleOptional) pkg_resources) Requirement)NormalizedNamecanonicalize_name)parse)misc) get_installer get_metadata)$pkg_resources_distribution_for_wheel)BaseDistributionBaseEntryPointBaseEnvironmentDistributionVersionWheelc@s&eZdZUeed<eed<eed<dS) EntryPointnamevaluegroupN)__name__ __module__ __qualname__str__annotations__r r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/metadata/pkg_resources.pyrs rc@s0eZdZejddddZeeeddddZ e e edd d Z e e edd d Z e edd dZe edddZe edddZe edddZe edddZe edddZeedddZeedddZe ejjdddZd&eeee d!d"d#Z!eedd$d%Z"dS)' DistributionN)distreturncCs ||_dSN)_distselfr#r r r!__init__ szDistribution.__init__)wheelrr$cCs>|}t|||j}Wdn1s,0Y||Sr%) as_zipfilerlocation)clsr*rzfr#r r r! from_wheel#s ,zDistribution.from_wheelr$cCs|jjSr%)r&r,r(r r r!r,)szDistribution.locationcCs|jjSr%)r&egg_infor1r r r!info_directory-szDistribution.info_directorycCs t|jjSr%)r r& project_namer1r r r!canonical_name1szDistribution.canonical_namecCs t|jjSr%) parse_versionr&versionr1r r r!r75szDistribution.versioncCs t|jSr%)rr&r1r r r! installer9szDistribution.installercCs t|jSr%)r dist_is_localr&r1r r r!local=szDistribution.localcCs t|jSr%)r dist_in_usersiter&r1r r r! in_usersiteAszDistribution.in_usersitecCs t|jSr%)r dist_in_site_packagesr&r1r r r!in_site_packagesEszDistribution.in_site_packagesrr$cCs |j|st||j|Sr%)r& has_metadataFileNotFoundErrorr)r(rr r r! read_textIs zDistribution.read_textccsZ|jD]F\}}|D]4\}}t|d\}}}t|||dVqqdS)N=)rrr)r& get_entry_mapitemsr partitionrstrip)r(rentriesr entry_point_rr r r!iter_entry_pointsNszDistribution.iter_entry_pointscCs t|jSr%)rr&r1r r r!metadataTszDistribution.metadatar )extrasr$cCs"|rt||jj}|j|Sr%) frozenset intersectionr&rMrequires)r(rMr r r!iter_dependenciesXszDistribution.iter_dependenciescCs|jjSr%)r&rMr1r r r!iter_provided_extras]sz!Distribution.iter_provided_extras)r )#rrrrr"r) classmethodrrr/propertyrr,r3r r5rr7r8boolr:r<r>rBrrrKemailmessageMessagerLrr rQrRr r r r!r"s2r"c@seZdZejddddZeedddZee e e edd d Z e e e d d d Ze e e d ddZee dddZdS) EnvironmentN)wsr$cCs ||_dSr%)_ws)r(rZr r r!r)bszEnvironment.__init__r0cCs |tjSr%)r working_set)r-r r r!defaulteszEnvironment.default)pathsr$cCs|t|Sr%)r WorkingSet)r-r^r r r! from_pathsiszEnvironment.from_pathsr?cCs,t|}|D]}|j|kr|SqdS)zFind a distribution matching the ``name`` in the environment. This searches from *all* distributions available in the environment, to match the behavior of ``pkg_resources.get_distribution()``. N)r iter_distributionsr5)r(rr5r#r r r!_search_distributionms    z Environment._search_distributioncCsD||}|r|Sz|j|Wntjy8YdS0||Sr%)rbr[requirerDistributionNotFound)r(rr#r r r!get_distributionys  zEnvironment.get_distributionccs|jD]}t|VqdSr%)r[r"r'r r r!_iter_distributionss zEnvironment._iter_distributions)rrrrr_r)rSrr]rrrr`rrbrerrfr r r r!rYas rY)' email.messagerVloggingtypingrrrrrr pip._vendorrZ"pip._vendor.packaging.requirementsr pip._vendor.packaging.utilsr r Zpip._vendor.packaging.versionr r6Zpip._internal.utilsr pip._internal.utils.packagingrrpip._internal.utils.wheelrbaserrrrr getLoggerrloggerrr"rYr r r r!s       BPK+]º,metadata/__pycache__/__init__.cpython-39.pycnu[a Re|@spddlmZmZddlmZmZmZmZmZgdZ edddZ eee edd d Z ee ed d d Z dS))ListOptional)BaseDistributionBaseEnvironmentFilesystemWheel MemoryWheelWheel)rrrrr get_default_environmentget_environmentget_wheel_distribution)returncCsddlm}|S)a Get the default representation for the current environment. This returns an Environment instance from the chosen backend. The default Environment instance should be built from ``sys.path`` and may use caching to share instance state accorss calls. r Environment) pkg_resourcesrdefaultrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/metadata/__init__.pyr s r )pathsr cCsddlm}||S)a'Get a representation of the environment specified by ``paths``. This returns an Environment instance from the chosen backend based on the given import paths. The backend must build a fresh instance representing the state of installed distributions when this function is called. rr)rr from_paths)rrrrrr s r )wheelcanonical_namer cCsddlm}|||S)aGet the representation of the specified wheel's distribution metadata. This returns a Distribution instance from the chosen backend based on the given wheel's ``.dist-info`` directory. :param canonical_name: Normalized project name of the given wheel. r) Distribution)rr from_wheel)rrrrrrr )s r N)typingrrbaserrrrr __all__r strr r rrrrs    PK+] /3:metadata/pkg_resources.pynu[import email.message import logging from typing import Collection, Iterable, Iterator, List, NamedTuple, Optional from pip._vendor import pkg_resources from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import parse as parse_version from pip._internal.utils import misc # TODO: Move definition here. from pip._internal.utils.packaging import get_installer, get_metadata from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel from .base import ( BaseDistribution, BaseEntryPoint, BaseEnvironment, DistributionVersion, Wheel, ) logger = logging.getLogger(__name__) class EntryPoint(NamedTuple): name: str value: str group: str class Distribution(BaseDistribution): def __init__(self, dist: pkg_resources.Distribution) -> None: self._dist = dist @classmethod def from_wheel(cls, wheel: Wheel, name: str) -> "Distribution": with wheel.as_zipfile() as zf: dist = pkg_resources_distribution_for_wheel(zf, name, wheel.location) return cls(dist) @property def location(self) -> Optional[str]: return self._dist.location @property def info_directory(self) -> Optional[str]: return self._dist.egg_info @property def canonical_name(self) -> NormalizedName: return canonicalize_name(self._dist.project_name) @property def version(self) -> DistributionVersion: return parse_version(self._dist.version) @property def installer(self) -> str: return get_installer(self._dist) @property def local(self) -> bool: return misc.dist_is_local(self._dist) @property def in_usersite(self) -> bool: return misc.dist_in_usersite(self._dist) @property def in_site_packages(self) -> bool: return misc.dist_in_site_packages(self._dist) def read_text(self, name: str) -> str: if not self._dist.has_metadata(name): raise FileNotFoundError(name) return self._dist.get_metadata(name) def iter_entry_points(self) -> Iterable[BaseEntryPoint]: for group, entries in self._dist.get_entry_map().items(): for name, entry_point in entries.items(): name, _, value = str(entry_point).partition("=") yield EntryPoint(name=name.strip(), value=value.strip(), group=group) @property def metadata(self) -> email.message.Message: return get_metadata(self._dist) def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]: if extras: # pkg_resources raises on invalid extras, so we sanitize. extras = frozenset(extras).intersection(self._dist.extras) return self._dist.requires(extras) def iter_provided_extras(self) -> Iterable[str]: return self._dist.extras class Environment(BaseEnvironment): def __init__(self, ws: pkg_resources.WorkingSet) -> None: self._ws = ws @classmethod def default(cls) -> BaseEnvironment: return cls(pkg_resources.working_set) @classmethod def from_paths(cls, paths: Optional[List[str]]) -> BaseEnvironment: return cls(pkg_resources.WorkingSet(paths)) def _search_distribution(self, name: str) -> Optional[BaseDistribution]: """Find a distribution matching the ``name`` in the environment. This searches from *all* distributions available in the environment, to match the behavior of ``pkg_resources.get_distribution()``. """ canonical_name = canonicalize_name(name) for dist in self.iter_distributions(): if dist.canonical_name == canonical_name: return dist return None def get_distribution(self, name: str) -> Optional[BaseDistribution]: # Search the distribution by looking through the working set. dist = self._search_distribution(name) if dist: return dist # If distribution could not be found, call working_set.require to # update the working set, and try to find the distribution again. # This might happen for e.g. when you install a package twice, once # using setup.py develop and again using setup.py install. Now when # running pip uninstall twice, the package gets removed from the # working set in the first uninstall, so we have to populate the # working set again so that pip knows about it and the packages gets # picked up and is successfully uninstalled the second time too. try: # We didn't pass in any version specifiers, so this can never # raise pkg_resources.VersionConflict. self._ws.require(name) except pkg_resources.DistributionNotFound: return None return self._search_distribution(name) def _iter_distributions(self) -> Iterator[BaseDistribution]: for dist in self._ws: yield Distribution(dist) PK,]._+_+metadata/base.pynu[import email.message import json import logging import re import zipfile from typing import ( IO, TYPE_CHECKING, Collection, Container, Iterable, Iterator, List, Optional, Union, ) from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.specifiers import InvalidSpecifier, SpecifierSet from pip._vendor.packaging.utils import NormalizedName from pip._vendor.packaging.version import LegacyVersion, Version from pip._internal.models.direct_url import ( DIRECT_URL_METADATA_NAME, DirectUrl, DirectUrlValidationError, ) from pip._internal.utils.compat import stdlib_pkgs # TODO: Move definition here. from pip._internal.utils.egg_link import egg_link_path_from_sys_path from pip._internal.utils.urls import url_to_path if TYPE_CHECKING: from typing import Protocol else: Protocol = object DistributionVersion = Union[LegacyVersion, Version] logger = logging.getLogger(__name__) class BaseEntryPoint(Protocol): @property def name(self) -> str: raise NotImplementedError() @property def value(self) -> str: raise NotImplementedError() @property def group(self) -> str: raise NotImplementedError() class BaseDistribution(Protocol): def __repr__(self) -> str: return f"{self.raw_name} {self.version} ({self.location})" def __str__(self) -> str: return f"{self.raw_name} {self.version}" @property def location(self) -> Optional[str]: """Where the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. """ raise NotImplementedError() @property def editable_project_location(self) -> Optional[str]: """The project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. """ # TODO: this property is relatively costly to compute, memoize it ? direct_url = self.direct_url if direct_url: if direct_url.is_local_editable(): return url_to_path(direct_url.url) else: # Search for an .egg-link file by walking sys.path, as it was # done before by dist_is_editable(). egg_link_path = egg_link_path_from_sys_path(self.raw_name) if egg_link_path: # TODO: get project location from second line of egg_link file # (https://github.com/pypa/pip/issues/10243) return self.location return None @property def info_directory(self) -> Optional[str]: """Location of the .[egg|dist]-info directory. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. """ raise NotImplementedError() @property def canonical_name(self) -> NormalizedName: raise NotImplementedError() @property def version(self) -> DistributionVersion: raise NotImplementedError() @property def direct_url(self) -> Optional[DirectUrl]: """Obtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. """ try: content = self.read_text(DIRECT_URL_METADATA_NAME) except FileNotFoundError: return None try: return DirectUrl.from_json(content) except ( UnicodeDecodeError, json.JSONDecodeError, DirectUrlValidationError, ) as e: logger.warning( "Error parsing %s for %s: %s", DIRECT_URL_METADATA_NAME, self.canonical_name, e, ) return None @property def installer(self) -> str: raise NotImplementedError() @property def editable(self) -> bool: return bool(self.editable_project_location) @property def local(self) -> bool: raise NotImplementedError() @property def in_usersite(self) -> bool: raise NotImplementedError() @property def in_site_packages(self) -> bool: raise NotImplementedError() def read_text(self, name: str) -> str: """Read a file in the .dist-info (or .egg-info) directory. Should raise ``FileNotFoundError`` if ``name`` does not exist in the metadata directory. """ raise NotImplementedError() def iter_entry_points(self) -> Iterable[BaseEntryPoint]: raise NotImplementedError() @property def metadata(self) -> email.message.Message: """Metadata of distribution parsed from e.g. METADATA or PKG-INFO.""" raise NotImplementedError() @property def metadata_version(self) -> Optional[str]: """Value of "Metadata-Version:" in distribution metadata, if available.""" return self.metadata.get("Metadata-Version") @property def raw_name(self) -> str: """Value of "Name:" in distribution metadata.""" # The metadata should NEVER be missing the Name: key, but if it somehow # does, fall back to the known canonical name. return self.metadata.get("Name", self.canonical_name) @property def requires_python(self) -> SpecifierSet: """Value of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. """ value = self.metadata.get("Requires-Python") if value is None: return SpecifierSet() try: # Convert to str to satisfy the type checker; this can be a Header object. spec = SpecifierSet(str(value)) except InvalidSpecifier as e: message = "Package %r has an invalid Requires-Python: %s" logger.warning(message, self.raw_name, e) return SpecifierSet() return spec def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]: """Dependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. """ raise NotImplementedError() def iter_provided_extras(self) -> Iterable[str]: """Extras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. """ raise NotImplementedError() class BaseEnvironment: """An environment containing distributions to introspect.""" @classmethod def default(cls) -> "BaseEnvironment": raise NotImplementedError() @classmethod def from_paths(cls, paths: Optional[List[str]]) -> "BaseEnvironment": raise NotImplementedError() def get_distribution(self, name: str) -> Optional["BaseDistribution"]: """Given a requirement name, return the installed distributions.""" raise NotImplementedError() def _iter_distributions(self) -> Iterator["BaseDistribution"]: """Iterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. """ raise NotImplementedError() def iter_distributions(self) -> Iterator["BaseDistribution"]: """Iterate through installed distributions.""" for dist in self._iter_distributions(): # Make sure the distribution actually comes from a valid Python # packaging distribution. Pip's AdjacentTempDirectory leaves folders # e.g. ``~atplotlib.dist-info`` if cleanup was interrupted. The # valid project name pattern is taken from PEP 508. project_name_valid = re.match( r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", dist.canonical_name, flags=re.IGNORECASE, ) if not project_name_valid: logger.warning( "Ignoring invalid distribution %s (%s)", dist.canonical_name, dist.location, ) continue yield dist def iter_installed_distributions( self, local_only: bool = True, skip: Container[str] = stdlib_pkgs, include_editables: bool = True, editables_only: bool = False, user_only: bool = False, ) -> Iterator[BaseDistribution]: """Return a list of installed distributions. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. """ it = self.iter_distributions() if local_only: it = (d for d in it if d.local) if not include_editables: it = (d for d in it if not d.editable) if editables_only: it = (d for d in it if d.editable) if user_only: it = (d for d in it if d.in_usersite) return (d for d in it if d.canonical_name not in skip) class Wheel(Protocol): location: str def as_zipfile(self) -> zipfile.ZipFile: raise NotImplementedError() class FilesystemWheel(Wheel): def __init__(self, location: str) -> None: self.location = location def as_zipfile(self) -> zipfile.ZipFile: return zipfile.ZipFile(self.location, allowZip64=True) class MemoryWheel(Wheel): def __init__(self, location: str, stream: IO[bytes]) -> None: self.location = location self.stream = stream def as_zipfile(self) -> zipfile.ZipFile: return zipfile.ZipFile(self.stream, allowZip64=True) PK,] s||metadata/__init__.pynu[from typing import List, Optional from .base import BaseDistribution, BaseEnvironment, FilesystemWheel, MemoryWheel, Wheel __all__ = [ "BaseDistribution", "BaseEnvironment", "FilesystemWheel", "MemoryWheel", "Wheel", "get_default_environment", "get_environment", "get_wheel_distribution", ] def get_default_environment() -> BaseEnvironment: """Get the default representation for the current environment. This returns an Environment instance from the chosen backend. The default Environment instance should be built from ``sys.path`` and may use caching to share instance state accorss calls. """ from .pkg_resources import Environment return Environment.default() def get_environment(paths: Optional[List[str]]) -> BaseEnvironment: """Get a representation of the environment specified by ``paths``. This returns an Environment instance from the chosen backend based on the given import paths. The backend must build a fresh instance representing the state of installed distributions when this function is called. """ from .pkg_resources import Environment return Environment.from_paths(paths) def get_wheel_distribution(wheel: Wheel, canonical_name: str) -> BaseDistribution: """Get the representation of the specified wheel's distribution metadata. This returns a Distribution instance from the chosen backend based on the given wheel's ``.dist-info`` directory. :param canonical_name: Normalized project name of the given wheel. """ from .pkg_resources import Distribution return Distribution.from_wheel(wheel, canonical_name) PK,]Ԑ_DD*resolution/__pycache__/base.cpython-39.pycnu[a ReG@sRddlmZmZmZddlmZddlmZeeeegefZ GdddZ dS))CallableListOptional)InstallRequirement)RequirementSetc@s6eZdZeeeedddZeeedddZdS) BaseResolver) root_reqscheck_supported_wheelsreturncCs tdSNNotImplementedError)selfrr r/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/base.pyresolve szBaseResolver.resolve)req_setr cCs tdSr r )rrrrrget_installation_ordersz#BaseResolver.get_installation_orderN) __name__ __module__ __qualname__rrboolrrrrrrrr s  rN) typingrrrZpip._internal.req.req_installrZpip._internal.req.req_setrstrInstallRequirementProviderrrrrrs   PK,]at.resolution/__pycache__/__init__.cpython-39.pycnu[a Re@sdS)Nrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/__init__.pyPK,]kR6 5resolution/resolvelib/__pycache__/base.cpython-39.pycnu[a Red@sddlmZmZmZmZmZddlmZddlm Z m Z ddl m Z m Z ddlmZmZddlmZddlmZeedeefZee e fZeeeed d d ZGd d d ZGdddZededddZGdddZdS)) FrozenSetIterableOptionalTupleUnion) SpecifierSet)NormalizedNamecanonicalize_name) LegacyVersionVersion)Linklinks_equivalent)InstallRequirement)Hashes Candidate)projectextrasreturncCs,|s|Stdd|D}d|d|S)Ncss|]}t|VqdSN)r ).0er/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py zformat_name..z{}[{}],)sortedformatjoin)rrcanonical_extrasrrr format_namesr c@sxeZdZeeeeddddZeddddZ ee ddd d Z e dd d Z e dd ddZde dddZdS) ConstraintN) specifierhasheslinksrcCs||_||_||_dSr)r"r#r$)selfr"r#r$rrr__init__szConstraint.__init__rcCsttttSr)r!rr frozenset)clsrrremptyszConstraint.empty)ireqrcCs.|jrt|jgnt}t|j|jdd|SNF)trust_internet)linkr(r!r"r#)r)r+r$rrr from_ireq"szConstraint.from_ireqcCst|jpt|jpt|jSr)boolr"r#r$r%rrr__bool__'szConstraint.__bool__)otherrcCsRt|tstS|j|j@}|j|jdd@}|j}|jrF||jg}t|||Sr,) isinstancerNotImplementedr"r#r$r.unionr!)r%r3r"r#r$rrr__and__*s  zConstraint.__and__r candidatercs4|jr"tfdd|jDs"dS|jjjddS)Nc3s|]}t|VqdSr) _match_link)rr.r9rrr6rz-Constraint.is_satisfied_by..FT) prereleases)r$allr"containsversionr%r9rr;ris_satisfied_by4szConstraint.is_satisfied_by)__name__ __module__ __qualname__rrrr r& classmethodr*rr/r0r2r7rArrrrr!s   r!c@s\eZdZeedddZeedddZdeddd Z e dd d Z edd d Z dS) Requirementr'cCs tddS)zThe "project name" of a requirement. This is different from ``name`` if this requirement contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. Subclass should overrideNNotImplementedErrorr1rrr project_name?szRequirement.project_namecCs tddS)zThe name identifying this requirement in the resolver. This is different from ``project_name`` if this requirement contains extras, where ``project_name`` would not contain the ``[...]`` part. rGNrHr1rrrnameIszRequirement.namerr8cCsdSNFrr@rrrrARszRequirement.is_satisfied_bycCs tddSNrGrHr1rrrget_candidate_lookupUsz Requirement.get_candidate_lookupcCs tddSrMrHr1rrrformat_for_errorXszRequirement.format_for_errorN) rBrCrDpropertyrrJstrrKr0rACandidateLookuprNrOrrrrrF>s rF)r.r9rcCs|jrt||jSdSrL) source_linkr )r.r9rrrr:\s r:c@seZdZeedddZeedddZeedddZ ee ddd Z ee dd d Z ee edd d Ze ee edddZe edddZedddZdS)rr'cCs tddS)zThe "project name" of the candidate. This is different from ``name`` if this candidate contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. Override in subclassNrHr1rrrrJcszCandidate.project_namecCs tddS)zThe name identifying this candidate in the resolver. This is different from ``project_name`` if this candidate contains extras, where ``project_name`` would not contain the ``[...]`` part. rTNrHr1rrrrKmszCandidate.namecCs tddSNrTrHr1rrrr?vszCandidate.versioncCs tddSrUrHr1rrr is_installedzszCandidate.is_installedcCs tddSrUrHr1rrr is_editable~szCandidate.is_editablecCs tddSrUrHr1rrrrSszCandidate.source_link) with_requiresrcCs tddSrUrH)r%rXrrriter_dependenciesszCandidate.iter_dependenciescCs tddSrUrHr1rrrget_install_requirementsz!Candidate.get_install_requirementcCs tddSrMrHr1rrrrOszCandidate.format_for_errorN)rBrCrDrPrrJrQrKCandidateVersionr?r0rVrWrr rSrrFrYrrZrOrrrrrbs N)typingrrrrrZ pip._vendor.packaging.specifiersrpip._vendor.packaging.utilsrr Zpip._vendor.packaging.versionr r pip._internal.models.linkr r Zpip._internal.req.req_installrpip._internal.utils.hashesrrRr[rQr r!rFr0r:rrrrrs    (PK,]K\oHoH;resolution/resolvelib/__pycache__/candidates.cpython-39.pycnu[a Re"G@sddlZddlZddlmZmZmZmZmZmZm Z m Z ddl m Z m Z ddlmZddlmZmZddlmZddlmZmZddlmZdd lmZmZdd lmZdd lm Z d d l!m"Z"m#Z#m$Z$m%Z%erd dl&m'Z'e(e)Z*e dZ+e e dZ,e"ee+dddZ-eeedddZ.eeedddZ/eeedddZ0Gddde"Z1Gddde1Z2Gd d!d!e1Z3Gd"d#d#e"Z4Gd$d%d%e"Z5Gd&d'd'e"Z6dS)(N) TYPE_CHECKINGAny FrozenSetIterableOptionalTupleUnioncast)NormalizedNamecanonicalize_name)Version) HashErrorMetadataInconsistent)BaseDistribution)Linklinks_equivalent)Wheel)install_req_from_editableinstall_req_from_line)InstallRequirement)normalize_version_info) CandidateCandidateVersion Requirement format_name)Factory)AlreadyInstalledCandidateEditableCandidate LinkCandidatez) candidatereturncCstttf}t||r|SdS)z%The runtime version of BaseCandidate.N)rrr isinstance)r base_candidate_classesr$/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.pyas_base_candidate$s r&)linktemplater!c Csh|jrJd|jr t|j}n|j}t||j|j|j|j|j t |j |j |j dd}|j|_||_|S)Nztemplate is editableinstall_optionsglobal_optionshashes user_supplied comes_from use_pep517isolated constraintoptions)editablereqstrurlrr.r/r0r1r2dictr*r+ hash_options original_linkr')r'r(lineireqr$r$r%make_install_req_from_link0s(  r=c CsD|jsJdt|j|j|j|j|j|j|jt |j |j |j ddS)Nztemplate not editabler))r.r/r0r1r2permit_editable_wheelsr3) r4rr7r.r/r0r1r2r>r8r*r+r9)r'r(r$r$r%make_install_req_from_editableJsr?)distr(r!c Csddlm}|jrt|j}n.|jr:|jd|jj}n|jd|j}t||j |j |j |j |j t|j|j|jdd}t||j|_|S)Nr) Distributionz @ z==r)r-)$pip._internal.metadata.pkg_resourcesrAr5r6r'canonical_namer7versionrr.r/r0r1r2r8r*r+r9r _dist satisfied_by)r@r(_Distr;r<r$r$r%_make_install_req_from_dist^s*   rHc @s,eZdZUdZeed<dZd)eeede e e e ddddZ e d d d Ze d d d Zed ddZeedddZee ed ddZee d ddZee d ddZee d ddZe d ddZed ddZeddd d!Zed d"d#Zeee ed$d%d&Z e ed d'd(Z!dS)*"_InstallRequirementBackedCandidateaA candidate backed by an ``InstallRequirement``. This represents a package request with the target not being already in the environment, and needs to be fetched and installed. The backing ``InstallRequirement`` is responsible for most of the leg work; this class exposes appropriate information to the resolver. :param link: The link passed to the ``InstallRequirement``. The backing ``InstallRequirement`` will use this link to fetch the distribution. :param source_link: The link this candidate "originates" from. This is different from ``link`` when the link is found in the wheel cache. ``link`` would point to the wheel cache, while this points to the found remote link (e.g. from pypi.org). r@FNr)r' source_linkr<factorynamerDr!cCs2||_||_||_||_||_||_||_dSN)_link _source_link_factory_ireq_name_version_preparer@)selfr'rJr<rKrLrDr$r$r%__init__s z+_InstallRequirementBackedCandidate.__init__r!cCs|jd|jS)N rLrDrUr$r$r%__str__sz*_InstallRequirementBackedCandidate.__str__cCsdj|jjt|jdS)Nz{class_name}({link!r})) class_namer')format __class____name__r6rNrZr$r$r%__repr__sz+_InstallRequirementBackedCandidate.__repr__cCst|j|jfSrM)hashr^rNrZr$r$r%__hash__sz+_InstallRequirementBackedCandidate.__hash__otherr!cCst||jrt|j|jSdSNF)r"r^rrNrUrdr$r$r%__eq__s z)_InstallRequirementBackedCandidate.__eq__cCs|jSrM)rOrZr$r$r%rJsz._InstallRequirementBackedCandidate.source_linkcCs|jdur|jj|_|jS):The normalised name of the project the candidate refers toN)rRr@rCrZr$r$r% project_names  z/_InstallRequirementBackedCandidate.project_namecCs|jSrMrirZr$r$r%rLsz'_InstallRequirementBackedCandidate.namecCs|jdur|jj|_|jSrM)rSr@rDrZr$r$r%rDs  z*_InstallRequirementBackedCandidate.versioncCs$d|j|j|jjr|jjn|jS)Nz{} {} (from {}))r]rLrDrNis_file file_pathrZr$r$r%format_for_errors z3_InstallRequirementBackedCandidate.format_for_errorcCs tddS)NzOverride in subclass)NotImplementedErrorrZr$r$r%_prepare_distributionsz8_InstallRequirementBackedCandidate._prepare_distribution)r@r!cCs`|jdur*|j|jkr*t|jd|j|j|jdur\|j|jkr\t|jdt|jt|jdS)z:Check for consistency of project name and version of dist.NrLrD)rRrCrrQrSrDr6)rUr@r$r$r%_check_metadata_consistencysz>_InstallRequirementBackedCandidate._check_metadata_consistencyc CsJz |}Wn.ty:}z|j|_WYd}~n d}~00|||SrM)ror rQr5rp)rUr@er$r$r%rTs  z+_InstallRequirementBackedCandidate._prepare with_requiresr!ccsH|r|jnd}|D]}|jt||jVq|j|jjVdSNr$)r@iter_dependenciesrPmake_requirement_from_specr6rQ make_requires_python_requirementrequires_python)rUrsrequiresrr$r$r%rusz4_InstallRequirementBackedCandidate.iter_dependenciescCs|jSrM)rQrZr$r$r%get_install_requirementsz:_InstallRequirementBackedCandidate.get_install_requirement)NN)"r_ __module__ __qualname____doc__r__annotations__ is_installedrrrr rrVr6r[r`intrbrboolrgpropertyrJrirLrDrmrorprTrrrur{r$r$r$r%rIzs@   rIcsHeZdZdZd eedeeeeddfdd Z e ddd Z Z S) rFNrr'r(rKrLrDr!c s|}|||}|dur,td|j|j}t||}|j|ksDJ|jjr|jjst|jj} t | j } || ksJ|d| d|durt | j } || ksJd || ||dur|jr|j|jurd|_tj||||||ddS)NzUsing cached wheel link: %sz != z for wheelz{!r} != {!r} for wheel {}Tr'rJr<rKrLrD)get_wheel_cache_entryloggerdebugr'r=is_wheelrkrfilenamer rLr rDr] persistentr:original_link_is_in_wheel_cachesuperrV) rUr'r(rKrLrDrJ cache_entryr<wheel wheel_name wheel_versionr^r$r%rVs>      zLinkCandidate.__init__rWcCs|jj}|j|jddS)NT)parallel_builds)rPpreparerprepare_linked_requirementrQ)rUrr$r$r%ro"sz#LinkCandidate._prepare_distribution)NN r_r|r} is_editablerrrr rrVrro __classcell__r$r$rr%rs*rcsHeZdZdZd eedeeeeddfdd Z e ddd Z Z S) rTNrrcs"tj||t|||||ddS)Nr)rrVr?)rUr'r(rKrLrDrr$r%rV*szEditableCandidate.__init__rWcCs|jj|jSrM)rPrprepare_editable_requirementrQrZr$r$r%ro;sz'EditableCandidate._prepare_distribution)NNrr$r$rr%r'src@seZdZdZdZeedddddZeddd Z edd d Z e dd d Z e edddZeedddZeedddZeedddZeedddZedddZeeeedddZeedddZdS) rTNr)r@r(rKr!cCs0||_t|||_||_d}|j|j|dS)Nzalready satisfied)r@rHrQrPrprepare_installed_requirement)rUr@r(rK skip_reasonr$r$r%rVCs  z"AlreadyInstalledCandidate.__init__rWcCs t|jSrM)r6r@rZr$r$r%r[Tsz!AlreadyInstalledCandidate.__str__cCsdj|jj|jdS)Nz{class_name}({distribution!r}))r\ distribution)r]r^r_r@rZr$r$r%r`Wsz"AlreadyInstalledCandidate.__repr__cCst|j|j|jfSrM)rar^rLrDrZr$r$r%rb]sz"AlreadyInstalledCandidate.__hash__rccCs(t||jr$|j|jko"|j|jkSdSre)r"r^rLrDrfr$r$r%rg`s z AlreadyInstalledCandidate.__eq__cCs|jjSrM)r@rCrZr$r$r%riesz&AlreadyInstalledCandidate.project_namecCs|jSrMrjrZr$r$r%rLiszAlreadyInstalledCandidate.namecCs|jjSrM)r@rDrZr$r$r%rDmsz!AlreadyInstalledCandidate.versioncCs|jjSrM)r@r4rZr$r$r%rqsz%AlreadyInstalledCandidate.is_editablecCs|jd|jdS)NrXz (Installed)rYrZr$r$r%rmusz*AlreadyInstalledCandidate.format_for_errorrrccs2|sdS|jD]}|jt||jVqdSrM)r@rurPrvr6rQ)rUrsrzr$r$r%ruxsz+AlreadyInstalledCandidate.iter_dependenciescCsdSrMr$rZr$r$r%r{~sz1AlreadyInstalledCandidate.get_install_requirement)r_r|r}rrJrrrVr6r[r`rrbrrrgrr rirLrrDrrmrrrrur{r$r$r$r%r?s, rc@seZdZdZeeeddddZedddZedd d Z e dd d Z e e d ddZeedddZeedddZeedddZedddZee dddZee dddZeeedddZe eeeddd Zeedd!d"ZdS)#ExtrasCandidateaA candidate that has 'extras', indicating additional dependencies. Requirements can be for a project with dependencies, something like foo[extra]. The extras don't affect the project/version being installed directly, but indicate that we need additional dependencies. We model that by having an artificial ExtrasCandidate that wraps the "base" candidate. The ExtrasCandidate differs from the base in the following ways: 1. It has a unique name, of the form foo[extra]. This causes the resolver to treat it as a separate node in the dependency graph. 2. When we're getting the candidate's dependencies, a) We specify that we want the extra dependencies as well. b) We add a dependency on the base candidate. See below for why this is needed. 3. We return None for the underlying InstallRequirement, as the base candidate will provide it, and we don't want to end up with duplicates. The dependency on the base candidate is needed so that the resolver can't decide that it should recommend foo[extra1] version 1.0 and foo[extra2] version 2.0. Having those candidates depend on foo=1.0 and foo=2.0 respectively forces the resolver to recognise that this is a conflict. N)baseextrasr!cCs||_||_dSrM)rr)rUrrr$r$r%rVszExtrasCandidate.__init__rWcCs,t|jdd\}}d|d|j|S)NrXrz {}[{}] {},)r6rsplitr]joinr)rUrLrestr$r$r%r[szExtrasCandidate.__str__cCsdj|jj|j|jdS)Nz.{class_name}(base={base!r}, extras={extras!r}))r\rr)r]r^r_rrrZr$r$r%r`s zExtrasCandidate.__repr__cCst|j|jfSrM)rarrrZr$r$r%rbszExtrasCandidate.__hash__rccCs(t||jr$|j|jko"|j|jkSdSre)r"r^rrrfr$r$r%rgs zExtrasCandidate.__eq__cCs|jjSrM)rrirZr$r$r%riszExtrasCandidate.project_namecCst|jj|jS)rh)rrrirrZr$r$r%rLszExtrasCandidate.namecCs|jjSrM)rrDrZr$r$r%rDszExtrasCandidate.versioncCsd|jdt|jS)Nz{} [{}]z, )r]rrmrsortedrrZr$r$r%rmsz ExtrasCandidate.format_for_errorcCs|jjSrM)rrrZr$r$r%rszExtrasCandidate.is_installedcCs|jjSrM)rrrZr$r$r%rszExtrasCandidate.is_editablecCs|jjSrM)rrJrZr$r$r%rJszExtrasCandidate.source_linkrrccs|jj}||jV|sdS|j|jj}|j|jj}t|D]}t d|jj |j |qN|jj |D]$}|t||jj|}|rx|VqxdS)Nz%%s %s does not provide the extra '%s')rrPmake_requirement_from_candidater intersectionr@iter_provided_extras differencerrwarningrLrDrurvr6rQ)rUrsrK valid_extrasinvalid_extrasextrarz requirementr$r$r%rus& z!ExtrasCandidate.iter_dependenciescCsdSrMr$rZr$r$r%r{sz'ExtrasCandidate.get_install_requirement) r_r|r}r~ BaseCandidaterr6rVr[r`rrbrrrgrr rirLrrDrmrrrrrJrrrurr{r$r$r$r%rs0 rc@seZdZdZdZeeedfddddZe ddd Z e e dd d Z e e dd d Ze edddZe dddZeeeedddZeedddZdS)RequiresPythonCandidateFN.)py_version_infor!cCs>|durt|}ntjdd}tddd|D|_dS)N.css|]}t|VqdSrM)r6).0cr$r$r% z3RequiresPythonCandidate.__init__..)rsys version_infor rrS)rUrrr$r$r%rVs z RequiresPythonCandidate.__init__rWcCs d|jSNzPython rSrZr$r$r%r[szRequiresPythonCandidate.__str__cCstSrMREQUIRES_PYTHON_IDENTIFIERrZr$r$r%ri sz$RequiresPythonCandidate.project_namecCstSrMrrZr$r$r%rL szRequiresPythonCandidate.namecCs|jSrMrrZr$r$r%rDszRequiresPythonCandidate.versioncCs d|jSr)rDrZr$r$r%rmsz(RequiresPythonCandidate.format_for_errorrrcCsdSrtr$)rUrsr$r$r%rusz)RequiresPythonCandidate.iter_dependenciescCsdSrMr$rZr$r$r%r{sz/RequiresPythonCandidate.get_install_requirement)r_r|r}rrJrrrrVr6r[rr rirLrrDrmrrrrurr{r$r$r$r%rs r)7loggingrtypingrrrrrrrr pip._vendor.packaging.utilsr r Zpip._vendor.packaging.versionr pip._internal.exceptionsr rpip._internal.metadatarpip._internal.models.linkrrpip._internal.models.wheelrpip._internal.req.constructorsrrZpip._internal.req.req_installrpip._internal.utils.miscrrrrrrrKr getLoggerr_rrrr&r=r?rHrIrrrrrr$r$r$r%sF(            {2CuPK,]  Aresolution/resolvelib/__pycache__/found_candidates.cpython-39.pycnu[a ReI@sdZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZe e ege effZerzeeZneZeeeedd d Zeeeeed d d Zeeeeed ddZGdddeZdS)aUtilities to lazily create and visit candidates found. Creating and visiting a candidate is a *very* costly operation. It involves fetching, extracting, potentially building modules from source, and verifying distribution metadata. It is therefore crucial for performance to keep everything here lazy all the way down, so we only touch candidates that we absolutely need, and not "download the world" when we only need one version of something. N)Sequence) TYPE_CHECKINGAnyCallableIteratorOptionalSetTuple) _BaseVersion) Candidate)infosreturnccsBt}|D]2\}}||vrq |}|dur,q |V||q dS)zIterator for ``FoundCandidates``. This iterator is used when the package is not already installed. Candidates from index come later in their normal ordering. N)setadd)r versions_foundversionfunc candidater/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py _iter_built%s r) installedr rccsJ|V|jh}|D]2\}}||vr$q|}|dur4q|V||qdS)aKIterator for ``FoundCandidates``. This iterator is used when the resolver prefers the already-installed candidate and NOT to upgrade. The installed candidate is therefore always yielded first, and candidates from index come later in their normal ordering, except skipped when the version is already installed. N)rrrr rrrrrrr_iter_built_with_prepended6s  rccsnt}|D]N\}}||vrq |j|kr8|V||j|}|durHq |V||q |j|vrj|VdS)aIterator for ``FoundCandidates``. This iterator is used when the resolver prefers to upgrade an already-installed package. Candidates from index are returned in their normal ordering, except replaced when the version is already installed. The implementation iterates through and yields other candidates, inserting the installed candidate exactly once before we start yielding older or equivalent candidates, or after all other candidates if they are all newer. N)rrrrrrr_iter_built_with_insertedLs      rc@seZdZdZegeefeee e e dddZ e e dddZeedd d Ze dd d Zejd de dddZdS)FoundCandidatesacA lazy sequence to provide candidates to the resolver. The intended usage is to return this from `find_matches()` so the resolver can iterate through the sequence multiple times, but only access the index page when remote packages are actually needed. This improve performances when suitable candidates are already installed on disk. ) get_infosrprefers_installedincompatible_idscCs||_||_||_||_dSN) _get_infos _installed_prefers_installed_incompatible_ids)selfrrrrrrr__init__uszFoundCandidates.__init__)indexrcCs tddSNz don't do thisNotImplementedError)r%r'rrr __getitem__szFoundCandidates.__getitem__)rcsJ}jst|}n jr,tj|}n tj|}fdd|DS)Nc3s |]}t|jvr|VqdSr )idr$).0cr%rr z+FoundCandidates.__iter__..)r!r"rr#rr)r%r iteratorrr/r__iter__s  zFoundCandidates.__iter__cCs tddSr(r)r/rrr__len__szFoundCandidates.__len__r )maxsizecCs|jr|jrdSt|S)NT)r#r"anyr/rrr__bool__s zFoundCandidates.__bool__N)__name__ __module__ __qualname____doc__rrIndexCandidateInforr boolrintr&rr+r3r4 functools lru_cacher7rrrrrls    r)r;r?collections.abcrtypingrrrrrrr Zpip._vendor.packaging.versionr baser r<SequenceCandidaterrrrrrrrs"  $     PK,]9resolution/resolvelib/__pycache__/provider.cpython-39.pycnu[a Re#@sddlZddlZddlmZmZmZmZmZmZm Z ddl m Z ddl m Z mZmZddlmZddlmZerddl mZdd lmZeee fZe ee efZne ZGd d d eZdS) N) TYPE_CHECKINGDictIterableIteratorMappingSequenceUnion)AbstractProvider) Candidate Constraint Requirement)REQUIRES_PYTHON_IDENTIFIER)Factory) Preference)RequirementInformationc@s eZdZdZeeeefeeeee fddddZ e e e fedddZeeee feeee feeed fed d d d d ZeedddZeeeee feeee fee dddZe e edddZe ee dddZeeed edddZdS) PipProvideraPip's provider implementation for resolvelib. :params constraints: A mapping of constraints specified by the user. Keys are canonicalized project names. :params ignore_dependencies: Whether the user specified ``--no-deps``. :params upgrade_strategy: The user-specified upgrade strategy. :params user_requested: A set of canonicalized package names that the user supplied for pip to install/upgrade. N)factory constraintsignore_dependenciesupgrade_strategyuser_requestedreturncCs2||_||_||_||_||_tdd|_dS)NcSstjSN)mathinfrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py@z&PipProvider.__init__..)_factory _constraints_ignore_dependencies_upgrade_strategy_user_requested collections defaultdict _known_depths)selfrrrrrrrr__init__3s zPipProvider.__init__)requirement_or_candidatercCs|jSrname)r(r*rrridentifyBszPipProvider.identifyPreferenceInformationr) identifier resolutions candidates informationbacktrack_causesrc sdd||D}t|\}}dddd|DD} |du} tdd| D} t| } zj|} WnDtytj} fdd||D}td d|Dd }Yn0d }|j|<j |tj} |t k}|d k} ||}| || | | || | |f S) a[Produce a sort key for given requirement based on preference. The lower the return value is, the more preferred this group of arguments is. Currently pip considers the followings in order: * Prefer if any of the known requirements is "direct", e.g. points to an explicit URL. * If equal, prefer if any requirement is "pinned", i.e. contains operator ``===`` or ``==``. * If equal, calculate an approximate "depth" and resolve requirements closer to the user-specified requirements first. * Order user-specified requirements by the order they are specified. * If equal, prefers "non-free" requirements, i.e. contains at least one operator, such as ``>=`` or ``<``. * If equal, order alphabetically for consistency (helps debuggability). css|]\}}|VqdSr)get_candidate_lookup).0r_rrr _rz-PipProvider.get_preference..cSsg|]}|D] }|jq qSr)operator)r5 specifier_set specifierrrr asz.PipProvider.get_preference..css|]}|r|jVqdSr)r;)r5ireqrrrr8crNcss|]}|dddkVqdS)Nz==r)r5oprrrr8hrc3s*|]"\}}|durj|jndVqdS)Ng)r'r,)r5r7parentr(rrr8oscss|] }|VqdSrr)r5drrrr8srg? setuptools) zipanyboolr$KeyErrorrrminr'getris_backtrack_cause)r(r/r0r1r2r3lookups candidateireqs operatorsdirectpinnedunfreerequested_order parent_depthsinferred_depthrequires_python delay_thisbacktrack_causerrArget_preferenceEs@       zPipProvider.get_preference)r/rcCsD||jvr|j|S|d\}}}|r<||jvr<|j|StS)N[)r! partitionr empty)r(r/r, open_bracketr7rrr_get_constraints    zPipProvider._get_constraint)r/ requirementsincompatibilitiesrcs6ttdfdd }jj||||| |dS)N)r,rcs&jdkrdSjdkr"|jvSdS)aAre upgrades allowed for this project? This checks the upgrade strategy, and whether the project was one that the user specified in the command line, in order to decide whether we should upgrade if there's a newer version available. (Note that we don't need access to the `--upgrade` flag, because an upgrade strategy of "to-satisfy-only" means that `--upgrade` was not specified). eagerTzonly-if-neededF)r#r$r+rArr_eligible_for_upgrades   z7PipProvider.find_matches.._eligible_for_upgrade)r/r^ constraintprefers_installedr_)strrFr find_candidatesr])r(r/r^r_rarrAr find_matchesszPipProvider.find_matches) requirementrLrcCs ||Sr)is_satisfied_by)r(rgrLrrrrhszPipProvider.is_satisfied_by)rLrcCs|j }dd||DS)NcSsg|]}|dur|qSrr)r5r6rrrr<rz0PipProvider.get_dependencies..)r"iter_dependencies)r(rL with_requiresrrrget_dependenciesszPipProvider.get_dependencies)r/r3rcCs8|D].}||jjkrdS|jr||jjkrdSqdS)NTF)rgr,r@)r/r3rWrrrrJs  zPipProvider.is_backtrack_cause)__name__ __module__ __qualname____doc__rrrdr rFintr)rr r r-rrrrrXr]rfrhrk staticmethodrJrrrrr(s8      T r)r%rtypingrrrrrrrZ pip._vendor.resolvelib.providersr baser r r r1rrrrZ pip._vendor.resolvelib.resolversrr.rd _ProviderBaserrrrrs$      PK,]<(9resolution/resolvelib/__pycache__/resolver.cpython-39.pycnu[a Rel%@s~ddlZddlZddlZddlmZmZmZmZmZm Z m Z ddl m Z ddl mZmZddl mZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZm Z dd l!m"Z"ddl#m$Z$m%Z%ddl&m'Z'm(Z(ddl)m*Z*erddl+m,Z-e-e(e'e.fZ,e/e0Z1GdddeZde2eee.e2fdddZ3e e.efeee.e2fe e2e.fdddZ4dS)N) TYPE_CHECKINGDictListOptionalSetTuplecastcanonicalize_name) BaseReporterResolutionImpossible)Resolver) DirectedGraph) WheelCache) PackageFinder)RequirementPreparer)InstallRequirement)RequirementSet) BaseResolverInstallRequirementProvider) PipProvider)PipDebuggingReporter PipReporter) Candidate Requirement)Factory)ResultcszeZdZhdZd eeeeee e e e e e ee e dfd fdd Z eee eddd Zeeed d d ZZS)r >zto-satisfy-onlyeagerzonly-if-neededN.) preparerfinder wheel_cachemake_install_req use_user_siteignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_infoc sJt| |jvsJt|||||| ||| d |_||_| |_d|_dS)N) r rr"r!r#r'r%r&r))super__init___allowed_strategiesrfactoryr$r(_result) selfrr r!r"r#r$r%r&r'r(r) __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.pyr+&s   zResolver.__init__) root_reqscheck_supported_wheelsreturnc Cs|j|}t|j|j|j|j|jd}dtjvr:t }nt }t ||}zd}|j |j |d}|_Wn@ty} z(|jtd| |j} | | WYd} ~ n d} ~ 00t|d} |jD]} | } | durq|j| }|durd| _nr|jjrd| _n`|j| jkrd| _nJ| js(|jr0d| _n2| jr| jjr| jjrXt d | j!qd| _nq| j}|r|j"rd j#| j!| j||j$pd d }t%|| &| q| j'}|jj()|| S) N)r- constraintsr$r(user_requestedPIP_RESOLVER_DEBUGi) max_roundsz,ResolutionImpossible[Requirement, Candidate])r5FTz%s is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.zThe candidate selected for download or install is a yanked version: {name!r} candidate (version {version} at {link}) Reason for being yanked: {reason}z )nameversionlinkreason)*r-collect_root_requirementsrr7r$r(r8osenvironrr RLResolverresolve requirementsr.r get_installation_errorrrmappingvaluesget_install_requirementget_dist_to_uninstallshould_reinstallr'r< is_editableeditable source_linkis_fileis_wheelloggerinfor; is_yankedformat yanked_reasonwarningadd_named_requirementall_requirementsr prepare_linked_requirements_more)r/r4r5 collectedproviderreporterresolver try_to_avoid_resolution_too_deepresulteerrorreq_set candidateireqinstalled_distr=msgreqsr2r2r3rCFs~         zResolver.resolve)rar6cCs^|jdusJd|jj}t|t|jjdd}t|jtj t |ddd}dd |DS) aGet order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept consistent as they get installed one-by-one. The current implementation creates a topological ordering of the dependency graph, while breaking any cycles in the graph at arbitrary points. We make no guarantees about where the cycle would be broken, other than they would be broken. Nzmust call resolve() firstr)expected_node_count)weightsT)keyreversecSsg|] \}}|qSr2r2).0_rcr2r2r3 z3Resolver.get_installation_order..) r.graphget_topological_weightslenrFsortedrDitems functoolspartial_req_set_item_sorter)r/rarorh sorted_itemsr2r2r3get_installation_orders zResolver.get_installation_order)N)__name__ __module__ __qualname__r,rrrrrboolstrrintr+rrrrCrx __classcell__r2r2r0r3r #s*! _r zDirectedGraph[Optional[str]])rorgr6csTtittddfdd dddks@Jt|ksPJS)aAssign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We take the length for the longest path to any node from root, ignoring any paths that contain a single node twice (i.e. cycles). This is done through a depth-first search through the graph, while keeping track of the path to the node. Cycles in the graph result would result in node being revisited while also being it's own path. In this case, take no action. This helps ensure we don't get stuck in a cycle. When assigning weight, the longer path (i.e. larger length) is preferred. N)noder6csZ|vr dS||D] }|q ||d}t|t|<dS)Nr)add iter_childrenremovegetmaxrq)rchildlast_known_parent_countropathvisitrhr2r3rs    z&get_topological_weights..visitr)setrr}rq)rorgr2rr3rpsrp)itemrhr6cCst|d}|||fS)a)Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests. rr )rrhr;r2r2r3rvs rv)5rtloggingr@typingrrrrrrrpip._vendor.packaging.utilsr pip._vendor.resolvelibr r r rBZpip._vendor.resolvelib.structsrpip._internal.cacher"pip._internal.index.package_finderr pip._internal.operations.preparerZpip._internal.req.req_installrZpip._internal.req.req_setrpip._internal.resolution.baserr,pip._internal.resolution.resolvelib.providerr,pip._internal.resolution.resolvelib.reporterrrbaserrr-rZ pip._vendor.resolvelib.resolversrZRLResultr} getLoggerryrPr~rprvr2r2r2r3s<$            ! /  PK,]pkJIJI8resolution/resolvelib/__pycache__/factory.cpython-39.pycnu[a Rej@sBddlZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZddlmZddlmZddlmZmZddlmZddlmZmZddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&dd l'm(Z(dd l)m*Z*dd l+m,Z,m-Z-dd l.m/Z/dd l0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7m8Z8ddl9m:Z:ddl;mZ>ddl?m@Z@ddlAmBZBddlCmDZDddlEmFZFmGZGmHZHmIZIddlJmKZKmLZLmMZMmNZNmOZOmPZPmQZQddlRmSZSmTZTddlUmVZVmWZWmXZXmYZYerddlmZZZGdddeZZ[e\e]Z^edZ_ee/e_fZ`Gd d!d!e ZaGd"d#d#ZbdS)$N) TYPE_CHECKINGDict FrozenSetIterableIteratorListMapping NamedTupleOptionalSequenceSetTupleTypeVarcast)InvalidRequirement) SpecifierSet)NormalizedNamecanonicalize_name)ResolutionImpossible) CacheEntry WheelCache)DistributionNotFoundInstallationErrorInstallationSubprocessErrorMetadataInconsistentUnsupportedPythonVersionUnsupportedWheel) PackageFinder) get_scheme)BaseDistributionget_default_environment)Link)Wheel)RequirementPreparer)install_req_from_link_and_ireq)InstallRequirementcheck_invalid_constraint_type)InstallRequirementProvider) get_supported)Hashes) dist_location)get_requirement)running_under_virtualenv) CandidateCandidateVersion Constraint Requirement)AlreadyInstalledCandidate BaseCandidateEditableCandidateExtrasCandidate LinkCandidateRequiresPythonCandidateas_base_candidate)FoundCandidatesIndexCandidateInfo)ExplicitRequirementRequiresPythonRequirementSpecifierRequirementUnsatisfiableRequirement)Protocolc@seZdZUeed<eed<dS) ConflictCause requirementparentN)__name__ __module__ __qualname__r<__annotations__r.rGrG/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.pyr@Ls r@Cc@s:eZdZUeeed<eeefed<eee fed<dS)CollectedRootRequirements requirements constraintsuser_requestedN) rCrDrErr1rFrstrr0intrGrGrGrHrJWs  rJc @s*eZdZdAeeeeeeeeeee e dfdd ddZ e edddZ edd d d Zeeeed d dZeeeeedddZeeeeeeeeeedddZeeeeeee e edddZ!e e"eee#edddZ$ee%ee#edddZ&ee'ee e"fe'ee#efe%ee eddd Z(ee eee"d!d"d#Z)e*ee+d$d%d&Z,ee-d'd(d)Z.dBeeee eee"d+d,d-Z/eee"d.d/d0Z0eeeee1d1d2d3Z2eeed'd4d5Z3ed6e4d7d8d9Z5e"eee6d:d;d<Z7d=e8ee%fe9d>d?d@Z:dS)CFactoryN.) finderpreparermake_install_req wheel_cache use_user_siteforce_reinstallignore_installedignore_requires_pythonpy_version_inforeturnc Cs||_||_||_t| |_||_||_||_||_i|_ i|_ i|_ i|_ i|_ |svt} dd| jddD|_ni|_dS)NcSsi|] }|j|qSrG)canonical_name).0distrGrGrH }sz$Factory.__init__..F) local_only)_finderrR _wheel_cacher7_python_candidate_make_install_req_from_spec_use_user_site_force_reinstall_ignore_requires_python_build_failures_link_candidate_cache_editable_candidate_cache_installed_candidate_cache_extras_candidate_cacher iter_installed_distributions_installed_dists) selfrQrRrSrTrUrVrWrXrYenvrGrGrH__init__^s(   zFactory.__init__rZcCs|jSN)rernrGrGrHrVszFactory.force_reinstall)linkrZcCsB|js dSt|j}||jjr*dS|jd}t|dS)Nz+ is not a supported wheel on this platform.)is_wheelr"filename supportedr` target_pythonget_tagsr)rnrtwheelmsgrGrGrH"_fail_if_link_is_unsupported_wheels  z*Factory._fail_if_link_is_unsupported_wheel)baseextrasrZcCsFt||f}z|j|}Wn&ty@t||}||j|<Yn0|Srr)idrkKeyErrorr5)rnr}r~ cache_key candidaterGrGrH_make_extras_candidates   zFactory._make_extras_candidate)r]r~templaterZcCsRz|j|j}Wn,ty<t|||d}||j|j<Yn0|sF|S|||S)N)factory)rjr[rr2r)rnr]r~rr}rGrGrH_make_candidate_from_dists z!Factory._make_candidate_from_dist)rtr~rnameversionrZc Cs||jvrdS|jr||jvr~zt|||||d|j|<WnBttfy|}z&td||||j|<WYd}~dSd}~00|j|}nx||jvrzt |||||d|j|<WnDttfy}z&td||||j|<WYd}~dSd}~00|j|}|s |S| ||S)N)rrrzDiscarding %s. %s) rgeditablerir4rrloggerwarningrhr6r)rnrtr~rrrer}rGrGrH_make_candidate_from_linksD       z!Factory._make_candidate_from_link)ireqs specifierhashesprefers_installedincompatible_idsrZc s|sdS|djsJdtjjt|D]<}|jsFJd|jjM|jddMt|jOq4ttdfdd }t t dfd d }t |||S) NrGrz)Candidates found on index must be PEP 508F)trust_internetrqcsfjr dSzj}Wnty,YdS0j|jddsBdSj|d}t|vrbdS|S)z6Get the candidate for the currently-installed version.NT) prereleases)r]r~r)rermrcontainsrrr)installed_distr)r~rrrnrrrGrH_get_installed_candidates   z@Factory._iter_found_candidates.._get_installed_candidatec 3sxjjd}t|}tdd|D}t|D]:}|sJ|jjrJq8tj j |j|j d}|j |fVq8dS)N) project_namerrcss|]}|jjVqdSrr)rt is_yanked)r\icanrGrGrH zUFactory._iter_found_candidates..iter_index_candidate_infos..)rtr~rrr) r`find_best_candidatelistiter_applicableallreversedrtr functoolspartialrr)resulticans all_yankedrfunc)r~rrrnrrrGrHiter_index_candidate_infoss&   zBFactory._iter_found_candidates..iter_index_candidate_infos) reqrr frozensetrrr~r r.rr:r9) rnrrrrrireqrrrG)r~rrrrnrrrH_iter_found_candidatess&    zFactory._iter_found_candidates)base_requirementsr~rZccsJ|D]@}|\}}|durqt|}|dus6Jd|||VqdS)a8Produce explicit candidates from the base given an extra-ed package. :param base_requirements: Requirements known to the resolver. The requirements are guaranteed to not have extras. :param extras: The extras to inject into the explicit requirements' candidates. Nzno extras here)get_candidate_lookupr8r)rnrr~r lookup_cand_ base_candrGrGrH#_iter_explicit_candidates_from_base2s  z+Factory._iter_explicit_candidates_from_base) identifier constraintrrZccsD|jD]8}|||j|tt||t|dd}|r|VqdS)zProduce explicit candidates from constraints. This creates "fake" InstallRequirement objects that are basically clones of what "should" be the template, but with original_link set to link. Nr~rrr)linksr|rrr$r)rnrrrrtrrGrGrH!_iter_candidates_from_constraintsHs  z)Factory._iter_candidates_from_constraints)rrKincompatibilitiesrrrZc st}g}D]4}|\} } | dur4|| | dur|| qtt:t} ||  | j dt | j Wdn1s0Y|rz||j|ddWntyYdS0dd| dD|s||jj|Sfdd|DS)NrGr)rcSsh|] }t|qSrG)rr\crGrGrH rz*Factory.find_candidates..c3sB|]:tvrrtfddDrVqdS)c3s|]}|VqdSrr)is_satisfied_by)r\rrrGrHrrz4Factory.find_candidates...N)rrr)r\rr incompat_idsrKrrHrs   z*Factory.find_candidates..)setraddappend contextlibsuppressrr+updatergetrrr~rrrrr) rnrrKrrrexplicit_candidatesrrcandrparsed_requirementrGrrHfind_candidates_sN       "  zFactory.find_candidates)rrequested_extrasrZcCs||s td|j|jdS|js.t|S||j|j|jt |j ||jr\t |jnddd}|dur|js|j |jt t |jS||S)Nz6Ignoring %s: markers '%s' don't match your environmentr) match_markersrinformarkersrtr=r|rrr~rrgr>make_requirement_from_candidate)rnrrrrGrGrH"_make_requirement_from_install_reqs,   z*Factory._make_requirement_from_install_req) root_ireqsrZcCstgii}t|D]\}}|jrt|}|r6t||s@q|jsNJdt|j}||jvrv|j||M<qt ||j|<q|j |dd}|durq|j r|j|j vr||j |j<|j|q|S)NzConstraint must be namedrG)r)rJ enumeraterr&rrrrrLr0 from_ireqr user_suppliedrMrKr)rnr collectedirproblemrrrGrGrHcollect_root_requirementss.    z!Factory.collect_root_requirements)rrZcCst|Srr)r;)rnrrGrGrHrsz'Factory.make_requirement_from_candidaterG)r comes_fromrrZcCs|||}|||Srr)rcr)rnrrrrrGrGrHmake_requirement_from_specs z"Factory.make_requirement_from_spec)rrZcCs"|jr dSt|sdSt||jSrr)rfrNr<rb)rnrrGrGrH make_requires_python_requirements z(Factory.make_requires_python_requirement)rtrrZcCs*|jdus|jjrdS|jj||tdS)aLook up the link in the wheel cache. If ``preparer.require_hashes`` is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have nondeterministic contents due to file modification times. N)rt package_namesupported_tags)rarRrequire_hashesget_cache_entryr()rnrtrrGrGrHget_wheel_cache_entrys zFactory.get_wheel_cache_entrycCs|j|j}|durdSz@t|jtjdddtjidtjdddtjidfvrXWdSWnt ylYn0|j sx|S|j r|St r|j rd|jd|j}t|dS)Npurelib rpm_prefixr})schemevarsplatlibzNWill not install to the user site because it will lack sys.path precedence to z in )rmrrr*_dist sysconfigget_pathsys base_prefixrrd in_usersiter,in_site_packagesraw_namelocationr)rnrr]messagerGrGrHget_dist_to_uninstalls0   zFactory.get_dist_to_uninstallr@)causesrZcCs|s Jd|jj}t|dkrVt|djj}d|djjd|d|}t|Sd|d}|D]0}|j }t|jj}|d |d |d 7}qft|S) Nz,Requires-Python error reported with no causer-rzPackage z requires a different Python: z not in z%Packages require a different Python. z not in: z (required by )) rbrlenrNrArrBrrformat_for_error)rnrrrrcausepackagerGrGrH_report_requires_python_error5s"     z%Factory._report_requires_python_error)rrBrZcCs|durt|}n|d|jd}|j|j}ddtdd|DD}td|d|pbd t|d kr|t d t d |S) Nz (from rcSsg|] }t|qSrG)rN)r\vrGrGrH Trz?Factory._report_single_requirement_conflict..cSsh|] }|jqSrG)rrrGrGrHrTrz>Factory._report_single_requirement_conflict..zNCould not find a version that satisfies the requirement %s (from versions: %s), nonezrequirements.txtzHINT: You are attempting to install a package literally named "requirements.txt" (which cannot exist). Consider using the '-r' flag to install the packages listed in requirements.txtz#No matching distribution found for ) rNrr`find_all_candidatesrsortedrcriticaljoinrr)rnrrBreq_dispcandsversionsrGrGrH#_report_single_requirement_conflictKs   z+Factory._report_single_requirement_conflictz,ResolutionImpossible[Requirement, Candidate])rrLrZcs|jsJdfdd|jD}|r6td|St|jdkrh|jd\}}|j|vrh||Stttddd }ttd d d }t }|jD],\}}|dur| } n||} | | q|r|t |} nd } d | } t| d} t } |jD]^\}}|j|vr | |j| d} |rH| |jd|jd} n| d} | | } q| D]"} || j}| d| |7} qd| ddddd} t| tdS)Nz)Installation error reported with no causecs*g|]"}t|jtr|jjs|qSrG) isinstancerAr<rrb)r\rrsrGrHrps z2Factory.get_installation_error..zSequence[ConflictCause]r-r)partsrZcSs2t|dkr|dSd|ddd|dS)Nr-rrz and )rr)rrGrGrH text_joins z1Factory.get_installation_error..text_join)rBrZcSsF|}|r|js$|jd|jSt|jtr.describe_triggerzthe requested packageszOCannot install {} because these package versions have conflicting dependencies.z The conflict is caused by:z  z depends on zThe user requested z% The user requested (constraint) z zTo fix this you could try to: z91. loosen the range of package versions you've specified z92. remove package versions to allow pip attempt to solve zthe dependency conflict znResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies)rrrrrrrrNr.rrrrformatrrrrrr)rnrrLrequires_python_causesrrBrr triggerstriggerrr{relevant_constraintskeyspecrGrsrHget_installation_errorfsr           zFactory.get_installation_error)N)rG);rCrDrErr#r'r rboolr rOrppropertyrVr!r|r3rrNr5rrr%r.rrr/rr rr)r rrr1rrr0rrrrrrJrr;rrrrrrrrrrrrrrGrGrGrHrP]s  &    5 V   G !     '   rP)crrloggingrrtypingrrrrrrrr r r r r rrZ"pip._vendor.packaging.requirementsrZ pip._vendor.packaging.specifiersrpip._vendor.packaging.utilsrrpip._vendor.resolvelibrpip._internal.cacherrpip._internal.exceptionsrrrrrr"pip._internal.index.package_finderrpip._internal.locationsrpip._internal.metadatarr pip._internal.models.linkr!pip._internal.models.wheelr" pip._internal.operations.preparer#pip._internal.req.constructorsr$Zpip._internal.req.req_installr%r&pip._internal.resolution.baser'&pip._internal.utils.compatibility_tagsr(pip._internal.utils.hashesr)pip._internal.utils.miscr*pip._internal.utils.packagingr+pip._internal.utils.virtualenvr,r}r.r/r0r1 candidatesr2r3r4r5r6r7r8found_candidatesr9r:rKr;r<r=r>r?r@ getLoggerrCrrICacherJrPrGrGrGrHsJ@                $    PK,] 9resolution/resolvelib/__pycache__/reporter.cpython-39.pycnu[a Re @spddlmZddlmZddlmZmZddlmZddl m Z m Z ee Z GdddeZGd d d eZd S) ) defaultdict) getLogger)Any DefaultDict) BaseReporter) Candidate Requirementc@s*eZdZddddZeddddZdS) PipReporterNreturncCstt|_dddd|_dS)Nzpip is looking at multiple versions of {package_name} to determine which version is compatible with other requirements. This could take a while.zThis is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.)r )rintbacktracks_by_package_messages_at_backtrackselfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/reporter.py__init__ s  zPipReporter.__init__ candidater cCsR|j|jd7<|j|j}||jvr.dS|j|}td|j|jddS)NrzINFO: %s) package_name)rnamerloggerinfoformat)rrcountmessagerrr backtracking#s    zPipReporter.backtracking)__name__ __module__ __qualname__rrr rrrrr sr c@seZdZdZddddZeddddZeedd d d Zedd d dZ e e ddddZ e ddddZ e ddddZdS)PipDebuggingReporterz9A reporter that does an info log for every event it sees.Nr cCstddS)NzReporter.starting()rrrrrrstarting1szPipDebuggingReporter.starting)indexr cCstd|dS)NzReporter.starting_round(%r)r%)rr'rrrstarting_round4sz#PipDebuggingReporter.starting_round)r'stater cCstd|dS)Nz Reporter.ending_round(%r, state)r%)rr'r)rrr ending_round7sz!PipDebuggingReporter.ending_round)r)r cCstd|dS)NzReporter.ending(%r)r%)rr)rrrending:szPipDebuggingReporter.ending) requirementparentr cCstd||dS)Nz#Reporter.adding_requirement(%r, %r)r%)rr,r-rrradding_requirement=sz'PipDebuggingReporter.adding_requirementrcCstd|dS)NzReporter.backtracking(%r)r%rrrrrr @sz!PipDebuggingReporter.backtrackingcCstd|dS)NzReporter.pinning(%r)r%r/rrrpinningCszPipDebuggingReporter.pinning)r!r"r#__doc__r&rr(rr*r+r rr.r r0rrrrr$.sr$N) collectionsrloggingrtypingrrZ pip._vendor.resolvelib.reportersrbaserr r!rr r$rrrrs   "PK,]3=resolution/resolvelib/__pycache__/requirements.cpython-39.pycnu[a ReO@sddlmZddlmZmZddlmZddlmZm Z m Z m Z Gddde Z Gdd d e Z Gd d d e ZGd d d e ZdS)) SpecifierSet)NormalizedNamecanonicalize_name)InstallRequirement) CandidateCandidateLookup Requirement format_namec@seZdZeddddZedddZeddd Zee dd d Z eedd d Z edddZ e dddZeedddZdS)ExplicitRequirementN candidatereturncCs ||_dSNr selfr r/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__ szExplicitRequirement.__init__rcCs t|jSr)strr rrrr__str__ szExplicitRequirement.__str__cCsdj|jj|jdS)Nz{class_name}({candidate!r})) class_namer )format __class____name__r rrrr__repr__szExplicitRequirement.__repr__cCs|jjSr)r project_namerrrrrsz ExplicitRequirement.project_namecCs|jjSr)r namerrrrr szExplicitRequirement.namecCs |jSr)r format_for_errorrrrrr! sz$ExplicitRequirement.format_for_errorcCs |jdfSrrrrrrget_candidate_lookup#sz(ExplicitRequirement.get_candidate_lookupcCs ||jkSrrrrrris_satisfied_by&sz#ExplicitRequirement.is_satisfied_by)r __module__ __qualname__rrrrrpropertyrrr r!rr"boolr#rrrrr sr c@seZdZeddddZedddZeddd Zee dd d Z eedd d Z edddZ e dddZeedddZdS)SpecifierRequirementN)ireqrcCs(|jdusJd||_t|j|_dS)NzThis is a link, not a specifier)link_ireq frozensetextras_extras)rr)rrrr+szSpecifierRequirement.__init__rcCs t|jjSr)rr+reqrrrrr0szSpecifierRequirement.__str__cCsdj|jjt|jjdS)Nz{class_name}({requirement!r}))r requirement)rrrrr+r/rrrrr3s zSpecifierRequirement.__repr__cCs|jjsJdt|jjjS)N'Specifier-backed ireq is always PEP 508)r+r/rr rrrrr9sz!SpecifierRequirement.project_namecCst|j|jSr)r rr.rrrrr >szSpecifierRequirement.namecCsZddt|dD}t|dkr(dSt|dkr<|dSd|ddd |dS) NcSsg|] }|qSr)strip).0srrr Hz9SpecifierRequirement.format_for_error..,rrz, z and )rsplitlenjoin)rpartsrrrr!Bs   z%SpecifierRequirement.format_for_errorcCs d|jfSr)r+rrrrr"Psz)SpecifierRequirement.get_candidate_lookupr cCsN|j|jks$Jd|jd|j|jjs4Jd|jjj}|j|jddS)Nz6Internal issue: Candidate is not for this requirement z vs r1T prereleases)r r+r/ specifiercontainsversion)rr specrrrr#Ss z$SpecifierRequirement.is_satisfied_by)rr$r%rrrrrr&rrr r!rr"rr'r#rrrrr(*sr(c@seZdZdZeeddddZedddZedd d Z e e dd d Z e edd dZ edddZedddZeedddZdS)RequiresPythonRequirementz4A requirement representing Requires-Python metadata.N)r@matchrcCs||_||_dSr)r@ _candidate)rr@rErrrrcsz"RequiresPythonRequirement.__init__rcCs d|jS)NzPython )r@rrrrrgsz!RequiresPythonRequirement.__str__cCsdj|jjt|jdS)Nz{class_name}({specifier!r}))rr@)rrrrr@rrrrrjsz"RequiresPythonRequirement.__repr__cCs|jjSr)rFrrrrrrpsz&RequiresPythonRequirement.project_namecCs|jjSr)rFr rrrrr tszRequiresPythonRequirement.namecCst|Srrrrrrr!xsz*RequiresPythonRequirement.format_for_errorcCs"|jj|jjddr|jdfSdS)NTr>NN)r@rArFrBrrrrr"{s z.RequiresPythonRequirement.get_candidate_lookupr cCs(|j|jjksJd|jj|jddS)NzNot Python candidateTr>)r rFr@rArBrrrrr#sz)RequiresPythonRequirement.is_satisfied_by)rr$r%__doc__rrrrrrr&rrr r!rr"r'r#rrrrrD`srDc@seZdZdZeddddZedddZedd d Ze edd d Z e edd dZ edddZ e dddZeedddZdS)UnsatisfiableRequirementz'A requirement that cannot be satisfied.N)r rcCs ||_dSr_name)rr rrrrsz!UnsatisfiableRequirement.__init__rcCs |jdS)Nz (unavailable)rKrrrrrsz UnsatisfiableRequirement.__str__cCsdj|jjt|jdS)Nz{class_name}({name!r}))rr )rrrrrLrrrrrsz!UnsatisfiableRequirement.__repr__cCs|jSrrKrrrrrsz%UnsatisfiableRequirement.project_namecCs|jSrrKrrrrr szUnsatisfiableRequirement.namecCst|SrrGrrrrr!sz)UnsatisfiableRequirement.format_for_errorcCsdS)NrHrrrrrr"sz-UnsatisfiableRequirement.get_candidate_lookupr cCsdS)NFrrrrrr#sz(UnsatisfiableRequirement.is_satisfied_by)rr$r%rIrrrrrr&rr r!rr"rr'r#rrrrrJsrJN)Z pip._vendor.packaging.specifiersrpip._vendor.packaging.utilsrrZpip._internal.req.req_installrbaserrr r r r(rDrJrrrrs  !6(PK,]I59resolution/resolvelib/__pycache__/__init__.cpython-39.pycnu[a Re@sdS)Nrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__init__.pyPK,]jk"G"G#resolution/resolvelib/candidates.pynu[import logging import sys from typing import TYPE_CHECKING, Any, FrozenSet, Iterable, Optional, Tuple, Union, cast from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from pip._internal.exceptions import HashError, MetadataInconsistent from pip._internal.metadata import BaseDistribution from pip._internal.models.link import Link, links_equivalent from pip._internal.models.wheel import Wheel from pip._internal.req.constructors import ( install_req_from_editable, install_req_from_line, ) from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.misc import normalize_version_info from .base import Candidate, CandidateVersion, Requirement, format_name if TYPE_CHECKING: from .factory import Factory logger = logging.getLogger(__name__) BaseCandidate = Union[ "AlreadyInstalledCandidate", "EditableCandidate", "LinkCandidate", ] # Avoid conflicting with the PyPI package "Python". REQUIRES_PYTHON_IDENTIFIER = cast(NormalizedName, "") def as_base_candidate(candidate: Candidate) -> Optional[BaseCandidate]: """The runtime version of BaseCandidate.""" base_candidate_classes = ( AlreadyInstalledCandidate, EditableCandidate, LinkCandidate, ) if isinstance(candidate, base_candidate_classes): return candidate return None def make_install_req_from_link( link: Link, template: InstallRequirement ) -> InstallRequirement: assert not template.editable, "template is editable" if template.req: line = str(template.req) else: line = link.url ireq = install_req_from_line( line, user_supplied=template.user_supplied, comes_from=template.comes_from, use_pep517=template.use_pep517, isolated=template.isolated, constraint=template.constraint, options=dict( install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, ), ) ireq.original_link = template.original_link ireq.link = link return ireq def make_install_req_from_editable( link: Link, template: InstallRequirement ) -> InstallRequirement: assert template.editable, "template not editable" return install_req_from_editable( link.url, user_supplied=template.user_supplied, comes_from=template.comes_from, use_pep517=template.use_pep517, isolated=template.isolated, constraint=template.constraint, permit_editable_wheels=template.permit_editable_wheels, options=dict( install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, ), ) def _make_install_req_from_dist( dist: BaseDistribution, template: InstallRequirement ) -> InstallRequirement: from pip._internal.metadata.pkg_resources import Distribution as _Dist if template.req: line = str(template.req) elif template.link: line = f"{dist.canonical_name} @ {template.link.url}" else: line = f"{dist.canonical_name}=={dist.version}" ireq = install_req_from_line( line, user_supplied=template.user_supplied, comes_from=template.comes_from, use_pep517=template.use_pep517, isolated=template.isolated, constraint=template.constraint, options=dict( install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, ), ) ireq.satisfied_by = cast(_Dist, dist)._dist return ireq class _InstallRequirementBackedCandidate(Candidate): """A candidate backed by an ``InstallRequirement``. This represents a package request with the target not being already in the environment, and needs to be fetched and installed. The backing ``InstallRequirement`` is responsible for most of the leg work; this class exposes appropriate information to the resolver. :param link: The link passed to the ``InstallRequirement``. The backing ``InstallRequirement`` will use this link to fetch the distribution. :param source_link: The link this candidate "originates" from. This is different from ``link`` when the link is found in the wheel cache. ``link`` would point to the wheel cache, while this points to the found remote link (e.g. from pypi.org). """ dist: BaseDistribution is_installed = False def __init__( self, link: Link, source_link: Link, ireq: InstallRequirement, factory: "Factory", name: Optional[NormalizedName] = None, version: Optional[CandidateVersion] = None, ) -> None: self._link = link self._source_link = source_link self._factory = factory self._ireq = ireq self._name = name self._version = version self.dist = self._prepare() def __str__(self) -> str: return f"{self.name} {self.version}" def __repr__(self) -> str: return "{class_name}({link!r})".format( class_name=self.__class__.__name__, link=str(self._link), ) def __hash__(self) -> int: return hash((self.__class__, self._link)) def __eq__(self, other: Any) -> bool: if isinstance(other, self.__class__): return links_equivalent(self._link, other._link) return False @property def source_link(self) -> Optional[Link]: return self._source_link @property def project_name(self) -> NormalizedName: """The normalised name of the project the candidate refers to""" if self._name is None: self._name = self.dist.canonical_name return self._name @property def name(self) -> str: return self.project_name @property def version(self) -> CandidateVersion: if self._version is None: self._version = self.dist.version return self._version def format_for_error(self) -> str: return "{} {} (from {})".format( self.name, self.version, self._link.file_path if self._link.is_file else self._link, ) def _prepare_distribution(self) -> BaseDistribution: raise NotImplementedError("Override in subclass") def _check_metadata_consistency(self, dist: BaseDistribution) -> None: """Check for consistency of project name and version of dist.""" if self._name is not None and self._name != dist.canonical_name: raise MetadataInconsistent( self._ireq, "name", self._name, dist.canonical_name, ) if self._version is not None and self._version != dist.version: raise MetadataInconsistent( self._ireq, "version", str(self._version), str(dist.version), ) def _prepare(self) -> BaseDistribution: try: dist = self._prepare_distribution() except HashError as e: # Provide HashError the underlying ireq that caused it. This # provides context for the resulting error message to show the # offending line to the user. e.req = self._ireq raise self._check_metadata_consistency(dist) return dist def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requirement]]: requires = self.dist.iter_dependencies() if with_requires else () for r in requires: yield self._factory.make_requirement_from_spec(str(r), self._ireq) yield self._factory.make_requires_python_requirement(self.dist.requires_python) def get_install_requirement(self) -> Optional[InstallRequirement]: return self._ireq class LinkCandidate(_InstallRequirementBackedCandidate): is_editable = False def __init__( self, link: Link, template: InstallRequirement, factory: "Factory", name: Optional[NormalizedName] = None, version: Optional[CandidateVersion] = None, ) -> None: source_link = link cache_entry = factory.get_wheel_cache_entry(link, name) if cache_entry is not None: logger.debug("Using cached wheel link: %s", cache_entry.link) link = cache_entry.link ireq = make_install_req_from_link(link, template) assert ireq.link == link if ireq.link.is_wheel and not ireq.link.is_file: wheel = Wheel(ireq.link.filename) wheel_name = canonicalize_name(wheel.name) assert name == wheel_name, f"{name!r} != {wheel_name!r} for wheel" # Version may not be present for PEP 508 direct URLs if version is not None: wheel_version = Version(wheel.version) assert version == wheel_version, "{!r} != {!r} for wheel {}".format( version, wheel_version, name ) if ( cache_entry is not None and cache_entry.persistent and template.link is template.original_link ): ireq.original_link_is_in_wheel_cache = True super().__init__( link=link, source_link=source_link, ireq=ireq, factory=factory, name=name, version=version, ) def _prepare_distribution(self) -> BaseDistribution: preparer = self._factory.preparer return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True) class EditableCandidate(_InstallRequirementBackedCandidate): is_editable = True def __init__( self, link: Link, template: InstallRequirement, factory: "Factory", name: Optional[NormalizedName] = None, version: Optional[CandidateVersion] = None, ) -> None: super().__init__( link=link, source_link=link, ireq=make_install_req_from_editable(link, template), factory=factory, name=name, version=version, ) def _prepare_distribution(self) -> BaseDistribution: return self._factory.preparer.prepare_editable_requirement(self._ireq) class AlreadyInstalledCandidate(Candidate): is_installed = True source_link = None def __init__( self, dist: BaseDistribution, template: InstallRequirement, factory: "Factory", ) -> None: self.dist = dist self._ireq = _make_install_req_from_dist(dist, template) self._factory = factory # This is just logging some messages, so we can do it eagerly. # The returned dist would be exactly the same as self.dist because we # set satisfied_by in _make_install_req_from_dist. # TODO: Supply reason based on force_reinstall and upgrade_strategy. skip_reason = "already satisfied" factory.preparer.prepare_installed_requirement(self._ireq, skip_reason) def __str__(self) -> str: return str(self.dist) def __repr__(self) -> str: return "{class_name}({distribution!r})".format( class_name=self.__class__.__name__, distribution=self.dist, ) def __hash__(self) -> int: return hash((self.__class__, self.name, self.version)) def __eq__(self, other: Any) -> bool: if isinstance(other, self.__class__): return self.name == other.name and self.version == other.version return False @property def project_name(self) -> NormalizedName: return self.dist.canonical_name @property def name(self) -> str: return self.project_name @property def version(self) -> CandidateVersion: return self.dist.version @property def is_editable(self) -> bool: return self.dist.editable def format_for_error(self) -> str: return f"{self.name} {self.version} (Installed)" def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requirement]]: if not with_requires: return for r in self.dist.iter_dependencies(): yield self._factory.make_requirement_from_spec(str(r), self._ireq) def get_install_requirement(self) -> Optional[InstallRequirement]: return None class ExtrasCandidate(Candidate): """A candidate that has 'extras', indicating additional dependencies. Requirements can be for a project with dependencies, something like foo[extra]. The extras don't affect the project/version being installed directly, but indicate that we need additional dependencies. We model that by having an artificial ExtrasCandidate that wraps the "base" candidate. The ExtrasCandidate differs from the base in the following ways: 1. It has a unique name, of the form foo[extra]. This causes the resolver to treat it as a separate node in the dependency graph. 2. When we're getting the candidate's dependencies, a) We specify that we want the extra dependencies as well. b) We add a dependency on the base candidate. See below for why this is needed. 3. We return None for the underlying InstallRequirement, as the base candidate will provide it, and we don't want to end up with duplicates. The dependency on the base candidate is needed so that the resolver can't decide that it should recommend foo[extra1] version 1.0 and foo[extra2] version 2.0. Having those candidates depend on foo=1.0 and foo=2.0 respectively forces the resolver to recognise that this is a conflict. """ def __init__( self, base: BaseCandidate, extras: FrozenSet[str], ) -> None: self.base = base self.extras = extras def __str__(self) -> str: name, rest = str(self.base).split(" ", 1) return "{}[{}] {}".format(name, ",".join(self.extras), rest) def __repr__(self) -> str: return "{class_name}(base={base!r}, extras={extras!r})".format( class_name=self.__class__.__name__, base=self.base, extras=self.extras, ) def __hash__(self) -> int: return hash((self.base, self.extras)) def __eq__(self, other: Any) -> bool: if isinstance(other, self.__class__): return self.base == other.base and self.extras == other.extras return False @property def project_name(self) -> NormalizedName: return self.base.project_name @property def name(self) -> str: """The normalised name of the project the candidate refers to""" return format_name(self.base.project_name, self.extras) @property def version(self) -> CandidateVersion: return self.base.version def format_for_error(self) -> str: return "{} [{}]".format( self.base.format_for_error(), ", ".join(sorted(self.extras)) ) @property def is_installed(self) -> bool: return self.base.is_installed @property def is_editable(self) -> bool: return self.base.is_editable @property def source_link(self) -> Optional[Link]: return self.base.source_link def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requirement]]: factory = self.base._factory # Add a dependency on the exact base # (See note 2b in the class docstring) yield factory.make_requirement_from_candidate(self.base) if not with_requires: return # The user may have specified extras that the candidate doesn't # support. We ignore any unsupported extras here. valid_extras = self.extras.intersection(self.base.dist.iter_provided_extras()) invalid_extras = self.extras.difference(self.base.dist.iter_provided_extras()) for extra in sorted(invalid_extras): logger.warning( "%s %s does not provide the extra '%s'", self.base.name, self.version, extra, ) for r in self.base.dist.iter_dependencies(valid_extras): requirement = factory.make_requirement_from_spec( str(r), self.base._ireq, valid_extras ) if requirement: yield requirement def get_install_requirement(self) -> Optional[InstallRequirement]: # We don't return anything here, because we always # depend on the base candidate, and we'll get the # install requirement from that. return None class RequiresPythonCandidate(Candidate): is_installed = False source_link = None def __init__(self, py_version_info: Optional[Tuple[int, ...]]) -> None: if py_version_info is not None: version_info = normalize_version_info(py_version_info) else: version_info = sys.version_info[:3] self._version = Version(".".join(str(c) for c in version_info)) # We don't need to implement __eq__() and __ne__() since there is always # only one RequiresPythonCandidate in a resolution, i.e. the host Python. # The built-in object.__eq__() and object.__ne__() do exactly what we want. def __str__(self) -> str: return f"Python {self._version}" @property def project_name(self) -> NormalizedName: return REQUIRES_PYTHON_IDENTIFIER @property def name(self) -> str: return REQUIRES_PYTHON_IDENTIFIER @property def version(self) -> CandidateVersion: return self._version def format_for_error(self) -> str: return f"Python {self.version}" def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requirement]]: return () def get_install_requirement(self) -> Optional[InstallRequirement]: return None PK,]jj resolution/resolvelib/factory.pynu[import contextlib import functools import logging import sys import sysconfig from typing import ( TYPE_CHECKING, Dict, FrozenSet, Iterable, Iterator, List, Mapping, NamedTuple, Optional, Sequence, Set, Tuple, TypeVar, cast, ) from pip._vendor.packaging.requirements import InvalidRequirement from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.resolvelib import ResolutionImpossible from pip._internal.cache import CacheEntry, WheelCache from pip._internal.exceptions import ( DistributionNotFound, InstallationError, InstallationSubprocessError, MetadataInconsistent, UnsupportedPythonVersion, UnsupportedWheel, ) from pip._internal.index.package_finder import PackageFinder from pip._internal.locations import get_scheme from pip._internal.metadata import BaseDistribution, get_default_environment from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.constructors import install_req_from_link_and_ireq from pip._internal.req.req_install import ( InstallRequirement, check_invalid_constraint_type, ) from pip._internal.resolution.base import InstallRequirementProvider from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.hashes import Hashes from pip._internal.utils.misc import dist_location from pip._internal.utils.packaging import get_requirement from pip._internal.utils.virtualenv import running_under_virtualenv from .base import Candidate, CandidateVersion, Constraint, Requirement from .candidates import ( AlreadyInstalledCandidate, BaseCandidate, EditableCandidate, ExtrasCandidate, LinkCandidate, RequiresPythonCandidate, as_base_candidate, ) from .found_candidates import FoundCandidates, IndexCandidateInfo from .requirements import ( ExplicitRequirement, RequiresPythonRequirement, SpecifierRequirement, UnsatisfiableRequirement, ) if TYPE_CHECKING: from typing import Protocol class ConflictCause(Protocol): requirement: RequiresPythonRequirement parent: Candidate logger = logging.getLogger(__name__) C = TypeVar("C") Cache = Dict[Link, C] class CollectedRootRequirements(NamedTuple): requirements: List[Requirement] constraints: Dict[str, Constraint] user_requested: Dict[str, int] class Factory: def __init__( self, finder: PackageFinder, preparer: RequirementPreparer, make_install_req: InstallRequirementProvider, wheel_cache: Optional[WheelCache], use_user_site: bool, force_reinstall: bool, ignore_installed: bool, ignore_requires_python: bool, py_version_info: Optional[Tuple[int, ...]] = None, ) -> None: self._finder = finder self.preparer = preparer self._wheel_cache = wheel_cache self._python_candidate = RequiresPythonCandidate(py_version_info) self._make_install_req_from_spec = make_install_req self._use_user_site = use_user_site self._force_reinstall = force_reinstall self._ignore_requires_python = ignore_requires_python self._build_failures: Cache[InstallationError] = {} self._link_candidate_cache: Cache[LinkCandidate] = {} self._editable_candidate_cache: Cache[EditableCandidate] = {} self._installed_candidate_cache: Dict[str, AlreadyInstalledCandidate] = {} self._extras_candidate_cache: Dict[ Tuple[int, FrozenSet[str]], ExtrasCandidate ] = {} if not ignore_installed: env = get_default_environment() self._installed_dists = { dist.canonical_name: dist for dist in env.iter_installed_distributions(local_only=False) } else: self._installed_dists = {} @property def force_reinstall(self) -> bool: return self._force_reinstall def _fail_if_link_is_unsupported_wheel(self, link: Link) -> None: if not link.is_wheel: return wheel = Wheel(link.filename) if wheel.supported(self._finder.target_python.get_tags()): return msg = f"{link.filename} is not a supported wheel on this platform." raise UnsupportedWheel(msg) def _make_extras_candidate( self, base: BaseCandidate, extras: FrozenSet[str] ) -> ExtrasCandidate: cache_key = (id(base), extras) try: candidate = self._extras_candidate_cache[cache_key] except KeyError: candidate = ExtrasCandidate(base, extras) self._extras_candidate_cache[cache_key] = candidate return candidate def _make_candidate_from_dist( self, dist: BaseDistribution, extras: FrozenSet[str], template: InstallRequirement, ) -> Candidate: try: base = self._installed_candidate_cache[dist.canonical_name] except KeyError: base = AlreadyInstalledCandidate(dist, template, factory=self) self._installed_candidate_cache[dist.canonical_name] = base if not extras: return base return self._make_extras_candidate(base, extras) def _make_candidate_from_link( self, link: Link, extras: FrozenSet[str], template: InstallRequirement, name: Optional[NormalizedName], version: Optional[CandidateVersion], ) -> Optional[Candidate]: # TODO: Check already installed candidate, and use it if the link and # editable flag match. if link in self._build_failures: # We already tried this candidate before, and it does not build. # Don't bother trying again. return None if template.editable: if link not in self._editable_candidate_cache: try: self._editable_candidate_cache[link] = EditableCandidate( link, template, factory=self, name=name, version=version, ) except (InstallationSubprocessError, MetadataInconsistent) as e: logger.warning("Discarding %s. %s", link, e) self._build_failures[link] = e return None base: BaseCandidate = self._editable_candidate_cache[link] else: if link not in self._link_candidate_cache: try: self._link_candidate_cache[link] = LinkCandidate( link, template, factory=self, name=name, version=version, ) except (InstallationSubprocessError, MetadataInconsistent) as e: logger.warning("Discarding %s. %s", link, e) self._build_failures[link] = e return None base = self._link_candidate_cache[link] if not extras: return base return self._make_extras_candidate(base, extras) def _iter_found_candidates( self, ireqs: Sequence[InstallRequirement], specifier: SpecifierSet, hashes: Hashes, prefers_installed: bool, incompatible_ids: Set[int], ) -> Iterable[Candidate]: if not ireqs: return () # The InstallRequirement implementation requires us to give it a # "template". Here we just choose the first requirement to represent # all of them. # Hopefully the Project model can correct this mismatch in the future. template = ireqs[0] assert template.req, "Candidates found on index must be PEP 508" name = canonicalize_name(template.req.name) extras: FrozenSet[str] = frozenset() for ireq in ireqs: assert ireq.req, "Candidates found on index must be PEP 508" specifier &= ireq.req.specifier hashes &= ireq.hashes(trust_internet=False) extras |= frozenset(ireq.extras) def _get_installed_candidate() -> Optional[Candidate]: """Get the candidate for the currently-installed version.""" # If --force-reinstall is set, we want the version from the index # instead, so we "pretend" there is nothing installed. if self._force_reinstall: return None try: installed_dist = self._installed_dists[name] except KeyError: return None # Don't use the installed distribution if its version does not fit # the current dependency graph. if not specifier.contains(installed_dist.version, prereleases=True): return None candidate = self._make_candidate_from_dist( dist=installed_dist, extras=extras, template=template, ) # The candidate is a known incompatiblity. Don't use it. if id(candidate) in incompatible_ids: return None return candidate def iter_index_candidate_infos() -> Iterator[IndexCandidateInfo]: result = self._finder.find_best_candidate( project_name=name, specifier=specifier, hashes=hashes, ) icans = list(result.iter_applicable()) # PEP 592: Yanked releases must be ignored unless only yanked # releases can satisfy the version range. So if this is false, # all yanked icans need to be skipped. all_yanked = all(ican.link.is_yanked for ican in icans) # PackageFinder returns earlier versions first, so we reverse. for ican in reversed(icans): if not all_yanked and ican.link.is_yanked: continue func = functools.partial( self._make_candidate_from_link, link=ican.link, extras=extras, template=template, name=name, version=ican.version, ) yield ican.version, func return FoundCandidates( iter_index_candidate_infos, _get_installed_candidate(), prefers_installed, incompatible_ids, ) def _iter_explicit_candidates_from_base( self, base_requirements: Iterable[Requirement], extras: FrozenSet[str], ) -> Iterator[Candidate]: """Produce explicit candidates from the base given an extra-ed package. :param base_requirements: Requirements known to the resolver. The requirements are guaranteed to not have extras. :param extras: The extras to inject into the explicit requirements' candidates. """ for req in base_requirements: lookup_cand, _ = req.get_candidate_lookup() if lookup_cand is None: # Not explicit. continue # We've stripped extras from the identifier, and should always # get a BaseCandidate here, unless there's a bug elsewhere. base_cand = as_base_candidate(lookup_cand) assert base_cand is not None, "no extras here" yield self._make_extras_candidate(base_cand, extras) def _iter_candidates_from_constraints( self, identifier: str, constraint: Constraint, template: InstallRequirement, ) -> Iterator[Candidate]: """Produce explicit candidates from constraints. This creates "fake" InstallRequirement objects that are basically clones of what "should" be the template, but with original_link set to link. """ for link in constraint.links: self._fail_if_link_is_unsupported_wheel(link) candidate = self._make_candidate_from_link( link, extras=frozenset(), template=install_req_from_link_and_ireq(link, template), name=canonicalize_name(identifier), version=None, ) if candidate: yield candidate def find_candidates( self, identifier: str, requirements: Mapping[str, Iterable[Requirement]], incompatibilities: Mapping[str, Iterator[Candidate]], constraint: Constraint, prefers_installed: bool, ) -> Iterable[Candidate]: # Collect basic lookup information from the requirements. explicit_candidates: Set[Candidate] = set() ireqs: List[InstallRequirement] = [] for req in requirements[identifier]: cand, ireq = req.get_candidate_lookup() if cand is not None: explicit_candidates.add(cand) if ireq is not None: ireqs.append(ireq) # If the current identifier contains extras, add explicit candidates # from entries from extra-less identifier. with contextlib.suppress(InvalidRequirement): parsed_requirement = get_requirement(identifier) explicit_candidates.update( self._iter_explicit_candidates_from_base( requirements.get(parsed_requirement.name, ()), frozenset(parsed_requirement.extras), ), ) # Add explicit candidates from constraints. We only do this if there are # kown ireqs, which represent requirements not already explicit. If # there are no ireqs, we're constraining already-explicit requirements, # which is handled later when we return the explicit candidates. if ireqs: try: explicit_candidates.update( self._iter_candidates_from_constraints( identifier, constraint, template=ireqs[0], ), ) except UnsupportedWheel: # If we're constrained to install a wheel incompatible with the # target architecture, no candidates will ever be valid. return () # Since we cache all the candidates, incompatibility identification # can be made quicker by comparing only the id() values. incompat_ids = {id(c) for c in incompatibilities.get(identifier, ())} # If none of the requirements want an explicit candidate, we can ask # the finder for candidates. if not explicit_candidates: return self._iter_found_candidates( ireqs, constraint.specifier, constraint.hashes, prefers_installed, incompat_ids, ) return ( c for c in explicit_candidates if id(c) not in incompat_ids and constraint.is_satisfied_by(c) and all(req.is_satisfied_by(c) for req in requirements[identifier]) ) def _make_requirement_from_install_req( self, ireq: InstallRequirement, requested_extras: Iterable[str] ) -> Optional[Requirement]: if not ireq.match_markers(requested_extras): logger.info( "Ignoring %s: markers '%s' don't match your environment", ireq.name, ireq.markers, ) return None if not ireq.link: return SpecifierRequirement(ireq) self._fail_if_link_is_unsupported_wheel(ireq.link) cand = self._make_candidate_from_link( ireq.link, extras=frozenset(ireq.extras), template=ireq, name=canonicalize_name(ireq.name) if ireq.name else None, version=None, ) if cand is None: # There's no way we can satisfy a URL requirement if the underlying # candidate fails to build. An unnamed URL must be user-supplied, so # we fail eagerly. If the URL is named, an unsatisfiable requirement # can make the resolver do the right thing, either backtrack (and # maybe find some other requirement that's buildable) or raise a # ResolutionImpossible eventually. if not ireq.name: raise self._build_failures[ireq.link] return UnsatisfiableRequirement(canonicalize_name(ireq.name)) return self.make_requirement_from_candidate(cand) def collect_root_requirements( self, root_ireqs: List[InstallRequirement] ) -> CollectedRootRequirements: collected = CollectedRootRequirements([], {}, {}) for i, ireq in enumerate(root_ireqs): if ireq.constraint: # Ensure we only accept valid constraints problem = check_invalid_constraint_type(ireq) if problem: raise InstallationError(problem) if not ireq.match_markers(): continue assert ireq.name, "Constraint must be named" name = canonicalize_name(ireq.name) if name in collected.constraints: collected.constraints[name] &= ireq else: collected.constraints[name] = Constraint.from_ireq(ireq) else: req = self._make_requirement_from_install_req( ireq, requested_extras=(), ) if req is None: continue if ireq.user_supplied and req.name not in collected.user_requested: collected.user_requested[req.name] = i collected.requirements.append(req) return collected def make_requirement_from_candidate( self, candidate: Candidate ) -> ExplicitRequirement: return ExplicitRequirement(candidate) def make_requirement_from_spec( self, specifier: str, comes_from: Optional[InstallRequirement], requested_extras: Iterable[str] = (), ) -> Optional[Requirement]: ireq = self._make_install_req_from_spec(specifier, comes_from) return self._make_requirement_from_install_req(ireq, requested_extras) def make_requires_python_requirement( self, specifier: SpecifierSet, ) -> Optional[Requirement]: if self._ignore_requires_python: return None # Don't bother creating a dependency for an empty Requires-Python. if not str(specifier): return None return RequiresPythonRequirement(specifier, self._python_candidate) def get_wheel_cache_entry( self, link: Link, name: Optional[str] ) -> Optional[CacheEntry]: """Look up the link in the wheel cache. If ``preparer.require_hashes`` is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have nondeterministic contents due to file modification times. """ if self._wheel_cache is None or self.preparer.require_hashes: return None return self._wheel_cache.get_cache_entry( link=link, package_name=name, supported_tags=get_supported(), ) def get_dist_to_uninstall(self, candidate: Candidate) -> Optional[BaseDistribution]: # TODO: Are there more cases this needs to return True? Editable? dist = self._installed_dists.get(candidate.project_name) if dist is None: # Not installed, no uninstallation required. return None # Prevent uninstalling packages from /usr try: if dist_location(dist._dist) in ( sysconfig.get_path('purelib', scheme='rpm_prefix', vars={'base': sys.base_prefix}), sysconfig.get_path('platlib', scheme='rpm_prefix', vars={'base': sys.base_prefix}), ): return None except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet pass # We're installing into global site. The current installation must # be uninstalled, no matter it's in global or user site, because the # user site installation has precedence over global. if not self._use_user_site: return dist # We're installing into user site. Remove the user site installation. if dist.in_usersite: return dist # We're installing into user site, but the installed incompatible # package is in global site. We can't uninstall that, and would let # the new user installation to "shadow" it. But shadowing won't work # in virtual environments, so we error out. if running_under_virtualenv() and dist.in_site_packages: message = ( f"Will not install to the user site because it will lack " f"sys.path precedence to {dist.raw_name} in {dist.location}" ) raise InstallationError(message) return None def _report_requires_python_error( self, causes: Sequence["ConflictCause"] ) -> UnsupportedPythonVersion: assert causes, "Requires-Python error reported with no cause" version = self._python_candidate.version if len(causes) == 1: specifier = str(causes[0].requirement.specifier) message = ( f"Package {causes[0].parent.name!r} requires a different " f"Python: {version} not in {specifier!r}" ) return UnsupportedPythonVersion(message) message = f"Packages require a different Python. {version} not in:" for cause in causes: package = cause.parent.format_for_error() specifier = str(cause.requirement.specifier) message += f"\n{specifier!r} (required by {package})" return UnsupportedPythonVersion(message) def _report_single_requirement_conflict( self, req: Requirement, parent: Optional[Candidate] ) -> DistributionNotFound: if parent is None: req_disp = str(req) else: req_disp = f"{req} (from {parent.name})" cands = self._finder.find_all_candidates(req.project_name) versions = [str(v) for v in sorted({c.version for c in cands})] logger.critical( "Could not find a version that satisfies the requirement %s " "(from versions: %s)", req_disp, ", ".join(versions) or "none", ) if str(req) == "requirements.txt": logger.info( "HINT: You are attempting to install a package literally " 'named "requirements.txt" (which cannot exist). Consider ' "using the '-r' flag to install the packages listed in " "requirements.txt" ) return DistributionNotFound(f"No matching distribution found for {req}") def get_installation_error( self, e: "ResolutionImpossible[Requirement, Candidate]", constraints: Dict[str, Constraint], ) -> InstallationError: assert e.causes, "Installation error reported with no cause" # If one of the things we can't solve is "we need Python X.Y", # that is what we report. requires_python_causes = [ cause for cause in e.causes if isinstance(cause.requirement, RequiresPythonRequirement) and not cause.requirement.is_satisfied_by(self._python_candidate) ] if requires_python_causes: # The comprehension above makes sure all Requirement instances are # RequiresPythonRequirement, so let's cast for convinience. return self._report_requires_python_error( cast("Sequence[ConflictCause]", requires_python_causes), ) # Otherwise, we have a set of causes which can't all be satisfied # at once. # The simplest case is when we have *one* cause that can't be # satisfied. We just report that case. if len(e.causes) == 1: req, parent = e.causes[0] if req.name not in constraints: return self._report_single_requirement_conflict(req, parent) # OK, we now have a list of requirements that can't all be # satisfied at once. # A couple of formatting helpers def text_join(parts: List[str]) -> str: if len(parts) == 1: return parts[0] return ", ".join(parts[:-1]) + " and " + parts[-1] def describe_trigger(parent: Candidate) -> str: ireq = parent.get_install_requirement() if not ireq or not ireq.comes_from: return f"{parent.name}=={parent.version}" if isinstance(ireq.comes_from, InstallRequirement): return str(ireq.comes_from.name) return str(ireq.comes_from) triggers = set() for req, parent in e.causes: if parent is None: # This is a root requirement, so we can report it directly trigger = req.format_for_error() else: trigger = describe_trigger(parent) triggers.add(trigger) if triggers: info = text_join(sorted(triggers)) else: info = "the requested packages" msg = ( "Cannot install {} because these package versions " "have conflicting dependencies.".format(info) ) logger.critical(msg) msg = "\nThe conflict is caused by:" relevant_constraints = set() for req, parent in e.causes: if req.name in constraints: relevant_constraints.add(req.name) msg = msg + "\n " if parent: msg = msg + f"{parent.name} {parent.version} depends on " else: msg = msg + "The user requested " msg = msg + req.format_for_error() for key in relevant_constraints: spec = constraints[key].specifier msg += f"\n The user requested (constraint) {key}{spec}" msg = ( msg + "\n\n" + "To fix this you could try to:\n" + "1. loosen the range of package versions you've specified\n" + "2. remove package versions to allow pip attempt to solve " + "the dependency conflict\n" ) logger.info(msg) return DistributionNotFound( "ResolutionImpossible: for help visit " "https://pip.pypa.io/en/latest/user_guide/" "#fixing-conflicting-dependencies" ) PK,]U##!resolution/resolvelib/provider.pynu[import collections import math from typing import TYPE_CHECKING, Dict, Iterable, Iterator, Mapping, Sequence, Union from pip._vendor.resolvelib.providers import AbstractProvider from .base import Candidate, Constraint, Requirement from .candidates import REQUIRES_PYTHON_IDENTIFIER from .factory import Factory if TYPE_CHECKING: from pip._vendor.resolvelib.providers import Preference from pip._vendor.resolvelib.resolvers import RequirementInformation PreferenceInformation = RequirementInformation[Requirement, Candidate] _ProviderBase = AbstractProvider[Requirement, Candidate, str] else: _ProviderBase = AbstractProvider # Notes on the relationship between the provider, the factory, and the # candidate and requirement classes. # # The provider is a direct implementation of the resolvelib class. Its role # is to deliver the API that resolvelib expects. # # Rather than work with completely abstract "requirement" and "candidate" # concepts as resolvelib does, pip has concrete classes implementing these two # ideas. The API of Requirement and Candidate objects are defined in the base # classes, but essentially map fairly directly to the equivalent provider # methods. In particular, `find_matches` and `is_satisfied_by` are # requirement methods, and `get_dependencies` is a candidate method. # # The factory is the interface to pip's internal mechanisms. It is stateless, # and is created by the resolver and held as a property of the provider. It is # responsible for creating Requirement and Candidate objects, and provides # services to those objects (access to pip's finder and preparer). class PipProvider(_ProviderBase): """Pip's provider implementation for resolvelib. :params constraints: A mapping of constraints specified by the user. Keys are canonicalized project names. :params ignore_dependencies: Whether the user specified ``--no-deps``. :params upgrade_strategy: The user-specified upgrade strategy. :params user_requested: A set of canonicalized package names that the user supplied for pip to install/upgrade. """ def __init__( self, factory: Factory, constraints: Dict[str, Constraint], ignore_dependencies: bool, upgrade_strategy: str, user_requested: Dict[str, int], ) -> None: self._factory = factory self._constraints = constraints self._ignore_dependencies = ignore_dependencies self._upgrade_strategy = upgrade_strategy self._user_requested = user_requested self._known_depths: Dict[str, float] = collections.defaultdict(lambda: math.inf) def identify(self, requirement_or_candidate: Union[Requirement, Candidate]) -> str: return requirement_or_candidate.name def get_preference( # type: ignore self, identifier: str, resolutions: Mapping[str, Candidate], candidates: Mapping[str, Iterator[Candidate]], information: Mapping[str, Iterable["PreferenceInformation"]], backtrack_causes: Sequence["PreferenceInformation"], ) -> "Preference": """Produce a sort key for given requirement based on preference. The lower the return value is, the more preferred this group of arguments is. Currently pip considers the followings in order: * Prefer if any of the known requirements is "direct", e.g. points to an explicit URL. * If equal, prefer if any requirement is "pinned", i.e. contains operator ``===`` or ``==``. * If equal, calculate an approximate "depth" and resolve requirements closer to the user-specified requirements first. * Order user-specified requirements by the order they are specified. * If equal, prefers "non-free" requirements, i.e. contains at least one operator, such as ``>=`` or ``<``. * If equal, order alphabetically for consistency (helps debuggability). """ lookups = (r.get_candidate_lookup() for r, _ in information[identifier]) candidate, ireqs = zip(*lookups) operators = [ specifier.operator for specifier_set in (ireq.specifier for ireq in ireqs if ireq) for specifier in specifier_set ] direct = candidate is not None pinned = any(op[:2] == "==" for op in operators) unfree = bool(operators) try: requested_order: Union[int, float] = self._user_requested[identifier] except KeyError: requested_order = math.inf parent_depths = ( self._known_depths[parent.name] if parent is not None else 0.0 for _, parent in information[identifier] ) inferred_depth = min(d for d in parent_depths) + 1.0 else: inferred_depth = 1.0 self._known_depths[identifier] = inferred_depth requested_order = self._user_requested.get(identifier, math.inf) # Requires-Python has only one candidate and the check is basically # free, so we always do it first to avoid needless work if it fails. requires_python = identifier == REQUIRES_PYTHON_IDENTIFIER # HACK: Setuptools have a very long and solid backward compatibility # track record, and extremely few projects would request a narrow, # non-recent version range of it since that would break a lot things. # (Most projects specify it only to request for an installer feature, # which does not work, but that's another topic.) Intentionally # delaying Setuptools helps reduce branches the resolver has to check. # This serves as a temporary fix for issues like "apache-airlfow[all]" # while we work on "proper" branch pruning techniques. delay_this = identifier == "setuptools" # Prefer the causes of backtracking on the assumption that the problem # resolving the dependency tree is related to the failures that caused # the backtracking backtrack_cause = self.is_backtrack_cause(identifier, backtrack_causes) return ( not requires_python, delay_this, not direct, not pinned, not backtrack_cause, inferred_depth, requested_order, not unfree, identifier, ) def _get_constraint(self, identifier: str) -> Constraint: if identifier in self._constraints: return self._constraints[identifier] # HACK: Theoratically we should check whether this identifier is a valid # "NAME[EXTRAS]" format, and parse out the name part with packaging or # some regular expression. But since pip's resolver only spits out # three kinds of identifiers: normalized PEP 503 names, normalized names # plus extras, and Requires-Python, we can cheat a bit here. name, open_bracket, _ = identifier.partition("[") if open_bracket and name in self._constraints: return self._constraints[name] return Constraint.empty() def find_matches( self, identifier: str, requirements: Mapping[str, Iterator[Requirement]], incompatibilities: Mapping[str, Iterator[Candidate]], ) -> Iterable[Candidate]: def _eligible_for_upgrade(name: str) -> bool: """Are upgrades allowed for this project? This checks the upgrade strategy, and whether the project was one that the user specified in the command line, in order to decide whether we should upgrade if there's a newer version available. (Note that we don't need access to the `--upgrade` flag, because an upgrade strategy of "to-satisfy-only" means that `--upgrade` was not specified). """ if self._upgrade_strategy == "eager": return True elif self._upgrade_strategy == "only-if-needed": return name in self._user_requested return False return self._factory.find_candidates( identifier=identifier, requirements=requirements, constraint=self._get_constraint(identifier), prefers_installed=(not _eligible_for_upgrade(identifier)), incompatibilities=incompatibilities, ) def is_satisfied_by(self, requirement: Requirement, candidate: Candidate) -> bool: return requirement.is_satisfied_by(candidate) def get_dependencies(self, candidate: Candidate) -> Sequence[Requirement]: with_requires = not self._ignore_dependencies return [r for r in candidate.iter_dependencies(with_requires) if r is not None] @staticmethod def is_backtrack_cause( identifier: str, backtrack_causes: Sequence["PreferenceInformation"] ) -> bool: for backtrack_cause in backtrack_causes: if identifier == backtrack_cause.requirement.name: return True if backtrack_cause.parent and identifier == backtrack_cause.parent.name: return True return False PK,])ZII)resolution/resolvelib/found_candidates.pynu["""Utilities to lazily create and visit candidates found. Creating and visiting a candidate is a *very* costly operation. It involves fetching, extracting, potentially building modules from source, and verifying distribution metadata. It is therefore crucial for performance to keep everything here lazy all the way down, so we only touch candidates that we absolutely need, and not "download the world" when we only need one version of something. """ import functools from collections.abc import Sequence from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional, Set, Tuple from pip._vendor.packaging.version import _BaseVersion from .base import Candidate IndexCandidateInfo = Tuple[_BaseVersion, Callable[[], Optional[Candidate]]] if TYPE_CHECKING: SequenceCandidate = Sequence[Candidate] else: # For compatibility: Python before 3.9 does not support using [] on the # Sequence class. # # >>> from collections.abc import Sequence # >>> Sequence[str] # Traceback (most recent call last): # File "", line 1, in # TypeError: 'ABCMeta' object is not subscriptable # # TODO: Remove this block after dropping Python 3.8 support. SequenceCandidate = Sequence def _iter_built(infos: Iterator[IndexCandidateInfo]) -> Iterator[Candidate]: """Iterator for ``FoundCandidates``. This iterator is used when the package is not already installed. Candidates from index come later in their normal ordering. """ versions_found: Set[_BaseVersion] = set() for version, func in infos: if version in versions_found: continue candidate = func() if candidate is None: continue yield candidate versions_found.add(version) def _iter_built_with_prepended( installed: Candidate, infos: Iterator[IndexCandidateInfo] ) -> Iterator[Candidate]: """Iterator for ``FoundCandidates``. This iterator is used when the resolver prefers the already-installed candidate and NOT to upgrade. The installed candidate is therefore always yielded first, and candidates from index come later in their normal ordering, except skipped when the version is already installed. """ yield installed versions_found: Set[_BaseVersion] = {installed.version} for version, func in infos: if version in versions_found: continue candidate = func() if candidate is None: continue yield candidate versions_found.add(version) def _iter_built_with_inserted( installed: Candidate, infos: Iterator[IndexCandidateInfo] ) -> Iterator[Candidate]: """Iterator for ``FoundCandidates``. This iterator is used when the resolver prefers to upgrade an already-installed package. Candidates from index are returned in their normal ordering, except replaced when the version is already installed. The implementation iterates through and yields other candidates, inserting the installed candidate exactly once before we start yielding older or equivalent candidates, or after all other candidates if they are all newer. """ versions_found: Set[_BaseVersion] = set() for version, func in infos: if version in versions_found: continue # If the installed candidate is better, yield it first. if installed.version >= version: yield installed versions_found.add(installed.version) candidate = func() if candidate is None: continue yield candidate versions_found.add(version) # If the installed candidate is older than all other candidates. if installed.version not in versions_found: yield installed class FoundCandidates(SequenceCandidate): """A lazy sequence to provide candidates to the resolver. The intended usage is to return this from `find_matches()` so the resolver can iterate through the sequence multiple times, but only access the index page when remote packages are actually needed. This improve performances when suitable candidates are already installed on disk. """ def __init__( self, get_infos: Callable[[], Iterator[IndexCandidateInfo]], installed: Optional[Candidate], prefers_installed: bool, incompatible_ids: Set[int], ): self._get_infos = get_infos self._installed = installed self._prefers_installed = prefers_installed self._incompatible_ids = incompatible_ids def __getitem__(self, index: Any) -> Any: # Implemented to satisfy the ABC check. This is not needed by the # resolver, and should not be used by the provider either (for # performance reasons). raise NotImplementedError("don't do this") def __iter__(self) -> Iterator[Candidate]: infos = self._get_infos() if not self._installed: iterator = _iter_built(infos) elif self._prefers_installed: iterator = _iter_built_with_prepended(self._installed, infos) else: iterator = _iter_built_with_inserted(self._installed, infos) return (c for c in iterator if id(c) not in self._incompatible_ids) def __len__(self) -> int: # Implemented to satisfy the ABC check. This is not needed by the # resolver, and should not be used by the provider either (for # performance reasons). raise NotImplementedError("don't do this") @functools.lru_cache(maxsize=1) def __bool__(self) -> bool: if self._prefers_installed and self._installed: return True return any(self) PK,]~p_ !resolution/resolvelib/reporter.pynu[from collections import defaultdict from logging import getLogger from typing import Any, DefaultDict from pip._vendor.resolvelib.reporters import BaseReporter from .base import Candidate, Requirement logger = getLogger(__name__) class PipReporter(BaseReporter): def __init__(self) -> None: self.backtracks_by_package: DefaultDict[str, int] = defaultdict(int) self._messages_at_backtrack = { 1: ( "pip is looking at multiple versions of {package_name} to " "determine which version is compatible with other " "requirements. This could take a while." ), 8: ( "pip is looking at multiple versions of {package_name} to " "determine which version is compatible with other " "requirements. This could take a while." ), 13: ( "This is taking longer than usual. You might need to provide " "the dependency resolver with stricter constraints to reduce " "runtime. See https://pip.pypa.io/warnings/backtracking for " "guidance. If you want to abort this run, press Ctrl + C." ), } def backtracking(self, candidate: Candidate) -> None: self.backtracks_by_package[candidate.name] += 1 count = self.backtracks_by_package[candidate.name] if count not in self._messages_at_backtrack: return message = self._messages_at_backtrack[count] logger.info("INFO: %s", message.format(package_name=candidate.name)) class PipDebuggingReporter(BaseReporter): """A reporter that does an info log for every event it sees.""" def starting(self) -> None: logger.info("Reporter.starting()") def starting_round(self, index: int) -> None: logger.info("Reporter.starting_round(%r)", index) def ending_round(self, index: int, state: Any) -> None: logger.info("Reporter.ending_round(%r, state)", index) def ending(self, state: Any) -> None: logger.info("Reporter.ending(%r)", state) def adding_requirement(self, requirement: Requirement, parent: Candidate) -> None: logger.info("Reporter.adding_requirement(%r, %r)", requirement, parent) def backtracking(self, candidate: Candidate) -> None: logger.info("Reporter.backtracking(%r)", candidate) def pinning(self, candidate: Candidate) -> None: logger.info("Reporter.pinning(%r)", candidate) PK,]\OO%resolution/resolvelib/requirements.pynu[from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.req.req_install import InstallRequirement from .base import Candidate, CandidateLookup, Requirement, format_name class ExplicitRequirement(Requirement): def __init__(self, candidate: Candidate) -> None: self.candidate = candidate def __str__(self) -> str: return str(self.candidate) def __repr__(self) -> str: return "{class_name}({candidate!r})".format( class_name=self.__class__.__name__, candidate=self.candidate, ) @property def project_name(self) -> NormalizedName: # No need to canonicalise - the candidate did this return self.candidate.project_name @property def name(self) -> str: # No need to canonicalise - the candidate did this return self.candidate.name def format_for_error(self) -> str: return self.candidate.format_for_error() def get_candidate_lookup(self) -> CandidateLookup: return self.candidate, None def is_satisfied_by(self, candidate: Candidate) -> bool: return candidate == self.candidate class SpecifierRequirement(Requirement): def __init__(self, ireq: InstallRequirement) -> None: assert ireq.link is None, "This is a link, not a specifier" self._ireq = ireq self._extras = frozenset(ireq.extras) def __str__(self) -> str: return str(self._ireq.req) def __repr__(self) -> str: return "{class_name}({requirement!r})".format( class_name=self.__class__.__name__, requirement=str(self._ireq.req), ) @property def project_name(self) -> NormalizedName: assert self._ireq.req, "Specifier-backed ireq is always PEP 508" return canonicalize_name(self._ireq.req.name) @property def name(self) -> str: return format_name(self.project_name, self._extras) def format_for_error(self) -> str: # Convert comma-separated specifiers into "A, B, ..., F and G" # This makes the specifier a bit more "human readable", without # risking a change in meaning. (Hopefully! Not all edge cases have # been checked) parts = [s.strip() for s in str(self).split(",")] if len(parts) == 0: return "" elif len(parts) == 1: return parts[0] return ", ".join(parts[:-1]) + " and " + parts[-1] def get_candidate_lookup(self) -> CandidateLookup: return None, self._ireq def is_satisfied_by(self, candidate: Candidate) -> bool: assert candidate.name == self.name, ( f"Internal issue: Candidate is not for this requirement " f"{candidate.name} vs {self.name}" ) # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. assert self._ireq.req, "Specifier-backed ireq is always PEP 508" spec = self._ireq.req.specifier return spec.contains(candidate.version, prereleases=True) class RequiresPythonRequirement(Requirement): """A requirement representing Requires-Python metadata.""" def __init__(self, specifier: SpecifierSet, match: Candidate) -> None: self.specifier = specifier self._candidate = match def __str__(self) -> str: return f"Python {self.specifier}" def __repr__(self) -> str: return "{class_name}({specifier!r})".format( class_name=self.__class__.__name__, specifier=str(self.specifier), ) @property def project_name(self) -> NormalizedName: return self._candidate.project_name @property def name(self) -> str: return self._candidate.name def format_for_error(self) -> str: return str(self) def get_candidate_lookup(self) -> CandidateLookup: if self.specifier.contains(self._candidate.version, prereleases=True): return self._candidate, None return None, None def is_satisfied_by(self, candidate: Candidate) -> bool: assert candidate.name == self._candidate.name, "Not Python candidate" # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. return self.specifier.contains(candidate.version, prereleases=True) class UnsatisfiableRequirement(Requirement): """A requirement that cannot be satisfied.""" def __init__(self, name: NormalizedName) -> None: self._name = name def __str__(self) -> str: return f"{self._name} (unavailable)" def __repr__(self) -> str: return "{class_name}({name!r})".format( class_name=self.__class__.__name__, name=str(self._name), ) @property def project_name(self) -> NormalizedName: return self._name @property def name(self) -> str: return self._name def format_for_error(self) -> str: return str(self) def get_candidate_lookup(self) -> CandidateLookup: return None, None def is_satisfied_by(self, candidate: Candidate) -> bool: return False PK,]"ddresolution/resolvelib/base.pynu[from typing import FrozenSet, Iterable, Optional, Tuple, Union from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import LegacyVersion, Version from pip._internal.models.link import Link, links_equivalent from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.hashes import Hashes CandidateLookup = Tuple[Optional["Candidate"], Optional[InstallRequirement]] CandidateVersion = Union[LegacyVersion, Version] def format_name(project: str, extras: FrozenSet[str]) -> str: if not extras: return project canonical_extras = sorted(canonicalize_name(e) for e in extras) return "{}[{}]".format(project, ",".join(canonical_extras)) class Constraint: def __init__( self, specifier: SpecifierSet, hashes: Hashes, links: FrozenSet[Link] ) -> None: self.specifier = specifier self.hashes = hashes self.links = links @classmethod def empty(cls) -> "Constraint": return Constraint(SpecifierSet(), Hashes(), frozenset()) @classmethod def from_ireq(cls, ireq: InstallRequirement) -> "Constraint": links = frozenset([ireq.link]) if ireq.link else frozenset() return Constraint(ireq.specifier, ireq.hashes(trust_internet=False), links) def __bool__(self) -> bool: return bool(self.specifier) or bool(self.hashes) or bool(self.links) def __and__(self, other: InstallRequirement) -> "Constraint": if not isinstance(other, InstallRequirement): return NotImplemented specifier = self.specifier & other.specifier hashes = self.hashes & other.hashes(trust_internet=False) links = self.links if other.link: links = links.union([other.link]) return Constraint(specifier, hashes, links) def is_satisfied_by(self, candidate: "Candidate") -> bool: # Reject if there are any mismatched URL constraints on this package. if self.links and not all(_match_link(link, candidate) for link in self.links): return False # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. return self.specifier.contains(candidate.version, prereleases=True) class Requirement: @property def project_name(self) -> NormalizedName: """The "project name" of a requirement. This is different from ``name`` if this requirement contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. """ raise NotImplementedError("Subclass should override") @property def name(self) -> str: """The name identifying this requirement in the resolver. This is different from ``project_name`` if this requirement contains extras, where ``project_name`` would not contain the ``[...]`` part. """ raise NotImplementedError("Subclass should override") def is_satisfied_by(self, candidate: "Candidate") -> bool: return False def get_candidate_lookup(self) -> CandidateLookup: raise NotImplementedError("Subclass should override") def format_for_error(self) -> str: raise NotImplementedError("Subclass should override") def _match_link(link: Link, candidate: "Candidate") -> bool: if candidate.source_link: return links_equivalent(link, candidate.source_link) return False class Candidate: @property def project_name(self) -> NormalizedName: """The "project name" of the candidate. This is different from ``name`` if this candidate contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. """ raise NotImplementedError("Override in subclass") @property def name(self) -> str: """The name identifying this candidate in the resolver. This is different from ``project_name`` if this candidate contains extras, where ``project_name`` would not contain the ``[...]`` part. """ raise NotImplementedError("Override in subclass") @property def version(self) -> CandidateVersion: raise NotImplementedError("Override in subclass") @property def is_installed(self) -> bool: raise NotImplementedError("Override in subclass") @property def is_editable(self) -> bool: raise NotImplementedError("Override in subclass") @property def source_link(self) -> Optional[Link]: raise NotImplementedError("Override in subclass") def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requirement]]: raise NotImplementedError("Override in subclass") def get_install_requirement(self) -> Optional[InstallRequirement]: raise NotImplementedError("Override in subclass") def format_for_error(self) -> str: raise NotImplementedError("Subclass should override") PK,]Wcl%l%!resolution/resolvelib/resolver.pynu[import functools import logging import os from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, cast from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible from pip._vendor.resolvelib import Resolver as RLResolver from pip._vendor.resolvelib.structs import DirectedGraph from pip._internal.cache import WheelCache from pip._internal.index.package_finder import PackageFinder from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet from pip._internal.resolution.base import BaseResolver, InstallRequirementProvider from pip._internal.resolution.resolvelib.provider import PipProvider from pip._internal.resolution.resolvelib.reporter import ( PipDebuggingReporter, PipReporter, ) from .base import Candidate, Requirement from .factory import Factory if TYPE_CHECKING: from pip._vendor.resolvelib.resolvers import Result as RLResult Result = RLResult[Requirement, Candidate, str] logger = logging.getLogger(__name__) class Resolver(BaseResolver): _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"} def __init__( self, preparer: RequirementPreparer, finder: PackageFinder, wheel_cache: Optional[WheelCache], make_install_req: InstallRequirementProvider, use_user_site: bool, ignore_dependencies: bool, ignore_installed: bool, ignore_requires_python: bool, force_reinstall: bool, upgrade_strategy: str, py_version_info: Optional[Tuple[int, ...]] = None, ): super().__init__() assert upgrade_strategy in self._allowed_strategies self.factory = Factory( finder=finder, preparer=preparer, make_install_req=make_install_req, wheel_cache=wheel_cache, use_user_site=use_user_site, force_reinstall=force_reinstall, ignore_installed=ignore_installed, ignore_requires_python=ignore_requires_python, py_version_info=py_version_info, ) self.ignore_dependencies = ignore_dependencies self.upgrade_strategy = upgrade_strategy self._result: Optional[Result] = None def resolve( self, root_reqs: List[InstallRequirement], check_supported_wheels: bool ) -> RequirementSet: collected = self.factory.collect_root_requirements(root_reqs) provider = PipProvider( factory=self.factory, constraints=collected.constraints, ignore_dependencies=self.ignore_dependencies, upgrade_strategy=self.upgrade_strategy, user_requested=collected.user_requested, ) if "PIP_RESOLVER_DEBUG" in os.environ: reporter: BaseReporter = PipDebuggingReporter() else: reporter = PipReporter() resolver: RLResolver[Requirement, Candidate, str] = RLResolver( provider, reporter, ) try: try_to_avoid_resolution_too_deep = 2000000 result = self._result = resolver.resolve( collected.requirements, max_rounds=try_to_avoid_resolution_too_deep ) except ResolutionImpossible as e: error = self.factory.get_installation_error( cast("ResolutionImpossible[Requirement, Candidate]", e), collected.constraints, ) raise error from e req_set = RequirementSet(check_supported_wheels=check_supported_wheels) for candidate in result.mapping.values(): ireq = candidate.get_install_requirement() if ireq is None: continue # Check if there is already an installation under the same name, # and set a flag for later stages to uninstall it, if needed. installed_dist = self.factory.get_dist_to_uninstall(candidate) if installed_dist is None: # There is no existing installation -- nothing to uninstall. ireq.should_reinstall = False elif self.factory.force_reinstall: # The --force-reinstall flag is set -- reinstall. ireq.should_reinstall = True elif installed_dist.version != candidate.version: # The installation is different in version -- reinstall. ireq.should_reinstall = True elif candidate.is_editable or installed_dist.editable: # The incoming distribution is editable, or different in # editable-ness to installation -- reinstall. ireq.should_reinstall = True elif candidate.source_link and candidate.source_link.is_file: # The incoming distribution is under file:// if candidate.source_link.is_wheel: # is a local wheel -- do nothing. logger.info( "%s is already installed with the same version as the " "provided wheel. Use --force-reinstall to force an " "installation of the wheel.", ireq.name, ) continue # is a local sdist or path -- reinstall ireq.should_reinstall = True else: continue link = candidate.source_link if link and link.is_yanked: # The reason can contain non-ASCII characters, Unicode # is required for Python 2. msg = ( "The candidate selected for download or install is a " "yanked version: {name!r} candidate (version {version} " "at {link})\nReason for being yanked: {reason}" ).format( name=candidate.name, version=candidate.version, link=link, reason=link.yanked_reason or "", ) logger.warning(msg) req_set.add_named_requirement(ireq) reqs = req_set.all_requirements self.factory.preparer.prepare_linked_requirements_more(reqs) return req_set def get_installation_order( self, req_set: RequirementSet ) -> List[InstallRequirement]: """Get order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept consistent as they get installed one-by-one. The current implementation creates a topological ordering of the dependency graph, while breaking any cycles in the graph at arbitrary points. We make no guarantees about where the cycle would be broken, other than they would be broken. """ assert self._result is not None, "must call resolve() first" graph = self._result.graph weights = get_topological_weights( graph, expected_node_count=len(self._result.mapping) + 1, ) sorted_items = sorted( req_set.requirements.items(), key=functools.partial(_req_set_item_sorter, weights=weights), reverse=True, ) return [ireq for _, ireq in sorted_items] def get_topological_weights( graph: "DirectedGraph[Optional[str]]", expected_node_count: int ) -> Dict[Optional[str], int]: """Assign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We take the length for the longest path to any node from root, ignoring any paths that contain a single node twice (i.e. cycles). This is done through a depth-first search through the graph, while keeping track of the path to the node. Cycles in the graph result would result in node being revisited while also being it's own path. In this case, take no action. This helps ensure we don't get stuck in a cycle. When assigning weight, the longer path (i.e. larger length) is preferred. """ path: Set[Optional[str]] = set() weights: Dict[Optional[str], int] = {} def visit(node: Optional[str]) -> None: if node in path: # We hit a cycle, so we'll break it here. return # Time to visit the children! path.add(node) for child in graph.iter_children(node): visit(child) path.remove(node) last_known_parent_count = weights.get(node, 0) weights[node] = max(last_known_parent_count, len(path)) # `None` is guaranteed to be the root node by resolvelib. visit(None) # Sanity checks assert weights[None] == 0 assert len(weights) == expected_node_count return weights def _req_set_item_sorter( item: Tuple[str, InstallRequirement], weights: Dict[Optional[str], int], ) -> Tuple[int, str]: """Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests. """ name = canonicalize_name(item[0]) return weights[name], name PK,]!resolution/resolvelib/__init__.pynu[PK,]005resolution/legacy/__pycache__/resolver.cpython-39.pycnu[a ReH@szdZddlZddlZddlmZddlmZddlmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZdd lmZmZmZmZmZmZdd lmZdd lmZdd lm Z dd l!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl/m2Z2ddl3m4Z4e5e6Z7ee8e e$fZ9dee e:e:e:fe;ddddZto-satisfy-onlyeageronly-if-neededN.) preparerfinder wheel_cachemake_install_req use_user_siteignore_dependenciesignore_installedr$force_reinstallupgrade_strategypy_version_infor%c st| |jvsJ| dur0tjdd} nt| } | |_||_||_||_ | |_ | |_ ||_ ||_ ||_||_||_tt|_dS)N)super__init___allowed_strategiessysr#r_py_version_infor=r>r?rErDrBrCr$rA_make_install_reqrlist_discovered_dependencies) selfr=r>r?r@rArBrCr$rDrErF __class__r6r7rIus" zResolver.__init__) root_reqscheck_supported_wheelsr%c Cst|d}|D]}|jr t|||qg}t}t|j|D]P}z||||WqBt y}z||_ | |WYd}~qBd}~00qB|r||S)aResolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. )rTN) r constraintradd_requirementrrall_requirementsextend _resolve_onerreqappend)rPrSrTrequirement_setrZZdiscovered_reqsZ hash_errorsr4r6r6r7resolves  "zResolver.resolverZr%cCs:|jdkrdS|jdkrdS|jdks*J|jp4|jSdS)Nr:Fr;Tr<)rE user_suppliedrUrPrZr6r6r7_is_upgrade_alloweds   zResolver._is_upgrade_allowedcCs*|jrt|jr t|jr d|_d|_dS)z4 Set a requirement to be installed. TN)rAr satisfied_byr should_reinstallr`r6r6r7_set_req_to_reinstallszResolver._set_req_to_reinstall)req_to_installr%cCs|jr dS||j|js dS|jr4||dS||sP|jdkrLdSdS|jsz|j j |ddWn$t y~YdSt yYn0||dS)aCheck if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. Nr<z#already satisfied, skipping upgradezalready satisfiedT)upgradezalready up-to-date) rCcheck_if_existsrArbrDrdrarElinkr>find_requirementr r)rPrer6r6r7_check_skip_installeds*       zResolver._check_skip_installedcCsR||}|j||}|s dS|j}|jrN|jp4d}dj||d}t||S)Nz zqThe candidate selected for download or install is a yanked version: {candidate} Reason for being yanked: {reason}) candidatereason) rar>rirh is_yanked yanked_reasonr1r+r,)rPrZrfbest_candidaterhrlmsgr6r6r7_find_requirement_link s   zResolver._find_requirement_linkcCs~|jdur|||_|jdus(|jjr,dS|jj|j|jtd}|durzt d|j|j|j urr|j rrd|_ |j|_dS)afEnsure that if a link can be found for this, that it is found. Note that req.link may still be None - if the requirement is already installed and not needed to be upgraded based on the return value of _is_upgrade_allowed(). If preparer.require_hashes is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have undeterministic contents due to file modification times. N)rh package_namesupported_tagszUsing cached wheel link: %sT) rhrqr?r=require_hashesget_cache_entrynamerr+r0 original_link persistentoriginal_link_is_in_wheel_cache)rPrZ cache_entryr6r6r7_populate_link!s  zResolver._populate_linkcCs|jr|j|S|jdus J||}|jr>|j||S|||j|}|jsf| |j |jr|j dkp|j p|jp|j jdk}|r||n td||S)zzTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. Nr:filezs2        zResolver._get_dist_for)r\rer%c s8js jrgSd_}t|jjdgtttddfdd }t  j sj stJj ddjsjrtdd jttjt|}|D]}td |j|j|qtt|tj@}||D]}|||d qWdn1s*0YS) zxPrepare a single requirements file. :return: A list of additional InstallRequirements to also install. T)r#r$N)subreqextras_requestedr%csPt|}j}j|||d\}}|rB|rBj|||dS)N)parent_req_namer)rMr'rvrVrOr[rX)rrZsub_install_reqrZ to_scan_againZ add_to_parentZ more_reqsrer\rPr6r7add_reqs z&Resolver._resolve_one..add_req)rz!Installing extra requirements: %r,z%%s %s does not provide the extra '%s')r)rUpreparedrr8rLr$r rr'rhas_requirementrvr_rVrBextrasr+r0r.sortedsetiter_provided_extrasr,r-r5iter_dependencies) rPr\rer"rZmissing_requestedmissingZavailable_requestedrr6rr7rYlsJ      0zResolver._resolve_one)req_setr%cs@gttddfdd |jD] }|q.S)zCreate the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. Nr^csN|js|vrdS|jrdS|j|jD] }|q2|dS)N)rbrUaddrOrvr[)rZdeporderZ ordered_reqsschedulerPr6r7rs  z1Resolver.get_installation_order..schedule)rr requirementsvalues)rPr install_reqr6rr7get_installation_orders   zResolver.get_installation_order)N)__name__ __module__ __qualname____doc__rJrrrr rboolr'r intrIrrrr]rardrjrrqr{rrrYr __classcell__r6r6rQr7r9nsF' %   60 Pr9)F)>rloggingrK collectionsr itertoolsrtypingrrrrrr Zpip._vendor.packagingr Z"pip._vendor.packaging.requirementsr pip._internal.cacher pip._internal.exceptionsr rrrrr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.linkr pip._internal.operations.preparerZpip._internal.req.req_installrrZpip._internal.req.req_setrpip._internal.resolution.baserr&pip._internal.utils.compatibility_tagsrpip._internal.utils.loggingrpip._internal.utils.miscrrr pip._internal.utils.packagingr! getLoggerrr+r'ZDiscoveredDependenciesrrr8r9r6r6r6r7s>                   7PK,]w25resolution/legacy/__pycache__/__init__.cpython-39.pycnu[a Re@sdS)Nrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__init__.pyPK,]!4_HHresolution/legacy/resolver.pynu["""Dependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) """ # The following comment should be removed at some point in the future. # mypy: strict-optional=False import logging import sys from collections import defaultdict from itertools import chain from typing import DefaultDict, Iterable, List, Optional, Set, Tuple from pip._vendor.packaging import specifiers from pip._vendor.packaging.requirements import Requirement from pip._internal.cache import WheelCache from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, HashError, HashErrors, NoneMetadataError, UnsupportedPythonVersion, ) from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import BaseDistribution from pip._internal.models.link import Link from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.req_install import ( InstallRequirement, check_invalid_constraint_type, ) from pip._internal.req.req_set import RequirementSet from pip._internal.resolution.base import BaseResolver, InstallRequirementProvider from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import dist_in_usersite, normalize_version_info from pip._internal.utils.misc import dist_in_install_path from pip._internal.utils.packaging import check_requires_python logger = logging.getLogger(__name__) DiscoveredDependencies = DefaultDict[str, List[InstallRequirement]] def _check_dist_requires_python( dist: BaseDistribution, version_info: Tuple[int, int, int], ignore_requires_python: bool = False, ) -> None: """ Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. """ # This idiosyncratically converts the SpecifierSet to str and let # check_requires_python then parse it again into SpecifierSet. But this # is the legacy resolver so I'm just not going to bother refactoring. try: requires_python = str(dist.requires_python) except FileNotFoundError as e: raise NoneMetadataError(dist, str(e)) try: is_compatible = check_requires_python( requires_python, version_info=version_info, ) except specifiers.InvalidSpecifier as exc: logger.warning( "Package %r has an invalid Requires-Python: %s", dist.raw_name, exc ) return if is_compatible: return version = ".".join(map(str, version_info)) if ignore_requires_python: logger.debug( "Ignoring failed Requires-Python check for package %r: %s not in %r", dist.raw_name, version, requires_python, ) return raise UnsupportedPythonVersion( "Package {!r} requires a different Python: {} not in {!r}".format( dist.raw_name, version, requires_python ) ) class Resolver(BaseResolver): """Resolves which packages need to be installed/uninstalled to perform \ the requested operation without breaking the requirements of any package. """ _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"} def __init__( self, preparer: RequirementPreparer, finder: PackageFinder, wheel_cache: Optional[WheelCache], make_install_req: InstallRequirementProvider, use_user_site: bool, ignore_dependencies: bool, ignore_installed: bool, ignore_requires_python: bool, force_reinstall: bool, upgrade_strategy: str, py_version_info: Optional[Tuple[int, ...]] = None, ) -> None: super().__init__() assert upgrade_strategy in self._allowed_strategies if py_version_info is None: py_version_info = sys.version_info[:3] else: py_version_info = normalize_version_info(py_version_info) self._py_version_info = py_version_info self.preparer = preparer self.finder = finder self.wheel_cache = wheel_cache self.upgrade_strategy = upgrade_strategy self.force_reinstall = force_reinstall self.ignore_dependencies = ignore_dependencies self.ignore_installed = ignore_installed self.ignore_requires_python = ignore_requires_python self.use_user_site = use_user_site self._make_install_req = make_install_req self._discovered_dependencies: DiscoveredDependencies = defaultdict(list) def resolve( self, root_reqs: List[InstallRequirement], check_supported_wheels: bool ) -> RequirementSet: """Resolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. """ requirement_set = RequirementSet(check_supported_wheels=check_supported_wheels) for req in root_reqs: if req.constraint: check_invalid_constraint_type(req) requirement_set.add_requirement(req) # Actually prepare the files, and collect any exceptions. Most hash # exceptions cannot be checked ahead of time, because # _populate_link() needs to be called before we can make decisions # based on link type. discovered_reqs: List[InstallRequirement] = [] hash_errors = HashErrors() for req in chain(requirement_set.all_requirements, discovered_reqs): try: discovered_reqs.extend(self._resolve_one(requirement_set, req)) except HashError as exc: exc.req = req hash_errors.append(exc) if hash_errors: raise hash_errors return requirement_set def _is_upgrade_allowed(self, req: InstallRequirement) -> bool: if self.upgrade_strategy == "to-satisfy-only": return False elif self.upgrade_strategy == "eager": return True else: assert self.upgrade_strategy == "only-if-needed" return req.user_supplied or req.constraint def _set_req_to_reinstall(self, req: InstallRequirement) -> None: """ Set a requirement to be installed. """ # Don't uninstall the conflict if doing a user install and the # conflict is not a user install. if ((not self.use_user_site or dist_in_usersite(req.satisfied_by)) and dist_in_install_path(req.satisfied_by)): req.should_reinstall = True req.satisfied_by = None def _check_skip_installed( self, req_to_install: InstallRequirement ) -> Optional[str]: """Check if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. """ if self.ignore_installed: return None req_to_install.check_if_exists(self.use_user_site) if not req_to_install.satisfied_by: return None if self.force_reinstall: self._set_req_to_reinstall(req_to_install) return None if not self._is_upgrade_allowed(req_to_install): if self.upgrade_strategy == "only-if-needed": return "already satisfied, skipping upgrade" return "already satisfied" # Check for the possibility of an upgrade. For link-based # requirements we have to pull the tree down and inspect to assess # the version #, so it's handled way down. if not req_to_install.link: try: self.finder.find_requirement(req_to_install, upgrade=True) except BestVersionAlreadyInstalled: # Then the best version is installed. return "already up-to-date" except DistributionNotFound: # No distribution found, so we squash the error. It will # be raised later when we re-try later to do the install. # Why don't we just raise here? pass self._set_req_to_reinstall(req_to_install) return None def _find_requirement_link(self, req: InstallRequirement) -> Optional[Link]: upgrade = self._is_upgrade_allowed(req) best_candidate = self.finder.find_requirement(req, upgrade) if not best_candidate: return None # Log a warning per PEP 592 if necessary before returning. link = best_candidate.link if link.is_yanked: reason = link.yanked_reason or "" msg = ( # Mark this as a unicode string to prevent # "UnicodeEncodeError: 'ascii' codec can't encode character" # in Python 2 when the reason contains non-ascii characters. "The candidate selected for download or install is a " "yanked version: {candidate}\n" "Reason for being yanked: {reason}" ).format(candidate=best_candidate, reason=reason) logger.warning(msg) return link def _populate_link(self, req: InstallRequirement) -> None: """Ensure that if a link can be found for this, that it is found. Note that req.link may still be None - if the requirement is already installed and not needed to be upgraded based on the return value of _is_upgrade_allowed(). If preparer.require_hashes is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have undeterministic contents due to file modification times. """ if req.link is None: req.link = self._find_requirement_link(req) if self.wheel_cache is None or self.preparer.require_hashes: return cache_entry = self.wheel_cache.get_cache_entry( link=req.link, package_name=req.name, supported_tags=get_supported(), ) if cache_entry is not None: logger.debug("Using cached wheel link: %s", cache_entry.link) if req.link is req.original_link and cache_entry.persistent: req.original_link_is_in_wheel_cache = True req.link = cache_entry.link def _get_dist_for(self, req: InstallRequirement) -> BaseDistribution: """Takes a InstallRequirement and returns a single AbstractDist \ representing a prepared variant of the same. """ if req.editable: return self.preparer.prepare_editable_requirement(req) # satisfied_by is only evaluated by calling _check_skip_installed, # so it must be None here. assert req.satisfied_by is None skip_reason = self._check_skip_installed(req) if req.satisfied_by: return self.preparer.prepare_installed_requirement(req, skip_reason) # We eagerly populate the link, since that's our "legacy" behavior. self._populate_link(req) dist = self.preparer.prepare_linked_requirement(req) # NOTE # The following portion is for determining if a certain package is # going to be re-installed/upgraded or not and reporting to the user. # This should probably get cleaned up in a future refactor. # req.req is only avail after unpack for URL # pkgs repeat check_if_exists to uninstall-on-upgrade # (#14) if not self.ignore_installed: req.check_if_exists(self.use_user_site) if req.satisfied_by: should_modify = ( self.upgrade_strategy != "to-satisfy-only" or self.force_reinstall or self.ignore_installed or req.link.scheme == "file" ) if should_modify: self._set_req_to_reinstall(req) else: logger.info( "Requirement already satisfied (use --upgrade to upgrade): %s", req, ) return dist def _resolve_one( self, requirement_set: RequirementSet, req_to_install: InstallRequirement, ) -> List[InstallRequirement]: """Prepare a single requirements file. :return: A list of additional InstallRequirements to also install. """ # Tell user what we are doing for this requirement: # obtain (editable), skipping, processing (local url), collecting # (remote url or package name) if req_to_install.constraint or req_to_install.prepared: return [] req_to_install.prepared = True # Parse and return dependencies dist = self._get_dist_for(req_to_install) # This will raise UnsupportedPythonVersion if the given Python # version isn't compatible with the distribution's Requires-Python. _check_dist_requires_python( dist, version_info=self._py_version_info, ignore_requires_python=self.ignore_requires_python, ) more_reqs: List[InstallRequirement] = [] def add_req(subreq: Requirement, extras_requested: Iterable[str]) -> None: # This idiosyncratically converts the Requirement to str and let # make_install_req then parse it again into Requirement. But this is # the legacy resolver so I'm just not going to bother refactoring. sub_install_req = self._make_install_req(str(subreq), req_to_install) parent_req_name = req_to_install.name to_scan_again, add_to_parent = requirement_set.add_requirement( sub_install_req, parent_req_name=parent_req_name, extras_requested=extras_requested, ) if parent_req_name and add_to_parent: self._discovered_dependencies[parent_req_name].append(add_to_parent) more_reqs.extend(to_scan_again) with indent_log(): # We add req_to_install before its dependencies, so that we # can refer to it when adding dependencies. if not requirement_set.has_requirement(req_to_install.name): # 'unnamed' requirements will get added here # 'unnamed' requirements can only come from being directly # provided by the user. assert req_to_install.user_supplied requirement_set.add_requirement(req_to_install, parent_req_name=None) if not self.ignore_dependencies: if req_to_install.extras: logger.debug( "Installing extra requirements: %r", ",".join(req_to_install.extras), ) missing_requested = sorted( set(req_to_install.extras) - set(dist.iter_provided_extras()) ) for missing in missing_requested: logger.warning( "%s %s does not provide the extra '%s'", dist.raw_name, dist.version, missing, ) available_requested = sorted( set(dist.iter_provided_extras()) & set(req_to_install.extras) ) for subreq in dist.iter_dependencies(available_requested): add_req(subreq, extras_requested=available_requested) return more_reqs def get_installation_order( self, req_set: RequirementSet ) -> List[InstallRequirement]: """Create the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. """ # The current implementation, which we may change at any point # installs the user specified things in the order given, except when # dependencies must come earlier to achieve topological order. order = [] ordered_reqs: Set[InstallRequirement] = set() def schedule(req: InstallRequirement) -> None: if req.satisfied_by or req in ordered_reqs: return if req.constraint: return ordered_reqs.add(req) for dep in self._discovered_dependencies[req.name]: schedule(dep) order.append(req) for install_req in req_set.requirements.values(): schedule(install_req) return order PK,]resolution/legacy/__init__.pynu[PK,]˩GGresolution/base.pynu[from typing import Callable, List, Optional from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet InstallRequirementProvider = Callable[ [str, Optional[InstallRequirement]], InstallRequirement ] class BaseResolver: def resolve( self, root_reqs: List[InstallRequirement], check_supported_wheels: bool ) -> RequirementSet: raise NotImplementedError() def get_installation_order( self, req_set: RequirementSet ) -> List[InstallRequirement]: raise NotImplementedError() PK,]resolution/__init__.pynu[PK,]I~D~Dindex/collector.pynu[""" The main purpose of this module is to expose LinkCollector.collect_sources(). """ import cgi import collections import functools import itertools import logging import os import re import urllib.parse import urllib.request import xml.etree.ElementTree from optparse import Values from typing import ( Callable, Iterable, List, MutableMapping, NamedTuple, Optional, Sequence, Union, ) from pip._vendor import html5lib, requests from pip._vendor.requests import Response from pip._vendor.requests.exceptions import RetryError, SSLError from pip._internal.exceptions import NetworkConnectionError from pip._internal.models.link import Link from pip._internal.models.search_scope import SearchScope from pip._internal.network.session import PipSession from pip._internal.network.utils import raise_for_status from pip._internal.utils.filetypes import is_archive_file from pip._internal.utils.misc import pairwise, redact_auth_from_url from pip._internal.vcs import vcs from .sources import CandidatesFromPage, LinkSource, build_source logger = logging.getLogger(__name__) HTMLElement = xml.etree.ElementTree.Element ResponseHeaders = MutableMapping[str, str] def _match_vcs_scheme(url: str) -> Optional[str]: """Look for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. """ for scheme in vcs.schemes: if url.lower().startswith(scheme) and url[len(scheme)] in "+:": return scheme return None class _NotHTML(Exception): def __init__(self, content_type: str, request_desc: str) -> None: super().__init__(content_type, request_desc) self.content_type = content_type self.request_desc = request_desc def _ensure_html_header(response: Response) -> None: """Check the Content-Type header to ensure the response contains HTML. Raises `_NotHTML` if the content type is not text/html. """ content_type = response.headers.get("Content-Type", "") if not content_type.lower().startswith("text/html"): raise _NotHTML(content_type, response.request.method) class _NotHTTP(Exception): pass def _ensure_html_response(url: str, session: PipSession) -> None: """Send a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. """ scheme, netloc, path, query, fragment = urllib.parse.urlsplit(url) if scheme not in {"http", "https"}: raise _NotHTTP() resp = session.head(url, allow_redirects=True) raise_for_status(resp) _ensure_html_header(resp) def _get_html_response(url: str, session: PipSession) -> Response: """Access an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotHTML` if it is not HTML. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got HTML, and raise `_NotHTML` otherwise. """ if is_archive_file(Link(url).filename): _ensure_html_response(url, session=session) logger.debug("Getting page %s", redact_auth_from_url(url)) resp = session.get( url, headers={ "Accept": "text/html", # We don't want to blindly returned cached data for # /simple/, because authors generally expecting that # twine upload && pip install will function, but if # they've done a pip install in the last ~10 minutes # it won't. Thus by setting this to zero we will not # blindly use any cached data, however the benefit of # using max-age=0 instead of no-cache, is that we will # still support conditional requests, so we will still # minimize traffic sent in cases where the page hasn't # changed at all, we will just always incur the round # trip for the conditional GET now instead of only # once per 10 minutes. # For more information, please see pypa/pip#5670. "Cache-Control": "max-age=0", }, ) raise_for_status(resp) # The check for archives above only works if the url ends with # something that looks like an archive. However that is not a # requirement of an url. Unless we issue a HEAD request on every # url we cannot know ahead of time for sure if something is HTML # or not. However we can check after we've downloaded it. _ensure_html_header(resp) return resp def _get_encoding_from_headers(headers: ResponseHeaders) -> Optional[str]: """Determine if we have any encoding information in our headers.""" if headers and "Content-Type" in headers: content_type, params = cgi.parse_header(headers["Content-Type"]) if "charset" in params: return params["charset"] return None def _determine_base_url(document: HTMLElement, page_url: str) -> str: """Determine the HTML document's base URL. This looks for a ```` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the HTML file's URL is used as the base URL. :param document: An HTML document representation. The current implementation expects the result of ``html5lib.parse()``. :param page_url: The URL of the HTML document. """ for base in document.findall(".//base"): href = base.get("href") if href is not None: return href return page_url def _clean_url_path_part(part: str) -> str: """ Clean a "part" of a URL path (i.e. after splitting on "@" characters). """ # We unquote prior to quoting to make sure nothing is double quoted. return urllib.parse.quote(urllib.parse.unquote(part)) def _clean_file_url_path(part: str) -> str: """ Clean the first part of a URL path that corresponds to a local filesystem path (i.e. the first part after splitting on "@" characters). """ # We unquote prior to quoting to make sure nothing is double quoted. # Also, on Windows the path part might contain a drive letter which # should not be quoted. On Linux where drive letters do not # exist, the colon should be quoted. We rely on urllib.request # to do the right thing here. return urllib.request.pathname2url(urllib.request.url2pathname(part)) # percent-encoded: / _reserved_chars_re = re.compile("(@|%2F)", re.IGNORECASE) def _clean_url_path(path: str, is_local_path: bool) -> str: """ Clean the path portion of a URL. """ if is_local_path: clean_func = _clean_file_url_path else: clean_func = _clean_url_path_part # Split on the reserved characters prior to cleaning so that # revision strings in VCS URLs are properly preserved. parts = _reserved_chars_re.split(path) cleaned_parts = [] for to_clean, reserved in pairwise(itertools.chain(parts, [""])): cleaned_parts.append(clean_func(to_clean)) # Normalize %xx escapes (e.g. %2f -> %2F) cleaned_parts.append(reserved.upper()) return "".join(cleaned_parts) def _clean_link(url: str) -> str: """ Make sure a link is fully quoted. For example, if ' ' occurs in the URL, it will be replaced with "%20", and without double-quoting other characters. """ # Split the URL into parts according to the general structure # `scheme://netloc/path;parameters?query#fragment`. result = urllib.parse.urlparse(url) # If the netloc is empty, then the URL refers to a local filesystem path. is_local_path = not result.netloc path = _clean_url_path(result.path, is_local_path=is_local_path) return urllib.parse.urlunparse(result._replace(path=path)) def _create_link_from_element( anchor: HTMLElement, page_url: str, base_url: str, ) -> Optional[Link]: """ Convert an anchor element in a simple repository page to a Link. """ href = anchor.get("href") if not href: return None url = _clean_link(urllib.parse.urljoin(base_url, href)) pyrequire = anchor.get("data-requires-python") yanked_reason = anchor.get("data-yanked") link = Link( url, comes_from=page_url, requires_python=pyrequire, yanked_reason=yanked_reason, ) return link class CacheablePageContent: def __init__(self, page: "HTMLPage") -> None: assert page.cache_link_parsing self.page = page def __eq__(self, other: object) -> bool: return isinstance(other, type(self)) and self.page.url == other.page.url def __hash__(self) -> int: return hash(self.page.url) def with_cached_html_pages( fn: Callable[["HTMLPage"], Iterable[Link]], ) -> Callable[["HTMLPage"], List[Link]]: """ Given a function that parses an Iterable[Link] from an HTMLPage, cache the function's result (keyed by CacheablePageContent), unless the HTMLPage `page` has `page.cache_link_parsing == False`. """ @functools.lru_cache(maxsize=None) def wrapper(cacheable_page: CacheablePageContent) -> List[Link]: return list(fn(cacheable_page.page)) @functools.wraps(fn) def wrapper_wrapper(page: "HTMLPage") -> List[Link]: if page.cache_link_parsing: return wrapper(CacheablePageContent(page)) return list(fn(page)) return wrapper_wrapper @with_cached_html_pages def parse_links(page: "HTMLPage") -> Iterable[Link]: """ Parse an HTML document, and yield its anchor elements as Link objects. """ document = html5lib.parse( page.content, transport_encoding=page.encoding, namespaceHTMLElements=False, ) url = page.url base_url = _determine_base_url(document, url) for anchor in document.findall(".//a"): link = _create_link_from_element( anchor, page_url=url, base_url=base_url, ) if link is None: continue yield link class HTMLPage: """Represents one page, along with its URL""" def __init__( self, content: bytes, encoding: Optional[str], url: str, cache_link_parsing: bool = True, ) -> None: """ :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. :param cache_link_parsing: whether links parsed from this page's url should be cached. PyPI index urls should have this set to False, for example. """ self.content = content self.encoding = encoding self.url = url self.cache_link_parsing = cache_link_parsing def __str__(self) -> str: return redact_auth_from_url(self.url) def _handle_get_page_fail( link: Link, reason: Union[str, Exception], meth: Optional[Callable[..., None]] = None, ) -> None: if meth is None: meth = logger.debug meth("Could not fetch URL %s: %s - skipping", link, reason) def _make_html_page(response: Response, cache_link_parsing: bool = True) -> HTMLPage: encoding = _get_encoding_from_headers(response.headers) return HTMLPage( response.content, encoding=encoding, url=response.url, cache_link_parsing=cache_link_parsing, ) def _get_html_page( link: Link, session: Optional[PipSession] = None ) -> Optional["HTMLPage"]: if session is None: raise TypeError( "_get_html_page() missing 1 required keyword argument: 'session'" ) url = link.url.split("#", 1)[0] # Check for VCS schemes that do not support lookup as web pages. vcs_scheme = _match_vcs_scheme(url) if vcs_scheme: logger.warning( "Cannot look at %s URL %s because it does not support lookup as web pages.", vcs_scheme, link, ) return None # Tack index.html onto file:// URLs that point to directories scheme, _, path, _, _, _ = urllib.parse.urlparse(url) if scheme == "file" and os.path.isdir(urllib.request.url2pathname(path)): # add trailing slash if not present so urljoin doesn't trim # final segment if not url.endswith("/"): url += "/" url = urllib.parse.urljoin(url, "index.html") logger.debug(" file: URL is directory, getting %s", url) try: resp = _get_html_response(url, session=session) except _NotHTTP: logger.warning( "Skipping page %s because it looks like an archive, and cannot " "be checked by a HTTP HEAD request.", link, ) except _NotHTML as exc: logger.warning( "Skipping page %s because the %s request got Content-Type: %s." "The only supported Content-Type is text/html", link, exc.request_desc, exc.content_type, ) except NetworkConnectionError as exc: _handle_get_page_fail(link, exc) except RetryError as exc: _handle_get_page_fail(link, exc) except SSLError as exc: reason = "There was a problem confirming the ssl certificate: " reason += str(exc) _handle_get_page_fail(link, reason, meth=logger.info) except requests.ConnectionError as exc: _handle_get_page_fail(link, f"connection error: {exc}") except requests.Timeout: _handle_get_page_fail(link, "timed out") else: return _make_html_page(resp, cache_link_parsing=link.cache_link_parsing) return None class CollectedSources(NamedTuple): find_links: Sequence[Optional[LinkSource]] index_urls: Sequence[Optional[LinkSource]] class LinkCollector: """ Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_sources() method. """ def __init__( self, session: PipSession, search_scope: SearchScope, ) -> None: self.search_scope = search_scope self.session = session @classmethod def create( cls, session: PipSession, options: Values, suppress_no_index: bool = False, ) -> "LinkCollector": """ :param session: The Session to use to make requests. :param suppress_no_index: Whether to ignore the --no-index option when constructing the SearchScope object. """ index_urls = [options.index_url] + options.extra_index_urls if options.no_index and not suppress_no_index: logger.debug( "Ignoring indexes: %s", ",".join(redact_auth_from_url(url) for url in index_urls), ) index_urls = [] # Make sure find_links is a list before passing to create(). find_links = options.find_links or [] search_scope = SearchScope.create( find_links=find_links, index_urls=index_urls, ) link_collector = LinkCollector( session=session, search_scope=search_scope, ) return link_collector @property def find_links(self) -> List[str]: return self.search_scope.find_links def fetch_page(self, location: Link) -> Optional[HTMLPage]: """ Fetch an HTML page containing package links. """ return _get_html_page(location, session=self.session) def collect_sources( self, project_name: str, candidates_from_page: CandidatesFromPage, ) -> CollectedSources: # The OrderedDict calls deduplicate sources by URL. index_url_sources = collections.OrderedDict( build_source( loc, candidates_from_page=candidates_from_page, page_validator=self.session.is_secure_origin, expand_dir=False, cache_link_parsing=False, ) for loc in self.search_scope.get_index_urls_locations(project_name) ).values() find_links_sources = collections.OrderedDict( build_source( loc, candidates_from_page=candidates_from_page, page_validator=self.session.is_secure_origin, expand_dir=True, cache_link_parsing=True, ) for loc in self.find_links ).values() if logger.isEnabledFor(logging.DEBUG): lines = [ f"* {s.link}" for s in itertools.chain(find_links_sources, index_url_sources) if s is not None and s.link is not None ] lines = [ f"{len(lines)} location(s) to search " f"for versions of {project_name}:" ] + lines logger.debug("\n".join(lines)) return CollectedSources( find_links=list(find_links_sources), index_urls=list(index_url_sources), ) PK,]/>/>*index/__pycache__/collector.cpython-39.pycnu[a Re~D@sdZddlZddlZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl mZddlmZmZmZmZmZmZmZmZddlmZmZddlmZddlmZmZddl m!Z!dd l"m#Z#dd l$m%Z%dd l&m'Z'dd l(m)Z)dd l*m+Z+ddl,m-Z-m.Z.ddl/m0Z0ddl1m2Z2m3Z3m4Z4e5e6Z7e j8j9j:Z;eeGddde?Z@eddddZAGddde?ZBed7d7ZSdNe#eeLsr>)rsessionrcCsFtj|\}}}}}|dvr$t|j|dd}t|t|dS)zSend a HEAD request to the URL, and ensure the response contains HTML. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotHTML` if the content type is not text/html. >httphttpsT)allow_redirectsN)urllibparseurlsplitr>headrr=)rr?r#netlocpathqueryfragmentrespr$r$r%_ensure_html_responsePs rLcCsRtt|jrt||dtdt||j|dddd}t|t ||S)aAccess an HTML page with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotHTML` if it is not HTML. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got HTML, and raise `_NotHTML` otherwise. r?zGetting page %sr8z max-age=0)Acceptz Cache-Control)r9) rrfilenamerLloggerdebugrr:rr=)rr?rKr$r$r%_get_html_response`s  rR)r9rcCs2|r.d|vr.t|d\}}d|vr.|dSdS)z=Determine if we have any encoding information in our headers.r6charsetN)cgi parse_header)r9r(paramsr$r$r%_get_encoding_from_headerss  rW)documentpage_urlrcCs.|dD]}|d}|dur |Sq |S)aDetermine the HTML document's base URL. This looks for a ```` tag in the HTML document. If present, its href attribute denotes the base URL of anchor tags in the document. If there is no such tag (or if it does not have a valid href attribute), the HTML file's URL is used as the base URL. :param document: An HTML document representation. The current implementation expects the result of ``html5lib.parse()``. :param page_url: The URL of the HTML document. z.//basehrefN)findallr:)rXrYbaserZr$r$r%_determine_base_urls   r])partrcCstjtj|S)zP Clean a "part" of a URL path (i.e. after splitting on "@" characters). )rCrDquoteunquoter^r$r$r%_clean_url_path_partsrbcCstjtj|S)z Clean the first part of a URL path that corresponds to a local filesystem path (i.e. the first part after splitting on "@" characters). )rCr; pathname2url url2pathnamerar$r$r%_clean_file_url_paths rez(@|%2F))rH is_local_pathrcCs^|r t}nt}t|}g}tt|dgD]$\}}|||||q.d |S)z* Clean the path portion of a URL. r7) rerb_reserved_chars_resplitr itertoolschainappendupperjoin)rHrf clean_funcparts cleaned_partsto_cleanreservedr$r$r%_clean_url_paths rscCs6tj|}|j }t|j|d}tj|j|dS)z Make sure a link is fully quoted. For example, if ' ' occurs in the URL, it will be replaced with "%20", and without double-quoting other characters. )rf)rH)rCrDurlparserGrsrH urlunparse_replace)rresultrfrHr$r$r% _clean_links rx)anchorrYbase_urlrcCsL|d}|sdSttj||}|d}|d}t||||d}|S)zJ Convert an anchor element in a simple repository page to a Link. rZNzdata-requires-pythonz data-yanked) comes_fromrequires_python yanked_reason)r:rxrCrDurljoinr)ryrYrzrZr pyrequirer}linkr$r$r%_create_link_from_elements   rc@s:eZdZdddddZeedddZed d d ZdS) CacheablePageContentHTMLPageNpagercCs|js J||_dSr*)cache_link_parsingr)r-rr$r$r%r,s zCacheablePageContent.__init__)otherrcCst|t|o|jj|jjkSr*) isinstancetyperr)r-rr$r$r%__eq__ szCacheablePageContent.__eq__rcCs t|jjSr*)hashrrr-r$r$r%__hash__szCacheablePageContent.__hash__) r0r1r2r,objectboolrintrr$r$r$r%rsrr)fnrcsLtjddtttdfdd tdttdfdd }|S) z Given a function that parses an Iterable[Link] from an HTMLPage, cache the function's result (keyed by CacheablePageContent), unless the HTMLPage `page` has `page.cache_link_parsing == False`. N)maxsize)cacheable_pagercst|jSr*)listr)r)rr$r%wrappersz'with_cached_html_pages..wrapperrrcs|jrt|St|Sr*)rrr)rrrr$r%wrapper_wrappers z/with_cached_html_pages..wrapper_wrapper) functools lru_cacherrrwraps)rrr$rr%with_cached_html_pagess rrccsVtj|j|jdd}|j}t||}|dD]"}t|||d}|durJq.|Vq.dS)zP Parse an HTML document, and yield its anchor elements as Link objects. F)transport_encodingnamespaceHTMLElementsz.//a)rYrzN)r rDcontentencodingrr]r[r)rrXrrzryrr$r$r% parse_links(s  rc@s:eZdZdZd eeeeeddddZeddd Z dS) rz'Represents one page, along with its URLTN)rrrrrcCs||_||_||_||_dS)am :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. :param cache_link_parsing: whether links parsed from this page's url should be cached. PyPI index urls should have this set to False, for example. N)rrrr)r-rrrrr$r$r%r,CszHTMLPage.__init__rcCs t|jSr*)rrrr$r$r%__str__VszHTMLPage.__str__)T) r0r1r2__doc__bytesrr3rr,rr$r$r$r%r@s ).N)rreasonmethrcCs|durtj}|d||dS)Nz%Could not fetch URL %s: %s - skipping)rPrQ)rrrr$r$r%_handle_get_page_failZsrT)r5rrcCst|j}t|j||j|dS)N)rrr)rWr9rrr)r5rrr$r$r%_make_html_pageds r)rr?rc Cs|durtd|jddd}t|}|r@td||dStj|\}}}}}}|dkrt j tj |r|ds|d7}tj|d}td |zt||d }WnNtytd |Yn>ty }z"td ||j|jWYd}~n d}~0ty:}zt||WYd}~nd}~0tyh}zt||WYd}~nd}~0ty}z,d } | t|7} t|| tjdWYd}~nld}~0tjy}zt|d|WYd}~n6d}~0tjyt|dYn0t||j dSdS)Nz?_get_html_page() missing 1 required keyword argument: 'session'#rrzICannot look at %s URL %s because it does not support lookup as web pages.file/z index.htmlz# file: URL is directory, getting %srMz`Skipping page %s because it looks like an archive, and cannot be checked by a HTTP HEAD request.ziSkipping page %s because the %s request got Content-Type: %s.The only supported Content-Type is text/htmlz4There was a problem confirming the ssl certificate: )rzconnection error: z timed out)r)! TypeErrorrrhr&rPwarningrCrDrtosrHisdirr;rdendswithr~rQrRr>r'r)r(rrrrr3infor ConnectionErrorTimeoutrr) rr?r vcs_schemer#_rHrKexcrr$r$r%_get_html_pagens^     $$rc@s.eZdZUeeeed<eeeed<dS)CollectedSources find_links index_urlsN)r0r1r2r rr__annotations__r$r$r$r%rs rc@sxeZdZdZeeddddZedeee dddd Z e e e d d d Zeeed ddZe eedddZdS) LinkCollectorz Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_sources() method. N)r? search_scopercCs||_||_dSr*)rr?)r-r?rr$r$r%r,szLinkCollector.__init__F)r?optionssuppress_no_indexrcCs`|jg|j}|jr8|s8tdddd|Dg}|jp@g}tj||d}t ||d}|S)z :param session: The Session to use to make requests. :param suppress_no_index: Whether to ignore the --no-index option when constructing the SearchScope object. zIgnoring indexes: %s,css|]}t|VqdSr*)r).0rr$r$r% z'LinkCollector.create..rr)r?r) index_urlextra_index_urlsno_indexrPrQrmrrcreater)clsr?rrrrrlink_collectorr$r$r%rs"   zLinkCollector.creatercCs|jjSr*)rrrr$r$r%rszLinkCollector.find_links)locationrcCst||jdS)z> Fetch an HTML page containing package links. rM)rr?)r-rr$r$r% fetch_pageszLinkCollector.fetch_page) project_namecandidates_from_pagercstfddj|D}tfddjD}ttj rddt ||D}t |d|dg|}t d|tt|t|d S) Nc3s$|]}t|jjdddVqdS)Frpage_validator expand_dirrNrr?is_secure_originrlocrr-r$r%rsz0LinkCollector.collect_sources..c3s$|]}t|jjdddVqdS)TrNrrrr$r%rscSs*g|]"}|dur|jdurd|jqS)Nz* )r)rsr$r$r% sz1LinkCollector.collect_sources..z' location(s) to search for versions of : r) collections OrderedDictrget_index_urls_locationsvaluesrrP isEnabledForloggingDEBUGrirjr"rQrmrr)r-rrindex_url_sourcesfind_links_sourceslinesr$rr%collect_sourcess*    zLinkCollector.collect_sources)F)r0r1r2rrrr, classmethodrrrpropertyrr3rrrrrrrrr$r$r$r%rs(   r)N)T)N)YrrTrrrirrre urllib.parserCurllib.requestxml.etree.ElementTreexmloptparsertypingrrrrrrr r pip._vendorr r Zpip._vendor.requestsr Zpip._vendor.requests.exceptionsrrpip._internal.exceptionsrpip._internal.models.linkr!pip._internal.models.search_scoperpip._internal.network.sessionrpip._internal.network.utilsrpip._internal.utils.filetypesrpip._internal.utils.miscrrpip._internal.vcsrsourcesrrr getLoggerr0rPetree ElementTreeElement HTMLElementr3ResponseHeadersr& Exceptionr'r=r>rLrRrWr]rbrecompile IGNORECASErgrrsrxrrrrrrrrrrr$r$r$r%s (              2         ?PK,]>k>>(index/__pycache__/sources.cpython-39.pycnu[a Re @s0ddlZddlZddlZddlZddlmZmZmZmZddl m Z ddl m Z ddl mZmZddlmZeeZee Zee Zee gee fZee gefZGdddZeed d d ZGd d d eZGdddeZGdddeZGdddeZ eeeeeeeeeefdddZ!dS)N)CallableIterableOptionalTuple)InstallationCandidate)Link) path_to_url url_to_path)is_urlc@s>eZdZeeedddZedddZe dddZ dS) LinkSourcereturncCs tdS)z,Returns the underlying link, if there's one.NNotImplementedErrorselfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/index/sources.pylinkszLinkSource.linkcCs tdS)z9Candidates found by parsing an archive listing HTML file.Nrrrrrpage_candidatesszLinkSource.page_candidatescCs tdS)z,Links found by specifying archives directly.Nrrrrr file_linksszLinkSource.file_linksN) __name__ __module__ __qualname__propertyrrrFoundCandidatesr FoundLinksrrrrrr sr )file_urlr cCstj|ddddkS)NF)strictrz text/html) mimetypes guess_type)rrrr _is_html_file#sr!c@sTeZdZdZeeddddZeee dddZ e dd d Z e dd d ZdS) _FlatDirectorySourcezLink source specified by ``--find-links=``. This looks the content of the directory, and returns: * ``page_candidates``: Links listed on each HTML file in the directory. * ``file_candidates``: Archives in the directory. N)candidates_from_pagepathr cCs||_ttj||_dSN)_candidates_from_pagepathlibPathosr$realpath_path)rr#r$rrr__init__0sz_FlatDirectorySource.__init__r cCsdSr%rrrrrr8sz_FlatDirectorySource.linkccs>|jD].}tt|}t|s$q |t|EdHq dSr%)r+iterdirrstrr!r&rrr$urlrrrr<s  z$_FlatDirectorySource.page_candidatesccs4|jD]$}tt|}t|r$q t|Vq dSr%)r+r-rr.r!rr/rrrrCs  z_FlatDirectorySource.file_links)rrr__doc__CandidatesFromPager.r,rrrrrrrrrrrrr"'s  r"c@sTeZdZdZeeddddZeeedddZ e dd d Z e dd d Z dS) _LocalFileSourceaC``--find-links=`` or ``--[extra-]index-url=``. If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to the option, it is converted to a URL first. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. Nr#rr cCs||_||_dSr%r&_linkrr#rrrrr,Usz_LocalFileSource.__init__r cCs|jSr%r6rrrrr]sz_LocalFileSource.linkccs&t|jjsdS||jEdHdSr%)r!r6r0r&rrrrras z _LocalFileSource.page_candidatesccst|jjrdS|jVdSr%)r!r6r0rrrrrfs z_LocalFileSource.file_linksrrrr1r2rr,rrrrrrrrrrrr3Ks  r3c@sVeZdZdZeeeddddZee edddZ e dd d Z e dd d ZdS) _RemoteFileSourcez``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. N)r#page_validatorrr cCs||_||_||_dSr%)r&_page_validatorr6)rr#r;rrrrr,usz_RemoteFileSource.__init__r cCs|jSr%r8rrrrrsz_RemoteFileSource.linkccs&||jsdS||jEdHdSr%)r<r6r&rrrrrs z!_RemoteFileSource.page_candidatesccs |jVdSr%r8rrrrrsz_RemoteFileSource.file_links)rrrr1r2 PageValidatorrr,rrrrrrrrrrrr:ls  r:c@sTeZdZdZeeddddZeeedddZ e dd d Z e dd d Z dS) _IndexDirectorySourcez``--[extra-]index-url=``. This is treated like a remote URL; ``candidates_from_page`` contains logic for this by appending ``index.html`` to the link. Nr4cCs||_||_dSr%r5r7rrrr,sz_IndexDirectorySource.__init__r cCs|jSr%r8rrrrrsz_IndexDirectorySource.linkccs||jEdHdSr%r5rrrrrsz%_IndexDirectorySource.page_candidatescCsdS)Nrrrrrrrsz _IndexDirectorySource.file_linksr9rrrrr>s r>)locationr#r; expand_dircache_link_parsingr c Csd}d}tj|r"t|}|}n$|dr:|}t|}n t|rF|}|durbd}t||dS|durt ||t ||dd}||fStj |r|rt ||d}nt |t ||dd}||fStj|rt|t ||dd}||fStd||dfS) Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)rA)r#r;r)r#r$)r#rz?Location '%s' is ignored: it is neither a file nor a directory.)r)r$existsr startswithr r loggerwarningr:risdirr"r>isfiler3) r?r#r;r@rAr$r0msgsourcerrr build_sourcesX          rJ)"loggingrr)r'typingrrrrpip._internal.models.candidaterpip._internal.models.linkrpip._internal.utils.urlsrr pip._internal.vcsr getLoggerrrDrrr2boolr=r r.r!r"r3r:r>rJrrrrs4    $! PK,]1%mm/index/__pycache__/package_finder.cpython-39.pycnu[a Re@sZdZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZddlmZddlmZddlmZddlmZdd lmZmZmZmZdd lmZmZdd lm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>gdZ?e0e@ZAe e de eBeCffZDe eBeBeBee eBeDfZEd3e$e eBeBeBfeFeFddd ZGGd!d"d"ZHee e4eCee d#d$d%ZIGd&d'd'ZJGd(d)d)ZKGd*d+d+ZLGd,d-d-ZMeCeCeBd.d/d0ZNeCeCe eCd.d1d2ZOdS)4z!Routines related to PyPI, indexesN) FrozenSetIterableListOptionalSetTupleUnion) specifiers)Tag)canonicalize_name) _BaseVersion)parse)BestVersionAlreadyInstalledDistributionNotFoundInvalidWheelFilenameUnsupportedWheel) LinkCollector parse_links)InstallationCandidate) FormatControl)Link) SearchScope)SelectionPreferences) TargetPython)Wheel)InstallRequirement) getLogger)WHEEL_EXTENSION)Hashes) indent_log) build_netloc)check_requires_python)SUPPORTED_EXTENSIONS) url_to_path)rBestCandidateResult PackageFinderF)link version_infoignore_requires_pythonreturncCs|zt|j|d}Wn$tjy6td|j|YnB0|sxdtt|}|sft d||j|dStd||j|dS)aa Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. )r(z2Ignoring invalid Requires-Python (%r) for link: %s.z4Link requires a different Python (%s not in: %r): %sFzBIgnoring failed Requires-Python check (%s not in: %r) for link: %sT) r!requires_pythonr InvalidSpecifierloggerdebugjoinmapstrverbose)r'r(r) is_compatibleversionr&r&/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/index/package_finder.py_check_link_requires_python3s8  r7c @sZeZdZdZedZd eeeee e e e ddddZ e ee e efddd ZdS) LinkEvaluatorzD Responsible for evaluating links for a particular project. z-py([123]\.?[0-9]?)$N) project_namecanonical_nameformats target_python allow_yankedr)r*cCs4|dur d}||_||_||_||_||_||_dS)a :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. NF) _allow_yanked_canonical_name_ignore_requires_python_formats_target_pythonr9)selfr9r:r;r<r=r)r&r&r6__init__nszLinkEvaluator.__init__)r'r*c Csd}|jr(|js(|jpd}dd|fS|jr<|j}|j}n|\}}|sPdS|tvrfdd|fSd|jvr|tkrd |j }d|fSd |j vr|d krd S|tkr0zt |j }WntyYd S0t|j|jkrd |j }d|fS|j}||s*|}d d|}d|fS|j}d|jvrZ|tkrZd|j }d|fS|slt||j}|sd|j }d|fS|j|} | r|d| }| d} | |jjkrdSt||jj|j d} | sdSt!"d||d|fS)aG Determine whether a link is a candidate for installation. :return: A tuple (is_candidate, result), where `result` is (1) a version string if `is_candidate` is True, and (2) if `is_candidate` is False, an optional string to log the reason the link fails to qualify. Nz Fzyanked for reason: )Fz not a filezunsupported archive format: binaryzNo binaries permitted for {}macosx10z.zip)Fz macosx10 one)Fzinvalid wheel filenamezwrong project name (not {})z^none of the wheel's tags ({}) are compatible (run pip debug --verbose to show compatible tags), sourcezNo sources permitted for zMissing project version for )FzPython version is incorrect)r(r))FNzFound link %s, version: %sT)# is_yankedr> yanked_reason egg_fragmentextsplitextr"rArformatr9pathrfilenamerr namer?rBget_tags supportedget_formatted_file_tagsr0r5_extract_version_from_fragment_py_version_researchstartgroup py_versionr7py_version_infor@r.r/) rCr'r5reasonegg_inforMwheelsupported_tags file_tagsmatchr[supports_pythonr&r&r6 evaluate_linksx              zLinkEvaluator.evaluate_link)N)__name__ __module__ __qualname____doc__recompilerWr2rrboolrrDrrrdr&r&r&r6r8bs  %r8) candidateshashesr9r*c Cs|stdt||t|Sg}g}d}|D]>}|j}|js@n"|j|drV|d7}n ||q.||q.|rx|}nt|}t|t|krd} n dt|d dd |D} td t|||j |t||| |S) a Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). zJGiven no hashes to check %s links for project %r: discarding no candidatesr)rmrIzdiscarding no candidateszdiscarding {} non-matches: {}z css|]}t|jVqdSN)r2r').0 candidater&r&r6 $z*filter_unallowed_hashes..zPChecked %s links for project %r against %s hashes (%s matches, %s no digest): %s) r.r/lenlistr'has_hashis_hash_allowedappendrOr0 digest_count) rlrmr9matches_or_no_digest non_matches match_countrpr'filtereddiscard_messager&r&r6filter_unallowed_hashessL      r~c@s$eZdZdZdeeddddZdS)CandidatePreferenceszk Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. FN) prefer_binaryallow_all_prereleasesr*cCs||_||_dS)zR :param allow_all_prereleases: Whether to allow all pre-releases. N)rr)rCrrr&r&r6rD<szCandidatePreferences.__init__)FF)rerfrgrhrkrDr&r&r&r6r5src@sTeZdZdZeeeeeeddddZeedddZ eedd d Z dS) r$zA collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. N)rlapplicable_candidatesbest_candidater*cCsHt|t|ksJ|dur&|r2Jn ||vs2J||_||_||_dS)a :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. N)set_applicable_candidates _candidatesrrCrlrrr&r&r6rDOs   zBestCandidateResult.__init__r*cCs t|jS)zIterate through all candidates.)iterrrCr&r&r6iter_allgszBestCandidateResult.iter_allcCs t|jS)z*Iterate through the applicable candidates.)rrrr&r&r6iter_applicableksz#BestCandidateResult.iter_applicable) rerfrgrhrrrrDrrrr&r&r&r6r$Hs r$c @seZdZdZedeeeeeee j ee ddddZ dee ee j eeee dddd Ze ee ed d d Zeed ddZe eeed ddZe eed ddZdS)CandidateEvaluatorzm Responsible for filtering and sorting candidates for installation based on what tags are valid. NF)r9r<rr specifierrmr*cCs:|durt}|durt}|}|||||||dS)aCreate a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. N)r9r`rrrrm)rr SpecifierSetrS)clsr9r<rrrrmr`r&r&r6createwszCandidateEvaluator.create)r9r`rrrrmr*cCs<||_||_||_||_||_||_ddt|D|_dS)z :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). cSsi|]\}}||qSr&r&)roidxtagr&r&r6 sz/CandidateEvaluator.__init__..N)_allow_all_prereleases_hashes_prefer_binary _project_name _specifier_supported_tags enumerate_wheel_tag_preferences)rCr9r`rrrrmr&r&r6rDs zCandidateEvaluator.__init__)rlr*csd|jpd}|j}dd|jdd|D|dDfdd|D}t||j|jd }t||jd S) zM Return the applicable candidates from a list of candidates. NcSsh|] }t|qSr&)r2)rovr&r&r6 sz?CandidateEvaluator.get_applicable_candidates..css|]}t|jVqdSrnr2r5rocr&r&r6rqrrz?CandidateEvaluator.get_applicable_candidates..) prereleasescsg|]}t|jvr|qSr&rrversionsr&r6 rrz@CandidateEvaluator.get_applicable_candidates..)rlrmr9key)rrfilterr~rrsorted _sort_key)rCrlallow_prereleasesrrfiltered_applicable_candidatesr&rr6get_applicable_candidatess  z,CandidateEvaluator.get_applicable_candidates)rpr*c Cs|j}t|}d}d}|j}|jrt|j}z|||j }Wn"tybt d |jYn0|j rnd}|j durt d|j } | } t| d| df}n| }t||j} dt|j} | | ||j||fS)a) Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal r&rzB{} is not a supported wheel for this platform. It can't be sorted.rINz ^(\d+)(.*)$)rrsr'is_wheelrrQfind_most_preferred_tagr ValueErrorrrOr build_tagrirbgroupsintrvrrJr5) rCrp valid_tags support_numrbinary_preferencer'r_prirbbuild_tag_groupshas_allowed_hash yank_valuer&r&r6rsD    zCandidateEvaluator._sort_keycCs|sdSt||jd}|S)zy Return the best candidate per the instance's sort order, or None if no candidate is acceptable. Nr)maxr)rCrlrr&r&r6sort_best_candidatesz&CandidateEvaluator.sort_best_candidatecCs"||}||}t|||dS)zF Compute and return a `BestCandidateResult` instance. )rr)rrr$rr&r&r6compute_best_candidate*s  z)CandidateEvaluator.compute_best_candidate)NFFNN)FFN)rerfrgrh classmethodr2rrrkr BaseSpecifierrrrr rDrrCandidateSortingKeyrrr$rr&r&r&r6rpsL(  $F rc @seZdZdZd;eeeeeee eeddddZ e deee)j*ee+e.d3d6d7Z/e0eee"d8d9d:Z1dS)?r%zThis finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. N)link_collectorr<r=format_controlcandidate_prefsr)r*cCsP|durt}|pttt}||_||_||_||_||_||_t|_ dS)a This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. N) rrrr>_candidate_prefsr@_link_collectorrBr _logged_links)rCrr<r=rrr)r&r&r6rDCszPackageFinder.__init__)rselection_prefsr<r*cCs8|durt}t|j|jd}|||||j|j|jdS)afCreate a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. N)rr)rrr<r=rr))rrrrr=rr))rrrr<rr&r&r6rjszPackageFinder.creatercCs|jSrn)rBrr&r&r6r<szPackageFinder.target_pythoncCs|jjSrnr search_scoperr&r&r6rszPackageFinder.search_scope)rr*cCs ||j_dSrnr)rCrr&r&r6rscCs|jjSrn)r find_linksrr&r&r6rszPackageFinder.find_linkscCs|jjSrn)r index_urlsrr&r&r6rszPackageFinder.index_urlsccs|jjjD]}t|Vq dSrn)rsessionpip_trusted_originsr )rC host_portr&r&r6 trusted_hostsszPackageFinder.trusted_hostscCs|jjSrnrrrr&r&r6rsz#PackageFinder.allow_all_prereleasescCs d|j_dSNTrrr&r&r6set_allow_all_prereleasessz'PackageFinder.set_allow_all_prereleasescCs|jjSrnrrrr&r&r6rszPackageFinder.prefer_binarycCs d|j_dSrrrr&r&r6set_prefer_binaryszPackageFinder.set_prefer_binary)r9r*cCs.t|}|j|}t||||j|j|jdS)N)r9r:r;r<r=r))r rget_allowed_formatsr8rBr>r@)rCr9r:r;r&r&r6make_link_evaluators z!PackageFinder.make_link_evaluator)linksr*cCsPgg}}t}|D]2}||vr|||jr<||q||q||S)z Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates )raddrLrw)rCreggsno_eggsseenr'r&r&r6 _sort_linkss    zPackageFinder._sort_links)r'r]r*cCs(||jvr$td|||j|dS)NzSkipping link: %s: %s)rr.r/r)rCr'r]r&r&r6_log_skipped_links zPackageFinder._log_skipped_link)link_evaluatorr'r*cCs8||\}}|s(|r$|j||ddSt|j||dS)z If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. )r]N)rRr'r5)rdrrr9)rCrr' is_candidateresultr&r&r6get_install_candidatesz#PackageFinder.get_install_candidate)rrr*cCs6g}||D]"}|||}|dur||q|S)zU Convert links that are candidates to InstallationCandidate objects. N)rrrw)rCrrrlr'rpr&r&r6evaluate_linkss   zPackageFinder.evaluate_links) project_urlrr*cCshtd||j|}|dur$gStt|}t|j||d}Wdn1sZ0Y|S)Nz-Fetching project page and analyzing links: %s)r)r.r/r fetch_pagertrrr)rCrr html_page page_links package_linksr&r&r6process_project_urls  $z!PackageFinder.process_project_url)maxsizec Cs||}|jj|tj|j|dd}tjdd|D}t |}tjdd|D}| |t |dd}t tjr|rdd |D}t d d |||S) aFind all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. )r)r9candidates_from_pagecss(|] }|D]}|dur |Vq qdSrn)page_candidatesrosourcesrHr&r&r6rqsz4PackageFinder.find_all_candidates..css(|] }|D]}|dur |Vq qdSrn) file_linksrr&r&r6rq'sT)reversecSsg|]}t|jjqSr&)r#r'urlrr&r&r6r3rrz5PackageFinder.find_all_candidates..zLocal files found: %srG)rrcollect_sources functoolspartialr itertoolschain from_iterablertrrr. isEnabledForloggingDEBUGr/r0) rCr9rcollected_sourcespage_candidates_itr file_links_itfile_candidatespathsr&r&r6find_all_candidates s.    z!PackageFinder.find_all_candidates)r9rrmr*cCs"|j}tj||j|j|j||dS)z*Create a CandidateEvaluator object to use.)r9r<rrrrm)rrrrBrr)rCr9rrmrr&r&r6make_candidate_evaluator9sz&PackageFinder.make_candidate_evaluatorcCs$||}|j|||d}||S)aFind matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. )r9rrm)rrr)rCr9rrmrlcandidate_evaluatorr&r&r6find_best_candidateJs z!PackageFinder.find_best_candidate)requpgrader*c Cs|jdd}|j|j|j|d}|j}d}|jdur@t|jj}tt t ddd}|dur|durt d||| td |d}|r|dus|j|krd }|s|dur|rt d |nt d ||jdS|rt d |||tt d|j|||S)zTry to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a InstallationCandidate if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise F)trust_internet)rrmN) cand_iterr*cSs dtdd|DtdpdS)NrGcSsh|]}t|jqSr&rrr&r&r6r~rrzKPackageFinder.find_requirement.._format_versions..rnone)r0r parse_version)rr&r&r6_format_versionsvs z8PackageFinder.find_requirement.._format_versionszNCould not find a version that satisfies the requirement %s (from versions: %s)z%No matching distribution found for {}TzLExisting installed version (%s) is most up-to-date and satisfies requirementzUExisting installed version (%s) satisfies requirement (most up-to-date version is %s)z=Installed version (%s) is most up-to-date (past versions: %s)z)Using version %s (newest of versions: %s))rmrrRrr satisfied_byr r5rrr2r.criticalrrrOr/rr) rCrrrmbest_candidate_resultrinstalled_versionr best_installedr&r&r6find_requirementash       zPackageFinder.find_requirement)NNN)N)NN)NN)2rerfrgrhrrrkrrrrDrrrpropertyr<rrsetterrr2rrrrrrrrr8rrrrrrrrr lru_cacherr rrrrr$rrrr&r&r&r6r%<s  '     0  r%)fragmentr:r*cCsNt|D].\}}|dkrqt|d||kr|Sqt|d|dS)aFind the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 -Nz does not match )rr r)rr:irr&r&r6_find_name_version_seps  rcCs@zt||d}Wnty&YdS0||d}|s+ filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. rIN)rr)rr: version_startr5r&r&r6rVs  rV)F)PrhrrrritypingrrrrrrrZpip._vendor.packagingr Zpip._vendor.packaging.tagsr pip._vendor.packaging.utilsr Zpip._vendor.packaging.versionr r r pip._internal.exceptionsrrrrpip._internal.index.collectorrrpip._internal.models.candidater#pip._internal.models.format_controlrpip._internal.models.linkr!pip._internal.models.search_scoper$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.models.wheelrpip._internal.reqrZpip._internal.utils._logrpip._internal.utils.filetypesrpip._internal.utils.hashesrpip._internal.utils.loggingrpip._internal.utils.miscr pip._internal.utils.packagingr!pip._internal.utils.unpackingr"pip._internal.utils.urlsr#__all__rer.rr2BuildTagrrkr7r8r~rr$rr%rrVr&r&r&r6sn$                       /  J(M~PK,]Srl  )index/__pycache__/__init__.cpython-39.pycnu[a Re@sdZdS)zIndex interaction code N)__doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/index/__init__.pyPK,]Windex/package_finder.pynu["""Routines related to PyPI, indexes""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False import functools import itertools import logging import re from typing import FrozenSet, Iterable, List, Optional, Set, Tuple, Union from pip._vendor.packaging import specifiers from pip._vendor.packaging.tags import Tag from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import _BaseVersion from pip._vendor.packaging.version import parse as parse_version from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, InvalidWheelFilename, UnsupportedWheel, ) from pip._internal.index.collector import LinkCollector, parse_links from pip._internal.models.candidate import InstallationCandidate from pip._internal.models.format_control import FormatControl from pip._internal.models.link import Link from pip._internal.models.search_scope import SearchScope from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.models.target_python import TargetPython from pip._internal.models.wheel import Wheel from pip._internal.req import InstallRequirement from pip._internal.utils._log import getLogger from pip._internal.utils.filetypes import WHEEL_EXTENSION from pip._internal.utils.hashes import Hashes from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import build_netloc from pip._internal.utils.packaging import check_requires_python from pip._internal.utils.unpacking import SUPPORTED_EXTENSIONS from pip._internal.utils.urls import url_to_path __all__ = ["FormatControl", "BestCandidateResult", "PackageFinder"] logger = getLogger(__name__) BuildTag = Union[Tuple[()], Tuple[int, str]] CandidateSortingKey = Tuple[int, int, int, _BaseVersion, Optional[int], BuildTag] def _check_link_requires_python( link: Link, version_info: Tuple[int, int, int], ignore_requires_python: bool = False, ) -> bool: """ Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. """ try: is_compatible = check_requires_python( link.requires_python, version_info=version_info, ) except specifiers.InvalidSpecifier: logger.debug( "Ignoring invalid Requires-Python (%r) for link: %s", link.requires_python, link, ) else: if not is_compatible: version = ".".join(map(str, version_info)) if not ignore_requires_python: logger.verbose( "Link requires a different Python (%s not in: %r): %s", version, link.requires_python, link, ) return False logger.debug( "Ignoring failed Requires-Python check (%s not in: %r) for link: %s", version, link.requires_python, link, ) return True class LinkEvaluator: """ Responsible for evaluating links for a particular project. """ _py_version_re = re.compile(r"-py([123]\.?[0-9]?)$") # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. def __init__( self, project_name: str, canonical_name: str, formats: FrozenSet[str], target_python: TargetPython, allow_yanked: bool, ignore_requires_python: Optional[bool] = None, ) -> None: """ :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. """ if ignore_requires_python is None: ignore_requires_python = False self._allow_yanked = allow_yanked self._canonical_name = canonical_name self._ignore_requires_python = ignore_requires_python self._formats = formats self._target_python = target_python self.project_name = project_name def evaluate_link(self, link: Link) -> Tuple[bool, Optional[str]]: """ Determine whether a link is a candidate for installation. :return: A tuple (is_candidate, result), where `result` is (1) a version string if `is_candidate` is True, and (2) if `is_candidate` is False, an optional string to log the reason the link fails to qualify. """ version = None if link.is_yanked and not self._allow_yanked: reason = link.yanked_reason or "" return (False, f"yanked for reason: {reason}") if link.egg_fragment: egg_info = link.egg_fragment ext = link.ext else: egg_info, ext = link.splitext() if not ext: return (False, "not a file") if ext not in SUPPORTED_EXTENSIONS: return (False, f"unsupported archive format: {ext}") if "binary" not in self._formats and ext == WHEEL_EXTENSION: reason = "No binaries permitted for {}".format(self.project_name) return (False, reason) if "macosx10" in link.path and ext == ".zip": return (False, "macosx10 one") if ext == WHEEL_EXTENSION: try: wheel = Wheel(link.filename) except InvalidWheelFilename: return (False, "invalid wheel filename") if canonicalize_name(wheel.name) != self._canonical_name: reason = "wrong project name (not {})".format(self.project_name) return (False, reason) supported_tags = self._target_python.get_tags() if not wheel.supported(supported_tags): # Include the wheel's tags in the reason string to # simplify troubleshooting compatibility issues. file_tags = wheel.get_formatted_file_tags() reason = ( "none of the wheel's tags ({}) are compatible " "(run pip debug --verbose to show compatible tags)".format( ", ".join(file_tags) ) ) return (False, reason) version = wheel.version # This should be up by the self.ok_binary check, but see issue 2700. if "source" not in self._formats and ext != WHEEL_EXTENSION: reason = f"No sources permitted for {self.project_name}" return (False, reason) if not version: version = _extract_version_from_fragment( egg_info, self._canonical_name, ) if not version: reason = f"Missing project version for {self.project_name}" return (False, reason) match = self._py_version_re.search(version) if match: version = version[: match.start()] py_version = match.group(1) if py_version != self._target_python.py_version: return (False, "Python version is incorrect") supports_python = _check_link_requires_python( link, version_info=self._target_python.py_version_info, ignore_requires_python=self._ignore_requires_python, ) if not supports_python: # Return None for the reason text to suppress calling # _log_skipped_link(). return (False, None) logger.debug("Found link %s, version: %s", link, version) return (True, version) def filter_unallowed_hashes( candidates: List[InstallationCandidate], hashes: Hashes, project_name: str, ) -> List[InstallationCandidate]: """ Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). """ if not hashes: logger.debug( "Given no hashes to check %s links for project %r: " "discarding no candidates", len(candidates), project_name, ) # Make sure we're not returning back the given value. return list(candidates) matches_or_no_digest = [] # Collect the non-matches for logging purposes. non_matches = [] match_count = 0 for candidate in candidates: link = candidate.link if not link.has_hash: pass elif link.is_hash_allowed(hashes=hashes): match_count += 1 else: non_matches.append(candidate) continue matches_or_no_digest.append(candidate) if match_count: filtered = matches_or_no_digest else: # Make sure we're not returning back the given value. filtered = list(candidates) if len(filtered) == len(candidates): discard_message = "discarding no candidates" else: discard_message = "discarding {} non-matches:\n {}".format( len(non_matches), "\n ".join(str(candidate.link) for candidate in non_matches), ) logger.debug( "Checked %s links for project %r against %s hashes " "(%s matches, %s no digest): %s", len(candidates), project_name, hashes.digest_count, match_count, len(matches_or_no_digest) - match_count, discard_message, ) return filtered class CandidatePreferences: """ Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. """ def __init__( self, prefer_binary: bool = False, allow_all_prereleases: bool = False, ) -> None: """ :param allow_all_prereleases: Whether to allow all pre-releases. """ self.allow_all_prereleases = allow_all_prereleases self.prefer_binary = prefer_binary class BestCandidateResult: """A collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. """ def __init__( self, candidates: List[InstallationCandidate], applicable_candidates: List[InstallationCandidate], best_candidate: Optional[InstallationCandidate], ) -> None: """ :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. """ assert set(applicable_candidates) <= set(candidates) if best_candidate is None: assert not applicable_candidates else: assert best_candidate in applicable_candidates self._applicable_candidates = applicable_candidates self._candidates = candidates self.best_candidate = best_candidate def iter_all(self) -> Iterable[InstallationCandidate]: """Iterate through all candidates.""" return iter(self._candidates) def iter_applicable(self) -> Iterable[InstallationCandidate]: """Iterate through the applicable candidates.""" return iter(self._applicable_candidates) class CandidateEvaluator: """ Responsible for filtering and sorting candidates for installation based on what tags are valid. """ @classmethod def create( cls, project_name: str, target_python: Optional[TargetPython] = None, prefer_binary: bool = False, allow_all_prereleases: bool = False, specifier: Optional[specifiers.BaseSpecifier] = None, hashes: Optional[Hashes] = None, ) -> "CandidateEvaluator": """Create a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. """ if target_python is None: target_python = TargetPython() if specifier is None: specifier = specifiers.SpecifierSet() supported_tags = target_python.get_tags() return cls( project_name=project_name, supported_tags=supported_tags, specifier=specifier, prefer_binary=prefer_binary, allow_all_prereleases=allow_all_prereleases, hashes=hashes, ) def __init__( self, project_name: str, supported_tags: List[Tag], specifier: specifiers.BaseSpecifier, prefer_binary: bool = False, allow_all_prereleases: bool = False, hashes: Optional[Hashes] = None, ) -> None: """ :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). """ self._allow_all_prereleases = allow_all_prereleases self._hashes = hashes self._prefer_binary = prefer_binary self._project_name = project_name self._specifier = specifier self._supported_tags = supported_tags # Since the index of the tag in the _supported_tags list is used # as a priority, precompute a map from tag to index/priority to be # used in wheel.find_most_preferred_tag. self._wheel_tag_preferences = { tag: idx for idx, tag in enumerate(supported_tags) } def get_applicable_candidates( self, candidates: List[InstallationCandidate], ) -> List[InstallationCandidate]: """ Return the applicable candidates from a list of candidates. """ # Using None infers from the specifier instead. allow_prereleases = self._allow_all_prereleases or None specifier = self._specifier versions = { str(v) for v in specifier.filter( # We turn the version object into a str here because otherwise # when we're debundled but setuptools isn't, Python will see # packaging.version.Version and # pkg_resources._vendor.packaging.version.Version as different # types. This way we'll use a str as a common data interchange # format. If we stop using the pkg_resources provided specifier # and start using our own, we can drop the cast to str(). (str(c.version) for c in candidates), prereleases=allow_prereleases, ) } # Again, converting version to str to deal with debundling. applicable_candidates = [c for c in candidates if str(c.version) in versions] filtered_applicable_candidates = filter_unallowed_hashes( candidates=applicable_candidates, hashes=self._hashes, project_name=self._project_name, ) return sorted(filtered_applicable_candidates, key=self._sort_key) def _sort_key(self, candidate: InstallationCandidate) -> CandidateSortingKey: """ Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal """ valid_tags = self._supported_tags support_num = len(valid_tags) build_tag: BuildTag = () binary_preference = 0 link = candidate.link if link.is_wheel: # can raise InvalidWheelFilename wheel = Wheel(link.filename) try: pri = -( wheel.find_most_preferred_tag( valid_tags, self._wheel_tag_preferences ) ) except ValueError: raise UnsupportedWheel( "{} is not a supported wheel for this platform. It " "can't be sorted.".format(wheel.filename) ) if self._prefer_binary: binary_preference = 1 if wheel.build_tag is not None: match = re.match(r"^(\d+)(.*)$", wheel.build_tag) build_tag_groups = match.groups() build_tag = (int(build_tag_groups[0]), build_tag_groups[1]) else: # sdist pri = -(support_num) has_allowed_hash = int(link.is_hash_allowed(self._hashes)) yank_value = -1 * int(link.is_yanked) # -1 for yanked. return ( has_allowed_hash, yank_value, binary_preference, candidate.version, pri, build_tag, ) def sort_best_candidate( self, candidates: List[InstallationCandidate], ) -> Optional[InstallationCandidate]: """ Return the best candidate per the instance's sort order, or None if no candidate is acceptable. """ if not candidates: return None best_candidate = max(candidates, key=self._sort_key) return best_candidate def compute_best_candidate( self, candidates: List[InstallationCandidate], ) -> BestCandidateResult: """ Compute and return a `BestCandidateResult` instance. """ applicable_candidates = self.get_applicable_candidates(candidates) best_candidate = self.sort_best_candidate(applicable_candidates) return BestCandidateResult( candidates, applicable_candidates=applicable_candidates, best_candidate=best_candidate, ) class PackageFinder: """This finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. """ def __init__( self, link_collector: LinkCollector, target_python: TargetPython, allow_yanked: bool, format_control: Optional[FormatControl] = None, candidate_prefs: Optional[CandidatePreferences] = None, ignore_requires_python: Optional[bool] = None, ) -> None: """ This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. """ if candidate_prefs is None: candidate_prefs = CandidatePreferences() format_control = format_control or FormatControl(set(), set()) self._allow_yanked = allow_yanked self._candidate_prefs = candidate_prefs self._ignore_requires_python = ignore_requires_python self._link_collector = link_collector self._target_python = target_python self.format_control = format_control # These are boring links that have already been logged somehow. self._logged_links: Set[Link] = set() # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. @classmethod def create( cls, link_collector: LinkCollector, selection_prefs: SelectionPreferences, target_python: Optional[TargetPython] = None, ) -> "PackageFinder": """Create a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. """ if target_python is None: target_python = TargetPython() candidate_prefs = CandidatePreferences( prefer_binary=selection_prefs.prefer_binary, allow_all_prereleases=selection_prefs.allow_all_prereleases, ) return cls( candidate_prefs=candidate_prefs, link_collector=link_collector, target_python=target_python, allow_yanked=selection_prefs.allow_yanked, format_control=selection_prefs.format_control, ignore_requires_python=selection_prefs.ignore_requires_python, ) @property def target_python(self) -> TargetPython: return self._target_python @property def search_scope(self) -> SearchScope: return self._link_collector.search_scope @search_scope.setter def search_scope(self, search_scope: SearchScope) -> None: self._link_collector.search_scope = search_scope @property def find_links(self) -> List[str]: return self._link_collector.find_links @property def index_urls(self) -> List[str]: return self.search_scope.index_urls @property def trusted_hosts(self) -> Iterable[str]: for host_port in self._link_collector.session.pip_trusted_origins: yield build_netloc(*host_port) @property def allow_all_prereleases(self) -> bool: return self._candidate_prefs.allow_all_prereleases def set_allow_all_prereleases(self) -> None: self._candidate_prefs.allow_all_prereleases = True @property def prefer_binary(self) -> bool: return self._candidate_prefs.prefer_binary def set_prefer_binary(self) -> None: self._candidate_prefs.prefer_binary = True def make_link_evaluator(self, project_name: str) -> LinkEvaluator: canonical_name = canonicalize_name(project_name) formats = self.format_control.get_allowed_formats(canonical_name) return LinkEvaluator( project_name=project_name, canonical_name=canonical_name, formats=formats, target_python=self._target_python, allow_yanked=self._allow_yanked, ignore_requires_python=self._ignore_requires_python, ) def _sort_links(self, links: Iterable[Link]) -> List[Link]: """ Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates """ eggs, no_eggs = [], [] seen: Set[Link] = set() for link in links: if link not in seen: seen.add(link) if link.egg_fragment: eggs.append(link) else: no_eggs.append(link) return no_eggs + eggs def _log_skipped_link(self, link: Link, reason: str) -> None: if link not in self._logged_links: # Put the link at the end so the reason is more visible and because # the link string is usually very long. logger.debug("Skipping link: %s: %s", reason, link) self._logged_links.add(link) def get_install_candidate( self, link_evaluator: LinkEvaluator, link: Link ) -> Optional[InstallationCandidate]: """ If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. """ is_candidate, result = link_evaluator.evaluate_link(link) if not is_candidate: if result: self._log_skipped_link(link, reason=result) return None return InstallationCandidate( name=link_evaluator.project_name, link=link, version=result, ) def evaluate_links( self, link_evaluator: LinkEvaluator, links: Iterable[Link] ) -> List[InstallationCandidate]: """ Convert links that are candidates to InstallationCandidate objects. """ candidates = [] for link in self._sort_links(links): candidate = self.get_install_candidate(link_evaluator, link) if candidate is not None: candidates.append(candidate) return candidates def process_project_url( self, project_url: Link, link_evaluator: LinkEvaluator ) -> List[InstallationCandidate]: logger.debug( "Fetching project page and analyzing links: %s", project_url, ) html_page = self._link_collector.fetch_page(project_url) if html_page is None: return [] page_links = list(parse_links(html_page)) with indent_log(): package_links = self.evaluate_links( link_evaluator, links=page_links, ) return package_links @functools.lru_cache(maxsize=None) def find_all_candidates(self, project_name: str) -> List[InstallationCandidate]: """Find all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. """ link_evaluator = self.make_link_evaluator(project_name) collected_sources = self._link_collector.collect_sources( project_name=project_name, candidates_from_page=functools.partial( self.process_project_url, link_evaluator=link_evaluator, ), ) page_candidates_it = itertools.chain.from_iterable( source.page_candidates() for sources in collected_sources for source in sources if source is not None ) page_candidates = list(page_candidates_it) file_links_it = itertools.chain.from_iterable( source.file_links() for sources in collected_sources for source in sources if source is not None ) file_candidates = self.evaluate_links( link_evaluator, sorted(file_links_it, reverse=True), ) if logger.isEnabledFor(logging.DEBUG) and file_candidates: paths = [url_to_path(c.link.url) for c in file_candidates] logger.debug("Local files found: %s", ", ".join(paths)) # This is an intentional priority ordering return file_candidates + page_candidates def make_candidate_evaluator( self, project_name: str, specifier: Optional[specifiers.BaseSpecifier] = None, hashes: Optional[Hashes] = None, ) -> CandidateEvaluator: """Create a CandidateEvaluator object to use.""" candidate_prefs = self._candidate_prefs return CandidateEvaluator.create( project_name=project_name, target_python=self._target_python, prefer_binary=candidate_prefs.prefer_binary, allow_all_prereleases=candidate_prefs.allow_all_prereleases, specifier=specifier, hashes=hashes, ) @functools.lru_cache(maxsize=None) def find_best_candidate( self, project_name: str, specifier: Optional[specifiers.BaseSpecifier] = None, hashes: Optional[Hashes] = None, ) -> BestCandidateResult: """Find matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. """ candidates = self.find_all_candidates(project_name) candidate_evaluator = self.make_candidate_evaluator( project_name=project_name, specifier=specifier, hashes=hashes, ) return candidate_evaluator.compute_best_candidate(candidates) def find_requirement( self, req: InstallRequirement, upgrade: bool ) -> Optional[InstallationCandidate]: """Try to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a InstallationCandidate if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise """ hashes = req.hashes(trust_internet=False) best_candidate_result = self.find_best_candidate( req.name, specifier=req.specifier, hashes=hashes, ) best_candidate = best_candidate_result.best_candidate installed_version: Optional[_BaseVersion] = None if req.satisfied_by is not None: installed_version = parse_version(req.satisfied_by.version) def _format_versions(cand_iter: Iterable[InstallationCandidate]) -> str: # This repeated parse_version and str() conversion is needed to # handle different vendoring sources from pip and pkg_resources. # If we stop using the pkg_resources provided specifier and start # using our own, we can drop the cast to str(). return ( ", ".join( sorted( {str(c.version) for c in cand_iter}, key=parse_version, ) ) or "none" ) if installed_version is None and best_candidate is None: logger.critical( "Could not find a version that satisfies the requirement %s " "(from versions: %s)", req, _format_versions(best_candidate_result.iter_all()), ) raise DistributionNotFound( "No matching distribution found for {}".format(req) ) best_installed = False if installed_version and ( best_candidate is None or best_candidate.version <= installed_version ): best_installed = True if not upgrade and installed_version is not None: if best_installed: logger.debug( "Existing installed version (%s) is most up-to-date and " "satisfies requirement", installed_version, ) else: logger.debug( "Existing installed version (%s) satisfies requirement " "(most up-to-date version is %s)", installed_version, best_candidate.version, ) return None if best_installed: # We have an existing version, and its the best version logger.debug( "Installed version (%s) is most up-to-date (past versions: %s)", installed_version, _format_versions(best_candidate_result.iter_applicable()), ) raise BestVersionAlreadyInstalled logger.debug( "Using version %s (newest of versions: %s)", best_candidate.version, _format_versions(best_candidate_result.iter_applicable()), ) return best_candidate def _find_name_version_sep(fragment: str, canonical_name: str) -> int: """Find the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 """ # Project name and version must be separated by one single dash. Find all # occurrences of dashes; if the string in front of it matches the canonical # name, this is the one separating the name and version parts. for i, c in enumerate(fragment): if c != "-": continue if canonicalize_name(fragment[:i]) == canonical_name: return i raise ValueError(f"{fragment} does not match {canonical_name}") def _extract_version_from_fragment(fragment: str, canonical_name: str) -> Optional[str]: """Parse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. """ try: version_start = _find_name_version_sep(fragment, canonical_name) + 1 except ValueError: return None version = fragment[version_start:] if not version: return None return version PK,]+index/sources.pynu[import logging import mimetypes import os import pathlib from typing import Callable, Iterable, Optional, Tuple from pip._internal.models.candidate import InstallationCandidate from pip._internal.models.link import Link from pip._internal.utils.urls import path_to_url, url_to_path from pip._internal.vcs import is_url logger = logging.getLogger(__name__) FoundCandidates = Iterable[InstallationCandidate] FoundLinks = Iterable[Link] CandidatesFromPage = Callable[[Link], Iterable[InstallationCandidate]] PageValidator = Callable[[Link], bool] class LinkSource: @property def link(self) -> Optional[Link]: """Returns the underlying link, if there's one.""" raise NotImplementedError() def page_candidates(self) -> FoundCandidates: """Candidates found by parsing an archive listing HTML file.""" raise NotImplementedError() def file_links(self) -> FoundLinks: """Links found by specifying archives directly.""" raise NotImplementedError() def _is_html_file(file_url: str) -> bool: return mimetypes.guess_type(file_url, strict=False)[0] == "text/html" class _FlatDirectorySource(LinkSource): """Link source specified by ``--find-links=``. This looks the content of the directory, and returns: * ``page_candidates``: Links listed on each HTML file in the directory. * ``file_candidates``: Archives in the directory. """ def __init__( self, candidates_from_page: CandidatesFromPage, path: str, ) -> None: self._candidates_from_page = candidates_from_page self._path = pathlib.Path(os.path.realpath(path)) @property def link(self) -> Optional[Link]: return None def page_candidates(self) -> FoundCandidates: for path in self._path.iterdir(): url = path_to_url(str(path)) if not _is_html_file(url): continue yield from self._candidates_from_page(Link(url)) def file_links(self) -> FoundLinks: for path in self._path.iterdir(): url = path_to_url(str(path)) if _is_html_file(url): continue yield Link(url) class _LocalFileSource(LinkSource): """``--find-links=`` or ``--[extra-]index-url=``. If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to the option, it is converted to a URL first. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. """ def __init__( self, candidates_from_page: CandidatesFromPage, link: Link, ) -> None: self._candidates_from_page = candidates_from_page self._link = link @property def link(self) -> Optional[Link]: return self._link def page_candidates(self) -> FoundCandidates: if not _is_html_file(self._link.url): return yield from self._candidates_from_page(self._link) def file_links(self) -> FoundLinks: if _is_html_file(self._link.url): return yield self._link class _RemoteFileSource(LinkSource): """``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. """ def __init__( self, candidates_from_page: CandidatesFromPage, page_validator: PageValidator, link: Link, ) -> None: self._candidates_from_page = candidates_from_page self._page_validator = page_validator self._link = link @property def link(self) -> Optional[Link]: return self._link def page_candidates(self) -> FoundCandidates: if not self._page_validator(self._link): return yield from self._candidates_from_page(self._link) def file_links(self) -> FoundLinks: yield self._link class _IndexDirectorySource(LinkSource): """``--[extra-]index-url=``. This is treated like a remote URL; ``candidates_from_page`` contains logic for this by appending ``index.html`` to the link. """ def __init__( self, candidates_from_page: CandidatesFromPage, link: Link, ) -> None: self._candidates_from_page = candidates_from_page self._link = link @property def link(self) -> Optional[Link]: return self._link def page_candidates(self) -> FoundCandidates: yield from self._candidates_from_page(self._link) def file_links(self) -> FoundLinks: return () def build_source( location: str, *, candidates_from_page: CandidatesFromPage, page_validator: PageValidator, expand_dir: bool, cache_link_parsing: bool, ) -> Tuple[Optional[str], Optional[LinkSource]]: path: Optional[str] = None url: Optional[str] = None if os.path.exists(location): # Is a local path. url = path_to_url(location) path = location elif location.startswith("file:"): # A file: URL. url = location path = url_to_path(location) elif is_url(location): url = location if url is None: msg = ( "Location '%s' is ignored: " "it is either a non-existing path or lacks a specific scheme." ) logger.warning(msg, location) return (None, None) if path is None: source: LinkSource = _RemoteFileSource( candidates_from_page=candidates_from_page, page_validator=page_validator, link=Link(url, cache_link_parsing=cache_link_parsing), ) return (url, source) if os.path.isdir(path): if expand_dir: source = _FlatDirectorySource( candidates_from_page=candidates_from_page, path=path, ) else: source = _IndexDirectorySource( candidates_from_page=candidates_from_page, link=Link(url, cache_link_parsing=cache_link_parsing), ) return (url, source) elif os.path.isfile(path): source = _LocalFileSource( candidates_from_page=candidates_from_page, link=Link(url, cache_link_parsing=cache_link_parsing), ) return (url, source) logger.warning( "Location '%s' is ignored: it is neither a file nor a directory.", location, ) return (url, None) PK,]C?Kindex/__init__.pynu["""Index interaction code """ PK,]G{ %vcs/__pycache__/bazaar.cpython-39.pycnu[a Re) @sddlZddlmZmZmZddlmZmZddlm Z ddl m Z ddl m Z mZmZmZmZeeZGdddeZeedS) N)ListOptionalTuple) HiddenText display_path) make_command) path_to_url)AuthInfoRemoteNotFoundError RevOptionsVersionControlvcscseZdZdZdZdZdZeee edddZ ee e dd d d Z ee e dd d d Zee e dd ddZeeeeeeefdfdd ZeeedddZeeedddZeeeeedddZZS)Bazaarbzrz.bzrbranch)zbzr+httpz bzr+httpszbzr+sshzbzr+sftpzbzr+ftpzbzr+lpzbzr+file)revreturncCsd|gS)Nz-r)rrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/bazaar.pyget_base_rev_args szBazaar.get_base_rev_argsN)desturl rev_optionsrcCs>|}td||t|tdd|||}||dS)NzChecking out %s%s to %sr-q) to_displayloggerinforrto_args run_command)selfrrr rev_displaycmd_argsrrr fetch_new$szBazaar.fetch_newcCs|jtd||ddS)Nswitchcwd)rr)rrrrrrrr#/sz Bazaar.switchcCs"tdd|}|j||ddS)Npullrr$)rrr)rrrrr!rrrupdate2sz Bazaar.update)rrcs.t|\}}}|dr$d|}|||fS)Nzssh://zbzr+)superget_url_rev_and_auth startswith)clsrr user_pass __class__rrr)6s zBazaar.get_url_rev_and_auth)locationrcCsz|jdgdd|d}|D]T}|}dD]B}||r,||d}||rbt|S|Sq,qtdS)NrFT show_stdout stdout_onlyr%)zcheckout of branch: zparent branch: )r splitlinesstripr*split_is_local_repositoryrr )r+r/urlslinexreporrrget_remote_url>s    zBazaar.get_remote_urlcCs |jdgdd|d}|dS)NrevnoFTr0)rr4)r+r/revisionrrr get_revisionMszBazaar.get_revision)rnamercCsdS)z&Always assume the versions don't matchFr)r+rrArrris_commit_id_equalWszBazaar.is_commit_id_equal)__name__ __module__ __qualname__rAdirname repo_nameschemes staticmethodstrrrrr r"r#r' classmethodrrr r)r<r@boolrB __classcell__rrr-rrs"  $ r)loggingtypingrrrpip._internal.utils.miscrrpip._internal.utils.subprocessrpip._internal.utils.urlsr pip._internal.vcs.versioncontrolr r r r r getLoggerrCrrregisterrrrrs   KPK,] )vcs/__pycache__/subversion.cpython-39.pycnu[a ReL-@sddlZddlZddlZddlmZmZmZddlmZm Z m Z m Z m Z ddl mZmZddlmZmZmZmZmZeeZedZedZedZed ZGd d d eZeedS) N)ListOptionalTuple) HiddenText display_pathis_console_interactiveis_installable_dirsplit_auth_from_netloc) CommandArgs make_command)AuthInfoRemoteNotFoundError RevOptionsVersionControlvcsz url="([^"]+)"zcommitted-rev="(\d+)"z\s*revision="(\d+)"z(.*)c seZdZdZdZdZdZeee dddZ e ee edd d Z eeed d d Zeeeeeeeeeeffdfdd Zeeeeeeefdfdd Ze eeeeedddZeeed ddZeeeeeefd ddZeeeee dddZd1e ddfd d! Zeed"fd#d$d%Zeed"fd#d&d'Zed#d(d)Zeeedd*d+d,Z eeedd*d-d.Z!eeedd*d/d0Z"Z#S)2 Subversionsvnz.svncheckout)zsvn+sshzsvn+httpz svn+httpszsvn+svnzsvn+file) remote_urlreturncCsdS)NT)clsrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/subversion.pyshould_add_vcs_url_prefix$sz$Subversion.should_add_vcs_url_prefix)revrcCsd|gS)Nz-rr)rrrrget_base_rev_args(szSubversion.get_base_rev_args)locationrc Csd}t|D]\}}}|j|vr0g|dd<q||jtj||jd}tj|s\q||\}}||kr|dus~J|d}n|r||sg|dd<qt ||}qt |S)zR Return the maximum revision for all files under a given location rNentries/) oswalkdirnameremovepathjoinexists_get_svn_url_rev startswithmaxstr) rrrevisionbasedirs_ entries_fndirurllocalrevrrr get_revision,s$        zSubversion.get_revision)netlocschemercs|dkrt||St|S)z This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. ssh)superget_netloc_and_authr )rr2r3 __class__rrr6IszSubversion.get_netloc_and_auth)urlrcs.t|\}}}|dr$d|}|||fS)Nzssh://zsvn+)r5get_url_rev_and_authr')rr9r user_passr7rrr:Xs zSubversion.get_url_rev_and_auth)usernamepasswordrcCs(g}|r|d|g7}|r$|d|g7}|S)Nz --usernamez --passwordr)r<r= extra_argsrrr make_rev_args`s   zSubversion.make_rev_argscCsT|}t|s6|}tj|}||krtd|tq||\}}|durPt|S)NzMCould not find Python project for directory %s (tried all parent directories))rrr#r!loggerwarningr r&)rr orig_location last_locationr9_revrrrget_remote_urlls zSubversion.get_remote_urlc Csddlm}tj||jd}tj|r\t|}|}Wdq`1sP0Ynd}d}| ds| ds| drt t t j |d}|dd=|dd }d d |Ddg}n| d rt|} | std || d}dd t|Ddg}npzP|jdd|gddd} t| } | dusBJ| d}dd t| D}Wn|ydg}}Yn0|rt|} nd} || fS)Nr)InstallationErrorr8910z cSs,g|]$}t|dkr|drt|dqS) )lenint).0drrr z/Subversion._get_svn_url_rev..zs     "PK,]J"QQ-vcs/__pycache__/versioncontrol.cpython-39.pycnu[a ReW@sdZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZmZmZmZddlmZddlmZmZddlmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$ddl%m&Z&erdd lm'Z'd gZ(e)e*Z+eee,ee,fZ-e,e.d d d Z/de,e,e,ee,e,dddZ0e,e,ee,dddZ1Gddde2Z3Gddde2Z4GdddZ5GdddZ6e6Z7GdddZ8dS)z)Handles all VCS (version control) supportN) TYPE_CHECKINGAnyDictIterableIteratorListMappingOptionalTupleTypeUnion)SpinnerInterface) BadCommandInstallationError) HiddenTextask_path_exists backup_dir display_pathhide_url hide_valueis_installable_dirrmtree) CommandArgscall_subprocess make_command)get_url_scheme)LiteralvcsnamereturncCs&t|}|durdS|gdtjvS)z3 Return true if the name looks like a URL. NF)httphttpsfileftp)rr all_schemes)rschemer'/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.pyis_url4sr))repo_urlrev project_namesubdirr cCs6|dd}|d|d|}|r2|d|7}|S)z Return the URL for a VCS requirement. Args: repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+"). project_name: the (unescaped) project name. -_@z#egg=z&subdirectory=)replace)r*r+r,r-egg_project_namereqr'r'r(make_vcs_requirement_url>s r4)location repo_rootr cCsV|}t|s6|}tj|}||krtd|dSqtj||rHdStj||S)z Find the the Python project's root by searching up the filesystem from `location`. Return the path to project root relative to `repo_root`. Return None if the project root is `repo_root`, or cannot be found. zOCould not find a Python project for directory %s (tried all parent directories)N)rospathdirnameloggerwarningsamefilerelpath)r5r6 orig_location last_locationr'r'r((find_path_to_project_root_from_repo_rootPs  r@c@s eZdZdS)RemoteNotFoundErrorN)__name__ __module__ __qualname__r'r'r'r(rAmsrAcs"eZdZedfdd ZZS)RemoteNotValidErrorurlcst|||_dSN)super__init__rG)selfrG __class__r'r(rJrs zRemoteNotValidError.__init__)rBrCrDstrrJ __classcell__r'r'rLr(rEqsrEc@seZdZdZdedeeeeddddZeddd Z e eedd d Z edd d Z edddZ eddddZdS) RevOptionsz Encapsulates a VCS-specific revision to install, along with any VCS install options. Instances of this class should be treated as if immutable. NVersionControl)vc_classr+ extra_argsr cCs(|dur g}||_||_||_d|_dS)z Args: vc_class: a VersionControl subclass. rev: the name of the revision to install. extra_args: a list of extra options. N)rSr+rR branch_name)rKrRr+rSr'r'r(rJs zRevOptions.__init__r cCsd|jjd|jdS)Nz )rRrr+rKr'r'r(__repr__szRevOptions.__repr__cCs|jdur|jjS|jSrH)r+rRdefault_arg_revrWr'r'r(arg_revs zRevOptions.arg_revcCs0g}|j}|dur"||j|7}||j7}|S)z< Return the VCS-specific command arguments. N)rZrRget_base_rev_argsrS)rKargsr+r'r'r(to_argss  zRevOptions.to_argscCs|js dSd|jdS)Nz (to revision )r+rWr'r'r( to_displayszRevOptions.to_displayr+r cCs|jj||jdS)z Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. rS)rRmake_rev_optionsrS)rKr+r'r'r(make_newszRevOptions.make_new)NN)rBrCrD__doc__r r rNrrJrXpropertyrZr]rarer'r'r'r(rPws   rPcseZdZUiZeedfed<gdZddfdd Ze eddd Z e e ddd d Z e e edd d Ze e edddZedddddZeddddZeeddddZeeddddZeeddddZZS) VcsSupportrQ _registry)sshgithgbzrsftpsvnNrUcstjj|jtdSrH)urllibparse uses_netlocextendschemesrIrJrWrLr'r(rJszVcsSupport.__init__cCs |jSrH)ri__iter__rWr'r'r(ruszVcsSupport.__iter__cCst|jSrH)listrivaluesrWr'r'r(backendsszVcsSupport.backendscCsdd|jDS)NcSsg|] }|jqSr')r9).0backendr'r'r( z'VcsSupport.dirnames..)rxrWr'r'r(dirnamesszVcsSupport.dirnamescCs g}|jD]}||jq |SrH)rxrsrt)rKrtrzr'r'r(r%s zVcsSupport.all_schemes)clsr cCsHt|dstd|jdS|j|jvrD||j|j<td|jdS)NrzCannot register VCS %szRegistered VCS backend: %s)hasattrr:r;rBrridebug)rKr~r'r'r(registers   zVcsSupport.registerrcCs||jvr|j|=dSrH)rirKrr'r'r( unregisters zVcsSupport.unregisterr5r cCsXi}|jD],}||}|s"qtd||j|||<q|sDdSt|td}||S)zv Return a VersionControl object if a repository of that type is found at the given directory. zDetermine that %s uses VCS: %sN)key)rirwget_repository_rootr:rrmaxlen)rKr5 vcs_backends vcs_backend repo_pathinner_most_repo_pathr'r'r(get_backend_for_dirs   zVcsSupport.get_backend_for_dir)r&r cCs&|jD]}||jvr |Sq dS)9 Return a VersionControl object or None. N)rirwrt)rKr&rr'r'r(get_backend_for_schemes  z!VcsSupport.get_backend_for_schemecCs|}|j|S)r)lowerrigetrr'r'r( get_backendszVcsSupport.get_backend)rBrCrDrirrN__annotations__rtrJrrurgrrxr}r%r rrr rrrrOr'r'rLr(rhs  rhc@seZdZUdZdZdZdZeedfe d<dZ eedfe d<dZ e ee d<e eedd d Ze ee ed d d Ze eedddZe eeedddZeeeedddZeeedddZe dPe ee eedddZe eedddZe eeeeee ee effd d!d"Ze eeee eefd#d$d%Zee ee eed&d'd(Zeeeefd#d)d*Z eeed#d+d,Z!e eeed-d.d/Z"eeedd0d1d2Z#eeedd0d3d4Z$eeedd0d5d6Z%e ee eed7d8d9Z&eedd:d;d<Z'eedd=d>d?Z(e eed d@dAZ)e eed dBdCZ*e dQe+eeefee edGe e,e-e ee e.ee/fe e0eeedH dIdJZ1e eedKdLdMZ2e ee ed dNdOZ3dS)RrQr^r'.rt unset_environNrY) remote_urlr cCs||jd S)z Return whether the vcs prefix (e.g. "git+") should be added to a repository's remote url when used in a requirement. :)r startswithr)r~rr'r'r(should_add_vcs_url_prefixsz(VersionControl.should_add_vcs_url_prefixrcCsdS)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. Nr'r~r5r'r'r(get_subdirectoryszVersionControl.get_subdirectory)repo_dirr cCs ||S)zR Return the revision string that should be used in a requirement. ) get_revision)r~rr'r'r(get_requirement_revision'sz'VersionControl.get_requirement_revision)rr,r cCsL||}||r$|jd|}||}||}t||||d}|S)aC Return the requirement string to use to redownload the files currently at the given repository directory. Args: project_name: the (unescaped) project name. The return value has a form similar to the following: {repository_url}@{revision}#egg={project_name} +)r-)get_remote_urlrrrrr4)r~rr,r*revisionr-r3r'r'r(get_src_requirement.s    z"VersionControl.get_src_requirementrbcCstdS)z Return the base revision arguments for a vcs command. Args: rev: the name of a revision to install. Cannot be None. NNotImplementedErrorr`r'r'r(r[Fsz VersionControl.get_base_rev_args)rGdestr cCsdS)aZ Return true if the commit hash checked out at dest matches the revision in url. Always return False, if the VCS does not support immutable commit hashes. This method does not check if there are local uncommitted changes in dest after checkout, as pip currently has no use case for that. Fr')rKrGrr'r'r(is_immutable_rev_checkoutPs z(VersionControl.is_immutable_rev_checkout)r+rSr cCst|||dS)z Return a RevOptions object. Args: rev: the name of a revision to install. extra_args: a list of extra options. rc)rP)r~r+rSr'r'r(rd]s zVersionControl.make_rev_options)repor cCs&tj|\}}|tjjp$t|S)zs posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\folder) )r7r8 splitdriversepbool)r~rdrivetailr'r'r(_is_local_repositoryjsz#VersionControl._is_local_repository)netlocr&r cCs|dfS)aZ Parse the repository URL's netloc, and return the new netloc to use along with auth information. Args: netloc: the original repository URL netloc. scheme: the repository URL's scheme without the vcs prefix. This is mainly for the Subversion class to override, so that auth information can be provided via the --username and --password options instead of through the URL. For other subclasses like Git without such an option, auth information must stay in the URL. Returns: (netloc, (username, password)). )NNr')r~rr&r'r'r(get_netloc_and_authssz"VersionControl.get_netloc_and_auth)rGr c Cstj|\}}}}}d|vr,td||ddd}|||\}}d}d|vrz|dd\}}|sztd|tj ||||df}|||fS)z Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). rzvSorry, {!r} is a malformed VCS url. The format is +://, e.g. svn+http://myrepo/svn/MyApp#egg=MyAppNr0zyThe URL {!r} has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.r^) rprqurlsplit ValueErrorformatsplitrrsplitr urlunsplit) r~rGr&rr8queryfrag user_passr+r'r'r(get_url_rev_and_auths(z#VersionControl.get_url_rev_and_auth)usernamepasswordr cCsgS)zM Return the RevOptions "extra arguments" to use in obtain(). r')rrr'r'r( make_rev_argsszVersionControl.make_rev_argsc CsT||j\}}}|\}}d}|dur.t|}|||}|j||d} t|| fS)zq Return the URL and RevOptions object to use in obtain(), as a tuple (url, rev_options). Nrc)rsecretrrrdr) rKrG secret_urlr+rrsecret_passwordrrS rev_optionsr'r'r(get_url_rev_optionss z"VersionControl.get_url_rev_optionscCstj|dS)zi Normalize a URL for comparison by unquoting it and removing any trailing slash. /)rprqunquoterstriprFr'r'r( normalize_urlszVersionControl.normalize_url)url1url2r cCs||||kS)zV Compare two repo URLs for identity, ignoring incidental differences. )r)r~rrr'r'r( compare_urlsszVersionControl.compare_urls)rrGrr cCstdS)z Fetch a revision from a repository, in the case that this is the first fetch from the repository. Args: dest: the directory to fetch the repository to. rev_options: a RevOptions object. NrrKrrGrr'r'r( fetch_news zVersionControl.fetch_newcCstdS)z} Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. Nrrr'r'r(switchszVersionControl.switchcCstdS)z Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. Nrrr'r'r(updateszVersionControl.update)rrr cCstdS)z Return whether the id of the current commit equals the given name. Args: dest: the repository directory. name: a string name. Nr)r~rrr'r'r(is_commit_id_equals z!VersionControl.is_commit_id_equal)rrGr c Cs||\}}tj|s,||||dS|}||r||}|||j rt d|j t|||||jst dt||j |||||n t ddSt d|j|j t||d}nt d||j|j d}t d |j|td |d |d }|d kr&td|dkrZt dt|t|||||dS|dkrt|}t dt||t||||||dS|dkrt d|j t|||||||dS)a Install or update in editable mode the package represented by this VersionControl object. :param dest: the repository directory in which to install or update. :param url: the repository URL starting with a vcs prefix. Nz)%s in %s exists, and has correct URL (%s)zUpdating %s %s%sz$Skipping because already up-to-date.z%s %s in %s exists with URL %s)z%(s)witch, (i)gnore, (w)ipe, (b)ackup )siwbz0Directory %s already exists, and is not a %s %s.)z(i)gnore, (w)ipe, (b)ackup )rrrz+The plan is to install the %s repository %szWhat to do? {}rrarz Deleting %srzBacking up %s to %srzSwitching %s %s to %s%s)rr7r8existsrrais_repository_directoryrrrr:r repo_nametitlerrr+inforr;rrrsysexitrrshutilmover) rKrrGr rev_display existing_urlpromptresponsedest_dirr'r'r(obtains          zVersionControl.obtain)r5rGr cCs&tj|rt||j||ddS)z Clean up current location and download the url repository (and vcs infos) into location :param url: the repository URL starting with a vcs prefix. rFN)r7r8rrr)rKr5rGr'r'r(unpackMs zVersionControl.unpackcCstdS)z Return the url used at location Raises RemoteNotFoundError if the repository does not have a remote url configured. Nrrr'r'r(rXszVersionControl.get_remote_urlcCstdS)zR Return the current commit id of the files at the given location. Nrrr'r'r(rbszVersionControl.get_revisionTraiseFz"Literal["raise", "warn", "ignore"]) cmd show_stdoutcwd on_returncodeextra_ok_returncodes command_desc extra_environspinnerlog_failed_cmd stdout_onlyr c Cst|jg|R}z"t||||||||j|| | d WSty`td|jd|jdYn$tytd|jdYn0dS)z Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available )rrrrrrrrzCannot find command z - do you have z installed and in your PATH?zNo permission to execute z - install it locally, globally (ask admin), or check your PATH. See possible solutions at https://pip.pypa.io/en/latest/reference/pip_freeze/#fixing-permission-denied.N)rrrrFileNotFoundErrorrPermissionError) r~rrrrrrrrrrr'r'r( run_commandis2    zVersionControl.run_command)r8r cCs,td||j|jtjtj||jS)zL Return whether a directory path is a repository directory. zChecking in %s for %s (%s)...)r:rr9rr7r8rjoin)r~r8r'r'r(rsz&VersionControl.is_repository_directorycCs||r|SdS)ay Return the "root" (top-level) directory controlled by the vcs, or `None` if the directory is not in any. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. This can do more than is_repository_directory() alone. For example, the Git override checks that Git is actually available. N)rrr'r'r(rs z"VersionControl.get_repository_root)NN) TNrNNNNTF)4rBrCrDrr9rrtr rNrrrYr classmethodrrrrr staticmethodrr[rrrPrdrrAuthInforrrrrrrrrrrrrrr rintrrr rrrr'r'r'r(rQ s           X   5rQ)N)9rfloggingr7rr urllib.parserptypingrrrrrrrr r r r pip._internal.cli.spinnersr pip._internal.exceptionsrrpip._internal.utils.miscrrrrrrrrpip._internal.utils.subprocessrrrpip._internal.utils.urlsrr__all__ getLoggerrBr:rNrrr)r4r@ ExceptionrArErPrhrrQr'r'r'r(s>4 (        CPPK,]))'vcs/__pycache__/__init__.cpython-39.pycnu[a ReT@s@ddlZddlZddlZddlZddlmZmZmZm Z m Z dS)N)RemoteNotFoundErrorRemoteNotValidErroris_urlmake_vcs_requirement_urlvcs) pip._internal.vcs.bazaarpippip._internal.vcs.gitpip._internal.vcs.mercurialpip._internal.vcs.subversion pip._internal.vcs.versioncontrolrrrrrr r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/__init__.pysPK,]rc0c0"vcs/__pycache__/git.cpython-39.pycnu[a ReE@sddlZddlZddlZddlZddlZddlZddlm Z m Z m Z ddl m Z mZddlmZmZmZddlmZddlmZmZmZmZmZmZmZejjZejjZe e!Z"e#dZ$e#dZ%e#d ej&Z'e(e)d d d Z*Gd ddeZ+e,e+dS)N)ListOptionalTuple) BadCommandInstallationError) HiddenText display_pathhide_url) make_command)AuthInfoRemoteNotFoundErrorRemoteNotValidError RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcsz(^git version (\d+)\.(\d+)(?:\.(\d+))?.*$z^[a-fA-F0-9]{40}$a/^ # Optional user, e.g. 'git@' (\w+@)? # Server, e.g. 'github.com'. ([^/:]+): # The server-side path. e.g. 'user/project.git'. Must start with an # alphanumeric character so as not to be confusable with a Windows paths # like 'C:/foo/bar' or 'C:\foo\bar'. (\w[^:]*) $)shareturncCstt|SN)bool HASH_REGEXmatch)rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/git.pylooks_like_hash7srcseZdZdZdZdZdZdZdZe e e e ddd Z e e e d d d Zeed fdddZee ee dddZee e eee e fdddZee e e dddZee eeedddZee ee e dddZe eeddd d!Ze eeddd"d#Ze eeddd$d%Zee e dd&d'Ze e e d(d)d*Zee e e d+d,d-Z ed;e ee e d+d.d/Z!ee ee dd0d1Z"ee ee ee e#fd(fd2d3 Z$ee ddd4d5Z%ee ee dfd6d7 Z&e e e d8d9d:Z'Z(S)<Gitgitz.gitclone)zgit+httpz git+httpszgit+sshzgit+gitzgit+file)GIT_DIR GIT_WORK_TREEHEAD)revrcCs|gSrrr!rrrget_base_rev_argsKszGit.get_base_rev_args)urldestrcCsJ|t|\}}|jsdS|||js.dSt|||jd}| S)NFr)get_url_rev_optionsr r!is_commit_id_equalrget_revision_sha)selfr$r%_ rev_optionsis_tag_or_branchrrris_immutable_rev_checkoutOszGit.is_immutable_rev_checkout.)rcCsF|jdgddd}t|}|s0td|dStdd|DS) NversionFT) show_stdout stdout_onlyzCan't parse git version: %srcss|]}t|VqdSr)int).0crrr cz&Git.get_git_version..) run_commandGIT_VERSION_REGEXrloggerwarningtuplegroups)r)r.rrrrget_git_version]s   zGit.get_git_version)locationrcCsBgd}|j|ddd|d}|}|dr>|tddSdS)zl Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). )z symbolic-ref-qr FTextra_ok_returncodesr/r0cwdz refs/heads/N)r6strip startswithlen)clsr=argsoutputrefrrrget_current_branches  zGit.get_current_branch)r%r!rc Cs|jd|g|dddd}i}|dD]T}|d}|s>q*z|jdd d \}}Wn tyttd |Yn0|||<q*d |}d |} ||} | dur| dfS|| } | dfS)z Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name. zshow-refFTignore)rCr/r0 on_returncode   )maxsplitzunexpected show-ref line: zrefs/remotes/origin/z refs/tags/N)r6rDsplitrstrip ValueErrorget) rGr%r!rIrefslineref_sharef_name branch_reftag_refrrrrr(~s0        zGit.get_revision_shacCs.|drdSt|sdS|||r*dSdS)a$ Return true if rev is a ref or is a commit that we don't have locally. Branches and tags are not considered in this method because they are assumed to be always available locally (which is a normal outcome of ``git clone`` and ``git fetch --tags``). zrefs/TF)rEr has_commit)rGr%r!rrr _should_fetchs  zGit._should_fetch)r%r$r+rcCs|j}|dusJ|||\}}|durF||}|r<|nd|_|St|sZtd||||sj|S|jt dd|| |d|j |dd}||}|S)z Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object. Nz:Did not find branch or tag '%s', assuming revision or ref.fetchr>rC FETCH_HEADr") arg_revr(make_new branch_namerr8r9r^r6r to_args get_revision)rGr%r$r+r!r is_branchrrrresolve_revisions*     zGit.resolve_revision)r%namercCs|sdS|||kS)z Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. F)rf)rGr%rirrrr's zGit.is_commit_id_equalNc Cs |}td||t||dkr@|tddd||n|tdd|||jr||||}t |dd}t d|||dur| ||jstdd| }|j||d n4| ||krd |}dd |d |g}|j||d n||}||}td ||j||dS)NzCloning %s%s to %s)rQrz--filter=blob:noner>rdzRev options %s, branch_name %scheckoutr`zorigin/z-bz--trackzResolved %s to commit %s) to_displayr8inforr<r6r r!rhgetattrdebugr'rerKrfrcupdate_submodules) r)r%r$r+ rev_displayrdcmd_args track_branchrrrr fetch_newsL      z Git.fetch_newcCsB|jtdd||dtdd|}|j||d||dS)Nconfigzremote.origin.urlr`rkr>)r6r rerpr)r%r$r+rrrrrswitch7s z Git.switchcCsn|dkr |jgd|dn|jddg|d||||}tddd|}|j||d||dS)N)r@ )r_r>z--tagsr`r_r>resetz--hard)r<r6rhr rerprvrrrupdateAs z Git.updatecCs||jgdddd|d}|}z |d}WntyBtYn0|D]}|drH|}q`qH|dd }||S) z Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. )ruz --get-regexpzremote\..*\.urlr?FTrArzremote.origin.url rPr@)r6 splitlines IndexErrorr rErS_git_remote_to_pip_urlrD)rGr=stdoutremotes found_remoteremoter$rrrget_remote_urlOs$     zGit.get_remote_url)r$rcCsNtd|r|Stj|r*t|St|}|rB| dSt |dS)a8 Convert a remote url from what git uses to what pip accepts. There are 3 legal forms **url** may take: 1. A fully qualified url: ssh://git@example.com/foo/bar.git 2. A local project.git folder: /path/to/bare/repository.git 3. SCP shorthand for form 1: git@example.com:foo/bar.git Form 1 is output as-is. Form 2 must be converted to URI and form 3 must be converted to form 1. See the corresponding test test_git_remote_url_to_pip() for examples of sample inputs/outputs. z\w+://z ssh://\1\2/\3N) rerospathexistspathlibPurePathas_uri SCP_REGEXexpandr )r$ scp_matchrrrr}ms    zGit._git_remote_to_pip_url)r=r!rcCs>z |jdddd|g|ddWnty4YdS0dSdS) zU Check if rev is a commit that is available in the local repository. rev-parser>z--verifyzsha^F)rClog_failed_cmdTN)r6r)rGr=r!rrrr]s  zGit.has_commitcCs*|dur d}|jd|gdd|d}|S)Nr rFTr/r0rC)r6rD)rGr=r! current_revrrrrfszGit.get_revisioncCsT|jddgdd|d}tj|s4tj||}tjtj|d}t||S)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. rz --git-dirFTrz..)r6rDrrisabsjoinabspathr)rGr=git_dir repo_rootrrrget_subdirectorys  zGit.get_subdirectoryc st|\}}}}}|dr|dt|d }|tj|ddd}|dd} |d| t || d||||f}d|vrd|vsJ|d d }t |\}} } |d d }nt |\}} } || | fS) a9 Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub. fileN/\+r@z://zfile:zgit+z git+ssh://zssh://) urlsplitendswithrFlstripurllibrequest url2pathnamereplacefind urlunsplitsuperget_url_rev_and_auth) rGr$schemenetlocrqueryfragmentinitial_slashesnewpath after_plusr! user_pass __class__rrrs&     zGit.get_url_rev_and_authcCs0tjtj|dsdS|jgd|ddS)Nz .gitmodules) submodulerzz--initz --recursiver>r`)rrrrr6)rGr=rrrrps zGit.update_submodulescsxt|}|r|Sz|jddg|ddddd}Wn2tyRtd|YdStydYdS0tj | dS) Nrz--show-toplevelFTraise)rCr/r0rMrzKcould not determine if %s is under git control because git is not availablez ) rget_repository_rootr6rr8rorrrnormpathrT)rGr=locrrrrrs*    zGit.get_repository_root)repo_urlrcCsdS)zEIn either https or ssh form, requirements must be prefixed with git+.Tr)rrrrshould_add_vcs_url_prefixszGit.should_add_vcs_url_prefix)N))__name__ __module__ __qualname__ridirname repo_nameschemes unset_environdefault_arg_rev staticmethodstrrr#rr-rr1r< classmethodrrKr(r^rrrhr'rtrwrzrr}r]rfrr rrprr __classcell__rrrrr;sV  --7  $r)-loggingos.pathrrr urllib.parserurllib.requesttypingrrrpip._internal.exceptionsrrpip._internal.utils.miscrrr pip._internal.utils.subprocessr pip._internal.vcs.versioncontrolr r r rrrrparserr getLoggerrr8compiler7rVERBOSErrrrrregisterrrrrs6 $    IPK,]o(vcs/__pycache__/mercurial.cpython-39.pycnu[a ReQ@sddlZddlZddlZddlmZmZddlmZmZddl m Z m Z ddl m Z ddlmZddlmZmZmZmZeeZGdd d eZeedS) N)ListOptional) BadCommandInstallationError) HiddenText display_path) make_command) path_to_url) RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcscseZdZdZdZdZdZeee edddZ ee e dd d d Z ee e dd d d Zee e dd ddZeeedddZeeedddZeeedddZeeeeedddZeeeedddZeeeedfdd ZZS) Mercurialhgz.hgclone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-http)revreturncCs|gS)N)rrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_args szMercurial.get_base_rev_argsN)desturl rev_optionsrcCsP|}td||t||tddd|||jtdd||ddS)NzCloning hg %s%s to %srz --noupdate-qupdatecwd) to_displayloggerinfor run_commandrto_args)selfrrr rev_displayrrr fetch_new$szMercurial.fetch_newc Cstj||jd}t}zR|||dd|jt |d}| |Wdn1s`0YWn8t tj fy}zt d||WYd}~n(d}~00tdd|}|j||ddS) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %srrr)ospathjoindirname configparserRawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorrwarningrr!r ) r"rrr repo_configconfig config_fileexccmd_argsrrrswitch2s  ,$zMercurial.switchcCs4|jddg|dtdd|}|j||ddS)Npullrrr)r rr!)r"rrrr;rrrr@szMercurial.update)locationrcCs4|jddgdd|d}||r,t|}|S)N showconfigz paths.defaultFT show_stdout stdout_onlyr)r strip_is_local_repositoryr )clsr>rrrrget_remote_urlEs  zMercurial.get_remote_urlcCs|jddgdd|d}|S)zW Return the repository-local changeset revision number, as an integer. parentsz--template={rev}FTr@r rC)rEr>current_revisionrrr get_revisionQs zMercurial.get_revisioncCs|jddgdd|d}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rGz--template={node}FTr@rH)rEr>current_rev_hashrrrget_requirement_revision^s z"Mercurial.get_requirement_revision)rnamercCsdS)z&Always assume the versions don't matchFr)rErrMrrris_commit_id_equallszMercurial.is_commit_id_equalcCsD|jdgdd|d}tj|s:tjtj||}t||S)z Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. rootFTr@)r rCr)r*isabsabspathr+r )rEr> repo_rootrrrget_subdirectoryqs   zMercurial.get_subdirectorycsvt|}|r|Sz|jdg|ddddd}Wn2tyPtd|YdStybYdS0tj | dS)NrOFTraise)rrArB on_returncodelog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez ) superget_repository_rootr rrdebugrr)r*normpathrstrip)rEr>locr __class__rrrXs*    zMercurial.get_repository_root)__name__ __module__ __qualname__rMr, repo_nameschemes staticmethodstrrrrr r$r<r classmethodrFrJrLrboolrNrSrX __classcell__rrr^rrs*    r)r-loggingr)typingrrpip._internal.exceptionsrrpip._internal.utils.miscrrpip._internal.utils.subprocessrpip._internal.utils.urlsr pip._internal.vcs.versioncontrolr r r r getLoggerr`rrregisterrrrrs   PK,]g+ )utils/__pycache__/parallel.cpython-39.pycnu[a Re| @s\dZddgZddlmZddlmZddlmZddlmZ ddl m Z m Z m Z mZmZddlmZeejej fZed Zed Zz dd lZWneyd ZYn0d ZdZeee edddZde egefe eee edddZde egefe eee edddZde egefe eee edddZerPeZZneZeZd S)abConvenient parallelization of higher order functions. This module provides two helper functions, with appropriate fallbacks on Python 2 and on systems lacking support for synchronization mechanisms: - map_multiprocess - map_multithread These helpers work like Python 3's map, with two differences: - They don't guarantee the order of processing of the elements of the iterable. - The underlying process/thread pools chop the iterable into a number of chunks, so that for very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. map_multiprocessmap_multithread)contextmanager)Poolpool)CallableIterableIteratorTypeVarUnion)DEFAULT_POOLSIZESTNTFi)rreturnccsBz"|VW|||n|||0dS)z>Return a context manager making sure the pool closes properly.N)closejoin terminaterr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/parallel.pyclosing.s r)funciterable chunksizercCs t||S)zMake an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open is unavailable. )map)rrrrrr _map_fallback;s rcCs<tt}||||WdS1s.0YdS)zChop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. N)r ProcessPoolimap_unorderedrrrrrrr_map_multiprocessGs r cCs>ttt}||||WdS1s00YdS)zChop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. N)r ThreadPoolr rrrrr_map_multithreadUs r")r)r)r)__doc____all__ contextlibrmultiprocessingrrrZmultiprocessing.dummyr!typingrr r r r Zpip._vendor.requests.adaptersr rrZmultiprocessing.synchronize ImportErrorZ LACK_SEM_OPENTIMEOUTrintrr r"rrrrrrsJ             PK,]7utils/__pycache__/inject_securetransport.cpython-39.pycnu[a Re@s$dZddlZddddZedS)a-A helper module that injects SecureTransport, on import. The import should be done as early as possible, to ensure all requests and sessions (or whatever) are created after injecting SecureTransport. Note that we only do the injection on macOS, when the linked OpenSSL is too old to handle TLSv1.2. N)returnc CsttjdkrdSz ddl}Wnty.YdS0|jdkr>dSzddlm}WnttfyfYdS0|dS)Ndarwinri)securetransport) sysplatformssl ImportErrorOPENSSL_VERSION_NUMBERpip._vendor.urllib3.contribrOSErrorinject_into_urllib3)rrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/inject_securetransport.pyinject_securetransport s    r)__doc__rrr r r rs PK,]W9222'utils/__pycache__/models.cpython-39.pycnu[a Re@s2dZddlZddlmZmZmZGdddZdS)zUtilities for defining models N)AnyCallableTypec@seZdZdZddgZeedddddZedd d Z ee d d d Z ee d ddZ ee d ddZ ee d ddZee d ddZeeeege fe dddZdS)KeyBasedCompareMixinz7Provides comparison capabilities that is based on a key _compare_key_defining_classN)keydefining_classreturncCs||_||_dSN)rr)selfrr r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/models.py__init__ szKeyBasedCompareMixin.__init__)r cCs t|jSr )hashr)r r r r__hash__szKeyBasedCompareMixin.__hash__)otherr cCs||tjSr )_compareoperator__lt__r rr r rrszKeyBasedCompareMixin.__lt__cCs||tjSr )rr__le__rr r rrszKeyBasedCompareMixin.__le__cCs||tjSr )rr__gt__rr r rrszKeyBasedCompareMixin.__gt__cCs||tjSr )rr__ge__rr r rrszKeyBasedCompareMixin.__ge__cCs||tjSr )rr__eq__rr r rr szKeyBasedCompareMixin.__eq__)rmethodr cCst||jstS||j|jSr ) isinstancerNotImplementedr)r rrr r rr#s zKeyBasedCompareMixin._compare)__name__ __module__ __qualname____doc__ __slots__rrrintrboolrrrrrrrr r r rrsr)r!rtypingrrrrr r r rsPK,]"ii'utils/__pycache__/hashes.cpython-39.pycnu[a Re@sddlZddlmZmZmZmZmZddlmZm Z m Z ddl m Z er`ddlm Z ddlmZdZgdZGd d d ZGd d d eZdS) N) TYPE_CHECKINGBinaryIODictIteratorList) HashMismatch HashMissingInstallationError) read_chunks)_Hash)NoReturnsha256)r sha384sha512c@seZdZdZd#eeeefddddZdddddZe e d d d Z eee d d dZ eeddddZeedfddddZeddddZeddddZe d ddZee ddd Ze d d!d"ZdS)$HasheszaA wrapper that builds multiple hashes at once and checks them against known-good values N)hashesreturncCs4i}|dur*|D]\}}t|||<q||_dS)zo :param hashes: A dict of algorithm names pointing to lists of allowed hex digests N)itemssorted_allowed)selfrallowedalgkeysr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/hashes.py__init__s zHashes.__init__)otherrcsbt|tstS|sSs|Si}|jD],\}jvr@q,fdd|D|<q,t|S)Ncsg|]}|jvr|qSr)r).0vrrrr ;z"Hashes.__and__..) isinstancerNotImplementedrr)rrnewvaluesrr r__and__+s  zHashes.__and__rcCstdd|jDS)Ncss|]}t|VqdSN)len)rdigestsrrr @r"z&Hashes.digest_count..)sumrr&rrrr digest_count>szHashes.digest_count) hash_name hex_digestrcCs||j|gvS)z/Return whether the given hex digest is allowed.)rget)rr0r1rrris_hash_allowedBszHashes.is_hash_allowed)chunksrc Csi}|jD]<}zt|||<WqttfyHtd|Yq0q|D]}|D]}||q\qP| D] \}}| |j|vrvdSqv| |dS)zCheck good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. zUnknown hash name: N) rrhashlibr% ValueError TypeErrorr r&updater hexdigest_raise)rr4gotsr0chunkhashgotrrrcheck_against_chunksFs zHashes.check_against_chunksr r r;rcCst|j|dSr))rrrr;rrrr:]sz Hashes._raise)filercCs|t|S)zaCheck good hashes against a file-like object Raise HashMismatch if none match. )r?r )rrBrrrcheck_against_file`szHashes.check_against_file)pathrcCs8t|d}||WdS1s*0YdS)Nrb)openrC)rrDrBrrrcheck_against_pathhs zHashes.check_against_pathcCs t|jS)z,Return whether I know any known-good hashes.)boolrr.rrr__bool__lszHashes.__bool__cCst|tstS|j|jkSr))r#rr$r)rrrrr__eq__ps z Hashes.__eq__cCs"tdtdd|jDS)N,css*|]"\}}|D]}d||fVqqdS):N)join)rr digest_listdigestrrrr,xsz"Hashes.__hash__..)r=rMrrrr.rrr__hash__uszHashes.__hash__)N)__name__ __module__ __qualname____doc__rstrrrr'propertyintr/rHr3rbytesr?r:rrCrGrIobjectrJrPrrrrrs rcs>eZdZdZddfdd Zeedfddd d ZZS) MissingHasheszA workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. Nr(cstjtgiddS)z!Don't offer the ``hashes`` kwarg.)rN)superr FAVORITE_HASHr. __class__rrrszMissingHashes.__init__r r r@cCst|tdSr))rr\r9rArrrr:szMissingHashes._raise) rQrRrSrTrrrUr: __classcell__rrr]rrZsrZ)r5typingrrrrrpip._internal.exceptionsrrr pip._internal.utils.miscr r r r\ STRONG_HASHESrrZrrrrs   hPK,]GAr r *utils/__pycache__/packaging.cpython-39.pycnu[a Re @sddlZddlZddlmZddlmZddlmZmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZdd lmZeeZeeeed fed d dZeedddZeedddZejddeedddZ dS)N)Message) FeedParser)OptionalTuple) pkg_resources) specifiersversion Requirement) Distribution)NoneMetadataError) display_path.)requires_python version_inforeturncCs4|dur dSt|}tdtt|}||vS)a Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return `False`. :raises InvalidSpecifier: If `requires_python` has an invalid format. NT.)r SpecifierSetrparsejoinmapstr)rrrequires_python_specifierpython_versionr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/packaging.pycheck_requires_pythons  r)distrcCsd}t|tjr&||r&||}n0|dr@d}||}ntdt|jd}|durht ||t }| || S)z :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. METADATAzPKG-INFOzNo metadata found in %sN) isinstancerDistInfoDistribution has_metadata get_metadataloggerwarningr locationr rfeedclose)r metadata_namemetadata feed_parserrrrr")s     r"cCs2|dr.|dD]}|r|SqdS)N INSTALLERr)r!get_metadata_linesstrip)rlinerrr get_installerDs  r/i)maxsize) req_stringrcCst|S)z5Construct a packaging.Requirement object with cachingr )r1rrrget_requirementLsr2)! functoolslogging email.messager email.parserrtypingrr pip._vendorrZpip._vendor.packagingrrZ"pip._vendor.packaging.requirementsr pip._vendor.pkg_resourcesr pip._internal.exceptionsr pip._internal.utils.miscr getLogger__name__r#rintboolrr"r/ lru_cacher2rrrrs$          PK,]/+&utils/__pycache__/glibc.cpython-39.pycnu[a Re& @spddlZddlZddlmZmZeedddZeedddZeeddd Zeeefdd d Z dS) N)OptionalTuple)returncCs tp tS)z9Returns glibc version string, or None if not using glibc.)glibc_version_string_confstrglibc_version_string_ctypesrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/glibc.pyglibc_version_string sr c CsDtjdkrdSztd\}}Wntttfy>YdS0|S)z@Primary implementation of glibc_version_string using os.confstr.win32NCS_GNU_LIBC_VERSION)sysplatformosconfstrsplitAttributeErrorOSError ValueError)_versionrrrrs rcCsrz ddl}Wnty YdS0|d}z |j}WntyJYdS0|j|_|}t|tsn| d}|S)z=Fallback implementation of glibc_version_string using ctypes.rNascii) ctypes ImportErrorCDLLgnu_get_libc_versionrc_char_prestype isinstancestrdecode)rprocess_namespacer version_strrrrrs       rcCst}|durdSd|fSdS)zTry to determine the glibc version Returns a tuple of strings (lib, version) which default to empty strings in case the lookup fails. N)r"glibc)r ) glibc_versionrrrlibc_verNsr%) rr typingrrrr rrr%rrrrs /PK,]\)utils/__pycache__/egg_link.cpython-39.pycnu[a Re@sddlZddlZddlZddlmZddlmZmZddlm Z m Z ddgZ e e ddd Z e ee dd dZe ee dd dZdS) N)Optional) site_packages user_site)running_under_virtualenvvirtualenv_no_globalegg_link_path_from_sys_pathegg_link_path_from_location)raw_namereturncCstdd|dS)z Convert a Name metadata value to a .egg-link name, by applying the same substitution as pkg_resources's safe_name function. Note: we cannot use canonicalize_name because it has a different logic. z[^A-Za-z0-9.]+-z .egg-link)resub)r r/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/egg_link.py_egg_link_namesrcCs:t|}tjD]&}tj||}tj|r|SqdS)zJ Look for a .egg-link file for project name, by walking sys.path. N)rsyspathosjoinisfile)r egg_link_name path_itemegg_linkrrrrs    cCszg}tr*|ttsBtrB|tntr8|t|tt|}|D]&}tj||}tj |rN|SqNdS)a Return the path for the .egg-link file if it exists, otherwise, None. There's 3 scenarios: 1) not in a virtualenv try to find in site.USER_SITE, then site_packages 2) in a no-global virtualenv try to find in site_packages 3) in a yes-global virtualenv try to find in site_packages, then site.USER_SITE (don't look in global location) For #1 and #3, there could be odd cases, where there's an egg-link in 2 locations. This method will just return the first one found. N) rappendrrrrrrrr)r sitesrsiteegglinkrrrr*s       )rr rtypingrpip._internal.locationsrrpip._internal.utils.virtualenvrr__all__strrrrrrrrs   PK,]j*utils/__pycache__/filetypes.cpython-39.pycnu[a Re@sUdZddlmZddlmZdZdZeedfed<dZ eedfed <d efZ eedfed <d Z eedfed <e ee e Z ee dddZdS)zFiletype information. )Tuple)splitextz.whl)z.tar.bz2z.tbz.BZ2_EXTENSIONS)z.tar.xzz.txzz.tlzz.tar.lzz .tar.lzma XZ_EXTENSIONSz.zipZIP_EXTENSIONS)z.tar.gzz.tgzz.tarTAR_EXTENSIONS)namereturncCs t|d}|tvrdSdS)z9Return True if `name` is a considered as an archive file.TF)rlowerARCHIVE_EXTENSIONS)rextr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/filetypes.pyis_archive_filesrN)__doc__typingrpip._internal.utils.miscrWHEEL_EXTENSIONrstr__annotations__rrrr boolrrrrrs  PK,]yss.utils/__pycache__/pkg_resources.cpython-39.pycnu[a Re@s2ddlmZmZmZddlmZGdddZdS))DictIterableList) yield_linesc@seZdZdZeeefddddZeedddZ eedd d Z ee edd d Z eedd dZ eeedddZeeddddZdS) DictMetadataz>IMetadataProvider that reads metadata files from a dictionary.N)metadatareturncCs ||_dSN _metadata)selfrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/pkg_resources.py__init__ szDictMetadata.__init__)namercCs ||jvSr r r rr r r has_metadata szDictMetadata.has_metadatac CsRz|j|WStyL}z$|jd|d7_WYd}~n d}~00dS)Nz in z file)r decodeUnicodeDecodeErrorreason)r rer r r get_metadatas zDictMetadata.get_metadatacCst||Sr )rrrr r rget_metadata_linesszDictMetadata.get_metadata_linescCsdS)NFr rr r rmetadata_isdirszDictMetadata.metadata_isdircCsgSr r rr r rmetadata_listdirszDictMetadata.metadata_listdir) script_name namespacercCsdSr r )r rrr r r run_script szDictMetadata.run_script)__name__ __module__ __qualname____doc__rstrbytesrboolrrrrrrrrr r r rrsrN)typingrrrpip._vendor.pkg_resourcesrrr r r rs PK,]`F;;)utils/__pycache__/encoding.cpython-39.pycnu[a Re@sUddlZddlZddlZddlZddlmZmZejdfejdfej dfej dfej dfej dfej d fgZeeeefed <ed Zeed d dZdS)N)ListTuplezutf-8zutf-16z utf-16-bez utf-16-lezutf-32z utf-32-bez utf-32-leBOMSscoding[:=]\s*([-\w.]+))datareturncCstD],\}}||r|t|d|Sq|dddD]T}|dddkrDt|rDt|}|dusxJ|dd}||SqD|t dpt S) zCheck a bytes string for a BOM to correctly detect the encoding Fallback to locale.getpreferredencoding(False) like open() on Python3N r#asciiF) r startswithlendecodesplit ENCODING_REsearchgroupslocalegetpreferredencodingsysgetdefaultencoding)rbomencodinglineresultr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/encoding.py auto_decodes    r)codecsrrertypingrrBOM_UTF8 BOM_UTF16 BOM_UTF16_BE BOM_UTF16_LE BOM_UTF32 BOM_UTF32_BE BOM_UTF32_LErbytesstr__annotations__compilerrrrrrs  PK,]A1%%)utils/__pycache__/datetime.cpython-39.pycnu[a Re@s$dZddlZeeeedddZdS)z.For when pip wants to check the date or time. N)yearmonthdayreturncCs tj}t|||}||kS)N)datetimedatetoday)rrrrgivenr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/datetime.pytoday_is_later_thans r )__doc__rintboolr r r r r sPK,]0:P%utils/__pycache__/_log.cpython-39.pycnu[a Re@sTdZddlZddlmZmZdZGdddejZeeddd Z dd d d Z dS) zCustomize logging Defines custom logger class for the `logger.verbose(...)` method. init_logging() must be called before any other modules that call logging.getLogger. N)Anycastc@s$eZdZdZeeeddddZdS) VerboseLoggerzXCustom Logger, defining a verbose log-level VERBOSE is between INFO and DEBUG. N)msgargskwargsreturncOs|jt|g|Ri|S)N)logVERBOSE)selfrrrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/_log.pyverboseszVerboseLogger.verbose)__name__ __module__ __qualname____doc__strrrr r r rrsr)namer cCsttt|S)zBlogging.getLogger, but ensures our VerboseLogger class is returned)rrlogging getLogger)rr r rrsr)r cCsttttddS)zRegister our VerboseLogger and VERBOSE log level. Should be called before any calls to getLogger(), i.e. in pip._internal.__init__ r N)rsetLoggerClassr addLevelNamer r r r r init_loggings r) rrtypingrrr Loggerrrrrr r r rs  PK,]T&QSQS%utils/__pycache__/misc.cpython-39.pycnu[a Re*Q@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddlm Z ddlmZmZmZddlmZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'ddl(m)Z)dd l*m+Z+dd l,m-Z-m.Z.m/Z/dd l,m0Z0dd l1m2Z2dd l3m4Z4ddl5m6Z6gdZ7e8e9Z:e dZ;eee<ee>e>fZ?ee@eee@ee@ffZAe@dddZBee>dfee>e>e>fdddZCe@ddddZDe@dddZEe%de&de'dd de@eFdd"d#d$ZGedefe@e=dd%d&d'ZHe@e@dd(d)ZIde@e@e@d+d,d-ZJe@ee@e@d.d/d0ZKe@dd1d2d3ZLe@ee@e@d.d4d5ZMe@e@d1d6d7ZNe@e@d1d8d9ZOe@e>d:d;d<ZPeQe@d=d>d?ZReeeeee@ee>fd@dAdBZSe@eFddCdDZTejUfee>eeVdEdFdGZWde@eFe@dHdIdJZXe@ee@e@fddKdLZYe@e@ddMdNdOZZe@eFddPdQZ[e#eFdRdSdTZ\e#eFdRdUdVZ]e#eFdRdWdXZ^dYdZZ_e@ee#d[d\d]Z`e#e@dRd^d_Zaeedd`dadbZbGdcdddde Zcejde@eecdedfdgZeeecddhdiZfeecddjdkZgeeeedldmdnZhe@ee>e@dodpdqZide@e@e@dsdtduZje@ee@ee>fdvdwdxZke@eAdvdydzZle@e@dvd{d|Zme@ee@geedffee@eAfd}d~dZne@eAdvddZoe@ee@dvddZpe@ee@e@ee@e@ffdddZqe@e@dddZre@e@dddZsGdddZte@etdddZue@etdddZveFddddZweFdddZxde@e>eee>fdddZyeFdddZzeeeeeefdddZ{ee;geFfee;eee;ee;fdddZ|dS)N)StringIO) filterfalsetee zip_longest) TracebackType) AnyBinaryIOCallableContextManagerIterableIteratorListOptionalTextIOTupleTypeTypeVarcast Distribution)retrystop_after_delay wait_fixed) __version__) CommandError)get_major_minor_version site_packages user_site) get_scheme)WINDOWS)egg_link_path_from_location)running_under_virtualenv) rmtree display_path backup_dirasksplitext format_sizeis_installable_dirnormalize_pathrenamesget_progcaptured_stdout ensure_dirremove_auth_from_urlTreturncCs4tjtjtdd}tj|}dt|tS)Nz..zpip {} from {} (python {})) ospathjoindirname__file__abspathformatrr) pip_pkg_dirr:/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/misc.pyget_pip_versionGs r<.)py_version_infor1cCsDt|dkr"|dt|d7}nt|dkr:|dd}td|S)ax Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None). )rN VersionInfo)lenr)r=r:r:r;normalize_version_infoRs   rA)r3r1c CsRzt|Wn>tyL}z&|jtjkr8|jtjkr8WYd}~n d}~00dS)z os.path.makedirs without EEXIST.N)r2makedirsOSErrorerrnoEEXIST ENOTEMPTY)r3er:r:r;r-es r-c CsPz2tjtjd}|dvr*tjdWS|WSWntttfyJYn0dS)Nr)z __main__.pyz-cz -m pippip) r2r3basenamesysargv executableAttributeError TypeError IndexError)progr:r:r;r+os r+Tr>g?)reraisestopwaitF)dir ignore_errorsr1cCstj||tddS)N)rUonerror)shutilr"rmtree_errorhandler)rTrUr:r:r;r"}sr")funcr3exc_infor1cCsRzt|jtj@ }Wnty,YdS0|rLt|tj||dSdS)zOn Windows, the files in .svn are read-only, so when rmtree() tries to remove them, an exception is thrown. We catch that here, remove the read-only attribute, and hopefully continue without problems.N)r2statst_modeS_IWRITErCchmod)rYr3rZhas_attr_readonlyr:r:r;rXs rXcCsFtjtj|}|ttjjrBd|ttd}|S)zTGives the display value for a given path, making it relative to cwd if possible..N)r2r3normcaser7 startswithgetcwdsepr@r3r:r:r;r#sr#.bak)rTextr1cCs6d}|}tj||r.|d7}|t|}q||S)z\Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc))r2r3existsstr)rTrgn extensionr:r:r;r$s r$)messageoptionsr1cCs2tjddD]}||vr|Sqt||S)NPIP_EXISTS_ACTION)r2environgetsplitr%)rmrnactionr:r:r;ask_path_existss ru)rmr1cCstjdrtd|dS)z&Raise an error if no input is allowed. PIP_NO_INPUTz5No input was expected ($PIP_NO_INPUT set); question: N)r2rqrr Exceptionrmr:r:r;_check_no_inputs rycCsFt|t|}|}||vrYour response ({!r}) was not one of the expected responses: {}z, N)ryinputstriplowerprintr8r4)rmrnresponser:r:r;r%s  r%cCst|t|S)zAsk for input interactively.)ryrzrxr:r:r; ask_inputsrcCst|t|S)z!Ask for a password interactively.)rygetpassrxr:r:r; ask_passwordsr)valr1cCs2|}|dvrdS|dvr dStd|dS)zConvert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. )yyesttrueon1rh)rknoffalseoff0rzinvalid truth value N)r| ValueError)rr:r:r; strtobools r)bytesr1cCs\|dkrd|ddS|dkr4dt|dS|dkrJd|dSdt|SdS) Ni@Bz {:.1f} MBg@@ii'z{} kBz {:.1f} kBz{} bytes)r8int)rr:r:r;r'sr')rowsr1cs@dd|D}ddt|ddiDfdd|D}|fS)zReturn a list of formatted rows and a list of column sizes. For example:: >>> tabulate([['foobar', 2000], [0xdeadbeef]]) (['foobar 2000', '3735928559'], [10, 4]) cSsg|]}ttt|qSr:)tuplemaprj.0rowr:r:r; ztabulate..cSsg|]}ttt|qSr:)maxrr@)rcolr:r:r;rr fillvaluerpcs$g|]}dttj|qS) )r4rrjljustrstriprsizesr:r;rr)r)rtabler:rr;tabulatesrcCsHtj|sdStjtj|dr*dStjtj|drDdSdS)atIs path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which are already covered by the pyproject.toml check. Fzpyproject.tomlTzsetup.py)r2r3isdirisfiler4rer:r:r;r(s r()filesizer1ccs||}|sq|VqdS)z7Yield pieces of data from a file-like object until EOF.N)read)rrchunkr:r:r; read_chunkss r)r3resolve_symlinksr1cCs6tj|}|rtj|}n tj|}tj|S)zN Convert a path to its canonical, case-normalized, absolute version. )r2r3 expanduserrealpathr7ra)r3rr:r:r;r)s   r)cCs@t|\}}|dr8|dd|}|dd}||fS)z,Like os.path.splitext, but take off .tar tooz.tarN) posixpathr&r|endswith)r3basergr:r:r;r&$s  r&)oldnewr1cCsxtj|\}}|r.|r.tj|s.t|t||tj|\}}|rt|rtzt|WntyrYn0dS)z7Like os.renames(), but handles renaming across devices.N) r2r3rsrirBrWmove removedirsrC)rrheadtailr:r:r;r*-s   r*cCsts dS|ttjS)z Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path. T)r!rbr)rJprefixrer:r:r;is_local>s r)distr1cCs tt|S)z Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv. )r dist_locationrr:r:r; dist_is_localLsrcCst|ttS)zF Return True if given Distribution is installed in user site. )rrbr)rrr:r:r;dist_in_usersiteWsrcCst|ttS)z[ Return True if given Distribution is installed in sysconfig.get_python_lib(). )rrbr)rrr:r:r;dist_in_site_packages^srcCs*tt|}|ttdjddS)zf Return True if given Distribution is installed in path matching distutils_scheme layout. rppythonr)r)rrbrpurelibrs)r norm_pathr:r:r;dist_in_install_pathfs r)req_namer1cCs<ddlm}ddlm}||}|dur0dSt||jS)a%Given a requirement name, return the installed Distribution object. This searches from *all* distributions available in the environment, to match the behavior of ``pkg_resources.get_distribution()``. Left for compatibility until direct pkg_resources uses are refactored out. r)get_default_environmentrN)pip._internal.metadatar$pip._internal.metadata.pkg_resourcesrget_distributionr_dist)rr_Distrr:r:r;rps    rcCs t|j}|rt|St|jS)aO Get the site-packages location of this distribution. Generally this is dist.location, except in the case of develop-installed packages, where dist.location is the source code location, and we want to know where the egg-link file is. The returned location is normalized (in particular, with symlinks removed). )r project_namer)location)regg_linkr:r:r;rs r)msgargsr1cGstj|g|RdSN)loggerinfo)rrr:r:r; write_outputsrc@s:eZdZUdZeed<eeddddZeddZ dS) StreamWrapperN orig_stream)rr1cCs ||_|Sr)r)clsrr:r:r; from_streamszStreamWrapper.from_streamcCs|jjSr)rencodingselfr:r:r;rszStreamWrapper.encoding) __name__ __module__ __qualname__rr__annotations__ classmethodrpropertyrr:r:r:r;rs  r) stream_namer1c csLtt|}tt|t|ztt|VWtt||ntt||0dS)zReturn a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo. N)getattrrJsetattrrr)r orig_stdoutr:r:r;captured_outputs  rcCstdS)zCapture the output of sys.stdout: with captured_stdout() as stdout: print('hello') self.assertEqual(stdout.getvalue(), 'hello ') Taken from Lib/support/__init__.py in the CPython repo. stdoutrr:r:r:r;r,s r,cCstdS)z See captured_stdout(). stderrrr:r:r:r;captured_stderrsr) sequentialnamedr1cOsDtt|tt|fi|}dd|D}||d<tdd|S)NcSsi|]\}}||qSr:r:)rkeyvaluer:r:r; rzenum..reverse_mappingEnumr:)dictzipranger@itemstype)rrenumsreverser:r:r;enumsr)hostportr1cCs.|dur |Sd|vr d|d}|d|S)z. Build a netloc from a host-port pair N:[]r:)rrr:r:r; build_netlocs  rhttps)netlocschemer1cCs8|ddkr*d|vr*d|vr*d|d}|d|S)z) Build a full URL from a netloc. r@rrz://)count)rrr:r:r;build_url_from_netlocs r)rr1cCs t|}tj|}|j|jfS)z2 Return the host-port pair from a netloc. )rurllibparseurlparsehostnamer)rurlparsedr:r:r; parse_netlocs r cCstd|vr|dfS|dd\}}d}d|vr>|dd\}}n |d}}tj|}|durhtj|}|||ffS)zp Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). r)NNrhNr)rsplitrsrrunquote)rauthpwuserr:r:r;split_auth_from_netlocs   rcCsNt|\}\}}|dur|S|dur.d}d}ntj|}d}dj|||dS)z Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com" N****rpz:****z{user}{password}@{netloc})rpasswordr)rrrquoter8)rrrr:r:r; redact_netloc s r)r transform_netlocr1cCsJtj|}||j}|j|d|j|j|jf}tj|}|t d|fS)aRTransform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1. r NetlocTuple) rrurlsplitrrr3queryfragment urlunsplitr)r rpurl netloc_tuple url_piecessurlr:r:r;_transform_urls   r!cCst|Sr)rrr:r:r; _get_netloc3sr#cCs t|fSr)rr"r:r:r;_redact_netloc7sr$)r r1cCst|t\}\}}|||fS)z Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password)) r!r#)r url_without_authrrr:r:r;split_auth_netloc_from_url;sr'cCst|tdS)z7Return a copy of url with 'username:password@' removed.rr%r r:r:r;r.Esr.cCst|tdS)z.Replace the password in a given url with ****.r)r!r$r(r:r:r;redact_auth_from_urlLsr)c@sJeZdZeeddddZedddZeddd Zeed d d Z dS) HiddenTextN)secretredactedr1cCs||_||_dSr)r+r,)rr+r,r:r:r;__init__RszHiddenText.__init__r0cCsdt|S)Nz)r8rjrr:r:r;__repr__VszHiddenText.__repr__cCs|jSrr,rr:r:r;__str__YszHiddenText.__str__)otherr1cCs t|t|krdS|j|jkS)NF)rr+)rr1r:r:r;__eq__]szHiddenText.__eq__) rrrrjr-r.r0rboolr2r:r:r:r;r*Qsr*)rr1cCs t|ddS)Nrr/)r*)rr:r:r; hide_valuefsr4cCst|}t||dS)Nr/)r)r*)r r,r:r:r;hide_urljsr5) modifying_pipr1cCszddtjddjtjddg}|oBtoBtjtjd|v}|rvtjddgtjd d}t d d |dS) zProtection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... zpip.exez pip{}.exerz pip{}.{}.exeNrz-mrHrhz3To modify pip, please run the following command: {}r) r8rJ version_inforr2r3rIrKrLrr4)r6 pip_namesshould_show_use_python_msg new_commandr:r:r;(protect_pip_from_modification_on_windowsosr;cCstjduotjS)zIs this console interactive?N)rJstdinisattyr:r:r:r;is_console_interactivesr>)r3 blocksizer1cCsft}d}t|d8}t||dD]}|t|7}||q$Wdn1sT0Y||fS)z5Return (hash, length) for path using hashlib.sha256()rrb)rN)hashlibsha256openrr@update)r3r@hlengthrblockr:r:r; hash_files  *rIcCs&z ddl}Wnty YdS0dS)z8 Return whether the wheel package is installed. rNFT)wheel ImportError)rJr:r:r;is_wheel_installeds   rL)iterabler1cCst|}t||S)zb Return paired elements. For example: s -> (s0, s1), (s2, s3), (s4, s5), ... )iterr)rMr:r:r;pairwisesrO)predrMr1cCs t|\}}t||t||fS)z Use a predicate to partition entries into false entries and true entries, like partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 )rrfilter)rPrMt1t2r:r:r; partitions rT)F)rf)T)r)r?)} contextlibrDrrBiologgingr2rrWr[rJ urllib.parserr itertoolsrrrtypesrtypingrrr r r r r rrrrrrpip._vendor.pkg_resourcesrpip._vendor.tenacityrrrrHrpip._internal.exceptionsrpip._internal.locationsrrrrpip._internal.utils.compatrpip._internal.utils.egg_linkr pip._internal.utils.virtualenvr!__all__ getLoggerrrr/ BaseExceptionExcInforr?rjrr<rAr-r+r3r"rXr#r$ruryr%rrrfloatr'rr(DEFAULT_BUFFER_SIZErrr)r&r*rrrrrrrrrcontextmanagerrr,rrrrr rrr!r#r$r'r.r)r*r4r5r;r>rIrLrOrTr:r:r:r;s  <         "    (          "   PK,]܇}}(utils/__pycache__/appdirs.cpython-39.pycnu[a Re@s|dZddlZddlZddlmZddlmZeedddZ dee ed d d Z dee ed d d Z eeedddZ dS)z This code wraps the vendored appdirs module to so the return values are compatible for the current pip code base. The intention is to rewrite current usages gradually, keeping the tests pass, and eventually drop this after all usages are changed. N)List) platformdirs)appnamereturncCstj|ddS)NF) appauthor)_appdirsuser_cache_dir)rr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/appdirs.pyrsrT)rroamingrcCsBtj|d|d}tj|r |Sd}|r6tj||}tj|S)NFrr z ~/.config/)r user_data_dirospathisdirjoin expanduser)rr rlinux_like_pathr r r _macos_user_config_dirs rcCs$tjdkrt||Stj|d|dS)NdarwinFr )sysplatformrruser_config_dir)rr r r r r"s  rcCsNtjdkrtj|dddgStj|ddd}tjdkr<|gS|tjdgS)NrFT)r multipathwin32z/etc)rrr site_data_dirsite_config_dirsplitrpathsep)rdirvalr r r site_config_dirs+s   r )T)T)__doc__rrtypingr pip._vendorrrstrrboolrrr r r r r s   PK,]VЋ)utils/__pycache__/temp_dir.cpython-39.pycnu[a Re@sUddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZeeZedddZedd d d Zdae eed <ee dd ddZGdddZdae eed<ee ed ddZGdddZeZGdddZ Gddde Z!dS)N) ExitStackcontextmanager)AnyDictIteratorOptionalTypeVarUnion)enumrmtree_T TempDirectory)boundz build-envzephem-wheel-cachez req-build) BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILD_tempdir_managerreturnccsJt0}t|}azdVW|an|a0Wdn1s<0YdSN)rr)stackold_tempdir_managerr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.pyglobal_tempdir_managers  rc@s@eZdZdZddddZeeddddZeed d d ZdS) TempDirectoryTypeRegistryzManages temp directory behaviorNrcCs i|_dSr_should_deleteselfrrr__init__*sz"TempDirectoryTypeRegistry.__init__)kindvaluercCs||j|<dS)z[Indicate whether a TempDirectory of the given kind should be auto-deleted. Nr)rr!r"rrr set_delete-sz$TempDirectoryTypeRegistry.set_deleter!rcCs|j|dS)z^Get configured auto-delete flag for a given TempDirectory type, default True. T)rget)rr!rrr get_delete3sz$TempDirectoryTypeRegistry.get_delete) __name__ __module__ __qualname____doc__r strboolr#r&rrrrr'sr_tempdir_registryccs$t}taztVW|an|a0dS)zuProvides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. N)r-r)old_tempdir_registryrrrtempdir_registry=s r/c@s eZdZdS)_DefaultN)r'r(r)rrrrr0Ksr0cseZdZdZdeddfeeeede feedfdd Z e edd d Z edd d Z eed ddZeeeddddZeedddZddddZZS)r aMHelper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. NtempF)pathdeleter!globally_managedcslt|tur$|dur d}nd}|dur6||}||_d|_||_||_|rhtdus^Jt |dS)NF) superr _default_create_path_deletedr3r!r enter_context)rr2r3r!r4 __class__rrr gs   zTempDirectory.__init__rcCs|jrJd|j|jS)Nz"Attempted to access deleted path: )r9r8rrrrr2szTempDirectory.pathcCsd|jjd|jdS)N< >)r<r'r2rrrr__repr__szTempDirectory.__repr__)rrcCs|Srrrrrr __enter__szTempDirectory.__enter__)excr"tbrcCs8|jdur|j}ntr$t|j}nd}|r4|dS)NT)r3r-r&r!cleanup)rrBr"rCr3rrr__exit__s zTempDirectory.__exit__r$cCs,tjtjd|dd}td||S)zs2      ^PK,] ש&utils/__pycache__/wheel.cpython-39.pycnu[a Re@s0dZddlZddlmZddlmZddlmZmZddl m Z m Z ddl m Z ddlmZmZdd lmZdd lmZd ZeeZGd d d eZe eeedddZe eeeefdddZe eedddZe eedddZe eedddZ eee!dfddd Z"ee!dfedd!d"d#Z#dS)$z0Support functions for working with wheel files. N)Message)Parser)DictTuple) BadZipFileZipFile)canonicalize_name)DistInfoDistribution Distribution)UnsupportedWheel) DictMetadata)rcsFeZdZdZeeefeddfdd Zeedfdd ZZ S) WheelMetadatazaMetadata provider that maps metadata decoding exceptions to our internal exception type. N)metadata wheel_namereturncst|||_dS)N)super__init__ _wheel_name)selfrr __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/wheel.pyrs zWheelMetadata.__init__)namerc sNzt|WStyH}z"td|jd|WYd}~n d}~00dS)NzError decoding metadata for : )r get_metadataUnicodeDecodeErrorr r)rrerrrrs zWheelMetadata.get_metadata) __name__ __module__ __qualname____doc__rstrbytesrr __classcell__rrrrrsr) wheel_ziprlocationrc st||\}fdd|D}i}|D]`}|dd\}}zt||||<Wq,ty}z td|t|WYd}~q,d}~00q,t||} t|| |dS)zaGet a pkg_resources distribution given a wheel. :raises UnsupportedWheel: on any errors cs g|]}|dr|qS)/) startswith.0pinfo_dirrr 2z8pkg_resources_distribution_for_wheel..r(r {} has an invalid wheel, {}N)r'r project_name) parse_wheelnamelistsplitread_wheel_metadata_filer formatr#rr ) r&rr'_metadata_files metadata_textpath metadata_namerrrr-r$pkg_resources_distribution_for_wheel)s, r=)r&rrc Cslz t||}t||}t|}Wn8tyX}z td|t|WYd}~n d}~00t||||fS)zExtract information from the provided wheel, ensuring it meets basic standards. Returns the name of the .dist-info directory and the parsed WHEEL metadata. r1N)wheel_dist_info_dirwheel_metadata wheel_versionr r7r#check_compatibility)r&rr.rversionrrrrr3Bs   * r3)sourcerrcCsdd|D}dd|D}|s,tdt|dkrLtdd||d }t|}t|}||s~td |||S) zReturns the name of the contained .dist-info directory. Raises AssertionError or UnsupportedWheel if not found, >1 found, or it doesn't match the provided name. cSsh|]}|dddqS)r(r r)r5r*rrr [r0z&wheel_dist_info_dir..cSsg|]}|dr|qS)z .dist-info)endswith)r+srrrr/]r0z'wheel_dist_info_dir..z.dist-info directory not foundr z)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r})r4r lenr7joinrr))rCrsubdirs info_dirsr. info_dir_namecanonical_namerrrr>Ts$  r>)rCr;rc CsPz ||WStttfyJ}z td|d|WYd}~n d}~00dS)Nzcould not read z file: )readrKeyError RuntimeErrorr )rCr;rrrrr6us r6)rC dist_info_dirrc Csf|d}t||}z |}Wn8tyX}z td|d|WYd}~n d}~00t|S)ziReturn the WHEEL metadata of an extracted wheel, if possible. Otherwise, raise UnsupportedWheel. z/WHEELzerror decoding rN)r6decoderr rparsestr)rCrPr;wheel_contents wheel_textrrrrr?~s   *r?.) wheel_datarcCs\|d}|durtd|}zttt|dWStyVtd|Yn0dS)zbGiven WHEEL metadata, return the parsed Wheel-Version. Otherwise, raise UnsupportedWheel. z Wheel-VersionNzWHEEL is missing Wheel-Version.zinvalid Wheel-Version: )r striptuplemapintr5 ValueError)rU version_textrBrrrr@s r@)rBrrc CsR|dtdkr.td|dtt|n |tkrNtddtt|dS)aRaises errors or warns if called with an incompatible Wheel-Version. pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given rzB{}'s Wheel-Version ({}) is not compatible with this version of piprVz*Installing from a newer Wheel-Version (%s)N)VERSION_COMPATIBLEr r7rHrYr#loggerwarning)rBrrrrrAs rA)$r"logging email.messager email.parserrtypingrrzipfilerrpip._vendor.packaging.utilsrpip._vendor.pkg_resourcesr r pip._internal.exceptionsr !pip._internal.utils.pkg_resourcesr r] getLoggerrr^rr#r=r3r>r$r6r?rZr@rArrrrs*       ! PK,]>3utils/__pycache__/compatibility_tags.cpython-39.pycnu[a Re@s*dZddlZddlmZmZmZddlmZmZm Z m Z m Z m Z m Z mZedZeedfeddd Zeeed d d Zeeed d dZeeed ddZeeeeeedddZeedddZdeeeeedddZdeeeeeeeeeeeedddZdS)z3Generate and work with PEP 425 Compatibility Tags. N)ListOptionalTuple) PythonVersionTagcompatible_tags cpython_tags generic_tagsinterpreter_nameinterpreter_version mac_platformsz(.+)_(\d+)_(\d+)_(.+).) version_inforeturncCsdtt|ddS)N)joinmapstr)r r/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/compatibility_tags.pyversion_info_to_nodotsr)archrcsRt|}|rH|\}}}t|t|f}fddt||D}n|g}|S)Ncs$g|]}d|tddqS)z{}_{}macosx_N)formatlen).0rnamerr sz"_mac_platforms..) _osx_arch_patmatchgroupsintr )rr majorminor actual_arch mac_versionarchesrrr_mac_platformss   r(cCsj|g}|d\}}}|dkrL|dvrf|d|||d||n|dkrf|d|||S)N_ manylinux2014>i686x86_64 manylinux2010 manylinux1) partitionappend)rr' arch_prefixarch_sep arch_suffixrrr_custom_manylinux_platforms.sr4cCs@|d\}}}|dr$t|}n|dvr6t|}n|g}|S)Nr)macosx)r*r-)r/ startswithr(r4)rr1r2r3r'rrr_get_custom_platformsCs   r7) platformsrcsT|sdStg}|D]8}|vr$qfddt|D}|||q|S)Ncsg|]}|vr|qSrr)rcseenrrrXz-_expand_allowed_platforms..)setr7updateextend)r8resultp additionsrr:r_expand_allowed_platformsNs  rC)versionrcCs:t|dkr(t|dt|ddfSt|dfSdS)Nr)rr")rDrrr_get_python_version_s rF)implementationrDrcCs(|durt}|durt}||S)N)r r )rGrDrrr_get_custom_interpreterfs rH)rDr8implabisrcCs~g}d}|durt|}t||}t|}|p2tdk}|rR|t|||dn|t|||d|t|||d|S)aVReturn a list of supported tags for each version specified in `versions`. :param version: a string version, of the form "33" or "32", or None. The version will be assumed to support our ABI. :param platform: specify a list of platforms you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abis: specify a list of abis you want valid tags for, or None. If None, use the local interpreter abi. Ncp)python_versionrJr8) interpreterrJr8)rLrMr8)rFrHrCr r?rr r)rDr8rIrJ supportedrLrM is_cpythonrrr get_supportedps< rP)NN)NNNN)__doc__retypingrrrZpip._vendor.packaging.tagsrrrrr r r r compilerr"rrr(r4r7rCrFrHrPrrrrs4(      PK,]c3 +utils/__pycache__/virtualenv.cpython-39.pycnu[a Re @sddlZddlZddlZddlZddlZddlmZmZee Z e dZ e dddZe dddZe dd d Zeeedd d Ze dd dZe dddZe dddZdS)N)ListOptionalz8include-system-site-packages\s*=\s*(?Ptrue|false))returncCstjttdtjkS)znChecks if sys.base_prefix and sys.prefix match. This handles PEP 405 compliant virtual environments. base_prefix)sysprefixgetattrr r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/virtualenv.py_running_under_venvsr cCs ttdS)zmChecks if sys.real_prefix is set. This handles virtual environments created with pypa's virtualenv. real_prefix)hasattrrr r r r !_running_under_regular_virtualenvsrcCs tp tS)zBReturn True if we're running inside a virtualenv, False otherwise.)r rr r r r running_under_virtualenvsrcCshtjtjd}z>t|dd}|WdWS1sB0YWntybYdS0dS)zReads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines Returns None, if it could not read/access the file. z pyvenv.cfgzutf-8)encodingN) ospathjoinrropenread splitlinesOSError)pyvenv_cfg_filefr r r _get_pyvenv_cfg_lines$s 0 rcCsPt}|durtddS|D]*}t|}|dur |ddkr dSq dS)aZCheck `{sys.prefix}/pyvenv.cfg` for system site-packages inclusion PEP 405 specifies that when system site-packages are not supposed to be visible from a virtual environment, `pyvenv.cfg` must contain the following line: include-system-site-packages = false Additionally, log a warning if accessing the file fails. NzCould not access 'pyvenv.cfg' despite a virtual environment being active. Assuming global site-packages is not accessible in this environment.TvaluefalseF)rloggerwarning#_INCLUDE_SYSTEM_SITE_PACKAGES_REGEXmatchgroup) cfg_linesliner r r r _no_global_under_venv3s  r$cCs0tjtjtj}tj|d}tj|S)zCheck if "no-global-site-packages.txt" exists beside site.py This mirrors logic in pypa/virtualenv for determining whether system site-packages are visible in the virtual environment. zno-global-site-packages.txt)rrdirnameabspathsite__file__rexists) site_mod_dirno_global_site_packages_filer r r #_no_global_under_regular_virtualenvPs r,cCstr tStrtSdS)zHReturns a boolean, whether running in venv with no system site-packages.F)r r$rr,r r r r virtualenv_no_global^s r-)loggingrrer'rtypingrr getLogger__name__rcompilerboolr rrstrrr$r,r-r r r r s   PK,]Hgoo/utils/__pycache__/distutils_args.cpython-39.pycnu[a Re@sXddlmZddlmZddlmZmZgdZeeZee ee e fdddZ dS) )DistutilsArgError) FancyGetopt)DictList) )z exec-prefix=N)zhome=Nr)z install-base=Nr)z install-data=Nr)zinstall-headers=Nr)z install-lib=Nr)zinstall-platlib=Nr)zinstall-purelib=Nr)zinstall-scripts=Nr)zprefix=Nr)zroot=Nr)userNr)argsreturnc CsHi}|D]:}ztj|gd\}}Wnty4Yq0||jq|S)z~Parse provided arguments, returning an object that has the matched arguments. Any unknown arguments are ignored. )r)_distutils_getoptgetoptrupdate__dict__)rresultarg_matchr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/distutils_args.pyparse_distutils_argss rN) distutils.errorsrdistutils.fancy_getoptrtypingrr_optionsr strrrrrrs  PK,]D+  'utils/__pycache__/compat.cpython-39.pycnu[a Re\@sxdZddlZddlZddlZgdZeeZedddZ e e ddd Z hd Z ejd prejd korejd kZdS)zKStuff that differs in different Python versions and platform distributions.N) get_path_uid stdlib_pkgsWINDOWS)returncCs2zddl}WdSty Yn0ddlm}|S)NrT) IS_PYOPENSSL)_ssl ImportErrorpip._vendor.urllib3.utilr)rrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/compat.pyhas_tlss  r )pathrcCsbttdr6t|tjtjB}t|j}t|n(tj |sPt |j}nt |d|S)a) Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read. O_NOFOLLOWz/ is a symlink; Will not return uid for symlinks) hasattrosopenO_RDONLYrfstatst_uidcloser islinkstatOSError)r fdfile_uidr r r rs    r>argparsewsgirefpythonwinclint)__doc__loggingrsys__all__ getLogger__name__loggerboolr strintrrplatform startswithnamerr r r r s   PK,]E/ZZ,utils/__pycache__/entrypoints.cpython-39.pycnu[a Rej@sDddlZddlmZmZddlmZdeeeeedddZ dS) N)ListOptional)mainF)args_nowarnreturncCs|stjdt|S)aCentral wrapper for all old entrypoints. Historically pip has had several entrypoints defined. Because of issues arising from PATH, sys.path, multiple Pythons, their interactions, and most of them having a pip installed, users suffer every time an entrypoint gets moved. To alleviate this pain, and provide a mechanism for warning users and directing them to an appropriate place for help, we now define all of our old entrypoints as wrappers for the current one. aWARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. )sysstderrwriter)rrr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/entrypoints.py_wrappers r )NF) rtypingrrpip._internal.cli.mainrstrboolintr r r r r s PK,] 1utils/__pycache__/setuptools_build.cpython-39.pycnu[a ReY @s ddlZddlmZmZmZdZdeeeeeeedddZeeeeeeeedd d Z eeeeed d d Z eeeeeeeeeeeeedddZ eeeeeedddZ eeeeeeeeeeeeeeeeeeed ddZ dS)N)ListOptionalSequencea'import io, os, sys, setuptools, tokenize; sys.argv[0] = {0!r}; __file__={0!r};f = getattr(tokenize, 'open', open)(__file__) if os.path.exists(__file__) else io.StringIO('from setuptools import setup; setup()');code = f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))F) setup_py_pathglobal_optionsno_user_configunbuffered_outputreturncCsFtjg}|r|dg7}|dt|g7}|r4||7}|rB|dg7}|S)ao Get setuptools command arguments with shim wrapped setup file invocation. :param setup_py_path: The path to setup.py to be wrapped. :param global_options: Additional global options. :param no_user_config: If True, disables personal user configuration. :param unbuffered_output: If True, adds the unbuffered switch to the argument list. z-uz-cz --no-user-cfg)sys executable_SETUPTOOLS_SHIMformat)rrrrargsr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/setuptools_build.pymake_setuptools_shim_argss  r)rr build_optionsdestination_dirr cCs(t||dd}|dd|g7}||7}|S)NTrr bdist_wheelz-dr)rrrrrrrr make_setuptools_bdist_wheel_args/s r)rrr cCst||dd}|ddg7}|S)NTrcleanz--allr)rrrrrrmake_setuptools_clean_argsAs  r)rrinstall_optionsrprefixhome use_user_siter cCsf|r |r Jt|||d}|ddg7}||7}|r>|d|g7}|durR|d|g7}|rb|ddg7}|S)N)rrdevelopz --no-deps--prefixz --install-dir--user --prefix=r)rrrrrrrrrrrmake_setuptools_develop_argsLs     r")r egg_info_dirrr cCs*t||d}|dg7}|r&|d|g7}|S)N)regg_infoz --egg-baser)rr#rrrrrmake_setuptools_egg_info_argsls    r%) rrrrecord_filenamerootr header_dirrrr pycompiler c Cs|r |r J|r|rJt||| dd} | dd|g7} | dg7} |durT| d|g7} |durh| d|g7} |dur|| d|g7} |r| d d g7} | r| d g7} n | d g7} |r| d |g7} | |7} | S)NT)rrrinstallz--recordz#--single-version-externally-managedz--rootrz--homer r!z --compilez --no-compilez--install-headersr) rrrr&r'rr(rrrr)rrrrmake_setuptools_install_args{s2          r+)NFF)r typingrrrr strboolrrrr"r%r+rrrrsd      ! PK,]C(8HH3utils/__pycache__/direct_url_helpers.cpython-39.pycnu[a Re @sddlmZddlmZmZmZmZddlmZddl m Z ddl m Z ee e dddZe ed d d Zdeee eedddZd S))Optional) ArchiveInfo DirectUrlDirInfoVcsInfo)Link) path_to_url)vcs) direct_urlnamereturncCs||d}g}t|jtr>|d|jj|j|jj7}nHt|jtrl||j7}|jj r| |jj nt|jt s|J||j7}|j r| d|j |r|dd |7}|S)z0Convert a DirectUrl to a pip requirement string.z @ z{}+{}@{}z subdirectory=#&)validate isinstanceinforformatr url commit_idrhashappendr subdirectoryjoin)r r requirement fragmentsr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/direct_url_helpers.py%direct_url_as_pep440_direct_reference s$    r) source_dirr cCstt|tdddS)NT)editable)rr)rrr)rrrrdirect_url_for_editable sr NF)linkrlink_is_in_wheel_cacher c Cs|jrlt|j}|sJ||j\}}}|r>|s8J|}n|sFJ||}t|t|j ||d|j dS| rt|jt |j dSd}|j } | r| d|j}t|jt|d|j dSdS)N)r rrequested_revision)rrr=)r)is_vcsr get_backend_for_schemeschemeget_url_rev_and_authurl_without_fragment get_revisionrrr subdirectory_fragmentis_existing_dirr hash_namerr) r!rr" vcs_backendrr#_rrr-rrrdirect_url_from_link'sF    r0)NF)typingrpip._internal.models.direct_urlrrrrpip._internal.models.linkrpip._internal.utils.urlsrpip._internal.vcsr strrr boolr0rrrrs     PK,]>Yii*utils/__pycache__/unpacking.cpython-39.pycnu[a Re"@sdZddlZddlZddlZddlZddlZddlZddlmZm Z m Z ddlm Z ddl m Z ddlmZmZmZmZddlmZeeZeeZzddlZee7ZWneyedYn0zddlZee7ZWneyed Yn0ed d d Zee ed ddZ eee!dddZ"eee!dddZ#edd ddZ$e e!dddZ%d%eee!ddddZ&eeddd d!Z'd&eee edd"d#d$Z(dS)'zUtilities related archives. N)IterableListOptional)ZipInfo)InstallationError)BZ2_EXTENSIONSTAR_EXTENSIONS XZ_EXTENSIONSZIP_EXTENSIONS) ensure_dirzbz2 module is not availablezlzma module is not available)returncCstd}t||S)zBGet the current umask which involves having to set it temporarily.r)osumask)maskr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py current_umask+s  r)pathr cCsh|dd}d|vrHd|vr4|d|dkss r!) directorytargetr cCs0tj|}tj|}tj||g}||kS)zL Return true if the absolute path of target is within the directory )r rabspath commonprefix)r"r# abs_directory abs_targetrrrris_within_directoryMs  r(cCst|dt@dBdS)zx Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs iIN)r chmodrrrrr2set_extracted_file_to_default_mode_plus_executableXsr+)infor cCs$|jd?}t|o t|o |d@S)Nr)) external_attrboolstatS_ISREG)r,moderrrzip_item_is_executable`s r3T)filenamelocationflattenr c CsRt|t|d}z.tj|dd}t|o2|}|D]}|j}|}|rZt|d}t j ||}t j |} t ||sd} t| ||||ds|drt|qd}n8|trRd}n$|drfd}ntd|d }tj||d d }zt d d | D}| D]}|j }|rt |d}t j||}t||sd}t|||||rt|q|rhz|||WnDtyd} z*td||j | WYd} ~ qWYd} ~ n d} ~ 00qz||} WnHttfy} z*td||j | WYd} ~ qWYd} ~ n d} ~ 00tt j|| dusJt|d} t| | Wdn1s 0Y| ||||jd@rt |qW|n |0dS)a Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. z.gzz.tgzzr:gzzr:bz2zr:xzz.tarrz-Cannot determine compression type for file %szr:*zutf-8)encodingcSsg|] }|jqSr)rI).0memberrrr zuntar_file..rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNr9r))!r lowerrBrr loggerwarningtarfiler:r! getmembersrIrr rr?r(rrAisdirissym_extract_member Exception extractfileKeyErrorAttributeErrorr@rCrDrEutimer2r+) r4r5r2tarrHrSrJrrLexcrMrNrrr untar_filest      $" ,   re)r4r5 content_typer cCstj|}|dks,|ts,t|rDt|||d dnR|dkslt |sl|t t t rxt||ntd|||td|dS)Nzapplication/zipz.whl)r6zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )r rrealpathrVrBr r; is_zipfilerOrY is_tarfilerrr rerWcriticalr)r4r5rfrrr unpack_files,   rk)T)N))__doc__loggingr rCr0rYr;typingrrrrpip._internal.exceptionsrpip._internal.utils.filetypesrrr r pip._internal.utils.miscr getLogger__name__rWSUPPORTED_EXTENSIONSbz2 ImportErrordebuglzmaintrstrrr/r!r(r+r3rOrerkrrrrsL          .TPK,]u:( ,utils/__pycache__/deprecation.cpython-39.pycnu[a Re+ @sUdZddlZddlZddlmZmZmZmZmZddl m Z ddl m Z dZGdddeZdaeed <deeefeeeeeeeedd d d Zdd ddZdddeeeeeeeeeddddZdS)zN A module that implements tooling to enable easy warnings about deprecations. N)AnyOptionalTextIOTypeUnion)parse) __version__z DEPRECATION: c@s eZdZdS)PipDeprecationWarningN)__name__ __module__ __qualname__r r /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/deprecation.pyr sr _original_showwarning)messagecategoryfilenamelinenofilelinereturncCsZ|dur$tdurVt||||||n2t|trDtd}||nt||||||dS)Nzpip._internal.deprecations)r issubclassr logging getLoggerwarning)rrrrrrloggerr r r _showwarnings   r)rcCs(tjdtddtdur$tjatt_dS)NdefaultT)append)warnings simplefilterr r showwarningrr r r rinstall_warning_logger,sr") feature_flagissue)reason replacementgone_inr#r$rcCs|duottt|k}|tdf||s.dndf|df||sBdndf|dfg}dd d |D}|rpt|tj|td d dS) aHelper to deprecate existing functionality. reason: Textual reason shown to the user about why this functionality has been deprecated. Should be a complete sentence. replacement: Textual suggestion shown to the user about what alternative functionality they can use. gone_in: The version of pip does this functionality should get removed in. Raises an error if pip's current version is greater than or equal to this. feature_flag: Command-line flag of the form --use-feature={feature_flag} for testing upcoming functionality. issue: Issue number on the tracker that would serve as a useful place for users to find related discussion and provide feedback. Nz{}z*pip {} will enforce this behaviour change.z*Since pip {}, this is no longer supported.zA possible replacement is {}.zEYou can use the flag --use-feature={} to test the upcoming behaviour.z@Discussion can be found at https://github.com/pypa/pip/issues/{} css,|]$\}}|dur|dur||VqdS)N)format).0value format_strr r r nszdeprecated..)r stacklevel)rcurrent_versionDEPRECATION_MSG_PREFIXjoinr rwarn)r%r&r'r#r$is_gone message_partsrr r r deprecated7s2  r6)NN)__doc__rrtypingrrrrrZpip._vendor.packaging.versionrpiprr0r1Warningr r__annotations__strintrr"r6r r r rs<     PK,] 88+utils/__pycache__/filesystem.cpython-39.pycnu[a Re@sddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z mZmZmZmZddlmZmZmZddlmZddlmZeedd d Zeedd d d ZeedddZeee ee dddZedededdZ e ej!Z!eedddZ"eedddZ#eeeedddZ$eee%e&fdddZ'eedd d!Z(eee%e&fdd"d#Z)eedd$d%Z*dS)&N)contextmanager)NamedTemporaryFile)AnyBinaryIOIteratorListUnioncast)retrystop_after_delay wait_fixed) get_path_uid) format_size)pathreturncCstjdksttdsdStj|s(Jd}||krtj|rtdkrvz t|}Wnt ylYdS0|dkSt |tj Sq,|tj |}}q,dS)Nwin32geteuidTrF) sysplatformhasattrosrisabslexistsrr OSErroraccessW_OKdirname)rpreviouspath_uidr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/filesystem.pycheck_path_owners    r!)srcdestrc Csnzt||WnXtyh||fD]:}z t|}WntyHYq&0|r&td|dq&Yn0dS)zWrap shutil.copy2() but map errors copying socket files to SpecialFileError as expected. See also https://bugs.python.org/issue37700. `z ` is a socketN)shutilcopy2r is_socketSpecialFileError)r"r#fis_socket_filerrr copy2_fixed-s    r+cCstt|jSN)statS_ISSOCKrlstatst_moderrrr r'Dsr')rkwargsrc kstfdtj|tj|dd|T}tt|}z |VW|t| n|t| 0Wdn1s0YdS)a%Return a file-like object pointing to a tmp file next to path. The file is created securely and is ensured to be written to disk after the context reaches its end. kwargs will be passed to tempfile.NamedTemporaryFile to control the way the temporary file will be opened. Fz.tmp)deletedirprefixsuffixN) rrrrbasenamer rflushfsyncfileno)rr2r)resultrrr adjacent_tmp_fileHs    r<Tg?)reraisestopwaitcCsHtj|s(tj|}||kr"q(|}qtjdkr@t|tjSt|S)zgCheck if a directory is writable. Uses os.access() on POSIX, tries creating files on Windows. posix)rrisdirrnamerr_test_writable_dir_win)rparentrrr test_writable_diris   rFc sd}dtdD]}|dfddtdD}tj||}zt|tjtjBtjB}Wn&tyrYqt yYdS0t |t |d Sqt d dS) N(accesstest_deleteme_fishfingers_custard_$abcdefghijklmnopqrstuvwxyz0123456789 c3s|]}tVqdSr,)randomchoice).0_alphabetrr z)_test_writable_dir_win..FTz3Unexpected condition testing for writable directory) rangejoinrropenO_RDWRO_CREATO_EXCLFileExistsErrorPermissionErrorcloseunlinkr)rr7rNrCfilefdrrOr rD{s       rD)rpatternrcsBg}t|D].\}}t||}|fdd|Dq|S)zReturns a list of absolute paths of files beneath path, recursively, with filenames which match the UNIX-style shell glob pattern.c3s|]}tj|VqdSr,)rrrU)rMr)rootrr rQrRzfind_files..)rwalkfnmatchfilterextend)rr`r;rNfilesmatchesrrar find_filess  ricCstj|rdStj|S)Nr)rrislinkgetsizer1rrr file_sizes rlcCs tt|Sr,)rrlr1rrr format_file_sizesrmcCsBd}t|D].\}}}|D]}tj||}|t|7}qq|S)Ng)rrcrrUrl)rsizerb_dirsrgfilename file_pathrrr directory_sizes rrcCs tt|Sr,)rrrr1rrr format_directory_sizesrs)+rdros.pathrKr%r-r contextlibrtempfilertypingrrrrrr pip._vendor.tenacityr r r pip._internal.utils.compatr pip._internal.utils.miscrstrboolr!r+r'r<_replace_retryreplacerFrDriintfloatrlrmrrrsrrrr s4        PK,]8U1)utils/__pycache__/__init__.cpython-39.pycnu[a Re@sdS)Nrrr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/__init__.pyPK,]$9bb%utils/__pycache__/urls.cpython-39.pycnu[a Re@spddlZddlZddlZddlZddlmZddlmZe ee dddZ e e dd d Z e e dd d Z dS) N)Optional)WINDOWS)urlreturncCs d|vr dS|dddS)N:rr)splitlower)rr /builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/urls.pyget_url_scheme sr )pathrcCs.tjtj|}tjdtj|}|S)zh Convert a path to a file: URL. The path will be made absolute and have quoted path parts. file:) osr normpathabspathurllibparseurljoinrequest pathname2url)r rr r r path_to_urlsrcCs|dsJd|dtj|\}}}}}|r<|dkrBd}ntrPd|}ntd|tj||}tr|st|dkr|d d kr|d t j vr|d d dvr|d d}|S)z( Convert a file: URL to a path. rz1You can only turn file: urls into filenames (not ) localhostz\\z8non-local file URIs are not supported on this platform: r/r)rz:/N) startswithrrurlsplitr ValueErrorr url2pathnamelenstring ascii_letters)r_netlocr r r r url_to_paths8       r() rr$ urllib.parserurllib.requesttypingrcompatrstrr rr(r r r r s   PK,]+utils/__pycache__/subprocess.cpython-39.pycnu[a ReJ'@sddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZmZddlmZerddlmZe e eefZdZe eeefed d d Ze e eefed d d Ze e eefe ed ddZe e eefe ee eeedddZde e eefe e ede eee ee e eefe eee ee e e e ed ddZ!eeddddZ"dS)N) TYPE_CHECKINGAnyCallableIterableListMappingOptionalUnion)SpinnerInterface open_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger) HiddenText)Literalz(----------------------------------------)argsreturncGs2g}|D]$}t|tr"||q||q|S)z& Create a CommandArgs object. ) isinstancelistextendappend)r command_argsargr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py make_command!s    rcCsddd|DS)z/ Format command arguments for display.  css0|](}t|trtt|nt|VqdS)N)rrshlexquotestr.0rrrr ;sz&format_command_args..)joinrrrrformat_command_args2s r%cCsdd|DS)z= Return the arguments in their raw, unredacted form. cSs g|]}t|tr|jn|qSr)rrsecretr rrr Ez'reveal_command_args..rr$rrrreveal_command_argsAsr))cmd_argscwdlines exit_statusrcCs0t|}d|}dj|||t||td}|S)z Create and return the error message to use to log a subprocess error with command output. :param lines: A list of lines, each ending with a newline. zCommand errored out with exit status {exit_status}: command: {command_display} cwd: {cwd_display} Complete output ({line_count} lines): {output}{divider})r-command_display cwd_display line_countoutputdivider)r%r#formatlen LOG_DIVIDER)r*r+r,r-commandr2msgrrrmake_subprocess_output_errorHs   r9FraiseTz"Literal["raise", "warn", "ignore"]) cmd show_stdoutr+ on_returncodeextra_ok_returncodes command_desc extra_environ unset_environspinnerlog_failed_cmd stdout_onlyrc  Cs|dur g}|durg}|r*tj} tj} n tj} t} t| k} | oL|du}|dur^t|}| d|tj }|r| ||D]}| |dqz0t jt|t jt j| st jnt j||dd}Wn8ty}z | rtd||WYd}~n d}~00g}| s|jsJ|js"J|j|j}|s@qz|}||d| ||r,|snJ|q,z|W|jr|jn|jr|j0d|}nT|\}}|D]}| |q|||D]}| |q|||}|jo|j|v}|rL|s0J|rB| dn | d |r|d kr| s| rt!||||jd }t"|t#|j|n8|d krt$d ||j|n|dkrnt%d||S)a Args: show_stdout: if true, use INFO to log the subprocess's stderr and stdout streams. Otherwise, use DEBUG. Defaults to False. extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. unset_environ: an iterable of environment variable names to unset prior to calling subprocess.Popen(). log_failed_cmd: if false, failed commands are not logged, only raised. stdout_only: if true, return only stdout, else return both. When true, logging of both stdout and stderr occurs when the subprocess has terminated, else logging occurs as subprocess output is produced. NzRunning command %sbackslashreplace)stdinstdoutstderrr+enverrorsz#Error %s while executing command %s r.errordoner:)r*r+r,r-warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=)&rinfologgingINFOverboser getEffectiveLevelr%osenvironcopyupdatepop subprocessPopenr)PIPESTDOUT ExceptioncriticalrGrFclosereadlinerstriprspinwaitr# communicate splitlines returncodefinishr9rLr warning ValueError)r;r<r+r=r>r?r@rArBrCrDlog_subprocess used_levelshowing_subprocess use_spinnerrInameprocexc all_outputliner2outerrout_lineerr_lineproc_had_errorr8rrrcall_subprocessks                              ry).N)messagercs2dttttttttfddfdd }|S)zProvide a subprocess_runner that shows a spinner message. Intended for use with for pep517's Pep517HookCaller. Thus, the runner has an API that matches what's expected by Pep517HookCaller.subprocess_runner. N)r;r+r@rcs<t }t||||dWdn1s.0YdS)N)r+r@rB)r ry)r;r+r@rBrzrrrunners z+runner_with_spinner_message..runner)NN)rrrrr)rzr|rr{rrunner_with_spinner_message s  r}) FNr:NNNNNTF)#rQrUrrZtypingrrrrrrrr pip._internal.cli.spinnersr r pip._internal.exceptionsr pip._internal.utils.loggingr rpip._internal.utils.miscrrr CommandArgsr6rr%r)intr9boolryr}rrrrs^(      %   #PK,]*dm$m$(utils/__pycache__/logging.cpython-39.pycnu[a Re -@sddlZddlZddlZddlZddlZddlZddlmZddlmZm Z m Z m Z m Z m Z mZmZddlmZmZddlmZddlmZddlmZz ddlZWneyddlZYn0zddlmZWneydZYn0eZ ed Z!Gd d d eZ"ee#e#e$d d dZ%ej&d&e'e ddddZ(e'dddZ)Gdddej*Z+e,e e,ge,fdddZ-Gdddej.Z/Gdddej0j1Z2Gdd d eZ3Gd!d"d"eZ4e'e$e e,e'd#d$d%Z5dS)'N)Filter)IOAnyCallableIteratorOptionalTextIOTypecast)VERBOSE getLogger)WINDOWS)DEPRECATION_MSG_PREFIX) ensure_dir)coloramazpip.subprocessorc@seZdZdZdS)BrokenStdoutLoggingErrorzO Raised if BrokenPipeError occurs for the stdout stream while logging. N)__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/utils/logging.pyr!sr) exc_classexcreturncCs0|tur dStsdSt|to.|jtjtjfvS)NTF)BrokenPipeErrorr isinstanceOSErrorerrnoEINVALEPIPE)rrrrr_is_broken_pipe_error's r!)numrc csDtt_tj|7_zdVWtj|8_ntj|8_0dS)zv A context manager which will cause the log output to be indented for any log messages emitted inside it. N)get_indentation _log_state indentation)r#rrr indent_log4s r'rcCs ttddS)Nr&r)getattrr%rrrrr$Csr$csZeZdZdZddeeeddfddZeeedd d Z e j ed fd d Z Z S)IndentingFormatterz%Y-%m-%dT%H:%M:%SF) add_timestampN)argsr+kwargsrcs||_tj|i|dS)z A logging.Formatter that obeys the indent_log() context manager. :param add_timestamp: A bool indicating output lines should be prefixed with their record's timestamp. N)r+super__init__)selfr+r,r- __class__rrr/Js zIndentingFormatter.__init__) formattedlevelnorcCs.|tjkrdS|trdS|tjkr*dSdS)zv Return the start of the formatted log message (not counting the prefix to add to each line). z WARNING: zERROR: )loggingWARNING startswithrERROR)r0r3r4rrrget_message_startYs   z$IndentingFormatter.get_message_startrecordrcslt|}|||j}||}d|jr<||ddt7dfdd|dD}|S)z Calls the standard formatter, but will indent all of the log message lines by our current indentation level. r5 csg|] }|qSrr).0lineprefixrr vz-IndentingFormatter.format..T) r.formatr:r4r+ formatTimer$join splitlines)r0r<r3 message_startr1r@rrDis zIndentingFormatter.format)rrrdefault_time_formatrboolr/strintr:r6 LogRecordrD __classcell__rrr1rr*Gsr*)colorsrcsttdfdd }|S)N)inprcsdt|tjjgS)Nr5)rFlistrStyle RESET_ALL)rPrOrrwrapped{sz_color_wrap..wrapped)rK)rOrUrrTr _color_wrapzsrVcseZdZer2ejeejjfej eejj fgZ ngZ de e eddfdd ZedddZeddd Zejed fd d Zejdd fd d ZZS)ColorizedStreamHandlerN)streamno_colorrcs,t|||_tr(tr(t|j|_dSN)r.r/ _no_colorr r AnsiToWin32rX)r0rXrYr1rrr/s zColorizedStreamHandler.__init__r(cCs.tr"tr"ttj|j}|jtjuS|jtjuS)zA Return whether the handler is using sys.stdout. )r rr r\rXrUsysstdout)r0rXrrr _using_stdouts z$ColorizedStreamHandler._using_stdoutcCsXtr |jrdSt|jtjs"|jn|jj}t|dr@|r@dStj ddkrTdSdS)NFisattyTTERMANSI) rr[rrXr\rUhasattrr`osenvironget)r0 real_streamrrr should_colors  z#ColorizedStreamHandler.should_colorr;cs>t|}|r:|jD]\}}|j|kr||}q:q|SrZ)r.rDrhCOLORSr4)r0r<msglevelcolorr1rrrDs  zColorizedStreamHandler.formatcs@tdd\}}|r4|r4|r4t||r4tt|S)Nr")r]exc_infor_r!rr. handleError)r0r<rrr1rrrnsz"ColorizedStreamHandler.handleError)NN)rrrrr6r9rVForeREDr7YELLOWrirrrJr/r_rhrMrKrDrnrNrrr1rrWs  rWcs&eZdZeedfdd ZZS)BetterRotatingFileHandlerr(csttj|jtSrZ)rrdpathdirname baseFilenamer._open)r0r1rrrvszBetterRotatingFileHandler._open)rrrrrrvrNrrr1rrrsrrc@s.eZdZeddddZejedddZdS)MaxLevelFilterN)rkrcCs ||_dSrZ)rk)r0rkrrrr/szMaxLevelFilter.__init__r;cCs |j|jkSrZ)r4rkr0r<rrrfilterszMaxLevelFilter.filter) rrrrLr/r6rMrJryrrrrrwsrwcs*eZdZdZejedfdd ZZS)ExcludeLoggerFilterzQ A logging Filter that excludes records from a logger (or its children). r;cst| SrZ)r.ryrxr1rrryszExcludeLoggerFilter.filter) rrrrr6rMrJryrNrrr1rrzsrz) verbosityrY user_log_filerc Cs~|dkrtj}nD|dkrt}n6|dkr.tj}n&|dkr>tj}n|dkrNtj}ntj}t|}|du}|rt|}d}nd}|}|d vrd nd}d d d } ddd} gd|rdgng} tj dddtjddt j ddt j ddt ddt dddd|| d|| d d!d"gd#d$d | d|| d%d!gd#d$|| d|| d%d&gd#d$d| d'|d(dd)d*d+|| d,d-d.|iid/|S)0znConfigures and sets up all of the logging Returns the requested logging level, as its integer value. r"NDEBUGz /dev/null)INFOr9r7zext://sys.stdoutzext://sys.stderr)r^stderrz2pip._internal.utils.logging.ColorizedStreamHandlerz5pip._internal.utils.logging.BetterRotatingFileHandler)rXfile)consoleconsole_errorsconsole_subprocessuser_logFz*pip._internal.utils.logging.MaxLevelFilter)()rkzlogging.Filter)rnamez/pip._internal.utils.logging.ExcludeLoggerFilter)exclude_warningsrestrict_to_subprocessexclude_subprocessz %(message)s)rrDT)rrDr+)indentindent_with_timestamprXr^rrr)rkclassrYrXfilters formatterrrrzutf-8r)rkrfilenameencodingdelayr)rrrr)rkhandlersz pip._vendorrk)versiondisable_existing_loggersr formattersrrootloggers) r6rr r7r9CRITICALr getLevelNameconfig dictConfigsubprocess_loggerrr*) r{rYr| level_numberrkinclude_user_logadditional_log_file root_levelvendored_log_level log_streamshandler_classesrrrr setup_loggings      % Ir)r")6 contextlibrr6logging.handlersrdr]rtypingrrrrrrr r Zpip._internal.utils._logr r pip._internal.utils.compatr pip._internal.utils.deprecationrpip._internal.utils.miscr threading ImportErrorZdummy_threading pip._vendorr Exceptionlocalr%rr BaseExceptionrJr!contextmanagerrLr'r$ Formatterr*rKrV StreamHandlerrWrRotatingFileHandlerrrrwrzrrrrrsB (        3Q PK,]utils/compatibility_tags.pynu["""Generate and work with PEP 425 Compatibility Tags. """ import re from typing import List, Optional, Tuple from pip._vendor.packaging.tags import ( PythonVersion, Tag, compatible_tags, cpython_tags, generic_tags, interpreter_name, interpreter_version, mac_platforms, ) _osx_arch_pat = re.compile(r"(.+)_(\d+)_(\d+)_(.+)") def version_info_to_nodot(version_info: Tuple[int, ...]) -> str: # Only use up to the first two numbers. return "".join(map(str, version_info[:2])) def _mac_platforms(arch: str) -> List[str]: match = _osx_arch_pat.match(arch) if match: name, major, minor, actual_arch = match.groups() mac_version = (int(major), int(minor)) arches = [ # Since we have always only checked that the platform starts # with "macosx", for backwards-compatibility we extract the # actual prefix provided by the user in case they provided # something like "macosxcustom_". It may be good to remove # this as undocumented or deprecate it in the future. "{}_{}".format(name, arch[len("macosx_") :]) for arch in mac_platforms(mac_version, actual_arch) ] else: # arch pattern didn't match (?!) arches = [arch] return arches def _custom_manylinux_platforms(arch: str) -> List[str]: arches = [arch] arch_prefix, arch_sep, arch_suffix = arch.partition("_") if arch_prefix == "manylinux2014": # manylinux1/manylinux2010 wheels run on most manylinux2014 systems # with the exception of wheels depending on ncurses. PEP 599 states # manylinux1/manylinux2010 wheels should be considered # manylinux2014 wheels: # https://www.python.org/dev/peps/pep-0599/#backwards-compatibility-with-manylinux2010-wheels if arch_suffix in {"i686", "x86_64"}: arches.append("manylinux2010" + arch_sep + arch_suffix) arches.append("manylinux1" + arch_sep + arch_suffix) elif arch_prefix == "manylinux2010": # manylinux1 wheels run on most manylinux2010 systems with the # exception of wheels depending on ncurses. PEP 571 states # manylinux1 wheels should be considered manylinux2010 wheels: # https://www.python.org/dev/peps/pep-0571/#backwards-compatibility-with-manylinux1-wheels arches.append("manylinux1" + arch_sep + arch_suffix) return arches def _get_custom_platforms(arch: str) -> List[str]: arch_prefix, arch_sep, arch_suffix = arch.partition("_") if arch.startswith("macosx"): arches = _mac_platforms(arch) elif arch_prefix in ["manylinux2014", "manylinux2010"]: arches = _custom_manylinux_platforms(arch) else: arches = [arch] return arches def _expand_allowed_platforms(platforms: Optional[List[str]]) -> Optional[List[str]]: if not platforms: return None seen = set() result = [] for p in platforms: if p in seen: continue additions = [c for c in _get_custom_platforms(p) if c not in seen] seen.update(additions) result.extend(additions) return result def _get_python_version(version: str) -> PythonVersion: if len(version) > 1: return int(version[0]), int(version[1:]) else: return (int(version[0]),) def _get_custom_interpreter( implementation: Optional[str] = None, version: Optional[str] = None ) -> str: if implementation is None: implementation = interpreter_name() if version is None: version = interpreter_version() return f"{implementation}{version}" def get_supported( version: Optional[str] = None, platforms: Optional[List[str]] = None, impl: Optional[str] = None, abis: Optional[List[str]] = None, ) -> List[Tag]: """Return a list of supported tags for each version specified in `versions`. :param version: a string version, of the form "33" or "32", or None. The version will be assumed to support our ABI. :param platform: specify a list of platforms you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abis: specify a list of abis you want valid tags for, or None. If None, use the local interpreter abi. """ supported: List[Tag] = [] python_version: Optional[PythonVersion] = None if version is not None: python_version = _get_python_version(version) interpreter = _get_custom_interpreter(impl, version) platforms = _expand_allowed_platforms(platforms) is_cpython = (impl or interpreter_name()) == "cp" if is_cpython: supported.extend( cpython_tags( python_version=python_version, abis=abis, platforms=platforms, ) ) else: supported.extend( generic_tags( interpreter=interpreter, abis=abis, platforms=platforms, ) ) supported.extend( compatible_tags( python_version=python_version, interpreter=interpreter, platforms=platforms, ) ) return supported PK,]_jjutils/entrypoints.pynu[import sys from typing import List, Optional from pip._internal.cli.main import main def _wrapper(args: Optional[List[str]] = None, _nowarn: bool = False) -> int: """Central wrapper for all old entrypoints. Historically pip has had several entrypoints defined. Because of issues arising from PATH, sys.path, multiple Pythons, their interactions, and most of them having a pip installed, users suffer every time an entrypoint gets moved. To alleviate this pain, and provide a mechanism for warning users and directing them to an appropriate place for help, we now define all of our old entrypoints as wrappers for the current one. """ if not _nowarn: sys.stderr.write( "WARNING: pip is being invoked by an old script wrapper. This will " "fail in a future version of pip.\n" "Please see https://github.com/pypa/pip/issues/5599 for advice on " "fixing the underlying issue.\n" "To avoid this problem you can invoke Python with '-m pip' instead of " "running pip directly.\n" ) return main(args) PK,]l=utils/datetime.pynu["""For when pip wants to check the date or time. """ import datetime def today_is_later_than(year: int, month: int, day: int) -> bool: today = datetime.date.today() given = datetime.date(year, month, day) return today > given PK,]>9utils/pkg_resources.pynu[from typing import Dict, Iterable, List from pip._vendor.pkg_resources import yield_lines class DictMetadata: """IMetadataProvider that reads metadata files from a dictionary.""" def __init__(self, metadata: Dict[str, bytes]) -> None: self._metadata = metadata def has_metadata(self, name: str) -> bool: return name in self._metadata def get_metadata(self, name: str) -> str: try: return self._metadata[name].decode() except UnicodeDecodeError as e: # Mirrors handling done in pkg_resources.NullProvider. e.reason += f" in {name} file" raise def get_metadata_lines(self, name: str) -> Iterable[str]: return yield_lines(self.get_metadata(name)) def metadata_isdir(self, name: str) -> bool: return False def metadata_listdir(self, name: str) -> List[str]: return [] def run_script(self, script_name: str, namespace: str) -> None: pass PK,]9utils/wheel.pynu["""Support functions for working with wheel files. """ import logging from email.message import Message from email.parser import Parser from typing import Dict, Tuple from zipfile import BadZipFile, ZipFile from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.pkg_resources import DistInfoDistribution, Distribution from pip._internal.exceptions import UnsupportedWheel from pip._internal.utils.pkg_resources import DictMetadata VERSION_COMPATIBLE = (1, 0) logger = logging.getLogger(__name__) class WheelMetadata(DictMetadata): """Metadata provider that maps metadata decoding exceptions to our internal exception type. """ def __init__(self, metadata: Dict[str, bytes], wheel_name: str) -> None: super().__init__(metadata) self._wheel_name = wheel_name def get_metadata(self, name: str) -> str: try: return super().get_metadata(name) except UnicodeDecodeError as e: # Augment the default error with the origin of the file. raise UnsupportedWheel( f"Error decoding metadata for {self._wheel_name}: {e}" ) def pkg_resources_distribution_for_wheel( wheel_zip: ZipFile, name: str, location: str ) -> Distribution: """Get a pkg_resources distribution given a wheel. :raises UnsupportedWheel: on any errors """ info_dir, _ = parse_wheel(wheel_zip, name) metadata_files = [p for p in wheel_zip.namelist() if p.startswith(f"{info_dir}/")] metadata_text: Dict[str, bytes] = {} for path in metadata_files: _, metadata_name = path.split("/", 1) try: metadata_text[metadata_name] = read_wheel_metadata_file(wheel_zip, path) except UnsupportedWheel as e: raise UnsupportedWheel("{} has an invalid wheel, {}".format(name, str(e))) metadata = WheelMetadata(metadata_text, location) return DistInfoDistribution(location=location, metadata=metadata, project_name=name) def parse_wheel(wheel_zip: ZipFile, name: str) -> Tuple[str, Message]: """Extract information from the provided wheel, ensuring it meets basic standards. Returns the name of the .dist-info directory and the parsed WHEEL metadata. """ try: info_dir = wheel_dist_info_dir(wheel_zip, name) metadata = wheel_metadata(wheel_zip, info_dir) version = wheel_version(metadata) except UnsupportedWheel as e: raise UnsupportedWheel("{} has an invalid wheel, {}".format(name, str(e))) check_compatibility(version, name) return info_dir, metadata def wheel_dist_info_dir(source: ZipFile, name: str) -> str: """Returns the name of the contained .dist-info directory. Raises AssertionError or UnsupportedWheel if not found, >1 found, or it doesn't match the provided name. """ # Zip file path separators must be / subdirs = {p.split("/", 1)[0] for p in source.namelist()} info_dirs = [s for s in subdirs if s.endswith(".dist-info")] if not info_dirs: raise UnsupportedWheel(".dist-info directory not found") if len(info_dirs) > 1: raise UnsupportedWheel( "multiple .dist-info directories found: {}".format(", ".join(info_dirs)) ) info_dir = info_dirs[0] info_dir_name = canonicalize_name(info_dir) canonical_name = canonicalize_name(name) if not info_dir_name.startswith(canonical_name): raise UnsupportedWheel( ".dist-info directory {!r} does not start with {!r}".format( info_dir, canonical_name ) ) return info_dir def read_wheel_metadata_file(source: ZipFile, path: str) -> bytes: try: return source.read(path) # BadZipFile for general corruption, KeyError for missing entry, # and RuntimeError for password-protected files except (BadZipFile, KeyError, RuntimeError) as e: raise UnsupportedWheel(f"could not read {path!r} file: {e!r}") def wheel_metadata(source: ZipFile, dist_info_dir: str) -> Message: """Return the WHEEL metadata of an extracted wheel, if possible. Otherwise, raise UnsupportedWheel. """ path = f"{dist_info_dir}/WHEEL" # Zip file path separators must be / wheel_contents = read_wheel_metadata_file(source, path) try: wheel_text = wheel_contents.decode() except UnicodeDecodeError as e: raise UnsupportedWheel(f"error decoding {path!r}: {e!r}") # FeedParser (used by Parser) does not raise any exceptions. The returned # message may have .defects populated, but for backwards-compatibility we # currently ignore them. return Parser().parsestr(wheel_text) def wheel_version(wheel_data: Message) -> Tuple[int, ...]: """Given WHEEL metadata, return the parsed Wheel-Version. Otherwise, raise UnsupportedWheel. """ version_text = wheel_data["Wheel-Version"] if version_text is None: raise UnsupportedWheel("WHEEL is missing Wheel-Version") version = version_text.strip() try: return tuple(map(int, version.split("."))) except ValueError: raise UnsupportedWheel(f"invalid Wheel-Version: {version!r}") def check_compatibility(version: Tuple[int, ...], name: str) -> None: """Raises errors or warns if called with an incompatible Wheel-Version. pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given """ if version[0] > VERSION_COMPATIBLE[0]: raise UnsupportedWheel( "{}'s Wheel-Version ({}) is not compatible with this version " "of pip".format(name, ".".join(map(str, version))) ) elif version > VERSION_COMPATIBLE: logger.warning( "Installing from a newer Wheel-Version (%s)", ".".join(map(str, version)), ) PK,]#/utils/distutils_args.pynu[from distutils.errors import DistutilsArgError from distutils.fancy_getopt import FancyGetopt from typing import Dict, List _options = [ ("exec-prefix=", None, ""), ("home=", None, ""), ("install-base=", None, ""), ("install-data=", None, ""), ("install-headers=", None, ""), ("install-lib=", None, ""), ("install-platlib=", None, ""), ("install-purelib=", None, ""), ("install-scripts=", None, ""), ("prefix=", None, ""), ("root=", None, ""), ("user", None, ""), ] # typeshed doesn't permit Tuple[str, None, str], see python/typeshed#3469. _distutils_getopt = FancyGetopt(_options) # type: ignore def parse_distutils_args(args: List[str]) -> Dict[str, str]: """Parse provided arguments, returning an object that has the matched arguments. Any unknown arguments are ignored. """ result = {} for arg in args: try: _, match = _distutils_getopt.getopt(args=[arg]) except DistutilsArgError: # We don't care about any other options, which here may be # considered unrecognized since our option list is not # exhaustive. pass else: result.update(match.__dict__) return result PK,]>S| | utils/parallel.pynu["""Convenient parallelization of higher order functions. This module provides two helper functions, with appropriate fallbacks on Python 2 and on systems lacking support for synchronization mechanisms: - map_multiprocess - map_multithread These helpers work like Python 3's map, with two differences: - They don't guarantee the order of processing of the elements of the iterable. - The underlying process/thread pools chop the iterable into a number of chunks, so that for very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. """ __all__ = ["map_multiprocess", "map_multithread"] from contextlib import contextmanager from multiprocessing import Pool as ProcessPool from multiprocessing import pool from multiprocessing.dummy import Pool as ThreadPool from typing import Callable, Iterable, Iterator, TypeVar, Union from pip._vendor.requests.adapters import DEFAULT_POOLSIZE Pool = Union[pool.Pool, pool.ThreadPool] S = TypeVar("S") T = TypeVar("T") # On platforms without sem_open, multiprocessing[.dummy] Pool # cannot be created. try: import multiprocessing.synchronize # noqa except ImportError: LACK_SEM_OPEN = True else: LACK_SEM_OPEN = False # Incredibly large timeout to work around bpo-8296 on Python 2. TIMEOUT = 2000000 @contextmanager def closing(pool: Pool) -> Iterator[Pool]: """Return a context manager making sure the pool closes properly.""" try: yield pool finally: # For Pool.imap*, close and join are needed # for the returned iterator to begin yielding. pool.close() pool.join() pool.terminate() def _map_fallback( func: Callable[[S], T], iterable: Iterable[S], chunksize: int = 1 ) -> Iterator[T]: """Make an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open is unavailable. """ return map(func, iterable) def _map_multiprocess( func: Callable[[S], T], iterable: Iterable[S], chunksize: int = 1 ) -> Iterator[T]: """Chop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. """ with closing(ProcessPool()) as pool: return pool.imap_unordered(func, iterable, chunksize) def _map_multithread( func: Callable[[S], T], iterable: Iterable[S], chunksize: int = 1 ) -> Iterator[T]: """Chop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. """ with closing(ThreadPool(DEFAULT_POOLSIZE)) as pool: return pool.imap_unordered(func, iterable, chunksize) if LACK_SEM_OPEN: map_multiprocess = map_multithread = _map_fallback else: map_multiprocess = _map_multiprocess map_multithread = _map_multithread PK,]Jx9? utils/_log.pynu["""Customize logging Defines custom logger class for the `logger.verbose(...)` method. init_logging() must be called before any other modules that call logging.getLogger. """ import logging from typing import Any, cast # custom log level for `--verbose` output # between DEBUG and INFO VERBOSE = 15 class VerboseLogger(logging.Logger): """Custom Logger, defining a verbose log-level VERBOSE is between INFO and DEBUG. """ def verbose(self, msg: str, *args: Any, **kwargs: Any) -> None: return self.log(VERBOSE, msg, *args, **kwargs) def getLogger(name: str) -> VerboseLogger: """logging.getLogger, but ensures our VerboseLogger class is returned""" return cast(VerboseLogger, logging.getLogger(name)) def init_logging() -> None: """Register our VerboseLogger and VERBOSE log level. Should be called before any calls to getLogger(), i.e. in pip._internal.__init__ """ logging.setLoggerClass(VerboseLogger) logging.addLevelName(VERBOSE, "VERBOSE") PK,]&] utils/direct_url_helpers.pynu[from typing import Optional from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo from pip._internal.models.link import Link from pip._internal.utils.urls import path_to_url from pip._internal.vcs import vcs def direct_url_as_pep440_direct_reference(direct_url: DirectUrl, name: str) -> str: """Convert a DirectUrl to a pip requirement string.""" direct_url.validate() # if invalid, this is a pip bug requirement = name + " @ " fragments = [] if isinstance(direct_url.info, VcsInfo): requirement += "{}+{}@{}".format( direct_url.info.vcs, direct_url.url, direct_url.info.commit_id ) elif isinstance(direct_url.info, ArchiveInfo): requirement += direct_url.url if direct_url.info.hash: fragments.append(direct_url.info.hash) else: assert isinstance(direct_url.info, DirInfo) requirement += direct_url.url if direct_url.subdirectory: fragments.append("subdirectory=" + direct_url.subdirectory) if fragments: requirement += "#" + "&".join(fragments) return requirement def direct_url_for_editable(source_dir: str) -> DirectUrl: return DirectUrl( url=path_to_url(source_dir), info=DirInfo(editable=True), ) def direct_url_from_link( link: Link, source_dir: Optional[str] = None, link_is_in_wheel_cache: bool = False ) -> DirectUrl: if link.is_vcs: vcs_backend = vcs.get_backend_for_scheme(link.scheme) assert vcs_backend url, requested_revision, _ = vcs_backend.get_url_rev_and_auth( link.url_without_fragment ) # For VCS links, we need to find out and add commit_id. if link_is_in_wheel_cache: # If the requested VCS link corresponds to a cached # wheel, it means the requested revision was an # immutable commit hash, otherwise it would not have # been cached. In that case we don't have a source_dir # with the VCS checkout. assert requested_revision commit_id = requested_revision else: # If the wheel was not in cache, it means we have # had to checkout from VCS to build and we have a source_dir # which we can inspect to find out the commit id. assert source_dir commit_id = vcs_backend.get_revision(source_dir) return DirectUrl( url=url, info=VcsInfo( vcs=vcs_backend.name, commit_id=commit_id, requested_revision=requested_revision, ), subdirectory=link.subdirectory_fragment, ) elif link.is_existing_dir(): return DirectUrl( url=link.url_without_fragment, info=DirInfo(), subdirectory=link.subdirectory_fragment, ) else: hash = None hash_name = link.hash_name if hash_name: hash = f"{hash_name}={link.hash}" return DirectUrl( url=link.url_without_fragment, info=ArchiveInfo(hash=hash), subdirectory=link.subdirectory_fragment, ) PK,][w]utils/egg_link.pynu[# The following comment should be removed at some point in the future. # mypy: strict-optional=False import os import re import sys from typing import Optional from pip._internal.locations import site_packages, user_site from pip._internal.utils.virtualenv import ( running_under_virtualenv, virtualenv_no_global, ) __all__ = [ "egg_link_path_from_sys_path", "egg_link_path_from_location", ] def _egg_link_name(raw_name: str) -> str: """ Convert a Name metadata value to a .egg-link name, by applying the same substitution as pkg_resources's safe_name function. Note: we cannot use canonicalize_name because it has a different logic. """ return re.sub("[^A-Za-z0-9.]+", "-", raw_name) + ".egg-link" def egg_link_path_from_sys_path(raw_name: str) -> Optional[str]: """ Look for a .egg-link file for project name, by walking sys.path. """ egg_link_name = _egg_link_name(raw_name) for path_item in sys.path: egg_link = os.path.join(path_item, egg_link_name) if os.path.isfile(egg_link): return egg_link return None def egg_link_path_from_location(raw_name: str) -> Optional[str]: """ Return the path for the .egg-link file if it exists, otherwise, None. There's 3 scenarios: 1) not in a virtualenv try to find in site.USER_SITE, then site_packages 2) in a no-global virtualenv try to find in site_packages 3) in a yes-global virtualenv try to find in site_packages, then site.USER_SITE (don't look in global location) For #1 and #3, there could be odd cases, where there's an egg-link in 2 locations. This method will just return the first one found. """ sites = [] if running_under_virtualenv(): sites.append(site_packages) if not virtualenv_no_global() and user_site: sites.append(user_site) else: if user_site: sites.append(user_site) sites.append(site_packages) egg_link_name = _egg_link_name(raw_name) for site in sites: egglink = os.path.join(site, egg_link_name) if os.path.isfile(egglink): return egglink return None PK, ]:AD$D$(__pycache__/wheel_builder.cpython-38.pycnu[U ʗRe1@sdZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZmZddlmZddlmZmZddlmZmZdd lmZdd lmZdd lm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6e7e8Z9e:dej;Ze e e&e e&fZ?e@e=dddZAe&e=e>e=dddZBe&e=dddZCe&e>e=d d!d"ZDe&e e=dd#d$ZEe&ee@d%d&d'ZFee=d(d)d*ZGe&e@dd+d,d-ZHe&e@e=e e@e e@e=e e@d.d/d0ZIe&e@e e@e e@e=e e@d1d2d3ZJe&e e@e=d4d5d6ZKe e&ee=e e@e e@e?d7d8d9ZLdS):z;Orchestrator for building wheels from InstallRequirements. N)AnyCallableIterableListOptionalTuple)canonicalize_namecanonicalize_version)InvalidVersionVersion) WheelCache)InvalidWheelFilenameUnsupportedWheel)FilesystemWheelget_wheel_distribution)Link)Wheel)build_wheel_pep517)build_wheel_editable)build_wheel_legacy)InstallRequirement) indent_log) ensure_dir hash_fileis_wheel_installed)make_setuptools_clean_args)call_subprocess) TempDirectory) path_to_url)vcsz([a-z0-9_.]+)-([a-z0-9_.!+-]+))sreturncCstt|S)zjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 )bool _egg_info_research)r r%/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/wheel_builder.py_contains_egg_info&sr')req need_wheelcheck_binary_allowedr!cCs|jr dS|jr&|r"td|jdS|r.dS|js8dS|jrF|S|jrPdS||sjtd|jdSt std|jdSdS)zBReturn whether an InstallRequirement should be built into a wheel.Fz(Skipping %s, due to already being wheel.TzCSkipping wheel build for %s, due to binaries being disabled for it.zOUsing legacy 'setup.py install' for %s, since package 'wheel' is not installed.) constraintis_wheelloggerinfoname source_direditablesupports_pyproject_editable use_pep517r)r(r)r*r%r%r& _should_build.s<r4)r(r!cCst|dtdS)NTr)r*)r4 _always_true)r(r%r%r&should_build_for_wheel_commandcsr7)r(r*r!cCst|d|dS)NFr5)r4)r(r*r%r%r& should_build_for_install_commandis r8cCs|js |jsdS|jrb|jjrb|jr(t|js2tt|jj}|sHt||jj |jr^dSdS|jslt|j \}}t |rdSdS)z Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. FT) r1r0linkis_vcsAssertionErrorrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr')r( vcs_backendbaseextr%r%r& _should_cachers    rD)r( wheel_cacher!cCs>t|j}|jst|r.t|r.||j}n ||j}|S)zdReturn the persistent or temporary cache directory where the built wheel need to be stored. )r" cache_dirr9r;rDget_path_for_linkget_ephem_path_for_link)r(rEcache_availablerFr%r%r&_get_cache_dirs     rJ)_r!cCsdS)NTr%)rKr%r%r&r6sr6)r( wheel_pathr!c Cst|jp d}ttj|}t|j|kr>td||jtt ||}t |j }t |t |j krztd||j |j }|dkrtdz t|}Wn&tk rd|}t|YnX|tdkrt|j tstd|dS)Nz7Wheel has unexpected file name: expected {!r}, got {!r}zMissing Metadata-VersionzInvalid Metadata-Version: z1.2z6Metadata 1.2 mandates PEP 440 version, but {!r} is not)rr/rospathbasenamer formatrrstrversionr metadata_versionrr r isinstance) r(rLcanonical_namewdist dist_verstrmetadata_version_valuerTmsgr%r%r& _verify_ones@   r\)r( output_dirverify build_optionsglobal_optionsr1r!c Cs|rdnd}z t|Wn:tk rR}ztd||j|WYdSd}~XYnX|jt|||||}W5QRX|r|rzt||Wn>tt fk r}ztd||j|WYdSd}~XYnX|S)zaBuild one wheel. :return: The filename of the built wheel, or None if the build failed. r1wheelzBuilding %s for %s failed: %sNzBuilt %s for %s is invalid: %s) rOSErrorr-warningr/ build_env_build_one_inside_envr\r r) r(r]r^r_r`r1artifacterLr%r%r& _build_ones4  rh)r(r]r_r`r1r!c Cs|tddf}|jst|jr|js(t|js2t|rDtd|j|rVtd|j|rtt|j|j|j|j d}qt |j|j|j|j d}nt |j|j |j |||j d}|dk rRtj |}tj ||}zNt|\} } t||td|j|| | td||WW5QRStk rP} ztd |j| W5d} ~ XYnX|jsdt||W5QRdSQRXdS) Nra)kindz7Ignoring --global-option when building %s using PEP 517z6Ignoring --build-option when building %s using PEP 517)r/backendmetadata_directorytempd)r/ setup_py_pathr0r`r_rlz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)rr/r;r3rkpep517_backendr-rcrrOrrrmunpacked_source_directoryrNrPjoinrshutilmover. hexdigest Exception_clean_one_legacy) r(r]r_r`r1temp_dirrL wheel_name dest_path wheel_hashlengthrgr%r%r&resx         re)r(r`r!cCs\t|j|d}td|jzt|d|jdWdStk rVtd|jYdSXdS)N)r`zRunning setup.py clean for %szpython setup.py clean) command_desccwdTz Failed cleaning build dir for %sF) rrmr-r.r/rr0rterror)r(r` clean_argsr%r%r&ru1sru) requirementsrEr^r_r`r!c Cs|s ggfStdddd|Dtgg}}|D]}|jsLtt||}t||||||jol|j } | r|j dk r| ||j t t | |_|jj|_|jjst||q>||q>W5QRX|rtdddd |D|rtd dd d |D||fS) zBuild wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build. z*Building wheels for collected packages: %sz, css|] }|jVqdS)Nr/.0r(r%r%r& Tszbuild..NzSuccessfully built %s cSsg|] }|jqSr%rrr%r%r& wszbuild..zFailed to build %scSsg|] }|jqSr%rrr%r%r&r|s)r-r.rprr/r;rJrhr1permit_editable_wheels download_inforecord_download_originrrr9 file_pathlocal_file_pathr,append) rrEr^r_r`build_successesbuild_failuresr(rF wheel_filer%r%r&buildBsL         r)M__doc__loggingos.pathrNrerqtypingrrrrrrpip._vendor.packaging.utilsrr Zpip._vendor.packaging.versionr r pip._internal.cacher pip._internal.exceptionsr rpip._internal.metadatarrpip._internal.models.linkrpip._internal.models.wheelr$pip._internal.operations.build.wheelr-pip._internal.operations.build.wheel_editabler+pip._internal.operations.build.wheel_legacyrZpip._internal.req.req_installrpip._internal.utils.loggingrpip._internal.utils.miscrrr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrpip._internal.utils.urlsrpip._internal.vcsr getLogger__name__r-compile IGNORECASEr#r"BinaryAllowedPredicate BuildResultrRr'r4r7r8rDrJr6r\rhrerurr%r%r%r&s                 6   !  ' GPK, ].Vy)commands/__pycache__/index.cpython-38.pycnu[U ʗRe@sddlZddlmZddlmZmZmZmZmZddl m Z m Z ddl m Z ddlmZddlmZmZddlmZdd lmZmZmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$e%e&Z'GdddeZ(dS)N)Values)AnyIterableListOptionalUnion) LegacyVersionVersion) cmdoptions)IndexGroupCommand)ERRORSUCCESS)print_dist_installation_info) CommandErrorDistributionNotFoundPipError) LinkCollector) PackageFinder)SelectionPreferences) TargetPython) PipSession) write_outputc@sneZdZdZdZddddZeeee ddd Z dee e e e eed d d Zeeeddd dZdS) IndexCommandz= Inspect information available from package indexes. z& %prog versions N)returncCs~t|j|jt|jt|jt|jtttj |j }|j d||j d|jdS)Nr) r add_target_python_optionscmd_opts add_optionignore_requires_pythonpre no_binary only_binarymake_option_group index_groupparserinsert_option_group)self index_optsr'/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/index.py add_optionss zIndexCommand.add_options)optionsargsrc Csd|ji}td|r$|d|kr>tddt|tS|d}z||||ddWn:tk r}zt|jdtWYSd}~XYnXt S)Nversionsztpip index is currently an experimental command. It may be removed/changed in a future release without prior warning.rzNeed an action (%s) to perform., ) get_available_package_versionsloggerwarningerrorjoinsortedr rr+r )r%r*r+handlersactioner'r'r(run/s& zIndexCommand.run)r*session target_pythonrrcCs.tj||d}td|j|d}tj|||dS)zK Create a package finder appropriate to the index command. )r*F) allow_yankedallow_all_prereleasesr)link_collectorselection_prefsr:)rcreaterrr)r%r*r9r:rr=r>r'r'r(_build_package_finderMs z"IndexCommand._build_package_finderc Cst|dkrtdt|}|d}||z}|j||||jd}dd||D}|jsndd|D}t |}|st d |d d t |d d D}|d} W5QRXt d || t d d|t|| dS)Nr.z(You need to specify exactly one argumentr)r*r9r:rcss|] }|jVqdSN)version).0 candidater'r'r( usz>IndexCommand.get_available_package_versions..css|]}|js|VqdSrA) is_prerelease)rCrBr'r'r(rE{sz%No matching distribution found for {}cSsg|] }t|qSr')str)rCverr'r'r( sz?IndexCommand.get_available_package_versions..T)reversez{} ({})zAvailable versions: {}r-)lenrr make_target_python_build_sessionr@rfind_all_candidatesrsetrformatr4rr3r) r%r*r+r:queryr9finderr,Zformatted_versionsZlatestr'r'r(r/fs8   z+IndexCommand.get_available_package_versions)NN)__name__ __module__ __qualname____doc__usager)rrrGintr8rrrboolrr@rr/r'r'r'r(rs" r))loggingoptparsertypingrrrrrZpip._vendor.packaging.versionrr Zpip._internal.clir pip._internal.cli.req_commandr pip._internal.cli.status_codesr r Zpip._internal.commands.searchrpip._internal.exceptionsrrrpip._internal.index.collectorr"pip._internal.index.package_finderr$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.network.sessionrpip._internal.utils.miscr getLoggerrSr0rr'r'r'r(s            PK, ][5)commands/__pycache__/cache.cpython-38.pycnu[U ʗRe@sddlZddlZddlmZddlmZmZddlmm m Z ddl m Z ddl mZmZddlmZmZddlmZeeZGdd d e ZdS) N)Values)AnyList)Command)ERRORSUCCESS) CommandErrorPipError) getLoggerc@seZdZdZdZdZddddZeee e dd d Z eee ddd d Z eee ddd dZeee ddddZee ddddZee ddddZeee ddddZeee ddddZee e dddZeee dddZee ee d d!d"ZdS)# CacheCommandaw Inspect and manage pip's wheel cache. Subcommands: - dir: Show the cache directory. - info: Show information about the cache. - list: List filenames of packages stored in the cache. - remove: Remove one or more package from the cache. - purge: Remove all items from the cache. ```` can be a glob expression or a package name. Tz %prog dir %prog info %prog list [] [--format=[human, abspath]] %prog remove %prog purge N)returncCs,|jjddddddd|jd|jdS) Nz--formatstore list_formathuman)rabspathz:Select the output format among: human (default) or abspath)actiondestdefaultchoiceshelpr)cmd_opts add_optionparserinsert_option_group)selfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/cache.py add_options's zCacheCommand.add_options)optionsargsr c Cs|j|j|j|j|jd}|js.tdtS|r>|d|krXtdd t |tS|d}z||||ddWn:t k r}zt|j dtWYSd}~XYnXt S)N)dirinfolistremovepurgezrEr,warningrNunlinkverboser!)rrrrKZno_matching_msgrTrrrr)s    zCacheCommand.remove_cache_itemscCs|r td||dgS)Nr3r5)rr)r4rrrr*szCacheCommand.purge_cache)rsubdirr cCstj|j|S)N)rNrOr.r+)rrrZrrrr@szCacheCommand._cache_dir)rr cCs||d}t|dS)Nr6r5r@rA find_files)rrZhttp_dirrrrr>s zCacheCommand._find_http_files)rrJr cCs,||d}|d|krdnd}t||S)Nr7-z*.whlz-*.whlr[)rrrJ wheel_dirrrrr?s zCacheCommand._find_wheels)__name__ __module__ __qualname____doc__ignore_require_venvusagerrrstrintr2rr&r'r(rHrIr)r*r@r>r?rrrrr s  $  r )rNrCoptparsertypingrrpip._internal.utils.filesystem _internalutilsrApip._internal.cli.base_commandrpip._internal.cli.status_codesrrpip._internal.exceptionsrr pip._internal.utils.loggingr r_r,r rrrrs   PK, ]a a +commands/__pycache__/inspect.cpython-38.pycnu[U ʗRe. @sddlZddlmZddlmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZdd lmZdd lmZeeZGd ddeZdS)N)Values)AnyDictList)default_environment) print_json) __version__) cmdoptions)Command)SUCCESS)BaseDistributionget_environment) stdlib_pkgs) path_to_urlc@sTeZdZdZdZdZddddZeee e dd d Z e e e efd d d ZdS)InspectCommandzZ Inspect the content of a Python environment and produce a report in JSON format. Tz %prog [options]N)returncCsN|jjddddd|jjdddddd |jt|jd |jdS) Nz--local store_trueFzSIf in a virtualenv that has global access, do not list globally-installed packages.)actiondefaulthelpz--useruserz,Only output packages installed in user-site.)destrrrr)cmd_opts add_optionr list_pathparserinsert_option_groupselfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/inspect.py add_optionss zInspectCommand.add_options)optionsargsrcs^tdt|t|jj|j|jt t d}dt fdd|Dt d}t |dtS)Nzypip inspect is currently an experimental command. The output format may change in a future release without prior warning.) local_only user_onlyskip0csg|]}|qSr) _dist_to_dict).0distrrr ?sz&InspectCommand.run..)version pip_version installed environment)data)loggerwarningr check_list_path_optionr pathiter_installed_distributionslocalrsetrrrrr )rr"r#distsoutputrrr run0s    zInspectCommand.run)r*rcCsv|j|jd}|j}|dk r*||d<n$|j}|dk rNt|ddid|d<|j}|jrb||d<|jrr|j|d<|S)N)metadataZmetadata_location direct_urleditableT)urldir_info installer requested) metadata_dict info_locationr<to_dicteditable_project_locationrr@installed_with_dist_inforA)rr*resr<rEr@rrr r(Fs&  zInspectCommand._dist_to_dict)__name__ __module__ __qualname____doc__ignore_require_venvusager!rrstrintr:r rrr(rrrr rs r)loggingoptparsertypingrrrZpip._vendor.packaging.markersrpip._vendor.richrpiprZpip._internal.clir pip._internal.cli.req_commandr pip._internal.cli.status_codesr pip._internal.metadatar r pip._internal.utils.compatrpip._internal.utils.urlsr getLoggerrHr1rrrrr s          PK, ](Q%{. . commands/inspect.pynu[import logging from optparse import Values from typing import Any, Dict, List from pip._vendor.packaging.markers import default_environment from pip._vendor.rich import print_json from pip import __version__ from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.metadata import BaseDistribution, get_environment from pip._internal.utils.compat import stdlib_pkgs from pip._internal.utils.urls import path_to_url logger = logging.getLogger(__name__) class InspectCommand(Command): """ Inspect the content of a Python environment and produce a report in JSON format. """ ignore_require_venv = True usage = """ %prog [options]""" def add_options(self) -> None: self.cmd_opts.add_option( "--local", action="store_true", default=False, help=( "If in a virtualenv that has global access, do not list " "globally-installed packages." ), ) self.cmd_opts.add_option( "--user", dest="user", action="store_true", default=False, help="Only output packages installed in user-site.", ) self.cmd_opts.add_option(cmdoptions.list_path()) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: List[str]) -> int: logger.warning( "pip inspect is currently an experimental command. " "The output format may change in a future release without prior warning." ) cmdoptions.check_list_path_option(options) dists = get_environment(options.path).iter_installed_distributions( local_only=options.local, user_only=options.user, skip=set(stdlib_pkgs), ) output = { "version": "0", "pip_version": __version__, "installed": [self._dist_to_dict(dist) for dist in dists], "environment": default_environment(), # TODO tags? scheme? } print_json(data=output) return SUCCESS def _dist_to_dict(self, dist: BaseDistribution) -> Dict[str, Any]: res: Dict[str, Any] = { "metadata": dist.metadata_dict, "metadata_location": dist.info_location, } # direct_url. Note that we don't have download_info (as in the installation # report) since it is not recorded in installed metadata. direct_url = dist.direct_url if direct_url is not None: res["direct_url"] = direct_url.to_dict() else: # Emulate direct_url for legacy editable installs. editable_project_location = dist.editable_project_location if editable_project_location is not None: res["direct_url"] = { "url": path_to_url(editable_project_location), "dir_info": { "editable": True, }, } # installer installer = dist.installer if dist.installer: res["installer"] = installer # requested if dist.installed_with_dist_info: res["requested"] = dist.requested return res PK, ]Q5j/locations/__pycache__/_distutils.cpython-38.pycnu[U ʗRen @sfdZzedWnek r(YnXddlZddlZddlZddlmZ ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZdd lmZdd lmZdd lmZd d lmZee Z!d dde"e#e"e"e#e"e#ee"e"fdddZ$d!e"e#ee"ee"e#ee"edddZ%e"dddZ&e"dddZ'e"dddZ(e"ee"e"fdddZ)dS)"z7Locations where we look for configs, install stuff, etc_distutils_hackN)Command) SCHEME_KEYS)installget_python_lib)DictListOptionalTupleUnioncast)Scheme)WINDOWS)running_under_virtualenv)get_major_minor_versionF)ignore_config_files) dist_nameuserhomerootisolatedprefixrreturnc Csddlm}d|i}|r"dg|d<||} |stz | Wn8tk rr| } tdddd | DYnXd } | jd d d } | d k st t t | } |r|rt d|d||r|rt d|d||p| j | _ |s|rd| _ |p| j | _ |p| j| _|p| j| _| i} tD]}t| d|| |<q&d| d krf| t| j| jdtr|rz|}n|r| j}n| j }tj|dddt|| d<|d k rtjtj| dd}tj||dd | d<| S)z+ Return a distutils install scheme r) Distributionnamez --no-user-cfg script_argsz6Ignore distutils configs in %s due to encoding errors.z, css|]}tj|VqdS)N)ospathbasename).0pr#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/locations/_distutils.py ?sz#distutils_scheme..NrT)createzuser=z prefix=zhome=install_ install_lib)purelibplatlibincludesitepythonheadersr)distutils.distrparse_config_filesUnicodeDecodeErrorfind_config_filesloggerwarningjoinget_command_objAssertionErrorr distutils_install_commandrrrrfinalize_optionsrgetattrget_option_dictupdatedictr)rinstall_userbaserrr splitdriveabspath)rrrrrrrr dist_argsdpathsobjischemekey path_no_driver#r#r$distutils_scheme#sb          rJ)rrrrrrrcCs8t||||||}t|d|d|d|d|ddS)a; Get the "scheme" corresponding to the input parameters. The distutils documentation provides the context for the available schemes: https://docs.python.org/3/install/index.html#alternate-installation :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme and provides the base directory for the same :param root: root under which other directories are re-based :param isolated: equivalent to --no-user-cfg, i.e. do not consider ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for scheme paths :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same r+r*r/scriptsdata)r+r*r/rKrL)rJr)rrrrrrrGr#r#r$ get_schemetsrM)rcCsrtjtj}tr>tj|d}tj|s:tj|d}|Stjdddkrd|dddkrddStj|dS)NScriptsbindarwinz/System/Library/z/usr/local/bin) rrnormpathsysrrr6existsplatform)rbin_pyr#r#r$get_bin_prefixs "rXcCs tddS)NF plat_specificrr#r#r#r$ get_purelibsr[cCs tddS)NTrYrr#r#r#r$ get_platlibsr\)rrcCstd|dtd|dfS)NF)rZrTr)rr#r#r$get_prefixed_libss  r])FNNFN)FNNFN)*__doc__ __import__ remove_shim ImportErrorloggingrrT distutils.cmdrDistutilsCommanddistutils.command.installrrr9distutils.sysconfigrtypingrr r r r r pip._internal.models.schemerpip._internal.utils.compatrpip._internal.utils.virtualenvrbaser getLogger__name__r4strboolrJrMrXr[r\r]r#r#r#r$sh            S #PK, ]m /locations/__pycache__/_sysconfig.cpython-38.pycnu[U ʗRe @s`ddlZddlZddlZddlZddlZddlmZmZddlm Z m Z ddl m Z ddl mZmZmZeeZeeZeeddZedd d Zedd d Zedd dZedddZddddddgZe ddk re!dd%eeej"eej"eeej"ee dddZ#edddZ$edddZ%edd d!Z&eej'eefd"d#d$Z(dS)&N)InvalidSchemeCombinationUserInstallationInvalid) SCHEME_KEYSScheme)running_under_virtualenv) change_rootget_major_minor_versionis_osx_frameworkZget_preferred_scheme)returncCsdtkot otS)aCheck for Apple's ``osx_framework_library`` scheme. Python distributed by Apple's Command Line Tools has this special scheme that's used when: * This is a framework build. * We are installing into the system prefix. This does not account for ``pip install --prefix`` (also means we're not installing to the system prefix), which should use ``posix_prefix``, but logic here means ``_infer_prefix()`` outputs ``osx_framework_library``. But since ``prefix`` is not available for ``sysconfig.get_default_scheme()``, which is the stdlib replacement for ``_infer_prefix()``, presumably Apple wouldn't be able to magically switch between ``osx_framework_library`` and ``posix_prefix``. ``_infer_prefix()`` returning ``osx_framework_library`` means its behavior is consistent whether we use the stdlib implementation or our own, and we deal with this special case in ``get_scheme()`` instead. osx_framework_library)_AVAILABLE_SCHEMESrr rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py _should_use_osx_framework_prefixs rcCsvtr tdStrdStjjdtj}|tkr6|StjjtkrJtjjStjd}|tkrb|StjtkrrtjSdS)a!Try to find a prefix scheme for the current platform. This tries: * A special ``osx_framework_library`` for Python distributed by Apple's Command Line Tools, when not running in a virtual environment. * Implementation + OS, used by PyPy on Windows (``pypy_nt``). * Implementation without OS, used by PyPy on POSIX (``pypy``). * OS + "prefix", used by CPython on POSIX (``posix_prefix``). * Just the OS name, used by CPython on Windows (``nt``). If none of the above works, fall back to ``posix_prefix``. prefixr __prefix posix_prefix)_PREFERRED_SCHEME_APIrsysimplementationnameosr )implementation_suffixedsuffixedrrr _infer_prefix7s   rcCsHtr tdStrtsd}n tjd}|tkr6|SdtkrDtdS)z3Try to find a user scheme for the current platform.userosx_framework_user_user posix_user)rr rrrr rrrrr _infer_userVs  r"cCs(tr tdStjd}|tkr$|SdS)z,Try to find a home for the current platform.home_home posix_home)rrrr r!rrr _infer_homees  r&installed_basebaseinstalled_platbaseplatbaser exec_prefixuserbaseF) dist_namerr#rootisolatedrr cs^|rrtddr$r$tdddk r4t}n|r@t}nt}dk rZ|dkrZd}dk rvfddtD}n dk rfd dtD}ni}tj||d }tr|r|d t j } n|d t j } d t } t j | dd| |d<n|sd}t|d|dt j |d||d|dd} |dk rZtD]"} t|t| | } t| | | q6| S)a\ Get the "scheme" corresponding to the input parameters. :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme :param root: root under which other directories are re-based :param isolated: ignored, but kept for distutils compatibility (where this controls whether the user-site pydistutils.cfg is honored) :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same z--userz--prefixz--homeNr rcsi|] }|qSrr.0k)r#rr szget_scheme..csi|] }|qSrrr0)rrrr3s)schemevarsr,r(pythonincludesiteUNKNOWNplatlibpurelibscriptsdata)r:r;headersr<r=)rr&r"r _HOME_KEYS sysconfig get_pathsrgetrrr rpathjoinrrrgetattrsetattr)r-rr#r.r/r scheme_name variablespathsr( python_xyr4keyvaluer)r#rr get_scheme|sJ    rMcCs4tjdddkr(tjdddkr(dStdS)Ndarwinz/System/Library/z/usr/local/binr<)rplatformrr@rArrrrget_bin_prefixs$rRcCs tdS)Nr;r@rArrrr get_purelibsrTcCs tdS)Nr:rSrrrr get_platlibsrU)rr cCs"tj||dd}|d|dfS)N)r(r*)r5r;r:rS)rrIrrrget_prefixed_libssrV)FNNFN))loggingrrr@typingpip._internal.exceptionsrrpip._internal.models.schemerrpip._internal.utils.virtualenvrr(rr r getLogger__name__loggersetget_scheme_namesr rErboolrstrrr"r&r?get_config_varappendOptionalrMrRrTrUTuplerVrrrrsT      MPK, ]Rn11-locations/__pycache__/__init__.cpython-38.pycnu[U ʗRe5D @s UddlZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZdd lmZmZmZmZmZmZd d d d dddddddg Ze e!Z"e#eddZ$e%e&d<ej'dkZ(e)dddZ*e*Z+e(re+sej,Z-nej.Z-e)dddZ/ee%e%fe)ddd Z0ej1dd!e)dd"d#Z2ej1dd!e)dd$d%Z3ej1dd!e)dd&d'Z4ej1dd!e)dd(d)Z5ej1dd!e)dd*d+Z6e e%e e%ddfd,d-d.Z7ej1dd!ej8ej8e%dd/d0d1Z9ej8ej8e%e)d/d2d3Z:ej1dd!d4dddd5e)e e%e e%e e%dd6d7d8Z;dJe%e)e e%e e%e)e e%ed9d:dZe%e)d=d>d?Z?e%dd@dZ@e%ddAdZAe%e%e e%dBdCdDZBe%e)dEdFdGZCe%e e%dHdIdZDdS)KN)AnyDict GeneratorListOptionalTuple) SCHEME_KEYSScheme)WINDOWS) deprecated)running_under_virtualenv) _sysconfig)USER_CACHE_DIRget_major_minor_versionget_src_prefixis_osx_framework site_packages user_siterget_bin_prefix get_bin_userr get_platlibget_prefixed_libs get_purelib get_schemerrrZ platlibdirlib _PLATLIBDIR) )returncCstttdtS)axThis function determines the value of _USE_SYSCONFIG. By default, pip uses sysconfig on Python 3.10+. But Python distributors can override this decision by setting: sysconfig._PIP_USE_SYSCONFIG = True / False Rationale in https://github.com/pypa/pip/issues/10647 This is a function for testability, but should be constant during any one run. _PIP_USE_SYSCONFIG)boolgetattr sysconfig_USE_SYSCONFIG_DEFAULTr%r%/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/locations/__init__.py_should_use_sysconfig/s r'cCs<ddlm}z|dd}Wntk r2YdSX|dkS)zsThe resolution to bpo-44860 will change this incorrect platlib. See . rINSTALL_SCHEMES unix_userplatlibFz $usersite)distutils.command.installr)KeyError)r)unix_user_platlibr%r%r&_looks_like_bpo_44860Gs  r/)schemercCsP|d}d|kr$|ddtd}d|kr0dS|dd}|dd|d kS) Nr+z /$platlibdir///lib64/Fz/lib/z $platbase/z$base/purelib)replacer)r0r+ unpatchedr%r%r&+_looks_like_red_hat_patched_platlib_purelibUs r6)maxsizecs"ddlmtfdddDS)zRed Hat patches platlib in unix_prefix and unix_home, but not purelib. This is the only way I can see to tell a Red Hat-patched Python. rr(c3s"|]}|kot|VqdSN)r6.0kr(r%r& gsz*_looks_like_red_hat_lib..) unix_prefix unix_home)r,r)allr%r%r(r&_looks_like_red_hat_lib_s  r@cCsddlm}d|kod|kS)z#Debian adds two additional schemes.rr( deb_system unix_local)r,r)r(r%r%r&_looks_like_debian_schemens rCcCs^ddlm}ddlm}||}||jtjt jdko\|j tjt j dkS)a\Red Hat patches ``sys.prefix`` and ``sys.exec_prefix``. Red Hat's ``00251-change-user-install-location.patch`` changes the install command's ``prefix`` and ``exec_prefix`` to append ``"/local"``. This is (fortunately?) done quite unconditionally, so we create a default command object without any configuration to detect this. r)install) Distributionz/local) r,rDdistutils.distrEfinalize_options exec_prefixospathnormpathsysprefix)rDrEcmdr%r%r&_looks_like_red_hat_schemevs   rOcCsJtdkr dSztjddd}Wntk r4YdSXd|dkoHdtkS)zSlackware patches sysconfig but fails to patch distutils and site. Slackware changes sysconfig's user scheme to use ``"lib64"`` for the lib path, but does not do the same to the site module. NF posix_user)r0expandr2r3)rr# get_pathsr-pathsr%r%r&_looks_like_slackware_schemesrUcs.tjdddtddfdddDDS)aMSYS2 patches distutils and sysconfig to use a UNIX-like scheme. However, MSYS2 incorrectly patches sysconfig ``nt`` scheme. The fix is likely going to be included in their 3.10 release, so we ignore the warning. See msys2/MINGW-packages#9319. MSYS2 MINGW's patch uses lowercase ``"lib"`` instead of the usual uppercase, and is missing the final ``"site-packages"``. ntF)rQcss*|]"}d|ko d|ko |d VqdS)Librz site-packagesN)endswithr:pr%r%r&r<sz1_looks_like_msys2_mingw_scheme..c3s|]}|VqdSr8r%)r:keyrSr%r&r<sr+r3)r#rRr?r%r%rSr&_looks_like_msys2_mingw_schemes r])partsrccshtd}ttdd}|r(|r(||s6|EdHdS|D](}||r\|ddt|}|Vq:dS)N LDVERSIONabiflagsr)r#get_config_varr"rLrXlen)r^ ldversionr`partr%r%r& _fix_abiflagss    re)oldnewr[rcCs d}d}tt|||||dS)Nz(https://github.com/pypa/pip/issues/10151zSValue for %s does not match. Please report this to <%s> distutils: %s sysconfig: %s)loggerlog_MISMATCH_LEVEL)rfrgr[ issue_urlmessager%r%r&_warn_mismatchedsrmcCs||kr dSt|||ddS)NFr[T)rm)rfrgr[r%r%r&_warn_if_mismatchsroFuserhomerootrM)rqrrrsrMrcCs,dddddg}ttd|||||dS)NzAdditional context:z user = %rz home = %rz root = %rz prefix = %r )rhrirjjoin)rqrrrsrMr^r%r%r& _log_contexts rv) dist_namerqrrrsisolatedrMrc stj||||||d}tr|Sddlm}|j||||||dg}tD]8} tt| } tt|| } | | krxqHt j j dko|dk o| dko| j | j ko| j do| j d} | rqH|oto| dko| j j | j ko| j j d} | rqH| dkrtrqH|o8| dko8t o8t jd ko8td ko8t}|rBqH|o^| dko^t o^t}|rhqH|p~|p~|p~t o| jdd d kot| jdko| jdd kot| jd ks| jddkotpt}|rqHt jdkot o| dkott| j| jk}|r(qHto<| dko.zConfiguring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621reason replacementgone_inrnrp)%rr_USE_SYSCONFIGrzrpathlibPathr"rLimplementationnameparent startswithrr@r version_inforr/rUr r^rbrOrCtuplerer]r#is_python_buildappenddistutils_schemeanyr rmrv)rwrqrrrsrxrMrgrzwarning_contextsr;old_vnew_vskip_pypy_special_case$skip_osx_framework_user_special_caseskip_bpo_44860skip_slackware_user_schemeskip_linux_system_special_caseskip_sysconfig_abiflag_bugskip_msys2_mingw_bugskip_cpython_buildr[r%rr&rs               cCsHt}tr|Sddlm}|}tt|t|ddrDt|S)Nr ry bin_prefixrn) rrrrrzrorrrvrgrzrfr%r%r&rs cCstjdddjS)NrT)rq)rrscriptsr%r%r%r&rs)valuercCsts dS|dkrdSdS)aCheck if the value is Debian's APT-controlled dist-packages. Debian's ``distutils.sysconfig.get_python_lib()`` implementation returns the default package path controlled by APT, but does not patch ``sysconfig`` to do the same. This is similar to the bug worked around in ``get_scheme()``, but here the default is ``deb_system`` instead of ``unix_local``. Ultimately we can't do anything about this Debian bug, and this detection allows us to skip the warning when needed. Fz/usr/lib/python3/dist-packagesT)rC)rr%r%r&$_looks_like_deb_system_dist_packagess rcCsTt}tr|Sddlm}|}t|r0|Stt|t|ddrPt |S)z,Return the default pure-Python lib location.r ryr3rn) rrrrrzrrorrrvrr%r%r&rs cCsTt}tr|Sddlm}|}t|r0|Stt|t|ddrPt |S)z0Return the default platform-shared lib location.r ryr+rn) rrrrrzrrorrrvrr%r%r&rs )v1v2rcCs||kr|gS||gS)zDeduplicate values from a list.r%)rrr%r%r& _deduplicatedsr)rJrcCs(tjdddkrdS|dtdkS)zAApple patches sysconfig to *always* look under */Library/Python*.NdarwinFz/Library/Python/z/site-packages)rLplatformr)rJr%r%r&_looks_like_apple_librarysr)rMrcCst|\}}trt||Sddlm}||\}}t||}tdd|Drdtdddd|Stt |t |dd tt |t |d d g}t |rt |d |S) z*Return the lib locations under ``prefix``.r rycss|]}t|VqdSr8)rrYr%r%r&r<sz$get_prefixed_libs..a&Python distributed by Apple's Command Line Tools incorrectly patches sysconfig to always point to '/Library/Python'. This will cause build isolation to operate incorrectly on Python 3.10 or later. Please help report this to Apple so they can fix this. https://developer.apple.com/bug-reporting/Nrzprefixed-purelibrnzprefixed-platlib)rM) rrrrrrzr?r rorrrrv)rMnew_purenew_platrzold_pureold_plat old_lib_pathswarnedr%r%r&rs6      )FNNFN)E functoolsloggingrIrrLr#typingrrrrrrpip._internal.models.schemerr pip._internal.utils.compatr pip._internal.utils.deprecationr pip._internal.utils.virtualenvr rrbaserrrrrr__all__ getLogger__name__rhr"rstr__annotations__rr$r!r'rWARNINGrjDEBUGr/r6 lru_cacher@rCrOrUr]rerrmrorvrrrrrrrrrr%r%r%r&s                  5 PK, ]JZ )locations/__pycache__/base.cpython-38.pycnu[U ʗRe @sUddlZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z e dZ edZejeed<edd d Zeeed d d ZedddZzeZejeed<Wnek rejZYnXejddedddZdS)N)InstallationError)appdirs)running_under_virtualenvpippurelib site_packages)returncCs djtjS)ze Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". z{}.{})formatsys version_infor r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/locations/base.pyget_major_minor_versionsr)new_rootpathnamercCstjdkrs(      PK, ]{ .distributions/__pycache__/sdist.cpython-38.pycnu[U ʗRe^@sddlZddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl mZddlmZeeZGd d d eZdS) N)IterableSetTuple)BuildEnvironment)AbstractDistribution)InstallationError) PackageFinder)BaseDistribution)runner_with_spinner_messagec@seZdZdZedddZeeeddddZedd d d Z e e dd d Z e e dddZ edd ddZe eee e fddddZee ddddZdS)SourceDistributionzRepresents 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`. )returncCs |jS)N)reqget_dist)selfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/distributions/sdist.pyget_metadata_distributionsz,SourceDistribution.get_metadata_distributionN)finderbuild_isolationcheck_build_depsr c Cs|j|jjo|}|r8|||j|||jjoB|}|r|jj}|dk s\t|jj |\}}|r~| d||r| ||j dS)Nthe backend dependencies) r load_pyproject_toml use_pep517_prepare_build_backendisolated_editable_sanity_check_install_build_reqspyproject_requiresAssertionError build_envcheck_requirements_raise_conflicts_raise_missing_reqsprepare_metadata) rrrrshould_isolateshould_check_depsr conflictingmissingrrrprepare_distribution_metadatas$         z0SourceDistribution.prepare_distribution_metadata)rr c Cs|jj}|dk stt|j_|jjj||ddd|jj|jj\}}|rZ|d||rt d|jt dd t t t|dS)Noverlayzbuild dependencieskindz"PEP 517/518 supported requirementsz4Missing build requirements in pyproject.toml for %s.z`The project does not specify a build backend, and pip cannot fall back to setuptools without %s.z and )r rrrrinstall_requirementsrrequirements_to_checkr loggerwarningjoinmapreprsorted)rrrr%r&rrrr?s.   z)SourceDistribution._prepare_build_backendc Csf|jjTtd}|jj}|dk s&t||"|W5QRW5QRSQRXW5QRXdS)Nz#Getting requirements to build wheel)r rr pep517_backendrsubprocess_runnerget_requires_for_build_wheelrrunnerbackendrrr_get_build_requires_wheelYs    z,SourceDistribution._get_build_requires_wheelc Csf|jjTtd}|jj}|dk s&t||"|W5QRW5QRSQRXW5QRXdS)Nz&Getting requirements to build editable)r rr r3rr4get_requires_for_build_editabler6rrr_get_build_requires_editableas   z/SourceDistribution._get_build_requires_editablecCsh|jjr$|jjr$|jr$|}n|}|jj|\}}|rN|d||jjj ||ddddS)Nrnormalzbackend dependenciesr)) r editablepermit_editable_wheelssupports_pyproject_editabler;r9rrr r+)rr build_reqsr%r&rrrrks"  z&SourceDistribution._install_build_reqs)conflicting_withconflicting_reqsr cCs6d}|j|j|dddt|Dd}t|dS)NzZSome build dependencies for {requirement} conflict with {conflicting_with}: {description}., css |]\}}|d|VqdS)z is incompatible with Nr).0 installedwantedrrr sz6SourceDistribution._raise_conflicts..) requirementrA description)formatr r/r2r)rrArB format_string error_messagerrrr ~s z#SourceDistribution._raise_conflicts)r&r cCs0d}|j|jdttt|d}t|dS)NzASome build dependencies for {requirement} are missing: {missing}.rC)rHr&)rJr r/r0r1r2r)rr&rKrLrrrr!sz&SourceDistribution._raise_missing_reqs)__name__ __module__ __qualname____doc__r rrboolr'rrstrr9r;rrrr r!rrrrr s  '  r )loggingtypingrrrpip._internal.build_envr pip._internal.distributions.baserpip._internal.exceptionsr"pip._internal.index.package_finderrpip._internal.metadatar pip._internal.utils.subprocessr getLoggerrMr-r rrrrs       PK, ]kԆ4operations/build/__pycache__/metadata.cpython-38.pycnu[U ʗRe|@sddZddlZddlmZddlmZddlmZmZddl m Z ddl m Z eee e dd d ZdS) z4Metadata generation logic for source distributions. N)Pep517HookCaller)BuildEnvironment)InstallationSubprocessErrorMetadataGenerationFailed)runner_with_spinner_message) TempDirectory) build_envbackenddetailsreturnc Cstddd}|j}|btd}||Dz||}Wn.tk rh}zt|d|W5d}~XYnXW5QRXW5QRXtj||S)zlGenerate metadata using mechanisms described in PEP 517. Returns the generated metadata directory. zmodern-metadataT)kindglobally_managedz#Preparing metadata (pyproject.toml))package_detailsN) rpathrsubprocess_runner prepare_metadata_for_build_wheelrrosjoin)rr r metadata_tmpdir metadata_dirrunner distinfo_direrrorr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/metadata.pygenerate_metadatas  2r)__doc__rZpip._vendor.pep517.wrappersrpip._internal.build_envrpip._internal.exceptionsrrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrstrrrrrrs    PK, ]"h1operations/build/__pycache__/wheel.cpython-38.pycnu[U ʗRe'@s\ddlZddlZddlmZddlmZddlmZee Z e ee e ee dddZ dS)N)Optional)Pep517HookCaller)runner_with_spinner_message)namebackendmetadata_directorytempdreturnc Cs|dk s tzDtd|td|d}|||j||d}W5QRXWn"tk rrtd|YdSXtj ||S)zBuild one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. NzDestination directory: %szBuilding wheel for z (pyproject.toml))rzFailed building wheel for %s) AssertionErrorloggerdebugrsubprocess_runner build_wheel Exceptionerrorospathjoin)rrrrrunner wheel_namer/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/wheel.pybuild_wheel_pep517 s     r) loggingrtypingrZpip._vendor.pep517.wrappersrpip._internal.utils.subprocessr getLogger__name__r strrrrrrs    PK, ]qV;;9operations/build/__pycache__/build_tracker.cpython-38.pycnu[U ʗRe%@sddlZddlZddlZddlZddlmZddlmZmZm Z m Z m Z m Z ddl mZddlmZddlmZeeZejeeddd d Zejed d d dZGdddZdS)N) TracebackType)Dict GeneratorOptionalSetTypeUnion)Link)InstallRequirement) TempDirectoryNNN)changesreturnc kstj}t}i}|D]>\}}z||||<Wntk rL|||<YnX|||<qz dVW5|D].\}}||kr||=qlt|tst|||<qlXdSN)osenvironobjectitemsKeyError isinstancestrAssertionError)r targetnon_existent_marker saved_valuesname new_valueoriginal_valuer/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/build_tracker.pyupdate_env_context_managers   r ) BuildTrackerNNrc csttjd}tV}|dkrL|tddj}|t|dt d|t | }|VW5QRXW5QRXdS)NPIP_BUILD_TRACKERz build-tracker)kind)r#z Initialized build tracking at %s) rrget contextlib ExitStack enter_contextr pathr loggerdebugr!)rootctxtrackerrrrget_build_tracker)s    r/c@seZdZeddddZddddZeeeeeee ddd d Z e ed d d Z e ddddZe ddddZddddZeje eddddZdS)r!N)r,rcCs ||_t|_td|jdS)NzCreated build tracker: %s)_rootset_entriesr*r+)selfr,rrr__init__7szBuildTracker.__init__r"cCstd|j|S)NzEntered build tracker: %s)r*r+r0)r3rrr __enter__<szBuildTracker.__enter__)exc_typeexc_valexc_tbrcCs |dSr)cleanup)r3r6r7r8rrr__exit__@szBuildTracker.__exit__)linkrcCs$t|j}tj|j|Sr) hashlibsha224url_without_fragmentencode hexdigestrr)joinr0)r3r;hashedrrr _entry_pathHszBuildTracker._entry_path)reqrc Cs|js t||j}z t|}|}W5QRXWntk rJYnXd|j|}t|||jksptt|ddd}| t |W5QRX|j |t d||jdS)z,Add an InstallRequirement to build tracking.z{} is already being built: {}wzutf-8)encodingzAdded %s to build tracker %rN)r;rrCopenreadFileNotFoundErrorformat LookupErrorr2writeraddr*r+r0)r3rD entry_pathfpcontentsmessagerrrrMLs    zBuildTracker.addcCs<|js tt||j|j|td||j dS)z1Remove an InstallRequirement from build tracking.z Removed %s from build tracker %rN) r;rrunlinkrCr2remover*r+r0r3rDrrrrShs  zBuildTracker.removecCs,t|jD]}||q td|jdS)NzRemoved build tracker: %r)r1r2rSr*r+r0rTrrrr9rs zBuildTracker.cleanupr ccs||dV||dSr)rMrSrTrrrtrackxs zBuildTracker.track)__name__ __module__ __qualname__rr4r5rr BaseExceptionrr:r rCr rMrSr9r&contextmanagerrrUrrrrr!6s   r!)r&r<loggingrtypesrtypingrrrrrrpip._internal.models.linkr Zpip._internal.req.req_installr pip._internal.utils.temp_dirr getLoggerrVr*rZrr r/r!rrrrs       PK, ]r/4operations/build/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdS)Nrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/__init__.pyPK, ]f$¨=operations/build/__pycache__/metadata_editable.cpython-38.pycnu[U ʗRe@sddZddlZddlmZddlmZddlmZmZddl m Z ddl m Z eee e dd d ZdS) z4Metadata generation logic for source distributions. N)Pep517HookCaller)BuildEnvironment)InstallationSubprocessErrorMetadataGenerationFailed)runner_with_spinner_message) TempDirectory) build_envbackenddetailsreturnc Cstddd}|j}|btd}||Dz||}Wn.tk rh}zt|d|W5d}~XYnXW5QRXW5QRXtj||S)zlGenerate metadata using mechanisms described in PEP 660. Returns the generated metadata directory. zmodern-metadataT)kindglobally_managedz,Preparing editable metadata (pyproject.toml))package_detailsN) rpathrsubprocess_runner#prepare_metadata_for_build_editablerrosjoin)rr r metadata_tmpdir metadata_dirrunner distinfo_direrrorr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/metadata_editable.pygenerate_editable_metadatas  2r)__doc__rZpip._vendor.pep517.wrappersrpip._internal.build_envrpip._internal.exceptionsrrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrstrrrrrrs    PK, ]. 8operations/build/__pycache__/wheel_legacy.cpython-38.pycnu[U ʗRe @sddlZddlZddlmZmZddlmZddlm Z ddl m Z m Z e eZeeeedddZeeeeeeeeed d d Zeeeeeeeeeed d dZdS)N)ListOptional) open_spinner) make_setuptools_bdist_wheel_args)call_subprocessformat_command_args) command_argscommand_outputreturncCs^t|}d|d}|s"|d7}n8ttjkr:|d7}n |dsL|d7}|d|7}|S)z'Format command information for logging.zCommand arguments:  zCommand output: Nonez'Command output: [use --verbose to show]zCommand output: )rloggergetEffectiveLevelloggingDEBUGendswith)rr command_desctextr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/wheel_legacy.pyformat_command_result s    r)namestemp_dirnamerr r cCstt|}|s2d|}|t||7}t|dSt|dkrbd||}|t||7}t|tj||dS)z>Return the path to the wheel in the temporary build directory.z1Legacy build of wheel for {!r} created no files. NzZLegacy build of wheel for {!r} created more than one file. Filenames (choosing first): {} r) sortedformatrr warninglenospathjoin)rrrrr msgrrrget_legacy_build_wheel_path s     r")r setup_py_path source_dirglobal_options build_optionstempdr c Cst||||d}d|d}t|}td|zt|d||d} Wn6tk r||dtd|YW5QRd SXt |} t | |||| d } | W5QRSQRXd S) zBuild one unpacked package using the "legacy" build process. Returns path to wheel if successfully built. Otherwise, returns None. )r%r&destination_dirzBuilding wheel for z (setup.py)zDestination directory: %szpython setup.py bdist_wheel)rcwdspinnererrorzFailed building wheel for %sN)rrrrr ) rrr debugr Exceptionfinishr+rlistdirr") rr#r$r%r&r' wheel_args spin_messager*outputr wheel_pathrrrbuild_wheel_legacy;s:        r4)ros.pathrtypingrrpip._internal.cli.spinnersr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrr getLogger__name__r strrr"r4rrrrs2     PK, ]R:operations/build/__pycache__/wheel_editable.cpython-38.pycnu[U ʗRe}@s`ddlZddlZddlmZddlmZmZddlmZe e Z e ee e ee dddZ dS)N)Optional) HookMissingPep517HookCaller)runner_with_spinner_message)namebackendmetadata_directorytempdreturnc Cs|dk s tztd|td|d}||\z|j||d}WnBtk r}z$td||WYW5QRWdSd}~XYnXW5QRXWn"tk rtd|YdSXt j ||S)zBuild one InstallRequirement using the PEP 660 build process. Returns path to wheel if successfully built. Otherwise, returns None. NzDestination directory: %szBuilding editable for z (pyproject.toml))rzLCannot build editable %s because the build backend does not have the %s hookzFailed building editable for %s) AssertionErrorloggerdebugrsubprocess_runnerbuild_editablererror Exceptionospathjoin)rrrr runner wheel_nameer/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/wheel_editable.pybuild_wheel_editable s.     2 r)loggingrtypingrZpip._vendor.pep517.wrappersrrpip._internal.utils.subprocessr getLogger__name__r strrrrrrs   PK, ]-  ;operations/build/__pycache__/metadata_legacy.cpython-38.pycnu[U ʗRe@sdZddlZddlZddlmZddlmZddlmZm Z m Z ddl m Z ddl mZddlmZeeZeed d d Zeeeeeed d dZdS)z;Metadata generation logic for legacy source distributions. N)BuildEnvironment) open_spinner)InstallationErrorInstallationSubprocessErrorMetadataGenerationFailed)make_setuptools_egg_info_args)call_subprocess) TempDirectory) directoryreturncCsRddt|D}|s&td|t|dkr@td|tj||dS)z.Find an .egg-info subdirectory in `directory`.cSsg|]}|dr|qS)z .egg-info)endswith).0fr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/build/metadata_legacy.py s z"_find_egg_info..z No .egg-info directory found in z-More than one .egg-info directory found in {}r)oslistdirrlenformatpathjoin)r filenamesrrr_find_egg_infos r) build_env setup_py_path source_dirisolateddetailsr c Cstd||tdddj}t|||d}|^tdJ}zt||d|dWn.tk r|}zt|d |W5d }~XYnXW5QRXW5QRXt |S) znGenerate metadata using setup.py-based defacto mechanisms. Returns the generated metadata directory. z2Running setup.py (path:%s) egg_info for package %sz pip-egg-infoT)kindglobally_managed) egg_info_dirno_user_configzPreparing metadata (setup.py)zpython setup.py egg_info)cwd command_descspinner)package_detailsN) loggerdebugr rrrrrrr) rrrrrr"argsr&errorrrrgenerate_metadata$s.   2r,)__doc__loggingrpip._internal.build_envrpip._internal.cli.spinnersrpip._internal.exceptionsrrr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrpip._internal.utils.temp_dirr getLogger__name__r(strrboolr,rrrrs"      PK, ]%%!operations/build/build_tracker.pynu[import contextlib import hashlib import logging import os from types import TracebackType from typing import Dict, Generator, Optional, Set, Type, Union from pip._internal.models.link import Link from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) @contextlib.contextmanager def update_env_context_manager(**changes: str) -> Generator[None, None, None]: target = os.environ # Save values from the target and change them. non_existent_marker = object() saved_values: Dict[str, Union[object, str]] = {} for name, new_value in changes.items(): try: saved_values[name] = target[name] except KeyError: saved_values[name] = non_existent_marker target[name] = new_value try: yield finally: # Restore original values in the target. for name, original_value in saved_values.items(): if original_value is non_existent_marker: del target[name] else: assert isinstance(original_value, str) # for mypy target[name] = original_value @contextlib.contextmanager def get_build_tracker() -> Generator["BuildTracker", None, None]: root = os.environ.get("PIP_BUILD_TRACKER") with contextlib.ExitStack() as ctx: if root is None: root = ctx.enter_context(TempDirectory(kind="build-tracker")).path ctx.enter_context(update_env_context_manager(PIP_BUILD_TRACKER=root)) logger.debug("Initialized build tracking at %s", root) with BuildTracker(root) as tracker: yield tracker class BuildTracker: def __init__(self, root: str) -> None: self._root = root self._entries: Set[InstallRequirement] = set() logger.debug("Created build tracker: %s", self._root) def __enter__(self) -> "BuildTracker": logger.debug("Entered build tracker: %s", self._root) return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: self.cleanup() def _entry_path(self, link: Link) -> str: hashed = hashlib.sha224(link.url_without_fragment.encode()).hexdigest() return os.path.join(self._root, hashed) def add(self, req: InstallRequirement) -> None: """Add an InstallRequirement to build tracking.""" assert req.link # Get the file to write information about this requirement. entry_path = self._entry_path(req.link) # Try reading from the file. If it exists and can be read from, a build # is already in progress, so a LookupError is raised. try: with open(entry_path) as fp: contents = fp.read() except FileNotFoundError: pass else: message = "{} is already being built: {}".format(req.link, contents) raise LookupError(message) # If we're here, req should really not be building already. assert req not in self._entries # Start tracking this requirement. with open(entry_path, "w", encoding="utf-8") as fp: fp.write(str(req)) self._entries.add(req) logger.debug("Added %s to build tracker %r", req, self._root) def remove(self, req: InstallRequirement) -> None: """Remove an InstallRequirement from build tracking.""" assert req.link # Delete the created file and the corresponding entries. os.unlink(self._entry_path(req.link)) self._entries.remove(req) logger.debug("Removed %s from build tracker %r", req, self._root) def cleanup(self) -> None: for req in set(self._entries): self.remove(req) logger.debug("Removed build tracker: %r", self._root) @contextlib.contextmanager def track(self, req: InstallRequirement) -> Generator[None, None, None]: self.add(req) yield self.remove(req) PK, ]:fQfQ3operations/install/__pycache__/wheel.cpython-38.pycnu[U ʗRej @sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZddlmZmZmZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)ddl*m+Z+dd l,m-Z-dd l.m/Z/dd l0m1Z1dd l2m3Z3dd l4m5Z5m6Z6m7Z7ddl8m9Z9m:Z:ddl;mm?Z?m@Z@ddlAmBZBmCZCmDZDmEZEddlFmGZGmHZHmIZImJZJddlKmLZLerddlmMZMGdddeMZNeOePZQe deRZSe$eSeRe%eTeRffZUdQeReTe$eReRfdddZVeReeRefdddZWeReXdd d!ZYeeXd"d#d$ZZe5e$eeReRfeeReRffd%d&d'Z[e"eRe!eRd(d)d*Z\eeUee$eReReRfd+d,d-Z]eSeReRd.d/d0Z^eReReSd1d2d3Z_eeeReeSeSfe#eSeeReReeUd4d5d6Z`eeReRfeeRd7d8d9ZaGd:d;d;ZbGdd?d?e1ZdeRdd@dAdBZeGdCdDdDe+ZfdReRe(eRe=eXeXe!e:eXddG dHdIZgejheRedJdKdLdMZidSeReRe=eReXeXe!e:eXddN dOdPZjdS)TzGSupport for installing and building the "wheel" binary package format. N)urlsafe_b64encode)Message)chain filterfalsestarmap)IO TYPE_CHECKINGAnyBinaryIOCallableDict GeneratorIterableIteratorListNewTypeOptionalSequenceSetTupleUnioncast)ZipFileZipInfo) ScriptMaker)get_export_entry)canonicalize_name)InstallationError)get_major_minor_version)BaseDistributionFilesystemWheelget_wheel_distribution)DIRECT_URL_METADATA_NAME DirectUrl) SCHEME_KEYSScheme)adjacent_tmp_filereplace)captured_stdout ensure_dir hash_file partition) current_umaskis_within_directory2set_extracted_file_to_default_mode_plus_executablezip_item_is_executable) parse_wheel)Protocolc@s4eZdZUded<eed<eed<ddddZdS) File RecordPathsrc_record_path dest_pathchangedNreturncCsdSNselfr:r:/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.pysaveFsz File.save)__name__ __module__ __qualname____annotations__strboolr>r:r:r:r=r2As r2r3)path blocksizer8cCs6t||\}}dt|dd}|t|fS)z?Return (encoded_digest, length) for path using hashlib.sha256()zsha256=latin1=)r*rdigestdecoderstriprC)rFrGhlengthrJr:r:r=rehashPsrO)moder8cCs |dddS)zPReturn keyword arguments to properly open a CSV file in the given mode. utf-8)rPnewlineencodingr:)rPr:r:r= csv_io_kwargsWsrUrFr8c Cstj|stt|dR}|}|dssz5message_about_scripts_not_on_PATH..PATHrQcs&i|]\}}tj|kr||qSr:)rZrFr{)r~ parent_dirrz not_warn_dirsr:r= sz5message_about_scripts_not_on_PATH..z script {} isrzscripts {} are, z and z.The {} installed in '{}' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriescss|]}|r|ddkVqdS)r~Nr:r}r:r:r= sz4message_about_scripts_not_on_PATH..ziNOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications. ) collections defaultdictsetrZrFdirnamebasenameaddenvironrnsplitpathsepappendr{r`raitemssortedlenformatjoinany) rzgrouped_by_dirdestfiler script_namewarn_for msg_lines dir_scriptssorted_scripts start_text last_line_fmtwarn_for_tildetilde_warning_msgr:rr=!message_about_scripts_not_on_PATHsV      r)outrowsr8cCstdd|DS)aNormalize the given rows of a RECORD file. Items in each row are converted into str. Rows are then sorted to make the value more predictable for tests. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. css"|]\}}}||t|fVqdSr9)rC)r~ record_pathhash_sizer:r:r=rsz&_normalized_outrows..)r)rr:r:r=_normalized_outrowssr)rlib_dirr8cCstj||Sr9)rZrFr)rrr:r:r=_record_to_fs_pathsr)rFrr8cCsPtj|dtj|dkr6tj||}|tjjd}td|S)Nr/r3)rZrF splitdriverorelpathr'r|r)rFrr:r:r=_fs_to_record_paths(r) old_csv_rows installedr6 generatedrr8cCsg}|D]}t|dkr$td|td|d}|||}||krZtt||\} } n0t|dkrn|dnd} t|dkr|dnd} ||| | fq|D]*} t| |} t| \} } || | | fq| D]} || ddfq|S)z_ :param installed: A map from archive RECORD path to installation RECORD path. z,RECORD line has more than three elements: %sr3rrrQ) rloggerwarningrpoprOrrrvalues)rrr6rrinstalled_rowsrowold_record_pathnew_record_pathrJrNfrFinstalled_record_pathr:r:r=get_csv_rows_for_installeds$       r)consoler8cCs|}g}|dd}|rdtjkr4|d|tjdddkr^|dtjd||dt d |d d |D}|D] }||=q|d d}|rdtjkr|d ||dt |dd |D}|D] }||=q| t dj| |S)zk Given the mapping from entrypoint name to callable, return the relevant console script specs. pipNENSUREPIP_OPTIONSzpip = rQ altinstallz pip{} = {}rz = cSsg|]}td|r|qS)zpip(\d(\.\d)?)?$rematchr~kr:r:r=rHs z,get_console_script_specs.. easy_installzeasy_install = zeasy_install-{} = {}cSsg|]}td|r|qS)zeasy_install(-\d\.\d)?$rrr:r:r=rVs {} = {}) copyrrZrrrnrr` version_inforextendrr)rscripts_to_generate pip_scriptpip_epreasy_install_scripteasy_install_epr:r:r=get_console_script_specss>#    rc@s<eZdZeeeddddZedddZdddd Z dS) ZipBackedFileN)r4r5zip_filer8cCs||_||_||_d|_dSNF)r4r5 _zip_filer6)r<r4r5rr:r:r=__init__cszZipBackedFile.__init__r7cCs|j|jSr9)rgetinfor4r;r:r:r=_getinfokszZipBackedFile._getinfoc Cstj|j}t|tj|jr0t|j|}|j |*}t |jd}t ||W5QRXW5QRXt |rt |jdS)NrY)rZrFrr5r)existsunlinkrrr]shutil copyfileobjr/r.)r<rzipinfordestr:r:r=r>ns   zZipBackedFile.save) r?r@rAr3rCrrrrr>r:r:r:r=rbs rc@s*eZdZdddddZddddZdS) ScriptFiler2Nfiler8cCs$||_|jj|_|jj|_d|_dSr)_filer4r5r6)r<rr:r:r=rs  zScriptFile.__init__r7cCs|jt|j|_dSr9)rr>rkr5r6r;r:r:r=r>s zScriptFile.save)r?r@rArr>r:r:r:r=rsrcs$eZdZeddfdd ZZS)MissingCallableSuffixN)rxr8cstd|dS)NzInvalid script entry point: {} - A callable suffix is required. Cf https://packaging.python.org/specifications/entry-points/#use-for-scripts for more information.)superrr)r<rx __class__r:r=rs zMissingCallableSuffix.__init__)r?r@rArCr __classcell__r:r:rr=rsr) specificationr8cCs*t|}|dk r&|jdkr&tt|dSr9)rsuffixrrC)rentryr:r:r=_raise_for_invalid_entrypointsrcs4eZdZdeeeefeedfdd ZZS)PipScriptMakerN)roptionsr8cst|t||Sr9)rrmake)r<rrrr:r=rszPipScriptMaker.make)N) r?r@rArCr r rrrr:r:rr=rsrTF) rw wheel_zip wheel_pathscheme pycompilewarn_script_location direct_url requestedr8c8 st||\}} t| r|jn|jitg} d4tttddfdd } ttddd} ttdd fd d ttt tgd fd fdd } tt t tgd fdfdd }ttddd}t t t| }t| |}t||\}}| |}t||}ttddd}t||\}}|||}t||}t||}ttt|}t|\d tdfdd }t||}t||}tt|}t||}|D] }|| |j|j|jqttddfdfdd }ttddd} |rt}!tntd|D]V}"t j!|"d d d!}#|#r| |"}$t"j#$|$sNt%t d"|$&t"j#j'd#}%| |%|$qW5QRXW5QRXt()|!*t+d|j,}&d |&_-d$h|&_.d |&_/t0}'t1t2d%j34}(|&5|'})| 6|)| 6|&5|(d&d i|rt7|)}*|*dk rt(8|*d't9@t:j;tt|},t"j#>|,d+}-|+|-}.|.?d,W5QRX| @|-|dk rt"j#>|,tA}/|+|/}0|0?|BCd-W5QRX| @|/|rt"j#>|,d.}1tD|1d/W5QRX| @|1|Ed0}2t1tFG|2H}3tI|3| d1}4t"j#>|,d0}5|+|5ftJd2$}6tFKt d3|6}7|7LtM|4W5QRXdS)5aInstall a wheel. :param name: Name of the project to install :param wheel_zip: open ZipFile for wheel being installed :param scheme: Distutils scheme dictating the install directories :param req_description: String used in place of the requirement, for logging :param pycompile: Whether to byte-compile installed Python files :param warn_script_location: Whether to check that scripts are installed into a directory on PATH :raises UnsupportedWheel: * when the directory holds an unpacked wheel with incompatible Wheel-Version * when the .dist-info dir does not match the wheel FN)srcfilermodifiedr8cs$t|}||<|r |dS)z6Map archive RECORD paths to installation RECORD paths.N)rr)rrrnewpath)r6rrr:r=record_installeds z(_install_wheel..record_installedrVcSs |dS)Nr)endswithrFr:r:r= is_dir_pathsz#_install_wheel..is_dir_path) dest_dir_path target_pathr8cs$t||s d}t|||dS)NzRThe wheel {!r} has a file {!r} trying to install outside the target directory {!r})r-rr)rrmessage)rr:r=assert_no_path_traversals   z0_install_wheel..assert_no_path_traversalr2)rrr8cstddfdd }|S)Nr2rr8cs0tj|}tj|}|t||Sr9)rZrFnormpathrr)r normed_pathr5)rrrr:r=make_root_scheme_files  zM_install_wheel..root_scheme_file_maker..make_root_scheme_file)r3)rrr )r)rrr=root_scheme_file_makersz._install_wheel..root_scheme_file_maker)rrr8cs0fddtDtddfdd }|S)Ncsi|]}|t|qSr:)getattr)r~key)rr:r=rszB_install_wheel..data_scheme_file_maker..r2rc stj|}z|tjjd\}}}Wn(tk rNd|}t|YnXz |}Wn:tk rd t }d|||}t|YnXtj ||}||t ||S)NrzbUnexpected file in {}: {!r}. .data directory contents should be named like: '/'.rzUnknown scheme key used in {}: {} (for file {!r}). .data directory contents should be in subdirectories named with a valid scheme key ({})) rZrFrrr| ValueErrorrrKeyErrorrrr) rr_ scheme_key dest_subpathr scheme_pathvalid_scheme_keysr5)r scheme_pathsrrr:r=make_data_scheme_files2   zM_install_wheel..data_scheme_file_maker..make_data_scheme_file)r$r3)rrr)rr)rrrr=data_scheme_file_makersz._install_wheel..data_scheme_file_makercSs|ddddS)Nrrr.data)rrrr:r:r=is_data_scheme_pathsz+_install_wheel..is_data_scheme_pathcSs2|dd}t|dko0|ddo0|ddkS)Nrrrrrrz)rrr)rFpartsr:r:r=is_script_scheme_path s z-_install_wheel..is_script_scheme_pathrcsz|j}tj|}|dr.|dd}n<|drJ|dd}n |drf|dd}n|}|kpx|kS)Nz.exez -script.pyiz.pya)r5rZrFrror)rrFrw matchname)rguir:r=is_entrypoint_wrapper3s z-_install_wheel..is_entrypoint_wrapperr7c3sHttD]2}tj|}tj|s0q|ds.pyc_source_file_pathscSs tj|S)z8Return the path the pyc file would have been written to.) importlibutilcache_from_sourcerr:r:r=pyc_output_path[sz'_install_wheel..pyc_output_pathignoreT)forcequietr3rrQrri)rFkwargsr8c ;s<t|f| }|VW5QRXt|jt|j|dSr9)r&rZchmodrwr')rFr)r)generated_file_moder:r=_generate_filesz&_install_wheel.._generate_file INSTALLERspip rR REQUESTEDrYRECORD)rr6rrwzIO[str])F)Nr0rppurelibplatlibrr3rCrDrr r%rrnamelistrr+maprr!r rryrr>r4r5r6r r(warningscatch_warningsfilterwarnings compileall compile_filerZrFrr\r'r|rdebuggetvaluerrzclobbervariantsset_moderlistrrr make_multiplerrrr, contextlibcontextmanagerr r rrfrr"to_jsonrbr] read_textcsvreader splitlinesrrUwriter writerowsr)8rwrrrrrrrinfo_dirrlrrrr rrpaths file_pathsroot_scheme_pathsdata_scheme_pathsr filesrother_scheme_pathsscript_scheme_pathsrother_scheme_files distributionrscript_scheme_filesrr!r%stdoutrFsuccesspyc_pathpyc_record_pathmakerrgui_scripts_to_generategenerated_console_scriptsmsgr, dest_info_dirinstaller_pathinstaller_filedirect_url_pathdirect_url_filerequested_path record_text record_rowsrowsr record_filerHr:)rr6rr+rrrrr=_install_wheels     !              "      "          rg)NNN)req_descriptionr8c csNz dVWn>tk rH}z d||jd}t||W5d}~XYnXdS)NzFor req: {}. {}r)rrargs)rherr:r:r=req_error_contexts  rk) rwrrrhrrrrr8c CsHt|dd2}t|t||||||||dW5QRXW5QRXdS)NT) allowZip64)rwrrrrrrr)rrkrg) rwrrrhrrrrzr:r:r= install_wheels  rn)rE)TTNF)TTNF)k__doc__rr8rArEr"loggingos.pathrZrrr`r5base64r email.messager itertoolsrrrtypingrrr r r r r rrrrrrrrrrzipfilerrpip._vendor.distlib.scriptsrZpip._vendor.distlib.utilrpip._vendor.packaging.utilsrpip._internal.exceptionsrpip._internal.locationsrpip._internal.metadatarr r!pip._internal.models.direct_urlr"r#pip._internal.models.schemer$r%pip._internal.utils.filesystemr&r'pip._internal.utils.miscr(r)r*r+pip._internal.utils.unpackingr,r-r.r/pip._internal.utils.wheelr0r1r2 getLoggerr?rrCr3intInstalledCSVRowrOrUrDrkrpryrrrrrrrrrrrrgrBrkrnr:r:r:r=s  L         ( I    Q(     PK, ]X 4operations/install/__pycache__/legacy.cpython-38.pycnu[U ʗRe @sdZddlZddlZddlmZmZmZddlmZddl m Z m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZeeZeeeeedd d dZeeeeeeeeeeeeeeeeeeeedddZdS)z6Legacy installation process, i.e. `setup.py install`. N)ListOptionalSequence)BuildEnvironment)InstallationErrorLegacyInstallFailure) change_root)Scheme) ensure_dir)make_setuptools_install_args)runner_with_spinner_message) TempDirectory) record_linesrootreq_descriptionreturnc sttdfdd }|D]&}tj|}|dr||}qRqd|}t|g}|D]<}|} tj| r~| tjj 7} | tj || |qZ| t |tj|d} t| d} | d|dW5QRXdS) N)pathrcs&dkstj|s|St|SdS)N)osrisabsr)rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/install/legacy.py prepend_rootszBwrite_installed_files_from_setuptools_record..prepend_rootz .egg-infoz{} did not indicate that it installed an .egg-info directory. Only setup.py projects generating .egg-info directories are supported.zinstalled-files.txtw )strrrdirnameendswithformatrstripisdirsepappendrelpathsortr joinopenwrite) rrrrline directory egg_info_dirmessage new_linesfilenameinst_files_pathfrrr,write_installed_files_from_setuptools_records,     r0)install_optionsglobal_optionsrhomeprefix use_user_site pycompilescheme setup_py_pathisolatedreq_name build_envunpacked_source_directoryrrcCs|j}tdd}ztj|jd}t|||||||||| |d }td| }| ||| dW5QRXtj|st d|WW5QRdSWn.t k r}zt | d |W5d}~XYnXt |}| }W5QRXW5QRXt||| d S) Nrecord)kindzinstall-record.txt) r2r1record_filenamerr4 header_dirr3r5no_user_configr6zRunning setup.py install for )cmdcwdzRecord file %s not foundF)package_detailsT)headersr rrr%r r existsloggerdebug Exceptionrr&read splitlinesr0)r1r2rr3r4r5r6r7r8r9r:r;r<rr@temp_dirr? install_argsrunnerer/rrrrinstall9sD      rP)__doc__loggingrtypingrrrpip._internal.build_envrpip._internal.exceptionsrrZpip._internal.locations.baserpip._internal.models.schemer pip._internal.utils.miscr $pip._internal.utils.setuptools_buildr pip._internal.utils.subprocessr pip._internal.utils.temp_dirr getLogger__name__rGrr0boolrPrrrrsB         &PK, ]D=operations/install/__pycache__/editable_legacy.cpython-38.pycnu[U ʗReJ @sdZddlZddlmZmZmZddlmZddlm Z ddl m Z ddl m Z eeZeeeeeeeeeeeeeedd d d ZdS) z?Legacy editable installation process, i.e. `setup.py develop`. N)ListOptionalSequence)BuildEnvironment) indent_log)make_setuptools_develop_args)call_subprocess) install_optionsglobal_optionsprefixhome use_user_sitename setup_py_pathisolated build_envunpacked_source_directoryreturnc CsVtd|t|||||||d} t$|t| d| dW5QRXW5QRXdS)z[Install a package in editable mode. Most arguments are pass-through to setuptools. zRunning setup.py develop for %s)r r no_user_configr r r zpython setup.py develop) command_desccwdN)loggerinforrr) r r r r r rrrrrargsr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/install/editable_legacy.pyinstall_editables"  r)__doc__loggingtypingrrrpip._internal.build_envrpip._internal.utils.loggingr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessr getLogger__name__rstrboolrrrrrs&     PK, ]md++6operations/install/__pycache__/__init__.cpython-38.pycnu[U ʗRe3@sdZdS)z,For modules related to installing packages. N)__doc__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/operations/install/__init__.pyPK, ]l̾+network/__pycache__/download.cpython-38.pycnu[U ʗRe@sTdZddlZddlZddlZddlZddlmZmZm Z ddl m Z m Z ddl mZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZmZdd lmZmZm Z e!e"Z#e ee$d ddZ%e ee&ee'dddZ(e&e&dddZ)e&e&e&dddZ*e ee&dddZ+eee dddZ,Gdd d Z-Gd!d"d"Z.dS)#z)Download files with progress indicators. N)IterableOptionalTuple)CONTENT_CHUNK_SIZEResponse)get_download_progress_renderer)NetworkConnectionError)PyPI)Link) is_from_cache) PipSession)HEADERSraise_for_statusresponse_chunks) format_sizeredact_auth_from_urlsplitext)respreturnc Cs2zt|jdWStttfk r,YdSXdS)Nzcontent-length)intheaders ValueErrorKeyError TypeError)rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/download.py_get_http_response_sizesr)rlink progress_barrc Cst|}|jtjkr|j}n|j}t|}|r>d|t|}t |rTt d|n t d|t t jkrtd}n*t |rd}n|sd}n|dkrd}nd}t|t}|s|St||d}||S)Nz{} ({})zUsing cached %szDownloading %sFTi@)bar_typesize)rnetlocr file_storage_domainshow_urlurl_without_fragmentrformatrr loggerinfogetEffectiveLevelloggingINFOrrr) rrr total_lengthurl logged_url show_progresschunksrendererrrr_prepare_downloads0    r1)filenamercCs tj|S)zJ Sanitize the "filename" value from a Content-Disposition header. )ospathbasename)r2rrrsanitize_content_filenameHsr6)content_dispositiondefault_filenamercCs4tj}||d<|d}|r,tt|}|p2|S)z Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. content-typer2)emailmessageMessage get_paramr6str)r7r8mr2rrrparse_content_dispositionOs    r@)rrrcCs|j}|jd}|r t||}t|d}|sPt|jdd}|rP||7}|s~|j|jkr~tj |jd}|r~||7}|S)zoGet an ideal filename from the given HTTP response, falling back to the link filename if not provided. zcontent-dispositionr9) r2rgetr@r mimetypesguess_extensionr,r3r4)rrr2r7extrrr_get_http_response_filename^s   rG)sessionrrcCs.|jddd}|j|tdd}t||S)N#rArT)rstream)r,splitrCr r)rHr target_urlrrrr_http_get_downloadssrMc@s8eZdZeeddddZeeeeefdddZdS) DownloaderNrHrrcCs||_||_dSN_session _progress_barselfrHrrrr__init__{szDownloader.__init__)rlocationrc Cszt|j|}WnDtk rT}z&|jdk s0ttd|jj|W5d}~XYnXt||}t j ||}t |||j }t|d}|D]} || qW5QRX|jdd} || fS)z.Download the file given by link into location.NHTTP error %s while getting %swb Content-TyperBrMrRrresponseAssertionErrorr&critical status_coderGr3r4joinr1rSopenwriterrC) rUrrWrer2filepathr/ content_filechunk content_typerrr__call__s$  zDownloader.__call__) __name__ __module__ __qualname__r r>rVr rrhrrrrrNzs  rNc@sHeZdZeeddddZeeeeeeeeeffdddZ dS)BatchDownloaderNrOcCs||_||_dSrPrQrTrrrrVszBatchDownloader.__init__)linksrWrc cs|D]}zt|j|}WnDtk r\}z&|jdk s8ttd|jj|W5d}~XYnXt||}t j ||}t |||j }t|d} |D]} | | qW5QRX|jdd} ||| ffVqdS)z0Download the files given by links into location.NrXrYrZrBr[) rUrmrWrrrcr2rdr/rerfrgrrrrhs&  zBatchDownloader.__call__) rirjrkr r>rVrr rrhrrrrrls rl)/__doc__ email.messager:r)rDr3typingrrrZpip._vendor.requests.modelsrrpip._internal.cli.progress_barsrpip._internal.exceptionsrpip._internal.models.indexr pip._internal.models.linkr pip._internal.network.cacher pip._internal.network.sessionr pip._internal.network.utilsr rrpip._internal.utils.miscrrr getLoggerrir&rrr>bytesr1r6r@rGrMrNrlrrrrs6        *PK, ]Uo& -network/__pycache__/lazy_wheel.cpython-38.pycnu[U ʗRe@sdZddgZddlmZmZddlmZddlmZddl m Z m Z m Z m Z mZmZddlmZmZdd lmZdd lmZmZdd lmZmZmZdd lmZdd lmZm Z m!Z!Gddde"Z#e$e$eedddZ%GdddZ&dS)zLazy ZIP over HTTPHTTPRangeRequestUnsupporteddist_from_wheel_url) bisect_left bisect_right)contextmanager)NamedTemporaryFile)AnyDict GeneratorListOptionalTuple) BadZipfileZipFile)canonicalize_name)CONTENT_CHUNK_SIZEResponse)BaseDistribution MemoryWheelget_wheel_distribution) PipSession)HEADERSraise_for_statusresponse_chunksc@s eZdZdS)rN)__name__ __module__ __qualname__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/lazy_wheel.pyrs)nameurlsessionreturnc Cs<t||(}t|j|}t|t|W5QRSQRXdS)aReturn a distribution object from the given wheel URL. This uses HTTP range requests to only fetch the potion of the wheel containing metadata, just enough for the object to be constructed. If such requests are not supported, HTTPRangeRequestUnsupported is raised. N)LazyZipOverHTTPrrrr)rr r!zfwheelrrrrs  c@s|eZdZdZefeeeddddZe edddZ e edd d Z e dd d Z ddd dZe e dddZd4eedddZe dddZd5eeedddZedddZd6eeedddZe ddd Zddd!d"Zedd#d$d%Zeed&dd'd(Zddd)d*Zefeee eefe!d+d,d-Z"eeeeee#eefddfd.d/d0Z$eedd1d2d3Z%dS)7r#aFile-like object mapped to a ZIP file over HTTP. This uses HTTP range requests to lazily fetch the file's content, which is supposed to be fed to ZipFile. If such requests are not supported by the server, raise HTTPRangeRequestUnsupported during initialization. N)r r! chunk_sizer"cCs|j|td}t||jdks$t||||_|_|_t|j d|_ t |_ | |j g|_g|_d|j ddkrtd|dS)N)headerszContent-Lengthbytesz Accept-Rangesnonezrange request is not supported)headrr status_codeAssertionError_session_url _chunk_sizeintr'_lengthr_filetruncate_left_rightgetr _check_zip)selfr r!r&r+rrr__init__1s zLazyZipOverHTTP.__init__)r"cCsdS)z!Opening mode, which is always rb.rbrr9rrrmodeAszLazyZipOverHTTP.modecCs|jjS)zPath to the underlying file.)r3rr<rrrrFszLazyZipOverHTTP.namecCsdS)z9Return whether random access is supported, which is True.Trr<rrrseekableKszLazyZipOverHTTP.seekablecCs|jdS)zClose the file.N)r3closer<rrrr?OszLazyZipOverHTTP.closecCs|jjS)zWhether the file is closed.)r3closedr<rrrr@SszLazyZipOverHTTP.closed)sizer"cCs`t||j}||j}}|dkr(|n t|||}td||}|||d|j|S)zRead up to size bytes from the object and return them. As a convenience, if size is unspecified or -1, all bytes until EOF are returned. Fewer than size bytes may be returned if EOF is reached. r)maxr0tellr2min _downloadr3read)r9rB download_sizestartlengthstoprrrrHXs  zLazyZipOverHTTP.readcCsdS)z3Return whether the file is readable, which is True.Trr<rrrreadablefszLazyZipOverHTTP.readabler)offsetwhencer"cCs|j||S)a-Change stream position and return the new absolute position. Seek to offset relative position indicated by whence: * 0: Start of stream (the default). pos should be >= 0; * 1: Current position - pos may be negative; * 2: End of stream - pos usually negative. )r3seek)r9rNrOrrrrPjszLazyZipOverHTTP.seekcCs |jS)zReturn the current position.)r3rEr<rrrrEtszLazyZipOverHTTP.tellcCs |j|S)zResize the stream to the given size in bytes. If size is unspecified resize to the current position. The current stream position isn't changed. Return the new file size. )r3r4)r9rBrrrr4xszLazyZipOverHTTP.truncatecCsdS)z Return False.Frr<rrrwritableszLazyZipOverHTTP.writablecCs|j|SN)r3 __enter__r<rrrrSs zLazyZipOverHTTP.__enter__)excr"cGs|jj|dSrR)r3__exit__)r9rTrrrrUszLazyZipOverHTTP.__exit__)NNNc cs$|}z dVW5||XdS)zyReturn a context manager keeping the position. At the end of the block, seek back to original position. N)rErP)r9posrrr_stays zLazyZipOverHTTP._stayc Csv|jd}ttd||jD]T}||||6z t|Wntk rVYnXW5QRqrW5QRXqdS)z1Check and download until the file is a valid ZIP.rCrN)r2reversedranger0rGrWrr)r9endrJrrrr8s    zLazyZipOverHTTP._check_zip)rJrZ base_headersr"cCs8|}d|d||d<d|d<|jj|j|ddS)z:Return HTTP response to a range request from start to end.zbytes=-Rangezno-cachez Cache-ControlT)r'stream)copyr.r7r/)r9rJrZr[r'rrr_stream_responsesz LazyZipOverHTTP._stream_response)rJrZleftrightr"c cs|j|||j||}}t|g|dd}}t|g|dd}t||D]&\}} ||krv||dfV| d}qX||kr||fV|g|g|j||<|j||<dS)a/Return a generator of intervals to be fetched. Args: start (int): Start of needed interval end (int): End of needed interval left (int): Index of first overlapping downloaded data right (int): Index after last overlapping downloaded data NrCrA)r5r6rFrDzip) r9rJrZrarblslicersliceijkrrr_merges   zLazyZipOverHTTP._merge)rJrZr"c Cs|tt|j|}t|j|}|||||D]D\}}|||}|||t ||j D]}|j |qdq2W5QRXdS)z-Download bytes from start to end inclusively.N) rWrr6rr5rir`rrPrr0r3write)r9rJrZrarbresponsechunkrrrrGs     zLazyZipOverHTTP._download)rA)r)N)&rrr__doc__rstrrr1r:propertyr=rboolr>r?r@r)rHrMrPrEr r4rQrSrrUrr rWr8rr rr`r rirGrrrrr#(sR        r#N)'rm__all__bisectrr contextlibrtempfilertypingrr r r r r zipfilerrpip._vendor.packaging.utilsrZpip._vendor.requests.modelsrrpip._internal.metadatarrrpip._internal.network.sessionrpip._internal.network.utilsrrr Exceptionrrnrr#rrrrs     PK, ]3+(network/__pycache__/utils.cpython-38.pycnu[U ʗRe@szUddlmZmZddlmZmZddlmZddiZee e fe d<eddd d Z efee ee ddfd d d ZdS))Dict Generator)CONTENT_CHUNK_SIZEResponse)NetworkConnectionErrorzAccept-EncodingidentityHEADERSN)respreturncCsd}t|jtrDz|jd}WqJtk r@|jd}YqJXn|j}d|jkr`dkr~nn|jd|d|j}n2d|jkrdkrnn|jd |d|j}|rt||d dS) Nzutf-8z iso-8859-1iiz Client Error: z for url: iXz Server Error: )response) isinstancereasonbytesdecodeUnicodeDecodeError status_codeurlr)r http_error_msgrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/utils.pyraise_for_statuss r)r chunk_sizer ccsTz |jj|ddD] }|VqWn.tk rN|j|}|sBqJ|Vq0YnXdS)z3Given a requests Response, provide the data chunks.F)decode_contentN)rawstreamAttributeErrorread)r rchunkrrrresponse_chunks9s   r)typingrrZpip._vendor.requests.modelsrrpip._internal.exceptionsrrstr__annotations__rintrrrrrrs  PK, ]rл dd'cli/__pycache__/spinners.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z e e ZGdddZGdddeZGd d d eZGd d d Zejeeeddfd ddZdZdZejeeeddddZdS)N)IO Generator)WINDOWS)get_indentationc@s*eZdZddddZeddddZdS)SpinnerInterfaceNreturncCs tdSNNotImplementedErrorselfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/spinners.pyspinszSpinnerInterface.spin final_statusrcCs tdSr r r rrrrfinishszSpinnerInterface.finish)__name__ __module__ __qualname__rstrrrrrrrsrc@sTeZdZdeeeeedddZedddd Zdd d d Zedd ddZ dS)InteractiveSpinnerN-\|/?)messagefile spin_charsmin_update_interval_secondscCs\||_|dkrtj}||_t||_d|_t||_ |j dt |jdd|_ dS)NF z ... r) _messagesysstdout_file RateLimiter _rate_limiter _finished itertoolscycle _spin_cyclewriter_width)r rrrrrrr__init__s  zInteractiveSpinner.__init__statusrcCs\|jr td|j}|j|d|j||j|t||_|j|jdS)Nr ) r'AssertionErrorr,r$r+lenflushr&reset)r r/backuprrr_write+s     zInteractiveSpinner._writercCs,|jr dS|jsdS|t|jdSr )r'r&readyr6nextr*r rrrr7s  zInteractiveSpinner.spinrcCs4|jr dS|||jd|jd|_dS)N T)r'r6r$r+r3rrrrr>s    zInteractiveSpinner.finish)Nrr) rrrrrfloatr-r6rrrrrrrs  rc@sNeZdZdeeddddZeddddZdd d d Zedd d dZdS)NonInteractiveSpinnerN@N)rrrcCs$||_d|_t||_|ddS)NFstarted)r!r'r%r&_update)r rrrrrr-Ls zNonInteractiveSpinner.__init__r.cCs(|jr t|jtd|j|dS)Nz%s: %s)r'r1r&r4loggerinfor!)r r/rrrr>Rs  zNonInteractiveSpinner._updatercCs&|jr dS|jsdS|ddS)Nzstill running...)r'r&r7r>r rrrrWs  zNonInteractiveSpinner.spinrcCs&|jr dS|d|dd|_dS)Nzfinished with status ''T)r'r>rrrrr^szNonInteractiveSpinner.finish)r<) rrrrr:r-r>rrrrrrr;Ksr;c@s8eZdZeddddZedddZdddd ZdS) r%N)rrcCs||_d|_dS)Nr)_min_update_interval_seconds _last_update)r rrrrr-fszRateLimiter.__init__rcCst}||j}||jkSr )timerCrB)r nowdeltarrrr7js zRateLimiter.readycCst|_dSr )rDrCr rrrr4oszRateLimiter.reset)rrrr:r-boolr7r4rrrrr%esr%)rrc cstjr"ttjkr"t|}nt|}z t tj |VW5QRXWn>t k rj| dYn*t k r| dYn X| ddS)Ncancelederrordone) r"r#isattyr?getEffectiveLevelloggingINFOrr; hidden_cursorKeyboardInterruptr Exception)rspinnerrrr open_spinnerss    rSz[?25lz[?25h)NNN)rrc csPtr dVn@|r"ttjkr*dVn"|tz dVW5|tXdSr ) rrKr?rLrMrNr+ HIDE_CURSOR SHOW_CURSOR)rrrrrOs  rO) contextlibr(rMr"rDtypingrrpip._internal.utils.compatrpip._internal.utils.loggingr getLoggerrr?rrr;r%contextmanagerrrSrTrUrOrrrrs$   5PK, ]luu#cli/__pycache__/main.cpython-38.pycnu[U ʗRe @sdZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZeeZd eeeed d d ZdS) z Primary application entrypoint. N)ListOptional) autocomplete) parse_command)create_command)PipError) deprecation)argsreturnc Cs|dkrtjdd}ttzt|\}}WnLtk r}z.tjd|tjt j t dW5d}~XYnXzt t jdWn0t jk r}ztd|W5d}~XYnXt|d|kd}||S)NzERROR: z%Ignoring error %s when setting localez --isolated)isolated)sysargvrinstall_warning_loggerrrrstderrwriteoslinesepexitlocale setlocaleLC_ALLErrorloggerdebugrmain)r cmd_namecmd_argsexcecommandr"/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/main.pyr-s r)N)__doc__rloggingrrtypingrr pip._internal.cli.autocompletionrpip._internal.cli.main_parserrpip._internal.commandsrpip._internal.exceptionsrZpip._internal.utilsr getLogger__name__rstrintrr"r"r"r#s      PK, ]o,cli/__pycache__/progress_bars.cpython-38.pycnu[U ʗRe@sddlZddlmZmZmZmZmZmZddlm Z m Z m Z m Z m Z mZmZmZmZmZddlmZeeegeefZeeeeeeddfdddZddeeeed d d ZdS) N)Callable GeneratorIterableIteratorOptionalTuple) BarColumnDownloadColumnFileSizeColumnProgressProgressColumn SpinnerColumn TextColumnTimeElapsedColumnTimeRemainingColumnTransferSpeedColumn)get_indentation)iterablebar_typesizereturnc cs|dkstd|s>td}tdtdddtttf}n$|}tdttttdt f}t |d d i}|j d t d |d }|(|D]}|V|j |t|dqW5QRXdS)Nonz-This should only be used in the default mode.infz([progress.description]{task.description}lineg?)speedetarefresh_per_second )total)advance)AssertionErrorfloatrr r rrrr rr add_taskrupdatelen)rrrr columnsprogresstask_idchunkr+/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py_rich_progress_bars.  r-)r)rrrcCs |dkrtjt||dStSdS)zGet an object that can be used to render the download progress. Returns a callable, that takes an iterable to "wrap". rrrN) functoolspartialr-iterr.r+r+r,get_download_progress_renderer:sr2)r/typingrrrrrrpip._vendor.rich.progressrr r r r r rrrrpip._internal.utils.loggingrbytesDownloadProgressRendererstrintr-r2r+r+r+r,s 0  %PK, ]M'models/__pycache__/wheel.cpython-38.pycnu[U ʗRe @sJdZddlZddlmZmZmZddlmZddlm Z GdddZ dS)z`Represents a wheel file and provides access to the various parts of the name that have meaning. N)DictIterableList)Tag)InvalidWheelFilenamec@seZdZdZedejZeddddZ e eddd Z e e e d d d Ze e ee e fe d ddZee ed ddZdS)Wheelz A wheel filez^(?P(?P.+?)-(?P.*?)) ((-(?P\d[^-]*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$N)filenamereturncsj|}|st|d|_|ddd_|ddd_|d_|d d_ |d  d_ |d  d_ fd d j D_ d S)zX :raises InvalidWheelFilename: when the filename is invalid for a wheel z is not a valid wheel filename.name_-verbuildpyver.abiplatcs0h|](}jD]}jD]}t|||qqqS)abisplatsr).0xyzselfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/wheel.py (s z!Wheel.__init__..N) wheel_file_rematchrrgroupreplacer version build_tagsplit pyversionsrr file_tags)rr wheel_inforrr__init__s   zWheel.__init__)r cCstdd|jDS)z4Return the wheel's tags as a sorted list of strings.css|]}t|VqdSN)strrtagrrr .sz0Wheel.get_formatted_file_tags..)sortedr&rrrrget_formatted_file_tags,szWheel.get_formatted_file_tags)tagsr cs<ztfddt|DWStk r6tYnXdS)aReturn the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. c3s |]\}}|jkr|VqdSr))r&)ritrrrr->s z*Wheel.support_index_min..N)next enumerate StopIteration ValueErrorrr0rrrsupport_index_min0s zWheel.support_index_min)r0tag_to_priorityr cstfdd|jDS)aReturn the priority of the most preferred tag that one of the wheel's file tag combinations achieves in the given list of supported tags using the given tag_to_priority mapping, where lower priorities are more-preferred. This is used in place of support_index_min in some cases in order to avoid an expensive linear scan of a large list of tags. :param tags: the PEP 425 tags to check the wheel against. :param tag_to_priority: a mapping from tag to priority of that tag, where lower is more preferred. :raises ValueError: If none of the wheel's file tags match one of the supported tags. c3s|]}|kr|VqdSr)rr+r9rrr-Ssz0Wheel.find_most_preferred_tag..)minr&)rr0r9rr:rfind_most_preferred_tagBs zWheel.find_most_preferred_tagcCs|j| S)zReturn whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. )r& isdisjointr7rrr supportedWszWheel.supported)__name__ __module__ __qualname____doc__recompileVERBOSErr*r(rr/rintr8rr<rboolr>rrrrr s  r) rBrCtypingrrrZpip._vendor.packaging.tagsrpip._internal.exceptionsrrrrrrs   PK, ]V=,models/__pycache__/direct_url.cpython-38.pycnu[U ʗRe@sBdZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z dddddgZ e d Zd Zed ZGd ddeZdeeefe eee ee ed ddZdeeefe eee eed ddZee dddddZeeeefdddZGdddZGdddZGdddZe eeefZGdddZdS)z PEP 610 N)AnyDictIterableOptionalTypeTypeVarUnion DirectUrlDirectUrlValidationErrorDirInfo ArchiveInfoVcsInfoTzdirect_url.jsonz.^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$c@s eZdZdS)r N)__name__ __module__ __qualname__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/direct_url.pyr s)d expected_typekeydefaultreturncCs4||kr |S||}t||s0td||||S)z3Get value from dictionary and verify expected type.z-{!r} has unexpected type for {} (expected {})) isinstancer formatrrrrvaluerrr_gets rcCs(t||||}|dkr$t|d|S)Nz must have a value)rr rrrr _get_required)srInfoType)infosrcCsFdd|D}|stdt|dkr.td|ddk s>t|dS)NcSsg|]}|dk r|qSNr).0inforrr 3sz#_exactly_one_of..z/missing one of archive_info, dir_info, vcs_infoz1more than one of archive_info, dir_info, vcs_infor)r lenAssertionError)r rrr_exactly_one_of2s r()kwargsrcKsdd|DS)z Make dict excluding None values.cSsi|]\}}|dk r||qSr!r)r"kvrrr Bsz _filter_none..)items)r)rrr _filter_none@sr.c@sdeZdZdZd eeeeddddZeeeee feddddZ eee fd d d Z dS) r vcs_infoN)vcs commit_idrequested_revisionrcCs||_||_||_dSr!r0r2r1)selfr0r1r2rrr__init__HszVcsInfo.__init__rrcCs2|dkr dS|t|tdt|tdt|tddS)Nr0r1r2)r0r1r2)rstrrclsrrrr _from_dictRs   zVcsInfo._from_dictrcCst|j|j|jdS)Nr3)r.r0r2r1r4rrr_to_dict\s zVcsInfo._to_dict)N) rrrnamer7rr5 classmethodrrr:r=rrrrr Es " c@s`eZdZdZd eeddddZeeeee feddddZ eee fd d d Z dS) r archive_infoN)hashrcCs ||_dSr!rA)r4rArrrr5gszArchiveInfo.__init__r6cCs|dkr dS|t|tddS)NrArB)rr7r8rrrr:mszArchiveInfo._from_dictr;cCs t|jdS)NrB)r.rAr<rrrr=sszArchiveInfo._to_dict)N) rrrr>rr7r5r?rrr:r=rrrrr ds "c@s\eZdZdZd eddddZeeee e fedddd Z ee e fd d d Z dS)r dir_infoFN)editablercCs ||_dSr!rD)r4rDrrrr5zszDirInfo.__init__r6cCs"|dkr dS|t|tddddS)NrDF)rrE)rboolr8rrrr:szDirInfo._from_dictr;cCst|jp ddS)NrE)r.rDr<rrrr=szDirInfo._to_dict)F) rrrr>rFr5r?rrr7rr:r=rrrrr ws "c@seZdZdeeeeddddZeedddZeedd d Z ddd d Z e e ee fdd ddZe ee fdddZe eddddZedddZedddZdS)r N)urlr# subdirectoryrcCs||_||_||_dSr!)rGr#rH)r4rGr#rHrrrr5szDirectUrl.__init__)netlocrcCsRd|kr |S|dd\}}t|jtr@|jjdkr@|dkr@|St|rN|S|S)N@r%git)splitrr#r r0 ENV_VAR_REmatch)r4rI user_passnetloc_no_user_passrrr_remove_auth_from_netlocs   z"DirectUrl._remove_auth_from_netlocr;cCs<tj|j}||j}tj|j||j|j |j f}|S)zurl with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL. ) urllibparseurlsplitrGrQrI urlunsplitschemepathqueryfragment)r4purlrIsurlrrr redacted_urls  zDirectUrl.redacted_urlcCs||dSr!) from_dictto_dictr<rrrvalidateszDirectUrl.validater6c CsRtt|tdt|tdttt|tdtt|tdt t|tdgdS)NrGrHr@rCr/)rGrHr#) r rr7rr(r r:dictr r r8rrrr]s  zDirectUrl.from_dictcCs&t|j|jd}|j||jj<|S)N)rGrH)r.r\rHr#r=r>)r4resrrrr^s zDirectUrl.to_dict)srcCs|t|Sr!)r]jsonloads)r9rbrrr from_jsonszDirectUrl.from_jsoncCstj|ddS)NT) sort_keys)rcdumpsr^r<rrrto_jsonszDirectUrl.to_jsoncCst|jto|jjSr!)rr#r rDr<rrris_local_editableszDirectUrl.is_local_editable)N)rrrr7rrr5rQpropertyr\r_r?rrr]r^rerhrFrirrrrr s$   )N)N)__doc__rcre urllib.parserRtypingrrrrrrr__all__rDIRECT_URL_METADATA_NAMEcompilerM Exceptionr r7rrr(r.r r r rr rrrrsJ$     PK, ]s//(models/__pycache__/scheme.cpython-38.pycnu[U ʗRe@s$dZdddddgZGdddZdS) z For types associated with installation schemes. For a general overview of available schemes and their context, see https://docs.python.org/3/install/index.html#alternate-installation. platlibpurelibheadersscriptsdatac@s,eZdZdZeZeeeeeddddZdS)SchemeztA Scheme holds paths which are used as the base directories for artifacts associated with a Python package. N)rrrrrreturncCs"||_||_||_||_||_dS)N)rrrrr)selfrrrrrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/scheme.py__init__s zScheme.__init__)__name__ __module__ __qualname____doc__ SCHEME_KEYS __slots__strr r r r r r srN)rrrr r r r sPK, ]޷ 5models/__pycache__/installation_report.cpython-38.pycnu[U ʗRe9 @sJddlmZmZmZddlmZddlmZddlm Z GdddZ dS))AnyDictSequence)default_environment) __version__)InstallRequirementc@sPeZdZeedddZeeeee fdddZ eee fddd Z d S) InstallationReport)install_requirementscCs ||_dS)N)_install_requirements)selfr r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/installation_report.py__init__ szInstallationReport.__init__)ireqreturncCsX|jstd||jt|j|j|jd}|jrT|jrTt t |j|d<|S)NzNo download_info for ) download_info is_direct requestedmetadatarequested_extras) rAssertionErrorto_dictbool original_link user_suppliedget_dist metadata_dictextraslistsorted)clsrresr r r _install_req_to_dict s z'InstallationReport._install_req_to_dict)rcs dtfddjDtdS)N0csg|]}|qSr )r").0rr r r +sz.InstallationReport.to_dict..)version pip_versioninstall environment)rr rr%r r%r r's  zInstallationReport.to_dictN) __name__ __module__ __qualname__rrr classmethodrstrrr"rr r r r r srN) typingrrrZpip._vendor.packaging.markersrpiprZpip._internal.req.req_installrrr r r r s   PK, ]0q9 9 models/installation_report.pynu[from typing import Any, Dict, Sequence from pip._vendor.packaging.markers import default_environment from pip import __version__ from pip._internal.req.req_install import InstallRequirement class InstallationReport: def __init__(self, install_requirements: Sequence[InstallRequirement]): self._install_requirements = install_requirements @classmethod def _install_req_to_dict(cls, ireq: InstallRequirement) -> Dict[str, Any]: assert ireq.download_info, f"No download_info for {ireq}" res = { # PEP 610 json for the download URL. download_info.archive_info.hash may # be absent when the requirement was installed from the wheel cache # and the cache entry was populated by an older pip version that did not # record origin.json. "download_info": ireq.download_info.to_dict(), # is_direct is true if the requirement was a direct URL reference (which # includes editable requirements), and false if the requirement was # downloaded from a PEP 503 index or --find-links. "is_direct": bool(ireq.original_link), # requested is true if the requirement was specified by the user (aka # top level requirement), and false if it was installed as a dependency of a # requirement. https://peps.python.org/pep-0376/#requested "requested": ireq.user_supplied, # PEP 566 json encoding for metadata # https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata "metadata": ireq.get_dist().metadata_dict, } if ireq.user_supplied and ireq.extras: # For top level requirements, the list of requested extras, if any. res["requested_extras"] = list(sorted(ireq.extras)) return res def to_dict(self) -> Dict[str, Any]: return { "version": "0", "pip_version": __version__, "install": [ self._install_req_to_dict(ireq) for ireq in self._install_requirements ], # https://peps.python.org/pep-0508/#environment-markers # TODO: currently, the resolver uses the default environment to evaluate # environment markers, so that is what we report here. In the future, it # should also take into account options such as --python-version or # --platform, perhaps under the form of an environment_override field? # https://github.com/pypa/pip/issues/11198 "environment": default_environment(), } PK, ]s6       PK, ]&&1metadata/__pycache__/pkg_resources.cpython-38.pycnu[U ʗReI$@s,ddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZmZddlmZddlmZmZmZddlmZdd lmZm Z dd l!m"Z"m#Z#d d l$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*e+e,Z-Gd dde Z.GdddZ/Gddde%Z0Gddde'Z1dS)N) CollectionIterableIteratorListMapping NamedTupleOptional) pkg_resources) Requirement)NormalizedNamecanonicalize_name)parse) InvalidWheelNoneMetadataErrorUnsupportedWheel)egg_link_path_from_location) display_pathnormalize_path) parse_wheelread_wheel_metadata_file)BaseDistributionBaseEntryPointBaseEnvironmentDistributionVersionInfoPathWheelc@s&eZdZUeed<eed<eed<dS) EntryPointnamevaluegroupN)__name__ __module__ __qualname__str__annotations__r&r&/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/pkg_resources.pyrs rc@seZdZdZeeefeddddZeedddZ eedd d Z ee edd d Z eedd dZ eeedddZeeddddZdS) WheelMetadatazIMetadataProvider that reads metadata files from a dictionary. This also maps metadata decoding exceptions to our internal exception type. N)metadata wheel_namereturncCs||_||_dSN) _metadata _wheel_name)selfr)r*r&r&r'__init__*szWheelMetadata.__init__rr+cCs ||jkSr,)r-r/rr&r&r' has_metadata.szWheelMetadata.has_metadatac CsVz|j|WStk rP}z"td|jd|d|dW5d}~XYnXdS)NzError decoding metadata for z: z in z file)r-decodeUnicodeDecodeErrorrr.)r/rer&r&r' get_metadata1s zWheelMetadata.get_metadatacCst||Sr,)r yield_linesr7r2r&r&r'get_metadata_lines:sz WheelMetadata.get_metadata_linescCsdSNFr&r2r&r&r'metadata_isdir=szWheelMetadata.metadata_isdircCsgSr,r&r2r&r&r'metadata_listdir@szWheelMetadata.metadata_listdir) script_name namespacer+cCsdSr,r&)r/r=r>r&r&r' run_scriptCszWheelMetadata.run_script)r!r"r#__doc__rr$bytesr0boolr3r7rr9r;rr<r?r&r&r&r'r($s r(c@sBeZdZejddddZeeedddZ ee eedd d Z e e ed d d Ze e ed ddZe e ed ddZe ed ddZe ed ddZe ed ddZeedddZeed ddZeedddZeed dd Zej j!d d!d"Z"d)e#eee$d$d%d&Z%eed d'd(Z&dS)* DistributionN)distr+cCs ||_dSr,)_distr/rDr&r&r'r0HszDistribution.__init__) directoryr+c Cs|tj}tj|\}}t||}|drJtj}tj |d}n.|dsXt tj }tj |ddd}||||d}||S)Nz .egg-inforz .dist-info-) project_namer)) rstriposseppathsplitr PathMetadataendswithrCsplitextAssertionErrorDistInfoDistribution) clsrGdist_dirbase_dir dist_dir_namer)dist_cls dist_namerDr&r&r'from_directoryKs   zDistribution.from_directory)wheelrr+c sz>|,t|\}fddD}W5QRXWndtjk rp}zt|j||W5d}~XYn4tk r}zt|d|W5d}~XYnXtj |jt ||j|d}||S)Ncs4i|],}|dr|dddt|qS)/r) startswithrNr).0rMinfo_dirzfr&r' dsz+Distribution.from_wheel..z has an invalid wheel, )locationr)rI) as_zipfilernamelistzipfile BadZipFilerrdrr rSr()rTr[r_ metadata_textr6rDr&r`r' from_wheel_s   $ zDistribution.from_wheelr+cCs|jjSr,)rErdr/r&r&r'rdtszDistribution.locationcCs.t|j}|r|}n|jr"|j}ndSt|Sr,)rraw_namerdr)r/egg_linkrdr&r&r'installed_locationxs zDistribution.installed_locationcCs|jjSr,)rEegg_informr&r&r' info_locationszDistribution.info_locationcCs,zt|jjjWStk r&YdSXdSr:)rBrE _providerrMAttributeErrorrmr&r&r'installed_by_distutilssz#Distribution.installed_by_distutilscCs t|jjSr,)r rErIrmr&r&r'canonical_nameszDistribution.canonical_namecCs t|jjSr,) parse_versionrEversionrmr&r&r'rxszDistribution.version)rMr+cCs|jt|Sr,)rEr3r$)r/rMr&r&r'is_fileszDistribution.is_fileccs|jdEdHdS)Nscripts)rEr<rmr&r&r'iter_distutils_script_namessz(Distribution.iter_distutils_script_namescCs>t|}|j|st||j|}|dkr:t|||Sr,)r$rEr3FileNotFoundErrorr7r)r/rMrcontentr&r&r' read_texts   zDistribution.read_textccsZ|jD]F\}}|D]4\}}t|d\}}}t|||dVqqdS)N=)rrr )rE get_entry_mapitemsr$ partitionrstrip)r/r entriesr entry_pointrirr&r&r'iter_entry_pointsszDistribution.iter_entry_pointscCst|jtjrd}nd}z||}Wn@tk rf|jrHt|j}n t|j}t d|d}YnXt j }|||S)z :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. METADATAzPKG-INFOzNo metadata found in %s) isinstancerEr rSr~r|rdrreprloggerwarningemailparser FeedParserfeedclose)r/ metadata_namer)displaying_path feed_parserr&r&r'_metadata_impls      zDistribution._metadata_implr&)extrasr+cCs"|rt||jj}|j|Sr,) frozenset intersectionrErrequires)r/rr&r&r'iter_dependenciesszDistribution.iter_dependenciescCs|jjSr,)rErrmr&r&r'iter_provided_extrassz!Distribution.iter_provided_extras)r&)'r!r"r#r rCr0 classmethodr$rrZrrkpropertyrrdrprrrBrur rvrrxrryrr{r~rrrrmessageMessagerrr rrr&r&r&r'rCGs0   rCc@seZdZejddddZeedddZee e e edd d Z e edd d Ze e ed ddZe e ed ddZdS) EnvironmentN)wsr+cCs ||_dSr,)_ws)r/rr&r&r'r0szEnvironment.__init__rlcCs |tjSr,)r working_set)rTr&r&r'defaultszEnvironment.default)pathsr+cCs|t|Sr,)r WorkingSet)rTrr&r&r' from_pathsszEnvironment.from_pathsccs|jD]}t|VqdSr,)rrCrFr&r&r'_iter_distributionss zEnvironment._iter_distributionsr1cCs,t|}|D]}|j|kr|SqdS)zFind a distribution matching the ``name`` in the environment. This searches from *all* distributions available in the environment, to match the behavior of ``pkg_resources.get_distribution()``. N)r iter_all_distributionsrv)r/rrvrDr&r&r'_search_distributions    z Environment._search_distributioncCsF||}|r|Sz|j|Wntjk r:YdSX||Sr,)rrrequirer DistributionNotFound)r/rrDr&r&r'get_distributions  zEnvironment.get_distribution)r!r"r#r rr0rrrrrr$rrrrrrr&r&r&r'rs r)2 email.messager email.parserloggingrKrgtypingrrrrrrr pip._vendorr "pip._vendor.packaging.requirementsr pip._vendor.packaging.utilsr r Zpip._vendor.packaging.versionr rwpip._internal.exceptionsrrrpip._internal.utils.egg_linkrpip._internal.utils.miscrrpip._internal.utils.wheelrrbaserrrrrr getLoggerr!rrr(rCrr&r&r&r's($     #PK, ],aM{h{h(metadata/__pycache__/base.cpython-38.pycnu[U ʗRea@sddlZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZddlmZddlmZmZddlmZddlmZm Z ddl!m"Z"ddl#m$Z$m%Z%m&Z&dd l'm(Z(m)Z)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0m1Z1dd l2m3Z3ddl4m5Z5ddl6m7Z7e rHddl m8Z8ne9Z8eee fZ:ee;eje?Z@Gddde8ZAee;dfee;dfe;dddZBGdddeZCGddde8ZDGdddZEGddde8ZFGd d!d!eFZGGd"d#d#eFZHdS)$N) IO TYPE_CHECKINGAny Collection ContainerDictIterableIteratorList NamedTupleOptionalTupleUnion) Requirement)InvalidSpecifier SpecifierSet)NormalizedName) LegacyVersionVersion)NoneMetadataError) get_scheme site_packages user_site)DIRECT_URL_METADATA_NAME DirectUrlDirectUrlValidationError) stdlib_pkgs)egg_link_path_from_sys_path)is_localnormalize_path) safe_extra) url_to_path) msg_to_json)Protocolc@sBeZdZeedddZeedddZeedddZdS) BaseEntryPointreturncCs tdSNNotImplementedErrorselfr-/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/base.pyname:szBaseEntryPoint.namecCs tdSr(r)r+r-r-r.value>szBaseEntryPoint.valuecCs tdSr(r)r+r-r-r.groupBszBaseEntryPoint.groupN)__name__ __module__ __qualname__propertystrr/r0r1r-r-r-r.r%9s r%.)entryinfor'cCsV|rD|ddkrD|r |ddkr*|d7}n |dd}|dd}qttj||S)aConvert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. r..)r9Nr"r6pathlibPath)r7r8r-r-r._convert_installed_files_pathGs   r>c@s&eZdZUeed<eed<eed<dS) RequiresEntry requirementextramarkerN)r2r3r4r6__annotations__r-r-r-r.r?es r?c@sReZdZeeddddZededdddZedd d Zedd d Ze e edd dZ e e edddZ e e edddZ e e edddZe edddZe edddZe edddZe edddZe edddZe eddd Ze edd!d"Ze e edd#d$Ze edd%d&Ze edd'd(Ze edd)d*Ze edd+d,Ze edd-d.Ze edd/d0Z e!ed1d2d3Z"e#edd4d5Z$e!ed1d6d7Z%e&e'dd8d9Z(e)j*j+dd:d;Z,e-j.dd?Z/e e)j*j+dd@dAZ0e e1ee2fddBdCZ3e e eddDdEZ4e eddFdGZ5e e6ddHdIZ7dbe8ee&e9dKdLdMZ:e&eddNdOZ;e e#eddPdQZe#e?ddVdWZ@e&eddXdYZAe&eddZd[ZBe)j*j+d\d]d^d_ZCe edd`daZDd\S)cBaseDistribution) directoryr'cCs tdS)zLoad the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``. Nr))clsrEr-r-r.from_directorylszBaseDistribution.from_directoryWheel)wheelr/r'cCs tdS)aLoad the distribution from a given wheel. :param wheel: A concrete wheel definition. :param name: File name of the wheel. :raises InvalidWheel: Whenever loading of the wheel causes a :py:exc:`zipfile.BadZipFile` exception to be thrown. :raises UnsupportedWheel: If the wheel is a valid zip, but malformed internally. Nr))rFrIr/r-r-r. from_wheelts zBaseDistribution.from_wheelr&cCs|jd|jd|jdS)N z ())raw_nameversionlocationr+r-r-r.__repr__szBaseDistribution.__repr__cCs|jd|jS)NrK)rMrNr+r-r-r.__str__szBaseDistribution.__str__cCs tdS)aWhere the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. Nr)r+r-r-r.rOs zBaseDistribution.locationcCs6|j}|r|r2t|jSnt|j}|r2|jSdS)zThe project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. N) direct_urlis_local_editabler!urlrrMrO)r,rR egg_link_pathr-r-r.editable_project_locations  z*BaseDistribution.editable_project_locationcCs tdS)aThe distribution's "installed" location. This should generally be a ``site-packages`` directory. This is usually ``dist.location``, except for legacy develop-installed packages, where ``dist.location`` is the source code location, and this is where the ``.egg-link`` file is. The returned location is normalized (in particular, with symlinks removed). Nr)r+r-r-r.installed_locations z#BaseDistribution.installed_locationcCs tdS)a/Location of the .[egg|dist]-info directory or file. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. Nr)r+r-r-r. info_locationszBaseDistribution.info_locationcCs|j}|sdSt|S)aWhether this distribution is installed with legacy distutils format. A distribution installed with "raw" distutils not patched by setuptools uses one single file at ``info_location`` to store metadata. We need to treat this specially on uninstallation. F)rXr<r=is_filer,rXr-r-r.installed_by_distutilssz'BaseDistribution.installed_by_distutilscCs|j}|sdS|dS)zWhether this distribution is installed as an egg. This usually indicates the distribution was installed by (older versions of) easy_install. Fz.egg)rOendswithr,rOr-r-r.installed_as_eggsz!BaseDistribution.installed_as_eggcCs*|j}|sdS|dsdSt|S)aWhether this distribution is installed with the ``.egg-info`` format. This usually indicates the distribution was installed with setuptools with an old pip version or with ``single-version-externally-managed``. Note that this ensure the metadata store is a directory. distutils can also installs an ``.egg-info``, but as a file, not a directory. This property is *False* for that case. Also see ``installed_by_distutils``. Fz .egg-inforXr\r<r=is_dirrZr-r-r."installed_with_setuptools_egg_infos  z3BaseDistribution.installed_with_setuptools_egg_infocCs*|j}|sdS|dsdSt|S)aaWhether this distribution is installed with the "modern format". This indicates a "modern" installation, e.g. storing metadata in the ``.dist-info`` directory. This applies to installations made by setuptools (but through pip, not directly), or anything using the standardized build backend interface (PEP 517). Fz .dist-infor_rZr-r-r.installed_with_dist_infos  z)BaseDistribution.installed_with_dist_infocCs tdSr(r)r+r-r-r.canonical_nameszBaseDistribution.canonical_namecCs tdSr(r)r+r-r-r.rNszBaseDistribution.versioncCs|jddS)zConvert a project name to its setuptools-compatible filename. This is a copy of ``pkg_resources.to_filename()`` for compatibility. -_)rMreplacer+r-r-r.setuptools_filename sz$BaseDistribution.setuptools_filenamec Cszz|t}Wntk r$YdSXz t|WSttjtfk rt}zt dt|j |WYdSd}~XYnXdS)zObtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. NzError parsing %s for %s: %s) read_textrFileNotFoundErrorr from_jsonUnicodeDecodeErrorjsonJSONDecodeErrorrloggerwarningrc)r,contenter-r-r.rRs$ zBaseDistribution.direct_urlc CsRz|d}Wntttfk r*YdSX|D]}|}|r4|Sq4dS)N INSTALLER)rhOSError ValueErrorr splitlinesstrip)r,installer_textline cleaned_liner-r-r. installer.s  zBaseDistribution.installercCs |dS)N REQUESTED)rYr+r-r-r. requested:szBaseDistribution.requestedcCs t|jSr()boolrVr+r-r-r.editable>szBaseDistribution.editablecCs|jdkrdSt|jS)z|If distribution is installed in the current virtual environment. Always True if we're not in a virtualenv. NF)rWrr+r-r-r.localBs zBaseDistribution.localcCs&|jdkstdkrdS|jttSNF)rWr startswithrr+r-r-r. in_usersiteLszBaseDistribution.in_usersitecCs&|jdkstdkrdS|jttSr)rWrrrr+r-r-r.in_site_packagesRsz!BaseDistribution.in_site_packages)pathr'cCs tdS)z7Check whether an entry in the info directory is a file.Nr)r,rr-r-r.rYXszBaseDistribution.is_filecCs tdS)zFind distutils 'scripts' entries metadata. If 'scripts' is supplied in ``setup.py``, distutils records those in the installed distribution's ``scripts`` directory, a file for each script. Nr)r+r-r-r.iter_distutils_script_names\sz,BaseDistribution.iter_distutils_script_namescCs tdS)zRead a file in the info directory. :raise FileNotFoundError: If ``path`` does not exist in the directory. :raise NoneMetadataError: If ``path`` exists in the info directory, but cannot be read. Nr)rr-r-r.rhdszBaseDistribution.read_textcCs tdSr(r)r+r-r-r.iter_entry_pointsmsz"BaseDistribution.iter_entry_pointscCs tdSr(r)r+r-r-r._metadata_implpszBaseDistribution._metadata_implr")maxsizecCs|}|||Sr()r_add_egg_info_requires)r,metadatar-r-r._metadata_cachedss z!BaseDistribution._metadata_cachedcCs|S)aMetadata of distribution parsed from e.g. METADATA or PKG-INFO. This should return an empty message if the metadata file is unavailable. :raises NoneMetadataError: If the metadata file is available, but does not contain valid metadata. )rr+r-r-r.r{s zBaseDistribution.metadatacCs t|jS)aPEP 566 compliant JSON-serializable representation of METADATA or PKG-INFO. This should return an empty dict if the metadata file is unavailable. :raises NoneMetadataError: If the metadata file is available, but does not contain valid metadata. )r#rr+r-r-r. metadata_dicts zBaseDistribution.metadata_dictcCs |jdS)zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)rgetr+r-r-r.metadata_versionsz!BaseDistribution.metadata_versioncCs|jd|jS)z*Value of "Name:" in distribution metadata.Name)rrrcr+r-r-r.rMszBaseDistribution.raw_namec Csp|jd}|dkrtSztt|}Wn@tk rj}z"d}t||j|tWYSd}~XYnX|S)zValue of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)rrrr6rrnrorM)r,r0specrqmessager-r-r.requires_pythons z BaseDistribution.requires_pythonr-)extrasr'cCs tdS)zDependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. Nr))r,rr-r-r.iter_dependenciessz"BaseDistribution.iter_dependenciescCs tdS)zExtras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. Nr)r+r-r-r.iter_provided_extrassz%BaseDistribution.iter_provided_extrascCs>z|d}Wntk r$YdSXddt|DS)NRECORDcss |]}tt|dVqdS)rNr;).0rowr-r-r. szFBaseDistribution._iter_declared_entries_from_record..)rhricsvreaderrv)r,textr-r-r."_iter_declared_entries_from_records z3BaseDistribution._iter_declared_entries_from_recordcsz|d}Wntk r$YdSXdd|jddD}|j}|j}|dksX|dkr\|Szt||Wntk r|YSXj s|Sfdd|DS)Nzinstalled-files.txtcss|]}|r|VqdSr(r-rpr-r-r.rszFBaseDistribution._iter_declared_entries_from_legacy..F)keependsc3s"|]}tt|jjVqdSr()r>r<r=partsrinfo_relr-r.rs) rhrirvrOrXr<r= relative_torur)r,rpathsrootr8r-rr."_iter_declared_entries_from_legacys$  z3BaseDistribution._iter_declared_entries_from_legacycCs|p|S)aIterate through file entries declared in this distribution. For modern .dist-info distributions, this is the files listed in the ``RECORD`` metadata file. For legacy setuptools distributions, this comes from ``installed-files.txt``, with entries normalized to be compatible with the format used by ``RECORD``. :return: An iterator for listed entries, or None if the distribution contains neither ``RECORD`` nor ``installed-files.txt``. )rrr+r-r-r.iter_declared_entriess z&BaseDistribution.iter_declared_entriesccsz|d}Wntk r$YdSXd}}|D]X}|}|r6|drRq6|dr~|dr~|dd\}}}q6t|||d Vq6dS) aParse a ``requires.txt`` in an egg-info directory. This is an INI-ish format where an egg-info stores dependencies. A section name describes extra other environment markers, while each entry is an arbitrary string (not a key-value pair) representing a dependency as a requirement string (no markers). There is a construct in ``importlib.metadata`` called ``Sectioned`` that does mostly the same, but the format is currently considered private. z requires.txtNrs#[]z[]:)r@rArB)rhrirvrwrr\ partitionr?)r,rprArBryrer-r-r._iter_requires_txt_entriess  z+BaseDistribution._iter_requires_txt_entriesccs8dh}|D]$}|j|krq||j|jVqdS)z'Get extras from the egg-info directory.rsN)rrAadd)r, known_extrasr7r-r-r._iter_egg_info_extrass    z&BaseDistribution._iter_egg_info_extrasccs|D]x}|jr4|jr4d|jdt|jd}n,|jrNdt|jd}n|jr\|j}nd}|rx|jd|Vq|jVqdS)aGet distribution dependencies from the egg-info directory. To ease parsing, this converts a legacy dependency entry into a PEP 508 requirement string. Like ``_iter_requires_txt_entries()``, there is code in ``importlib.metadata`` that does mostly the same, but not do exactly what we need. Namely, ``importlib.metadata`` does not normalize the extra name before putting it into the requirement string, which causes marker comparison to fail because the dist-info format do normalize. This is consistent in all currently available PEP 517 backends, although not standardized. (z) and extra == ""z extra == "rsz ; N)rrArBr r@)r,r7rBr-r-r._iter_egg_info_dependenciess  z,BaseDistribution._iter_egg_info_dependenciesN)rr'cCsD|ds |D] }||d<q|ds@|D] }||d<q2dS)z6Add egg-info requires.txt information to the metadata.z Requires-DistzProvides-ExtraN)get_allrr)r,rdeprAr-r-r.r*s      z'BaseDistribution._add_egg_info_requirescCs(t|j}|ttdjddS)zr Return True if given Distribution is installed in path matching distutils_scheme layout. rspythonr)rrWrrpurelibsplit)r, norm_pathr-r-r.in_install_path3s z BaseDistribution.in_install_path)r-)Er2r3r4 classmethodr6rGrJrPrQr5r rOrVrWrXr~r[r^rarbrrcDistributionVersionrNrgrrRr{r}rrrrInfoPathrYr rrhrr%remailrMessager functools lru_cacherrrrrrrMrrrrrrrrrr?rrrrrr-r-r-r.rDks             rDc@seZdZdZeddddZeeeeddddZ eedd d d Z e ddd d Z e e dddZdedddfeeeeeee e dddZdS)BaseEnvironmentz6An environment containing distributions to introspect.r&cCs tdSr(r))rFr-r-r.defaultAszBaseEnvironment.default)rr'cCs tdSr(r))rFrr-r-r. from_pathsEszBaseEnvironment.from_pathsrD)r/r'cCs tdS)zGiven a requirement name, return the installed distributions. The name may not be normalized. The implementation must canonicalize it for lookup. Nr))r,r/r-r-r.get_distributionIsz BaseEnvironment.get_distributioncCs tdS)aIterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. Nr)r+r-r-r._iter_distributionsQsz#BaseEnvironment._iter_distributionsccsD|D]6}tjd|jtjd}|s8td|j|jq|VqdS)zBIterate through all installed distributions without any filtering.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)flagsz%Ignoring invalid distribution %s (%s)N)rrematchrc IGNORECASErnrorO)r,distproject_name_validr-r-r.iter_all_distributionsZs z&BaseEnvironment.iter_all_distributionsTF) local_onlyskipinclude_editableseditables_only user_onlyr'csb|}|rdd|D}|s,dd|D}|r>dd|D}|rPdd|D}fdd|DS)a/Return a list of installed distributions. This is based on ``iter_all_distributions()`` with additional filtering options. Note that ``iter_installed_distributions()`` without arguments is *not* equal to ``iter_all_distributions()``, since some of the configurations exclude packages by default. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. css|]}|jr|VqdSr()rrdr-r-r.rsz?BaseEnvironment.iter_installed_distributions..css|]}|js|VqdSr(rrr-r-r.rscss|]}|jr|VqdSr(rrr-r-r.rscss|]}|jr|VqdSr()rrr-r-r.rsc3s|]}|jkr|VqdSr()rcrrr-r.rs )r)r,rrrrritr-rr.iter_installed_distributionsosz,BaseEnvironment.iter_installed_distributionsN)r2r3r4__doc__rrr r r6rrr rrDrrr~rrr-r-r-r.r>s* rc@s&eZdZUeed<ejdddZdS)rHrOr&cCs tdSr(r)r+r-r-r. as_zipfileszWheel.as_zipfileN)r2r3r4r6rCzipfileZipFilerr-r-r-r.rHs rHc@s,eZdZeddddZejdddZdS)FilesystemWheelN)rOr'cCs ||_dSr()rOr]r-r-r.__init__szFilesystemWheel.__init__r&cCstj|jddSNT) allowZip64)rrrOr+r-r-r.rszFilesystemWheel.as_zipfile)r2r3r4r6rrrrr-r-r-r.rsrc@s2eZdZeeeddddZejdddZ dS) MemoryWheelN)rOstreamr'cCs||_||_dSr()rOr)r,rOrr-r-r.rszMemoryWheel.__init__r&cCstj|jddSr)rrrr+r-r-r.rszMemoryWheel.as_zipfile) r2r3r4r6rbytesrrrrr-r-r-r.rsr)Ir email.messagerrrlloggingr<rrtypingrrrrrrrr r r r r r"pip._vendor.packaging.requirementsrZ pip._vendor.packaging.specifiersrrpip._vendor.packaging.utilsrZpip._vendor.packaging.versionrrpip._internal.exceptionsrpip._internal.locationsrrrpip._internal.models.direct_urlrrrpip._internal.utils.compatrpip._internal.utils.egg_linkrpip._internal.utils.miscrrpip._internal.utils.packagingr pip._internal.utils.urlsr!_jsonr#r$objectrr6PurePathr getLoggerr2rnr%r>r?rDrrHrrr-r-r-r.sR<             VUPK, ]b  )metadata/__pycache__/_json.cpython-38.pycnu[U ʗRe# @sddlmZmZmZddlmZddlmZmZm Z m Z dddddd d d d d dddddddddddddddgZ e e dddZ eee efd d!d"Zd#S)$)Header decode_header make_header)Message)AnyDictListUnion)zMetadata-VersionF)NameF)VersionF)DynamicT)PlatformT)zSupported-PlatformT)SummaryF) DescriptionF)zDescription-Content-TypeF)KeywordsF)z Home-pageF)z Download-URLF)AuthorF)z Author-emailF) MaintainerF)zMaintainer-emailF)LicenseF) ClassifierT)z Requires-DistT)zRequires-PythonF)zRequires-ExternalT)z Project-URLT)zProvides-ExtraT)z Provides-DistT)zObsoletes-DistT)fieldreturncCs|ddS)N-_)lowerreplace)rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/_json.py json_name%sr)msgrcstttftdddi}tD]|\}}||kr2q t|}|rXfdd||D}n<||}|dkrd|krdd|dD}n|}|||<q |}|r||d <|S) z;Convert a Message object into a JSON-compatible dictionary.)hrc Ssvt|trng}t|D]J\}}|dkrRz|dd}Wntk rPd}YnX|||fqtt|St|S)Nz unknown-8bitzutf-8latin1) isinstancerrdecodeUnicodeDecodeErrorappendstrr)rchunksbytesencodingrrrsanitise_header,s    z$msg_to_json..sanitise_headercsg|] }|qSrr.0vr)rr Bszmsg_to_json..keywords,cSsg|] }|qSr)stripr*rrrr.Ks description) r rr%METADATA_FIELDSrget_allgetsplit get_payload)rresultrmultikeyvaluepayloadrr-r msg_to_json)s(   r=N)Z email.headerrrr email.messagertypingrrrr r3r%rr=rrrrs< PK, ]_dd6metadata/importlib/__pycache__/__init__.cpython-38.pycnu[U ʗRek@s$ddlmZddlmZddgZdS)) Distribution) EnvironmentrrN)Z_distsrZ_envsr__all__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/importlib/__init__.pys  PK, ]5z 4metadata/importlib/__pycache__/_dists.cpython-38.pycnu[U ʗRe @sddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZmZddlmZmZmZmZm Z ddl!m"Z"dd l#m$Z$dd l%m&Z&m'Z'd d l(m)Z)m*Z*Gd ddej+j,Z-GdddeZ,dS)N) CollectionDictIterableIteratorMappingOptionalSequencecast) Requirement)NormalizedNamecanonicalize_name)parse) InvalidWheelUnsupportedWheel)BaseDistributionBaseEntryPointDistributionVersionInfoPathWheel)normalize_path safe_extra) parse_wheelread_wheel_metadata_file)BasePath get_dist_namec@sreZdZdZeejefejddddZe e j e e ddddZ eeejd d d Ze ee d d dZdS)WheelDistributionaAn ``importlib.metadata.Distribution`` read from a wheel. Although ``importlib.metadata.PathDistribution`` accepts ``zipfile.Path``, its implementation is too "lazy" for pip's needs (we can't keep the ZipFile handle open for the entire lifetime of the distribution object). This implementation eagerly reads the entire metadata directory into the memory instead, and operates from that. N)files info_locationreturncCs||_||_dSN)_filesr)selfrrr$/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/importlib/_dists.py__init__/szWheelDistribution.__init__)zfnamelocationr csLt|\}fddD}fdd|D}t|}|||S)Nc3s8|]0}|dr|t|dddfVqdS)/rN) startswithpathlib PurePosixPathsplit).0r()info_dirr$r% ?sz1WheelDistribution.from_zipfile..csi|]\}}|t|qSr$)r)r0fullpathrelpath)r'r$r% Dsz2WheelDistribution.from_zipfile..)rnamelistr-r.)clsr'r(r)_pathsrrr$)r1r'r% from_zipfile7s   zWheelDistribution.from_zipfilepathr cCs*tt||jkrt|jSt|dSr!)r-r.strr"iterFileNotFoundErrorr#r<r$r$r%iterdirKs zWheelDistribution.iterdir)filenamer c Csz|jt|}Wntk r*YdSXz|d}WnJtk r}z,|jj}d|d|d|d}t|W5d}~XYnX|S)Nzutf-8zError decoding metadata for z: z in z file) r"r-r.KeyErrordecodeUnicodeDecodeErrorrparentr)r#rBdatatextewheelerrorr$r$r% read_textQszWheelDistribution.read_text)__name__ __module__ __qualname____doc__rr-r.bytesr& classmethodzipfileZipFiler=r:rrrArrLr$r$r$r%r$s  rc@sPeZdZejjeeeeddddZe e e dddZ e e e e dd d Zeee d d d Zeee d ddZeee d ddZee d ddZeed ddZeed ddZeedddZee d ddZee dddZeed dd Z e!j"j#d d!d"Z$ee d d#d$Z%d)e&e ee'd&d'd(Z(dS)* DistributionN)distrinstalled_locationr cCs||_||_||_dSr!)_dist_info_location_installed_location)r#rVrrWr$r$r%r&`szDistribution.__init__) directoryr cCs&t|}tjj|}||||jSr!)r-Path importlibmetadatarUatrF)r7r[rrVr$r$r%from_directoryjs zDistribution.from_directory)rJr(r c Csz(|}t|||j}W5QRXWndtjk rZ}zt|j||W5d}~XYn4tk r}zt|d|W5d}~XYnX|||jt |jS)Nz has an invalid wheel, ) as_zipfilerr:r)rS BadZipFilerrrr-r.)r7rJr(r'rVrIr$r$r% from_wheelps $zDistribution.from_wheel)r cCs|jdkrdSt|jjSr!)rYr=rFr#r$r$r%r){s zDistribution.locationcCs|jdkrdSt|jSr!)rYr=rdr$r$r%rs zDistribution.info_locationcCs|jdkrdStt|jSr!)rZrr=rdr$r$r%rWs zDistribution.installed_locationcCs>|jdkrdStj|jj\}}|dkr.dS|dddS)zrTry to get the name from the metadata directory name. This is much faster than reading metadata. N)z .dist-infoz .egg-info-rr)rYosr<splitextr(r/)r#stemsuffixr$r$r%_get_dist_name_from_locations  z)Distribution._get_dist_name_from_locationcCs|pt|j}t|Sr!)rjrrXr )r#r(r$r$r%canonical_nameszDistribution.canonical_namecCs t|jjSr!) parse_versionrXversionrdr$r$r%rmszDistribution.versionr;cCs|jt|dk Sr!)rXrLr=r@r$r$r%is_fileszDistribution.is_fileccs4t|jtjsdS|jdD] }|jVq"dS)Nscripts) isinstancerYr-r\joinpathrAr()r#childr$r$r%iter_distutils_script_namessz(Distribution.iter_distutils_script_namescCs$|jt|}|dkr t||Sr!)rXrLr=r?)r#r<contentr$r$r%rLszDistribution.read_textcCs|jjSr!)rXZ entry_pointsrdr$r$r%iter_entry_pointsszDistribution.iter_entry_pointscCsttjj|jjSr!)r emailmessageMessagerXr^rdr$r$r%_metadata_implszDistribution._metadata_implcCsdd|jdgDS)Ncss|]}t|VqdSr!r)r0extrar$r$r%r2sz4Distribution.iter_provided_extras..zProvides-Extra)r^get_allrdr$r$r%iter_provided_extrass z!Distribution.iter_provided_extrasr$)extrasr c#stdd|D}|jdgD]R}t|js6Vq|sRjddirRVqtfdd|DrVqdS)NcSsg|]}dt|iqS)rzr)r0rIr$r$r% sz2Distribution.iter_dependencies..z Requires-Distrzc3s|]}j|VqdSr!)markerevaluate)r0contextreqr$r%r2sz1Distribution.iter_dependencies..)r^r{r rrany)r#r}Zcontexts req_stringr$rr%iter_dependenciesszDistribution.iter_dependencies)r$))rMrNrOr]r^rUrrr&rRr=rr`rrcpropertyr)rrWrjr rkrrmrboolrnrrsrLrrrurvrwrxryr|rr rr$r$r$r%rU_s6    rU). email.messagervimportlib.metadatar]rfr-rStypingrrrrrrrr "pip._vendor.packaging.requirementsr pip._vendor.packaging.utilsr r Zpip._vendor.packaging.versionr rlpip._internal.exceptionsrrZpip._internal.metadata.baserrrrrpip._internal.utils.miscrpip._internal.utils.packagingrpip._internal.utils.wheelrrZ_compatrrr^rUrr$r$r$r%s (    ;PK, ]h3metadata/importlib/__pycache__/_envs.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z mZddlmZmZddlmZmZddlmZddlmZddlmZdd lmZmZmZdd lm Z e!e"d d d Z#GdddZ$ej%dde e!dd ddZ&GdddeZ'dS)N)IteratorListOptionalSequenceSetTuple)NormalizedNamecanonicalize_name)BaseDistributionBaseEnvironment)Wheel deprecated)WHEEL_EXTENSION)BasePath get_dist_nameget_info_location) DistributionlocationreturncCs@|tsdStj|sdStjtj|s6dSt |S)NF) endswithrospathisfiler wheel_file_rematchbasenamezipfile is_zipfilerr"/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/importlib/_envs.py_looks_like_wheels  r$c@seZdZdZeejjee fZ ddddZ e e e dddZe e edd d Ze e edd d Ze e edd dZe e edddZe e edddZdS)_DistributionFindera$Finder to locate distributions. The main purpose of this class is to memoize found distributions' names, so only one distribution is returned for each package name. At lot of pip code assumes this (because it is setuptools's behavior), and not doing the same can potentially cause a distribution in lower precedence path to override a higher precedence one if the caller is not careful. Eventually we probably want to make it possible to see lower precedence installations as well. It's useful feature, after all. NrcCs t|_dSN)set _found_names)selfr"r"r#__init__.sz_DistributionFinder.__init__rccs\t|r dStjj|gdD]:}tt|}||jkr8q|j|t|}||fVqdS)z!Find distributions in a location.N)r) r$ importlibmetadata distributionsr rr)addr)r*rdistZnormalized_name info_locationr"r"r# _find_impl1s   z_DistributionFinder._find_implccs:||D]*\}}|dkr d}n|j}t|||Vq dS)ziFind distributions in a location. The path can be either a directory, or a ZIP archive. N)r2parentr)r*rr0r1installed_locationr"r"r#findBs z_DistributionFinder.findc cst|}|sdS|D]|}|jdkr.q|(}dd|D}tdd|Dd}W5QRX|sjqt||}| |D]\}} t || |VqqdS)aRead location in egg-link files and return distributions in there. The path should be a directory; otherwise this returns nothing. This follows how setuptools does this for compatibility. The first non-empty line in the egg-link is read as a path (resolved against the egg-link's containing directory if relative). Distributions found at that linked location are returned. Nz .egg-linkcss|]}|VqdSr')strip.0liner"r"r# ^sz2_DistributionFinder.find_linked..css|]}|r|VqdSr'r"r7r"r"r#r:_s) pathlibPathis_diriterdirsuffixopennextstrjoinpathr2r) r*rrchildflinesZ target_relZtarget_locationr0r1r"r"r# find_linkedNs    z_DistributionFinder.find_linkedc csfddlm}ddlm}t|:}|D].}|jds:q(||jD]}| |VqDq(W5QRXdS)Nr)find_distributions pkg_resourcesz.egg) pip._vendor.pkg_resourcesrIpip._internal.metadatarKrscandirnamerrr)r*rrIlegacyitentryr0r"r"r#_find_eggs_in_dirfs    z%_DistributionFinder._find_eggs_in_dirccs`ddlm}ddlm}zt|}Wntjk r>YdSX|||D]}||VqJdS)Nr)find_eggs_in_ziprJ)rLrTrMrK zipimport zipimporterZipImportErrorr)r*rrTrPimporterr0r"r"r#_find_eggs_in_ziprs  z%_DistributionFinder._find_eggs_in_zipccs:tj|r||EdHt|r6||EdHdS)aFind eggs in a location. This actually uses the old *pkg_resources* backend. We likely want to deprecate this so we can eventually remove the *pkg_resources* dependency entirely. Before that, this should first emit a deprecation warning for some versions when using the fallback since importing *pkg_resources* is slow for those who don't need it. N)rrisdirrSrr rY)r*rr"r"r# find_eggs~s  z_DistributionFinder.find_eggs)__name__ __module__ __qualname____doc__rr,r-rrrZ FoundResultr+rCrr2r r5rHrSrYr[r"r"r"r#r%s    r%)maxsizecCstd|dddddS)NzLoading egg at z is deprecated.z$to use pip for package installation.)reason replacementgone_inr r!r"r"r#_emit_egg_deprecations  rdc@steZdZeeddddZeedddZee e eeddd Z e e dd d Zee e d d dZdS) EnvironmentN)pathsrcCs ||_dSr')_paths)r*rfr"r"r#r+szEnvironment.__init__r&cCs |tjSr'sysr)clsr"r"r#defaultszEnvironment.defaultcCs|dkr|tjS||Sr'rh)rjrfr"r"r# from_pathss zEnvironment.from_pathsccsLt}|jD]:}||EdH||D] }|Vq*||EdHq dSr')r%rgr5r[rH)r*finderrr0r"r"r#_iter_distributionss  zEnvironment._iter_distributions)rOrcs fdd|D}t|dS)Nc3s |]}|jtkr|VqdSr')canonical_namer )r8 distributionrOr"r#r:sz/Environment.get_distribution..)iter_all_distributionsrB)r*rOmatchesr"rqr#get_distributions zEnvironment.get_distribution)r\r]r^rrCr+ classmethodr rkrrrlrr rnrtr"r"r"r#res re)( functoolsimportlib.metadatar,rr<rirrUtypingrrrrrrpip._vendor.packaging.utilsrr Zpip._internal.metadata.baser r pip._internal.models.wheelr pip._internal.utils.deprecationrpip._internal.utils.filetypesrZ_compatrrrZ_distsrrCboolr$r% lru_cacherdrer"r"r"r#s&      n PK, ]5metadata/importlib/__pycache__/_compat.cpython-38.pycnu[U ʗRe@s`ddlZddlmZmZmZmZGdddeZejj eedddZ ejj e dd d Z dS) N)AnyOptionalProtocolcastc@s4eZdZdZeedddZeddddZdS)BasePathaA protocol that various path objects conform. This exists because importlib.metadata uses both ``pathlib.Path`` and ``zipfile.Path``, and we need a common base for type hints (Union does not work well since ``zipfile.Path`` is too new for our linter setup). This does not mean to be exhaustive, but only contains things that present in both classes *that we need*. )returncCs tdSNNotImplementedErrorselfr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/importlib/_compat.pynamesz BasePath.namecCs tdSrr r r r rparentszBasePath.parentN)__name__ __module__ __qualname____doc__propertystrrrr r r rrs  r)drcCs t|ddS)aFind the path to the distribution's metadata directory. HACK: This relies on importlib.metadata's private ``_path`` attribute. Not all distributions exist on disk, so importlib.metadata is correct to not expose the attribute as public. But pip's code base is old and not as clean, so we do this to avoid having to rewrite too many things. Hopefully we can eliminate this some day. _pathN)getattr)rr r rget_info_locations r)distrcCs tt|jS)zGet the distribution's project name. The ``name`` attribute is only available in Python 3.10 or later. We are targeting exactly that, but Mypy does not know this. )rrr)rr r r get_dist_name%sr) importlib.metadata importlibtypingrrrrrmetadata Distributionrrrr r r rs PK, ]Lk|metadata/importlib/_compat.pynu[import importlib.metadata from typing import Any, Optional, Protocol, cast class BasePath(Protocol): """A protocol that various path objects conform. This exists because importlib.metadata uses both ``pathlib.Path`` and ``zipfile.Path``, and we need a common base for type hints (Union does not work well since ``zipfile.Path`` is too new for our linter setup). This does not mean to be exhaustive, but only contains things that present in both classes *that we need*. """ @property def name(self) -> str: raise NotImplementedError() @property def parent(self) -> "BasePath": raise NotImplementedError() def get_info_location(d: importlib.metadata.Distribution) -> Optional[BasePath]: """Find the path to the distribution's metadata directory. HACK: This relies on importlib.metadata's private ``_path`` attribute. Not all distributions exist on disk, so importlib.metadata is correct to not expose the attribute as public. But pip's code base is old and not as clean, so we do this to avoid having to rewrite too many things. Hopefully we can eliminate this some day. """ return getattr(d, "_path", None) def get_dist_name(dist: importlib.metadata.Distribution) -> str: """Get the distribution's project name. The ``name`` attribute is only available in Python 3.10 or later. We are targeting exactly that, but Mypy does not know this. """ return cast(Any, dist).name PK, ]&P  metadata/importlib/_dists.pynu[import email.message import importlib.metadata import os import pathlib import zipfile from typing import ( Collection, Dict, Iterable, Iterator, Mapping, Optional, Sequence, cast, ) from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import parse as parse_version from pip._internal.exceptions import InvalidWheel, UnsupportedWheel from pip._internal.metadata.base import ( BaseDistribution, BaseEntryPoint, DistributionVersion, InfoPath, Wheel, ) from pip._internal.utils.misc import normalize_path from pip._internal.utils.packaging import safe_extra from pip._internal.utils.wheel import parse_wheel, read_wheel_metadata_file from ._compat import BasePath, get_dist_name class WheelDistribution(importlib.metadata.Distribution): """An ``importlib.metadata.Distribution`` read from a wheel. Although ``importlib.metadata.PathDistribution`` accepts ``zipfile.Path``, its implementation is too "lazy" for pip's needs (we can't keep the ZipFile handle open for the entire lifetime of the distribution object). This implementation eagerly reads the entire metadata directory into the memory instead, and operates from that. """ def __init__( self, files: Mapping[pathlib.PurePosixPath, bytes], info_location: pathlib.PurePosixPath, ) -> None: self._files = files self.info_location = info_location @classmethod def from_zipfile( cls, zf: zipfile.ZipFile, name: str, location: str, ) -> "WheelDistribution": info_dir, _ = parse_wheel(zf, name) paths = ( (name, pathlib.PurePosixPath(name.split("/", 1)[-1])) for name in zf.namelist() if name.startswith(f"{info_dir}/") ) files = { relpath: read_wheel_metadata_file(zf, fullpath) for fullpath, relpath in paths } info_location = pathlib.PurePosixPath(location, info_dir) return cls(files, info_location) def iterdir(self, path: InfoPath) -> Iterator[pathlib.PurePosixPath]: # Only allow iterating through the metadata directory. if pathlib.PurePosixPath(str(path)) in self._files: return iter(self._files) raise FileNotFoundError(path) def read_text(self, filename: str) -> Optional[str]: try: data = self._files[pathlib.PurePosixPath(filename)] except KeyError: return None try: text = data.decode("utf-8") except UnicodeDecodeError as e: wheel = self.info_location.parent error = f"Error decoding metadata for {wheel}: {e} in {filename} file" raise UnsupportedWheel(error) return text class Distribution(BaseDistribution): def __init__( self, dist: importlib.metadata.Distribution, info_location: Optional[BasePath], installed_location: Optional[BasePath], ) -> None: self._dist = dist self._info_location = info_location self._installed_location = installed_location @classmethod def from_directory(cls, directory: str) -> BaseDistribution: info_location = pathlib.Path(directory) dist = importlib.metadata.Distribution.at(info_location) return cls(dist, info_location, info_location.parent) @classmethod def from_wheel(cls, wheel: Wheel, name: str) -> BaseDistribution: try: with wheel.as_zipfile() as zf: dist = WheelDistribution.from_zipfile(zf, name, wheel.location) except zipfile.BadZipFile as e: raise InvalidWheel(wheel.location, name) from e except UnsupportedWheel as e: raise UnsupportedWheel(f"{name} has an invalid wheel, {e}") return cls(dist, dist.info_location, pathlib.PurePosixPath(wheel.location)) @property def location(self) -> Optional[str]: if self._info_location is None: return None return str(self._info_location.parent) @property def info_location(self) -> Optional[str]: if self._info_location is None: return None return str(self._info_location) @property def installed_location(self) -> Optional[str]: if self._installed_location is None: return None return normalize_path(str(self._installed_location)) def _get_dist_name_from_location(self) -> Optional[str]: """Try to get the name from the metadata directory name. This is much faster than reading metadata. """ if self._info_location is None: return None stem, suffix = os.path.splitext(self._info_location.name) if suffix not in (".dist-info", ".egg-info"): return None return stem.split("-", 1)[0] @property def canonical_name(self) -> NormalizedName: name = self._get_dist_name_from_location() or get_dist_name(self._dist) return canonicalize_name(name) @property def version(self) -> DistributionVersion: return parse_version(self._dist.version) def is_file(self, path: InfoPath) -> bool: return self._dist.read_text(str(path)) is not None def iter_distutils_script_names(self) -> Iterator[str]: # A distutils installation is always "flat" (not in e.g. egg form), so # if this distribution's info location is NOT a pathlib.Path (but e.g. # zipfile.Path), it can never contain any distutils scripts. if not isinstance(self._info_location, pathlib.Path): return for child in self._info_location.joinpath("scripts").iterdir(): yield child.name def read_text(self, path: InfoPath) -> str: content = self._dist.read_text(str(path)) if content is None: raise FileNotFoundError(path) return content def iter_entry_points(self) -> Iterable[BaseEntryPoint]: # importlib.metadata's EntryPoint structure sasitfies BaseEntryPoint. return self._dist.entry_points def _metadata_impl(self) -> email.message.Message: # From Python 3.10+, importlib.metadata declares PackageMetadata as the # return type. This protocol is unfortunately a disaster now and misses # a ton of fields that we need, including get() and get_payload(). We # rely on the implementation that the object is actually a Message now, # until upstream can improve the protocol. (python/cpython#94952) return cast(email.message.Message, self._dist.metadata) def iter_provided_extras(self) -> Iterable[str]: return ( safe_extra(extra) for extra in self.metadata.get_all("Provides-Extra", []) ) def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]: contexts: Sequence[Dict[str, str]] = [{"extra": safe_extra(e)} for e in extras] for req_string in self.metadata.get_all("Requires-Dist", []): req = Requirement(req_string) if not req.marker: yield req elif not extras and req.marker.evaluate({"extra": ""}): yield req elif any(req.marker.evaluate(context) for context in contexts): yield req PK, ]2sDkkmetadata/importlib/__init__.pynu[from ._dists import Distribution from ._envs import Environment __all__ = ["Distribution", "Environment"] PK, ]>nmetadata/importlib/_envs.pynu[import functools import importlib.metadata import os import pathlib import sys import zipfile import zipimport from typing import Iterator, List, Optional, Sequence, Set, Tuple from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.metadata.base import BaseDistribution, BaseEnvironment from pip._internal.models.wheel import Wheel from pip._internal.utils.deprecation import deprecated from pip._internal.utils.filetypes import WHEEL_EXTENSION from ._compat import BasePath, get_dist_name, get_info_location from ._dists import Distribution def _looks_like_wheel(location: str) -> bool: if not location.endswith(WHEEL_EXTENSION): return False if not os.path.isfile(location): return False if not Wheel.wheel_file_re.match(os.path.basename(location)): return False return zipfile.is_zipfile(location) class _DistributionFinder: """Finder to locate distributions. The main purpose of this class is to memoize found distributions' names, so only one distribution is returned for each package name. At lot of pip code assumes this (because it is setuptools's behavior), and not doing the same can potentially cause a distribution in lower precedence path to override a higher precedence one if the caller is not careful. Eventually we probably want to make it possible to see lower precedence installations as well. It's useful feature, after all. """ FoundResult = Tuple[importlib.metadata.Distribution, Optional[BasePath]] def __init__(self) -> None: self._found_names: Set[NormalizedName] = set() def _find_impl(self, location: str) -> Iterator[FoundResult]: """Find distributions in a location.""" # Skip looking inside a wheel. Since a package inside a wheel is not # always valid (due to .data directories etc.), its .dist-info entry # should not be considered an installed distribution. if _looks_like_wheel(location): return # To know exactly where we find a distribution, we have to feed in the # paths one by one, instead of dumping the list to importlib.metadata. for dist in importlib.metadata.distributions(path=[location]): normalized_name = canonicalize_name(get_dist_name(dist)) if normalized_name in self._found_names: continue self._found_names.add(normalized_name) info_location = get_info_location(dist) yield dist, info_location def find(self, location: str) -> Iterator[BaseDistribution]: """Find distributions in a location. The path can be either a directory, or a ZIP archive. """ for dist, info_location in self._find_impl(location): if info_location is None: installed_location: Optional[BasePath] = None else: installed_location = info_location.parent yield Distribution(dist, info_location, installed_location) def find_linked(self, location: str) -> Iterator[BaseDistribution]: """Read location in egg-link files and return distributions in there. The path should be a directory; otherwise this returns nothing. This follows how setuptools does this for compatibility. The first non-empty line in the egg-link is read as a path (resolved against the egg-link's containing directory if relative). Distributions found at that linked location are returned. """ path = pathlib.Path(location) if not path.is_dir(): return for child in path.iterdir(): if child.suffix != ".egg-link": continue with child.open() as f: lines = (line.strip() for line in f) target_rel = next((line for line in lines if line), "") if not target_rel: continue target_location = str(path.joinpath(target_rel)) for dist, info_location in self._find_impl(target_location): yield Distribution(dist, info_location, path) def _find_eggs_in_dir(self, location: str) -> Iterator[BaseDistribution]: from pip._vendor.pkg_resources import find_distributions from pip._internal.metadata import pkg_resources as legacy with os.scandir(location) as it: for entry in it: if not entry.name.endswith(".egg"): continue for dist in find_distributions(entry.path): yield legacy.Distribution(dist) def _find_eggs_in_zip(self, location: str) -> Iterator[BaseDistribution]: from pip._vendor.pkg_resources import find_eggs_in_zip from pip._internal.metadata import pkg_resources as legacy try: importer = zipimport.zipimporter(location) except zipimport.ZipImportError: return for dist in find_eggs_in_zip(importer, location): yield legacy.Distribution(dist) def find_eggs(self, location: str) -> Iterator[BaseDistribution]: """Find eggs in a location. This actually uses the old *pkg_resources* backend. We likely want to deprecate this so we can eventually remove the *pkg_resources* dependency entirely. Before that, this should first emit a deprecation warning for some versions when using the fallback since importing *pkg_resources* is slow for those who don't need it. """ if os.path.isdir(location): yield from self._find_eggs_in_dir(location) if zipfile.is_zipfile(location): yield from self._find_eggs_in_zip(location) @functools.lru_cache(maxsize=None) # Warn a distribution exactly once. def _emit_egg_deprecation(location: Optional[str]) -> None: deprecated( reason=f"Loading egg at {location} is deprecated.", replacement="to use pip for package installation.", gone_in=None, ) class Environment(BaseEnvironment): def __init__(self, paths: Sequence[str]) -> None: self._paths = paths @classmethod def default(cls) -> BaseEnvironment: return cls(sys.path) @classmethod def from_paths(cls, paths: Optional[List[str]]) -> BaseEnvironment: if paths is None: return cls(sys.path) return cls(paths) def _iter_distributions(self) -> Iterator[BaseDistribution]: finder = _DistributionFinder() for location in self._paths: yield from finder.find(location) for dist in finder.find_eggs(location): # _emit_egg_deprecation(dist.location) # TODO: Enable this. yield dist # This must go last because that's how pkg_resources tie-breaks. yield from finder.find_linked(location) def get_distribution(self, name: str) -> Optional[BaseDistribution]: matches = ( distribution for distribution in self.iter_all_distributions() if distribution.canonical_name == canonicalize_name(name) ) return next(matches, None) PK, ]Am# # metadata/_json.pynu[# Extracted from https://github.com/pfmoore/pkg_metadata from email.header import Header, decode_header, make_header from email.message import Message from typing import Any, Dict, List, Union METADATA_FIELDS = [ # Name, Multiple-Use ("Metadata-Version", False), ("Name", False), ("Version", False), ("Dynamic", True), ("Platform", True), ("Supported-Platform", True), ("Summary", False), ("Description", False), ("Description-Content-Type", False), ("Keywords", False), ("Home-page", False), ("Download-URL", False), ("Author", False), ("Author-email", False), ("Maintainer", False), ("Maintainer-email", False), ("License", False), ("Classifier", True), ("Requires-Dist", True), ("Requires-Python", False), ("Requires-External", True), ("Project-URL", True), ("Provides-Extra", True), ("Provides-Dist", True), ("Obsoletes-Dist", True), ] def json_name(field: str) -> str: return field.lower().replace("-", "_") def msg_to_json(msg: Message) -> Dict[str, Any]: """Convert a Message object into a JSON-compatible dictionary.""" def sanitise_header(h: Union[Header, str]) -> str: if isinstance(h, Header): chunks = [] for bytes, encoding in decode_header(h): if encoding == "unknown-8bit": try: # See if UTF-8 works bytes.decode("utf-8") encoding = "utf-8" except UnicodeDecodeError: # If not, latin1 at least won't fail encoding = "latin1" chunks.append((bytes, encoding)) return str(make_header(chunks)) return str(h) result = {} for field, multi in METADATA_FIELDS: if field not in msg: continue key = json_name(field) if multi: value: Union[str, List[str]] = [ sanitise_header(v) for v in msg.get_all(field) ] else: value = sanitise_header(msg.get(field)) if key == "keywords": # Accept both comma-separated and space-separated # forms, for better compatibility with old data. if "," in value: value = [v.strip() for v in value.split(",")] else: value = value.split() result[key] = value payload = msg.get_payload() if payload: result["description"] = payload return result PK, ]L<ډ.resolution/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdS)Nrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/__init__.pyPK, ] ]rFF*resolution/__pycache__/base.cpython-38.pycnu[U ʗReG@sRddlmZmZmZddlmZddlmZeeeegefZ GdddZ dS))CallableListOptional)InstallRequirement)RequirementSetc@s6eZdZeeeedddZeeedddZdS) BaseResolver) root_reqscheck_supported_wheelsreturncCs tdSNNotImplementedError)selfrr r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/base.pyresolve szBaseResolver.resolve)req_setr cCs tdSr r )rrrrrget_installation_ordersz#BaseResolver.get_installation_orderN) __name__ __module__ __qualname__rrboolrrrrrrrr s rN) typingrrrZpip._internal.req.req_installrZpip._internal.req.req_setrstrInstallRequirementProviderrrrrrs   PK, ]>MKMK8resolution/resolvelib/__pycache__/factory.cpython-38.pycnu[U ʗRen@s&ddlZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZddlmZddlmZddlmZmZddlmZddlmZmZddl m!Z!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'dd l(m)Z)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0ddl1m2Z2ddl3m4Z4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddlm?Z?ddl@mAZAmBZBmCZCmDZDddlEmFZFmGZGmHZHmIZImJZJmKZKmLZLddlMmNZNmOZOddlPmQZQmRZRmSZSmTZTerddlmUZUGdddeUZVeWeXZYedZZee,eZfZ[Gddde Z\Gd d!d!Z]dS)"N) TYPE_CHECKINGDict FrozenSetIterableIteratorListMapping NamedTupleOptionalSequenceSetTupleTypeVarcast)InvalidRequirement) SpecifierSet)NormalizedNamecanonicalize_name)ResolutionImpossible) CacheEntry WheelCache)DistributionNotFoundInstallationErrorMetadataInconsistentUnsupportedPythonVersionUnsupportedWheel) PackageFinder)BaseDistributionget_default_environment)Link)Wheel)RequirementPreparer)install_req_from_link_and_ireq)InstallRequirementcheck_invalid_constraint_type)InstallRequirementProvider) get_supported)Hashes)get_requirement)running_under_virtualenv) CandidateCandidateVersion Constraint Requirement)AlreadyInstalledCandidate BaseCandidateEditableCandidateExtrasCandidate LinkCandidateRequiresPythonCandidateas_base_candidate)FoundCandidatesIndexCandidateInfo)ExplicitRequirementRequiresPythonRequirementSpecifierRequirementUnsatisfiableRequirement)Protocolc@seZdZUeed<eed<dS) ConflictCause requirementparentN)__name__ __module__ __qualname__r9__annotations__r+rDrD/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.pyr=Is r=Cc@s:eZdZUeeed<eeefed<eee fed<dS)CollectedRootRequirements requirements constraintsuser_requestedN) r@rArBrr.rCrstrr-intrDrDrDrErGTs  rGc @s*eZdZdAeeeeeeeeeee e dfdd ddZ e edddZ edd d d Zeeeed d dZeeeeedddZeeeeeeeeeedddZeeeeeee e edddZ!e e"eee#edddZ$ee%ee#edddZ&ee'ee e"fe'ee#efe%ee eddd Z(ee eee"d!d"d#Z)e*ee+d$d%d&Z,ee-d'd(d)Z.dBeeee eee"d+d,d-Z/eee"d.d/d0Z0eeeee1d1d2d3Z2eeed'd4d5Z3ed6e4d7d8d9Z5e"eee6d:d;d<Z7d=e8ee%fe9d>d?d@Z:dS)CFactoryN.) finderpreparermake_install_req wheel_cache use_user_siteforce_reinstallignore_installedignore_requires_pythonpy_version_inforeturnc Cs||_||_||_t| |_||_||_||_||_i|_ i|_ i|_ i|_ i|_ |svt} dd| jddD|_ni|_dS)NcSsi|] }|j|qSrD)canonical_name).0distrDrDrE zsz$Factory.__init__..F) local_only)_finderrO _wheel_cacher4_python_candidate_make_install_req_from_spec_use_user_site_force_reinstall_ignore_requires_python_build_failures_link_candidate_cache_editable_candidate_cache_installed_candidate_cache_extras_candidate_cacheriter_installed_distributions_installed_dists) selfrNrOrPrQrRrSrTrUrVenvrDrDrE__init__[s(   zFactory.__init__rWcCs|jSN)rbrkrDrDrErSszFactory.force_reinstall)linkrWcCsB|js dSt|j}||jjr*dS|jd}t|dS)Nz+ is not a supported wheel on this platform.)is_wheelr filename supportedr] target_pythonget_tagsr)rkrqwheelmsgrDrDrE"_fail_if_link_is_unsupported_wheels  z*Factory._fail_if_link_is_unsupported_wheel)baseextrasrWcCsHt||f}z|j|}Wn(tk rBt||}||j|<YnX|Sro)idrhKeyErrorr2)rkrzr{ cache_key candidaterDrDrE_make_extras_candidates  zFactory._make_extras_candidate)rZr{templaterWcCsTz|j|j}Wn.tk r>t|||d}||j|j<YnX|sH|S|||S)N)factory)rgrXr}r/r)rkrZr{rrzrDrDrE_make_candidate_from_distsz!Factory._make_candidate_from_dist)rqr{rnameversionrWc Cs$||jkrdS|jr||jkrzt|||||d|j|<WnHtk r}z*tjd||ddid||j|<WYdSd}~XYnX|j|}n~||jkrzt|||||d|j|<WnJtk r}z*tjd||ddid||j|<WYdSd}~XYnX|j|}|s|S| ||S)N)rrrz3Discarding [blue underline]%s[/]: [yellow]%s[reset]markupT)extra) rdeditablerfr1rloggerinforer3r)rkrqr{rrrerzrDrDrE_make_candidate_from_linksX       z!Factory._make_candidate_from_link)ireqs specifierhashesprefers_installedincompatible_idsrWc s|sdS|djstdtjjt|D]<}|jsFtd|jjM|jddMt|jOq4tt dfdd }t t dfd d }t |||S) NrDrz)Candidates found on index must be PEP 508F)trust_internetrncshjr dSzj}Wntk r.YdSXj|jddsDdSj|d}t|krddS|S)z6Get the candidate for the currently-installed version.NT) prereleases)rZr{r)rbrjr}containsrrr|)installed_distr)r{rrrkrrrDrE_get_installed_candidates  z@Factory._iter_found_candidates.._get_installed_candidatec 3sjjd}t|}tdd|D}ttddd}|}t|D]>}|r\|sf|jj rfqPt j j |j|j d}|j |fVqPdS)N) project_namerrcss|]}|jjVqdSro)rq is_yanked)rYicanrDrDrE #szUFactory._iter_found_candidates..iter_index_candidate_infos..rrWcSs<|D]2}|jdkrdS|jdkr$q|jdr2qdSdS)Nz===T==z.*F)operatorrendswith)rsprDrDrE is_pinned%s   zUFactory._iter_found_candidates..iter_index_candidate_infos..is_pinned)rqr{rrr)r]find_best_candidatelistiter_applicableallrboolreversedrqr functoolspartialrr)resulticans all_yankedrpinnedrfunc)r{rrrkrrrDrEiter_index_candidate_infoss*   zBFactory._iter_found_candidates..iter_index_candidate_infos) reqAssertionErrorrr frozensetrrr{r r+rr7r6) rkrrrrrireqrrrD)r{rrrrkrrrE_iter_found_candidatess&    (zFactory._iter_found_candidates)base_requirementsr{rWccsJ|D]@}|\}}|dkrqt|}|dk s6td|||VqdS)a8Produce explicit candidates from the base given an extra-ed package. :param base_requirements: Requirements known to the resolver. The requirements are guaranteed to not have extras. :param extras: The extras to inject into the explicit requirements' candidates. Nzno extras here)get_candidate_lookupr5rr)rkrr{r lookup_cand_ base_candrDrDrE#_iter_explicit_candidates_from_baseGs  z+Factory._iter_explicit_candidates_from_base) identifier constraintrrWccsD|jD]8}|||j|tt||t|dd}|r|VqdS)zProduce explicit candidates from constraints. This creates "fake" InstallRequirement objects that are basically clones of what "should" be the template, but with original_link set to link. Nr{rrr)linksryrrr"r)rkrrrrqrrDrDrE!_iter_candidates_from_constraints]s  z)Factory._iter_candidates_from_constraints)rrHincompatibilitiesrrrWc s t}g}D]4}|\} } | dk r4|| | dk r|| qtt0t} ||  | j dt | j W5QRX|rz||j|ddWntk rYdSXdd| dD|s||jj|Sfdd|DS)NrDr)rcSsh|] }t|qSrD)r|rYcrDrDrE sz*Factory.find_candidates..c3sB|]:tkrrtfddDrVqdS)c3s|]}|VqdSro)is_satisfied_by)rYrrrDrErsz4Factory.find_candidates...N)r|rr)rYrr incompat_idsrHrrErs   z*Factory.find_candidates..)setraddappend contextlibsuppressrr(updatergetrrr{rrrrr) rkrrHrrrexplicit_candidatesrrcandrparsed_requirementrDrrEfind_candidatestsN        zFactory.find_candidates)rrequested_extrasrWcCs||s td|j|jdS|js.t|S||j|j|jt |j ||jr\t |jnddd}|dkr|js|j |jt t |jS||S)Nz6Ignoring %s: markers '%s' don't match your environmentr) match_markersrrrmarkersrqr:ryrrr{rrdr;make_requirement_from_candidate)rkrrrrDrDrE"_make_requirement_from_install_reqs,   z*Factory._make_requirement_from_install_req) root_ireqsrWcCstgii}t|D]\}}|jrt|}|r6t||s@q|jsNtdt|j}||j krv|j ||M<qt ||j |<q|j |dd}|dkrq|j r|j|jkr||j|j<|j|q|S)NzConstraint must be namedrD)r)rG enumeraterr$rrrrrrIr- from_ireqr user_suppliedrJrHr)rkr collectedirproblemrrrDrDrEcollect_root_requirementss.    z!Factory.collect_root_requirements)rrWcCst|Sro)r8)rkrrDrDrErsz'Factory.make_requirement_from_candidaterD)r comes_fromrrWcCs|||}|||Sro)r`r)rkrrrrrDrDrEmake_requirement_from_specs z"Factory.make_requirement_from_specrcCs"|jr dSt|sdSt||jSro)rcrKr9r_)rkrrDrDrE make_requires_python_requirements z(Factory.make_requires_python_requirement)rqrrWcCs*|jdks|jjrdS|jj||tdS)aLook up the link in the wheel cache. If ``preparer.require_hashes`` is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have nondeterministic contents due to file modification times. N)rq package_namesupported_tags)r^rOrequire_hashesget_cache_entryr&)rkrqrrDrDrEget_wheel_cache_entrys zFactory.get_wheel_cache_entrycCs|j|j}|dkrdSz<|jtjdddtjidtjdddtjidfkrTWdSWntk rjYnX|j sv|S|j r|St r|j rd|j d|j}t|dS)Npurelib rpm_prefixrz)schemevarsplatlibzNWill not install to the user site because it will lack sys.path precedence to z in )rjrrinstalled_location sysconfigget_pathsys base_prefixr}ra in_usersiter)in_site_packagesraw_namelocationr)rkrrZmessagerDrDrEget_dist_to_uninstall$s(  zFactory.get_dist_to_uninstallr=)causesrWcCs|s td|jj}t|dkrVt|djj}d|djjd|d|}t |Sd|d}|D]0}|j }t|jj}|d |d |d 7}qft |S) Nz,Requires-Python error reported with no causer*rzPackage z requires a different Python: z not in z%Packages require a different Python. z not in: z (required by )) rr_rlenrKr>rr?rrformat_for_error)rkrrrrcausepackagerDrDrE_report_requires_python_errorJs     z%Factory._report_requires_python_error)rr?rWcCs|dkrt|}n|d|jd}|j|j}|j}ddtdd|DD}|rrtdd |pnd td |d |pd t|d krt d t d|S)Nz (from rcSsg|] }t|qSrD)rK)rYvrDrDrE jsz?Factory._report_single_requirement_conflict..cSsh|] }|jqSrD)rrrDrDrErjsz>Factory._report_single_requirement_conflict..zJIgnored the following versions that require a different python version: %sz; nonezNCould not find a version that satisfies the requirement %s (from versions: %s), zrequirements.txtzHINT: You are attempting to install a package literally named "requirements.txt" (which cannot exist). Consider using the '-r' flag to install the packages listed in requirements.txtz#No matching distribution found for ) rKrr]find_all_candidatesrrequires_python_skipped_reasonssortedrcriticaljoinrr)rkrr?req_dispcandsskipped_by_requires_pythonversionsrDrDrE#_report_single_requirement_conflict`s*     z+Factory._report_single_requirement_conflictz,ResolutionImpossible[Requirement, Candidate])rrIrWcs|jstdfdd|jD}|r6td|St|jdkrh|jd\}}|j|krh||Stttddd }t td d d }t }|jD],\}}|dkr| } n||} | | q|r|t |} nd } d| } t| d} t } |jD]^\}}|j|kr | |j| d} |rH| |jd|jd} n| d} | | } q| D]"} || j}| d| |7} qd| ddddd} t| tdS)Nz)Installation error reported with no causecs*g|]"}t|jtr|jjs|qSrD) isinstancer>r9rr_)rYrrprDrErs z2Factory.get_installation_error..zSequence[ConflictCause]r*r)partsrWcSs2t|dkr|dSd|ddd|dS)Nr*rrz and )rr)rrDrDrE text_joins z1Factory.get_installation_error..text_join)r?rWcSsF|}|r|js$|jd|jSt|jtr.describe_triggerzthe requested packageszOCannot install {} because these package versions have conflicting dependencies.z The conflict is caused by:z  z depends on zThe user requested z% The user requested (constraint) z zTo fix this you could try to: z91. loosen the range of package versions you've specified z92. remove package versions to allow pip attempt to solve zthe dependency conflict zResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts)rrrrrrr rrKr+rrrrformatrrrrrr)rkrrIrequires_python_causesrr?rrtriggerstriggerrrxrelevant_constraintskeyspecrDrprEget_installation_errorsr           zFactory.get_installation_error)N)rD);r@rArBrr!r%r rrr rLrmpropertyrSrryr0rrKr2rrr#r+rrr,rr rr'r rrr.rrr-rrrrrrGrr8rrrrrrrrrr rrrrDrDrDrErMZs  &    @ c   G !     '  $ rM)^rrloggingrrtypingrrrrrrrr r r r r rr"pip._vendor.packaging.requirementsrZ pip._vendor.packaging.specifiersrpip._vendor.packaging.utilsrrpip._vendor.resolvelibrpip._internal.cacherrpip._internal.exceptionsrrrrr"pip._internal.index.package_finderrpip._internal.metadatarrpip._internal.models.linkrpip._internal.models.wheelr pip._internal.operations.preparer!pip._internal.req.constructorsr"Zpip._internal.req.req_installr#r$pip._internal.resolution.baser%&pip._internal.utils.compatibility_tagsr&pip._internal.utils.hashesr'pip._internal.utils.packagingr(pip._internal.utils.virtualenvr)rzr+r,r-r. candidatesr/r0r1r2r3r4r5found_candidatesr6r7rHr8r9r:r;r<r= getLoggerr@rrFCacherGrMrDrDrDrEsF@             $    PK, ]O=resolution/resolvelib/__pycache__/requirements.cpython-38.pycnu[U ʗReO@sddlmZddlmZmZddlmZddlmZm Z m Z m Z Gddde Z Gdd d e Z Gd d d e ZGd d d e ZdS)) SpecifierSet)NormalizedNamecanonicalize_name)InstallRequirement) CandidateCandidateLookup Requirement format_namec@seZdZeddddZedddZeddd Zee dd d Z eedd d Z edddZ e dddZeedddZdS)ExplicitRequirementN candidatereturncCs ||_dSNr selfr r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__ szExplicitRequirement.__init__rcCs t|jSr)strr rrrr__str__ szExplicitRequirement.__str__cCsdj|jj|jdS)Nz{class_name}({candidate!r})) class_namer )format __class____name__r rrrr__repr__szExplicitRequirement.__repr__cCs|jjSr)r project_namerrrrrsz ExplicitRequirement.project_namecCs|jjSr)r namerrrrr szExplicitRequirement.namecCs |jSr)r format_for_errorrrrrr! sz$ExplicitRequirement.format_for_errorcCs |jdfSrrrrrrget_candidate_lookup#sz(ExplicitRequirement.get_candidate_lookupcCs ||jkSrrrrrris_satisfied_by&sz#ExplicitRequirement.is_satisfied_by)r __module__ __qualname__rrrrrpropertyrrr r!rr"boolr#rrrrr sr c@seZdZeddddZedddZeddd Zee dd d Z eedd d Z edddZ e dddZeedddZdS)SpecifierRequirementN)ireqrcCs(|jdkstd||_t|j|_dS)NzThis is a link, not a specifier)linkAssertionError_ireq frozensetextras_extras)rr)rrrr+szSpecifierRequirement.__init__rcCs t|jjSr)rr,reqrrrrr0szSpecifierRequirement.__str__cCsdj|jjt|jjdS)Nz{class_name}({requirement!r}))r requirement)rrrrr,r0rrrrr3s zSpecifierRequirement.__repr__cCs|jjstdt|jjjS)N'Specifier-backed ireq is always PEP 508)r,r0r+rr rrrrr9sz!SpecifierRequirement.project_namecCst|j|jSr)r rr/rrrrr >szSpecifierRequirement.namecCsZddt|dD}t|dkr(dSt|dkr<|dSd|ddd |dS) NcSsg|] }|qSr)strip).0srrr Hsz9SpecifierRequirement.format_for_error..,rrz, z and )rsplitlenjoin)rpartsrrrr!Bs   z%SpecifierRequirement.format_for_errorcCs d|jfSr)r,rrrrr"Psz)SpecifierRequirement.get_candidate_lookupr cCsN|j|jks$td|jd|j|jjs4td|jjj}|j|jddS)Nz6Internal issue: Candidate is not for this requirement z vs r2T prereleases)r r+r,r0 specifiercontainsversion)rr specrrrr#Ss  z$SpecifierRequirement.is_satisfied_by)rr$r%rrrrrr&rrr r!rr"rr'r#rrrrr(*sr(c@seZdZdZeeddddZedddZedd d Z e e dd d Z e edd dZ edddZedddZeedddZdS)RequiresPythonRequirementz4A requirement representing Requires-Python metadata.N)r@matchrcCs||_||_dSr)r@ _candidate)rr@rErrrrcsz"RequiresPythonRequirement.__init__rcCs d|jS)NzPython )r@rrrrrgsz!RequiresPythonRequirement.__str__cCsdj|jjt|jdS)Nz{class_name}({specifier!r}))rr@)rrrrr@rrrrrjsz"RequiresPythonRequirement.__repr__cCs|jjSr)rFrrrrrrpsz&RequiresPythonRequirement.project_namecCs|jjSr)rFr rrrrr tszRequiresPythonRequirement.namecCst|Srrrrrrr!xsz*RequiresPythonRequirement.format_for_errorcCs"|jj|jjddr|jdfSdS)NTr>NN)r@rArFrBrrrrr"{s z.RequiresPythonRequirement.get_candidate_lookupr cCs(|j|jjkstd|jj|jddS)NzNot Python candidateTr>)r rFr+r@rArBrrrrr#sz)RequiresPythonRequirement.is_satisfied_by)rr$r%__doc__rrrrrrr&rrr r!rr"r'r#rrrrrD`srDc@seZdZdZeddddZedddZedd d Ze edd d Z e edd dZ edddZ e dddZeedddZdS)UnsatisfiableRequirementz'A requirement that cannot be satisfied.N)r rcCs ||_dSr_name)rr rrrrsz!UnsatisfiableRequirement.__init__rcCs |jdS)Nz (unavailable)rKrrrrrsz UnsatisfiableRequirement.__str__cCsdj|jjt|jdS)Nz{class_name}({name!r}))rr )rrrrrLrrrrrsz!UnsatisfiableRequirement.__repr__cCs|jSrrKrrrrrsz%UnsatisfiableRequirement.project_namecCs|jSrrKrrrrr szUnsatisfiableRequirement.namecCst|SrrGrrrrr!sz)UnsatisfiableRequirement.format_for_errorcCsdS)NrHrrrrrr"sz-UnsatisfiableRequirement.get_candidate_lookupr cCsdS)NFrrrrrr#sz(UnsatisfiableRequirement.is_satisfied_by)rr$r%rIrrrrrr&rr r!rr"rr'r#rrrrrJsrJN)Z pip._vendor.packaging.specifiersrpip._vendor.packaging.utilsrrZpip._internal.req.req_installrbaserrr r r r(rDrJrrrrs  !6(PK, ]}Fw9resolution/resolvelib/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdS)Nrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/__init__.pyPK, ]; 9resolution/resolvelib/__pycache__/resolver.cpython-38.pycnu[U ʗRe -@sddlZddlZddlZddlmZmZmZmZmZm Z m Z ddl m Z ddl mZmZddl mZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZm Z dd l!m"Z"ddl#m$Z$m%Z%ddl&m'Z'm(Z(ddl)m*Z*erddl+m,Z-e-e(e'e.fZ,e/e0Z1GdddeZdee.eee.e2fdddZ3e e.efeee.e2fe e2e.fdddZ4dS)N) TYPE_CHECKINGDictListOptionalSetTuplecastcanonicalize_name) BaseReporterResolutionImpossible)Resolver) DirectedGraph) WheelCache) PackageFinder)RequirementPreparer)InstallRequirement)RequirementSet) BaseResolverInstallRequirementProvider) PipProvider)PipDebuggingReporter PipReporter) Candidate Requirement)Factory)Resultcs|eZdZdddhZdeeeeee e e e e e ee e dfd fdd Z eee ed d d Zeeed d dZZS)r eagerzonly-if-neededzto-satisfy-onlyN.) preparerfinder wheel_cachemake_install_req use_user_siteignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_infoc sJt| |jkstt|||||| ||| d |_||_| |_d|_dS)N) r rr"r!r#r'r%r&r)) super__init___allowed_strategiesAssertionErrorrfactoryr$r(_result) selfrr r!r"r#r$r%r&r'r(r) __class__/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.pyr+&s   zResolver.__init__) root_reqscheck_supported_wheelsreturnc Cs|j|}t|j|j|j|j|jd}dtjkr:t }nt }t ||}zd}|j |j |d}|_Wn>tk r} z |jtd| |j} | | W5d} ~ XYnXt|d} |jD]} | } | dkrq|j| }|dkrd| _np|jjrd| _n`|j| jkrd| _nJ| js$|jr,d| _n2| jr| jjr| jjrTt d | j!qd| _nq| j}|r|j"rd j#| j!| j||j$pd d }t%|| &| q| j'}|jj()|| S) N)r. constraintsr$r(user_requestedPIP_RESOLVER_DEBUGi) max_roundsz,ResolutionImpossible[Requirement, Candidate])r6FTz%s is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.zThe candidate selected for download or install is a yanked version: {name!r} candidate (version {version} at {link}) Reason for being yanked: {reason}z )nameversionlinkreason)*r.collect_root_requirementsrr8r$r(r9osenvironrr RLResolverresolve requirementsr/r get_installation_errorrrmappingvaluesget_install_requirementget_dist_to_uninstallshould_reinstallr'r= is_editableeditable source_linkis_fileis_wheelloggerinfor< is_yankedformat yanked_reasonwarningadd_named_requirementall_requirementsr prepare_linked_requirements_more)r0r5r6 collectedproviderreporterresolver try_to_avoid_resolution_too_deepresulteerrorreq_set candidateireqinstalled_distr>msgreqsr3r3r4rDFs        zResolver.resolve)rbr7cCsd|jdk std|jsgS|jj}t|t|j}t|jt j t |ddd}dd|DS)aZGet order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept consistent as they get installed one-by-one. The current implementation creates a topological ordering of the dependency graph, giving more weight to packages with less or no dependencies, while breaking any cycles in the graph at arbitrary points. We make no guarantees about where the cycle would be broken, other than it *would* be broken. Nzmust call resolve() first)weightsT)keyreversecSsg|] \}}|qSr3r3).0_rdr3r3r4 sz3Resolver.get_installation_order..) r/r-rEgraphget_topological_weightssetkeyssorteditems functoolspartial_req_set_item_sorter)r0rbrnrh sorted_itemsr3r3r4get_installation_orders zResolver.get_installation_order)N)__name__ __module__ __qualname__r,rrrrrboolstrrintr+rrrrDrx __classcell__r3r3r1r4r #s, ! _r zDirectedGraph[Optional[str]])rnrequirement_keysr7cstittddfdd t}D],}|dkrBq4|D]}q4qL||q4|shqtd}|D]}|krqx||<qx|D]}|qq*dt}|rt |S)aAssign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We first simplify the dependency graph by pruning any leaves and giving them the highest weight: a package without any dependencies should be installed first. This is done again and again in the same way, giving ever less weight to the newly found leaves. The loop stops when no leaves are left: all remaining packages have at least one dependency left in the graph. Then we continue with the remaining graph, by taking the length for the longest path to any node from root, ignoring any paths that contain a single node twice (i.e. cycles). This is done through a depth-first search through the graph, while keeping track of the path to the node. Cycles in the graph result would result in node being revisited while also being on its own path. In this case, take no action. This helps ensure we don't get stuck in a cycle. When assigning weight, the longer path (i.e. larger length) is preferred. We are only interested in the weights of packages that are in the requirement_keys. N)noder7csf|kr dS||D] }|q ||krDdS|d}t|t|<dS)Nr)add iter_childrenremovegetmaxlen)rchildlast_known_parent_countrnpathrvisitrhr3r4rs    z&get_topological_weights..visitr) rprr}rrrrrq differencer-)rnrleavesri_childweightleafrr3rr4ros.     ro)itemrhr7cCst|d}|||fS)a)Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests. rr )rrhr<r3r3r4rvs rv)5rtloggingrAtypingrrrrrrrpip._vendor.packaging.utilsr pip._vendor.resolvelibr r r rCZpip._vendor.resolvelib.structsrpip._internal.cacher"pip._internal.index.package_finderr pip._internal.operations.preparerZpip._internal.req.req_installrZpip._internal.req.req_setrpip._internal.resolution.baserr,pip._internal.resolution.resolvelib.providerr,pip._internal.resolution.resolvelib.reporterrrbaserrr.rZ pip._vendor.resolvelib.resolversrZRLResultr} getLoggerryrQr~rorvr3r3r3r4s>$            # Z  PK, ]Fv9resolution/resolvelib/__pycache__/provider.cpython-38.pycnu[U ʗRe&@sddlZddlZddlmZmZmZmZmZmZm Z m Z ddl m Z ddl mZmZmZddlmZddlmZerddl mZdd lmZeeefZe eeefZne Ze d Ze d Zeeefeee eefd d dZGdddeZdS)N) TYPE_CHECKINGDictIterableIteratorMappingSequenceTypeVarUnion)AbstractProvider) Candidate Constraint Requirement)REQUIRES_PYTHON_IDENTIFIER)Factory) Preference)RequirementInformationDV)mapping identifierdefaultreturncCs8||kr||S|d\}}}|r4||kr4||S|S)aiGet item from a package name lookup mapping with a resolver identifier. This extra logic is needed when the target mapping is keyed by package name, which cannot be directly looked up with an identifier (which may contain requested extras). Additional logic is added to also look up a value by "cleaning up" the extras from the identifier. [) partition)rrrname open_bracket_r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/provider.py_get_with_identifier5s  r c@seZdZdZeeeefeeeee fddddZ e e e fedddZeeee feeee feeed fed d d d d Zeeeee feeee fee dddZe e edddZe ee dddZeeed edddZdS) PipProvideraPip's provider implementation for resolvelib. :params constraints: A mapping of constraints specified by the user. Keys are canonicalized project names. :params ignore_dependencies: Whether the user specified ``--no-deps``. :params upgrade_strategy: The user-specified upgrade strategy. :params user_requested: A set of canonicalized package names that the user supplied for pip to install/upgrade. N)factory constraintsignore_dependenciesupgrade_strategyuser_requestedrcCs2||_||_||_||_||_tdd|_dS)NcSstjSN)mathinfrrrrfz&PipProvider.__init__..)_factory _constraints_ignore_dependencies_upgrade_strategy_user_requested collections defaultdict _known_depths)selfr"r#r$r%r&rrr__init__Ys zPipProvider.__init__)requirement_or_candidatercCs|jSr')r)r4r6rrridentifyhszPipProvider.identifyPreferenceInformationr)r resolutions candidates informationbacktrack_causesrc sdd||D}t|\}}dddd|DD} |dk } tdd| D} t| } zj|} WnFtk rtj} fdd||D}td d|Dd }YnXd }|j|<j |tj} |t k}|d k} ||}| || | | || | |f S) aZProduce a sort key for given requirement based on preference. The lower the return value is, the more preferred this group of arguments is. Currently pip considers the following in order: * Prefer if any of the known requirements is "direct", e.g. points to an explicit URL. * If equal, prefer if any requirement is "pinned", i.e. contains operator ``===`` or ``==``. * If equal, calculate an approximate "depth" and resolve requirements closer to the user-specified requirements first. * Order user-specified requirements by the order they are specified. * If equal, prefers "non-free" requirements, i.e. contains at least one operator, such as ``>=`` or ``<``. * If equal, order alphabetically for consistency (helps debuggability). css|]\}}|VqdSr')get_candidate_lookup).0rrrrr sz-PipProvider.get_preference..cSsg|]}|D] }|jq qSr)operator)r> specifier_set specifierrrr sz.PipProvider.get_preference..css|]}|r|jVqdSr')rC)r>ireqrrrr@sNcss|]}|dddkVqdS)Nz==r)r>oprrrr@sc3s*|]"\}}|dk rj|jndVqdS)Ng)r3r)r>rparentr4rrr@scss|] }|VqdSr'r)r>drrrr@sg? setuptools) zipanyboolr0KeyErrorr(r)minr3getris_backtrack_cause)r4rr9r:r;r<lookups candidateireqs operatorsdirectpinnedunfreerequested_order parent_depthsinferred_depthrequires_python delay_thisbacktrack_causerrIrget_preferenceks@      zPipProvider.get_preference)r requirementsincompatibilitiesrcsDttdfdd }tj|td}jj||||| |dS)N)rrcs4jdkrdSjdkr0tj|dd}|dk SdS)aAre upgrades allowed for this project? This checks the upgrade strategy, and whether the project was one that the user specified in the command line, in order to decide whether we should upgrade if there's a newer version available. (Note that we don't need access to the `--upgrade` flag, because an upgrade strategy of "to-satisfy-only" means that `--upgrade` was not specified). eagerTzonly-if-neededNrF)r/r r0)r user_orderrIrr_eligible_for_upgrades  z7PipProvider.find_matches.._eligible_for_upgraderd)rra constraintprefers_installedrb)strrNr r-r emptyr,find_candidates)r4rrarbrfrgrrIr find_matchesszPipProvider.find_matches) requirementrTrcCs ||Sr')is_satisfied_by)r4rmrTrrrrnszPipProvider.is_satisfied_by)rTrcCs|j }dd||DS)NcSsg|]}|dk r|qSr'r)r>r?rrrrDsz0PipProvider.get_dependencies..)r.iter_dependencies)r4rT with_requiresrrrget_dependenciesszPipProvider.get_dependencies)rr<rcCs8|D].}||jjkrdS|jr||jjkrdSqdS)NTF)rmrrH)rr<r_rrrrRs  zPipProvider.is_backtrack_cause)__name__ __module__ __qualname____doc__rrrir rNintr5r rr r7rrrrr`rlrnrq staticmethodrRrrrrr!Ns8      V )r!)r1r(typingrrrrrrrr Z pip._vendor.resolvelib.providersr baser r rr:rr"rrZ pip._vendor.resolvelib.resolversrr8ri _ProviderBaserrr r!rrrrs((        PK, ]Z@Aresolution/resolvelib/__pycache__/found_candidates.cpython-38.pycnu[U ʗReI@sdZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZe e ege effZerzeeZneZeeeedd d Zeeeeed d d Zeeeeed ddZGdddeZdS)aUtilities to lazily create and visit candidates found. Creating and visiting a candidate is a *very* costly operation. It involves fetching, extracting, potentially building modules from source, and verifying distribution metadata. It is therefore crucial for performance to keep everything here lazy all the way down, so we only touch candidates that we absolutely need, and not "download the world" when we only need one version of something. N)Sequence) TYPE_CHECKINGAnyCallableIteratorOptionalSetTuple) _BaseVersion) Candidate)infosreturnccsBt}|D]2\}}||krq |}|dkr,q |V||q dS)zIterator for ``FoundCandidates``. This iterator is used when the package is not already installed. Candidates from index come later in their normal ordering. N)setadd)r versions_foundversionfunc candidater/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py _iter_built%s r) installedr rccsJ|V|jh}|D]2\}}||kr$q|}|dkr4q|V||qdS)aKIterator for ``FoundCandidates``. This iterator is used when the resolver prefers the already-installed candidate and NOT to upgrade. The installed candidate is therefore always yielded first, and candidates from index come later in their normal ordering, except skipped when the version is already installed. N)rrrr rrrrrrr_iter_built_with_prepended6s  rccsnt}|D]N\}}||krq |j|kr8|V||j|}|dkrHq |V||q |j|krj|VdS)aIterator for ``FoundCandidates``. This iterator is used when the resolver prefers to upgrade an already-installed package. Candidates from index are returned in their normal ordering, except replaced when the version is already installed. The implementation iterates through and yields other candidates, inserting the installed candidate exactly once before we start yielding older or equivalent candidates, or after all other candidates if they are all newer. N)rrrrrrr_iter_built_with_insertedLs      rc@seZdZdZegeefeee e e dddZ e e dddZeedd d Ze dd d Zejd de dddZdS)FoundCandidatesacA lazy sequence to provide candidates to the resolver. The intended usage is to return this from `find_matches()` so the resolver can iterate through the sequence multiple times, but only access the index page when remote packages are actually needed. This improve performances when suitable candidates are already installed on disk. ) get_infosrprefers_installedincompatible_idscCs||_||_||_||_dSN) _get_infos _installed_prefers_installed_incompatible_ids)selfrrrrrrr__init__uszFoundCandidates.__init__)indexrcCs tddSNz don't do thisNotImplementedError)r%r'rrr __getitem__szFoundCandidates.__getitem__)rcsJ}jst|}n jr,tj|}n tj|}fdd|DS)Nc3s |]}t|jkr|VqdSr )idr$).0cr%rr sz+FoundCandidates.__iter__..)r!r"rr#rr)r%r iteratorrr/r__iter__s  zFoundCandidates.__iter__cCs tddSr(r)r/rrr__len__szFoundCandidates.__len__r )maxsizecCs|jr|jrdSt|S)NT)r#r"anyr/rrr__bool__s zFoundCandidates.__bool__N)__name__ __module__ __qualname____doc__rrIndexCandidateInforr boolrintr&rr+r2r3 functools lru_cacher6rrrrrls    r)r:r>collections.abcrtypingrrrrrrr Zpip._vendor.packaging.versionr baser r;SequenceCandidaterrrrrrrrs&  $     PK, ]ט5resolution/resolvelib/__pycache__/base.cpython-38.pycnu[U ʗRed@sddlmZmZmZmZmZddlmZddlm Z m Z ddl m Z m Z ddlmZmZddlmZddlmZeedeefZee e fZeeeed d d ZGd d d ZGdddZededddZGdddZdS)) FrozenSetIterableOptionalTupleUnion) SpecifierSet)NormalizedNamecanonicalize_name) LegacyVersionVersion)Linklinks_equivalent)InstallRequirement)Hashes Candidate)projectextrasreturncCs,|s|Stdd|D}d|d|S)Ncss|]}t|VqdSN)r ).0er/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/base.py szformat_name..z{}[{}],)sortedformatjoin)rrcanonical_extrasrrr format_namesrc@sxeZdZeeeeddddZeddddZ ee ddd d Z e dd d Z e dd ddZde dddZdS) ConstraintN) specifierhasheslinksrcCs||_||_||_dSr)r!r"r#)selfr!r"r#rrr__init__szConstraint.__init__rcCsttttSr)r rr frozenset)clsrrremptyszConstraint.empty)ireqrcCs.|jrt|jgnt}t|j|jdd|SNF)trust_internet)linkr'r r!r")r(r*r#rrr from_ireq"szConstraint.from_ireqcCst|jpt|jpt|jSr)boolr!r"r#r$rrr__bool__'szConstraint.__bool__)otherrcCsRt|tstS|j|j@}|j|jdd@}|j}|jrF||jg}t|||Sr+) isinstancerNotImplementedr!r"r#r-unionr )r$r2r!r"r#rrr__and__*s  zConstraint.__and__r candidatercs4|jr"tfdd|jDs"dS|jjjddS)Nc3s|]}t|VqdSr) _match_link)rr-r8rrr6sz-Constraint.is_satisfied_by..FT) prereleases)r#allr!containsversionr$r8rr:ris_satisfied_by4szConstraint.is_satisfied_by)__name__ __module__ __qualname__rrrr r% classmethodr)rr.r/r1r6r@rrrrr s  r c@s\eZdZeedddZeedddZdeddd Z e dd d Z edd d Z dS) Requirementr&cCs tddS)zThe "project name" of a requirement. This is different from ``name`` if this requirement contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. Subclass should overrideNNotImplementedErrorr0rrr project_name?szRequirement.project_namecCs tddS)zThe name identifying this requirement in the resolver. This is different from ``project_name`` if this requirement contains extras, where ``project_name`` would not contain the ``[...]`` part. rFNrGr0rrrnameIszRequirement.namerr7cCsdSNFrr?rrrr@RszRequirement.is_satisfied_bycCs tddSNrFrGr0rrrget_candidate_lookupUsz Requirement.get_candidate_lookupcCs tddSrLrGr0rrrformat_for_errorXszRequirement.format_for_errorN) rArBrCpropertyrrIstrrJr/r@CandidateLookuprMrNrrrrrE>s rE)r-r8rcCs|jrt||jSdSrK) source_linkr )r-r8rrrr9\s r9c@seZdZeedddZeedddZeedddZ ee ddd Z ee dd d Z ee edd d Ze ee edddZe edddZedddZdS)rr&cCs tddS)zThe "project name" of the candidate. This is different from ``name`` if this candidate contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. Override in subclassNrGr0rrrrIcszCandidate.project_namecCs tddS)zThe name identifying this candidate in the resolver. This is different from ``project_name`` if this candidate contains extras, where ``project_name`` would not contain the ``[...]`` part. rSNrGr0rrrrJmszCandidate.namecCs tddSNrSrGr0rrrr>vszCandidate.versioncCs tddSrTrGr0rrr is_installedzszCandidate.is_installedcCs tddSrTrGr0rrr is_editable~szCandidate.is_editablecCs tddSrTrGr0rrrrRszCandidate.source_link) with_requiresrcCs tddSrTrG)r$rWrrriter_dependenciesszCandidate.iter_dependenciescCs tddSrTrGr0rrrget_install_requirementsz!Candidate.get_install_requirementcCs tddSrLrGr0rrrrNszCandidate.format_for_errorN)rArBrCrOrrIrPrJCandidateVersionr>r/rUrVrr rRrrErXrrYrNrrrrrbs N)typingrrrrrZ pip._vendor.packaging.specifiersrpip._vendor.packaging.utilsrr Zpip._vendor.packaging.versionr r pip._internal.models.linkr r Zpip._internal.req.req_installrpip._internal.utils.hashesrrQrZrPrr rEr/r9rrrrrs    (PK, ]ajII;resolution/resolvelib/__pycache__/candidates.cpython-38.pycnu[U ʗReJ@sddlZddlZddlmZmZmZmZmZmZm Z m Z ddl m Z m Z ddlmZddlmZmZmZddlmZddlmZmZddlmZdd lmZmZdd lmZdd l m!Z!dd l"m#Z#d dl$m%Z%m&Z&m'Z'm(Z(erd dl)m*Z*e+e,Z-e dZ.e e dZ/e%ee.dddZ0eeedddZ1eeedddZ2eeedddZ3Gddde%Z4Gdd d e4Z5Gd!d"d"e4Z6Gd#d$d$e%Z7Gd%d&d&e%Z8Gd'd(d(e%Z9dS))N) TYPE_CHECKINGAny FrozenSetIterableOptionalTupleUnioncast)NormalizedNamecanonicalize_name)Version) HashErrorInstallationSubprocessErrorMetadataInconsistent)BaseDistribution)Linklinks_equivalent)Wheel)install_req_from_editableinstall_req_from_line)InstallRequirement)direct_url_from_link)normalize_version_info) CandidateCandidateVersion Requirement format_name)Factory)AlreadyInstalledCandidateEditableCandidate LinkCandidatez) candidatereturncCstttf}t||r|SdS)z%The runtime version of BaseCandidate.N)rr r! isinstance)r"base_candidate_classesr&/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.pyas_base_candidate)s r()linktemplater#c Csl|jrtd|jr t|j}n|j}t||j|j|j|j |j t |j |j |jd|jd}|j|_||_|S)Nztemplate is editableinstall_optionsglobal_optionshashes user_supplied comes_from use_pep517isolated constraintoptionsconfig_settings)editableAssertionErrorreqstrurlrr0r1r2r3r4dictr,r- hash_optionsr6 original_linkr))r)r*lineireqr&r&r'make_install_req_from_link5s* rAc CsH|jstdt|j|j|j|j|j|j|j t |j |j |j d|jd S)Nztemplate not editabler+)r0r1r2r3r4permit_editable_wheelsr5r6)r7r8rr;r0r1r2r3r4rBr<r,r-r=r6)r)r*r&r&r'make_install_req_from_editablePs rC)distr*r#c Cs~|jrt|j}n.|jr.|jd|jj}n|jd|j}t||j|j|j |j |j t |j |j|jd|jd}||_|S)Nz @ z==r+r/)r9r:r)canonical_namer;versionrr0r1r2r3r4r<r,r-r=r6 satisfied_by)rDr*r?r@r&r&r'_make_install_req_from_distes* rHc @s,eZdZUdZeed<dZd)eeede e e e ddddZ e d d d Ze d d d Zed ddZeedddZee ed ddZee d ddZee d ddZee d ddZe d ddZed ddZeddd d!Zed d"d#Zeee ed$d%d&Z e ed d'd(Z!dS)*"_InstallRequirementBackedCandidateaA candidate backed by an ``InstallRequirement``. This represents a package request with the target not being already in the environment, and needs to be fetched and installed. The backing ``InstallRequirement`` is responsible for most of the leg work; this class exposes appropriate information to the resolver. :param link: The link passed to the ``InstallRequirement``. The backing ``InstallRequirement`` will use this link to fetch the distribution. :param source_link: The link this candidate "originates" from. This is different from ``link`` when the link is found in the wheel cache. ``link`` would point to the wheel cache, while this points to the found remote link (e.g. from pypi.org). rDFNr)r) source_linkr@factorynamerFr#cCs2||_||_||_||_||_||_||_dSN)_link _source_link_factory_ireq_name_version_preparerD)selfr)rJr@rKrLrFr&r&r'__init__s z+_InstallRequirementBackedCandidate.__init__r#cCs|jd|jS)N rLrFrUr&r&r'__str__sz*_InstallRequirementBackedCandidate.__str__cCsdj|jjt|jdS)Nz{class_name}({link!r})) class_namer))format __class____name__r:rNrZr&r&r'__repr__sz+_InstallRequirementBackedCandidate.__repr__cCst|j|jfSrM)hashr^rNrZr&r&r'__hash__sz+_InstallRequirementBackedCandidate.__hash__otherr#cCst||jrt|j|jSdSNF)r$r^rrNrUrdr&r&r'__eq__s z)_InstallRequirementBackedCandidate.__eq__cCs|jSrM)rOrZr&r&r'rJsz._InstallRequirementBackedCandidate.source_linkcCs|jdkr|jj|_|jS):The normalised name of the project the candidate refers toN)rRrDrErZr&r&r' project_names  z/_InstallRequirementBackedCandidate.project_namecCs|jSrMrirZr&r&r'rLsz'_InstallRequirementBackedCandidate.namecCs|jdkr|jj|_|jSrM)rSrDrFrZr&r&r'rFs  z*_InstallRequirementBackedCandidate.versioncCs$d|j|j|jjr|jjn|jS)Nz{} {} (from {}))r]rLrFrNis_file file_pathrZr&r&r'format_for_errors z3_InstallRequirementBackedCandidate.format_for_errorcCs tddS)NzOverride in subclass)NotImplementedErrorrZr&r&r'_prepare_distributionsz8_InstallRequirementBackedCandidate._prepare_distribution)rDr#cCs`|jdk r*|j|jkr*t|jd|j|j|jdk r\|j|jkr\t|jdt|jt|jdS)z:Check for consistency of project name and version of dist.NrLrF)rRrErrQrSrFr:)rUrDr&r&r'_check_metadata_consistencysz>_InstallRequirementBackedCandidate._check_metadata_consistencyc Cspz |}WnTtk r8}z|j|_W5d}~XYn*tk r`}z d|_W5d}~XYnX|||S)NzSee above for output.)ror rQr9rcontextrp)rUrDeexcr&r&r'rTs  z+_InstallRequirementBackedCandidate._prepare with_requiresr#ccsH|r|jnd}|D]}|jt||jVq|j|jjVdSNr&)rDiter_dependenciesrPmake_requirement_from_specr:rQ make_requires_python_requirementrequires_python)rUrurequiresrr&r&r'rwsz4_InstallRequirementBackedCandidate.iter_dependenciescCs|jSrM)rQrZr&r&r'get_install_requirementsz:_InstallRequirementBackedCandidate.get_install_requirement)NN)"r_ __module__ __qualname____doc__r__annotations__ is_installedrrrr rrVr:r[r`intrbrboolrgpropertyrJrirLrFrmrorprTrrrwr}r&r&r&r'rIs@  rIcsHeZdZdZd eedeeeeddfdd Z e ddd Z Z S) r!FNrr)r*rKrLrFr#c s|}|||}|dk r,td|j|j}t||}|j|ksDt|jjr|jjst|jj } t | j } || kst|d| d|dk rt | j } || kstd|| ||dk r|jr|j|jkrd|_|jdk r|j|_nt||jd|_tj||||||ddS)NzUsing cached wheel link: %sz != z for wheelz{!r} != {!r} for wheel {}T)link_is_in_wheel_cacher)rJr@rKrLrF)get_wheel_cache_entryloggerdebugr)rAr8is_wheelrkrfilenamer rLr rFr] persistentr>original_link_is_in_wheel_cacheorigin download_inforsuperrV) rUr)r*rKrLrFrJ cache_entryr@wheel wheel_name wheel_versionr^r&r'rVsF       zLinkCandidate.__init__rWcCs|jj}|j|jddS)NT)parallel_builds)rPpreparerprepare_linked_requirementrQ)rUrr&r&r'ro2sz#LinkCandidate._prepare_distribution)NN r_r~r is_editablerrrr rrVrro __classcell__r&r&rr'r!s/r!csHeZdZdZd eedeeeeddfdd Z e ddd Z Z S) r TNrrcs"tj||t|||||ddS)Nr)rrVrC)rUr)r*rKrLrFrr&r'rV:szEditableCandidate.__init__rWcCs|jj|jSrM)rPrprepare_editable_requirementrQrZr&r&r'roKsz'EditableCandidate._prepare_distribution)NNrr&r&rr'r 7sr c@seZdZdZdZeedddddZeddd Z edd d Z e dd d Z e edddZeedddZeedddZeedddZeedddZedddZeeeedddZeedddZdS) rTNr)rDr*rKr#cCs0||_t|||_||_d}|j|j|dS)Nzalready satisfied)rDrHrQrPrprepare_installed_requirement)rUrDr*rK skip_reasonr&r&r'rVSs  z"AlreadyInstalledCandidate.__init__rWcCs t|jSrM)r:rDrZr&r&r'r[dsz!AlreadyInstalledCandidate.__str__cCsdj|jj|jdS)Nz{class_name}({distribution!r}))r\ distribution)r]r^r_rDrZr&r&r'r`gsz"AlreadyInstalledCandidate.__repr__cCst|j|j|jfSrM)rar^rLrFrZr&r&r'rbmsz"AlreadyInstalledCandidate.__hash__rccCs(t||jr$|j|jko"|j|jkSdSre)r$r^rLrFrfr&r&r'rgps z AlreadyInstalledCandidate.__eq__cCs|jjSrM)rDrErZr&r&r'riusz&AlreadyInstalledCandidate.project_namecCs|jSrMrjrZr&r&r'rLyszAlreadyInstalledCandidate.namecCs|jjSrM)rDrFrZr&r&r'rF}sz!AlreadyInstalledCandidate.versioncCs|jjSrM)rDr7rZr&r&r'rsz%AlreadyInstalledCandidate.is_editablecCs|jd|jdS)NrXz (Installed)rYrZr&r&r'rmsz*AlreadyInstalledCandidate.format_for_errorrtccs2|sdS|jD]}|jt||jVqdSrM)rDrwrPrxr:rQ)rUrur|r&r&r'rwsz+AlreadyInstalledCandidate.iter_dependenciescCsdSrMr&rZr&r&r'r}sz1AlreadyInstalledCandidate.get_install_requirement)r_r~rrrJrrrVr:r[r`rrbrrrgrr rirLrrFrrmrrrrwr}r&r&r&r'rOs, rc@seZdZdZeeeddddZedddZedd d Z e dd d Z e e d ddZeedddZeedddZeedddZedddZee dddZee dddZeeedddZe eeeddd Zeedd!d"ZdS)#ExtrasCandidateaA candidate that has 'extras', indicating additional dependencies. Requirements can be for a project with dependencies, something like foo[extra]. The extras don't affect the project/version being installed directly, but indicate that we need additional dependencies. We model that by having an artificial ExtrasCandidate that wraps the "base" candidate. The ExtrasCandidate differs from the base in the following ways: 1. It has a unique name, of the form foo[extra]. This causes the resolver to treat it as a separate node in the dependency graph. 2. When we're getting the candidate's dependencies, a) We specify that we want the extra dependencies as well. b) We add a dependency on the base candidate. See below for why this is needed. 3. We return None for the underlying InstallRequirement, as the base candidate will provide it, and we don't want to end up with duplicates. The dependency on the base candidate is needed so that the resolver can't decide that it should recommend foo[extra1] version 1.0 and foo[extra2] version 2.0. Having those candidates depend on foo=1.0 and foo=2.0 respectively forces the resolver to recognise that this is a conflict. N)baseextrasr#cCs||_||_dSrM)rr)rUrrr&r&r'rVszExtrasCandidate.__init__rWcCs,t|jdd\}}d|d|j|S)NrXrz {}[{}] {},)r:rsplitr]joinr)rUrLrestr&r&r'r[szExtrasCandidate.__str__cCsdj|jj|j|jdS)Nz.{class_name}(base={base!r}, extras={extras!r}))r\rr)r]r^r_rrrZr&r&r'r`s zExtrasCandidate.__repr__cCst|j|jfSrM)rarrrZr&r&r'rbszExtrasCandidate.__hash__rccCs(t||jr$|j|jko"|j|jkSdSre)r$r^rrrfr&r&r'rgs zExtrasCandidate.__eq__cCs|jjSrM)rrirZr&r&r'riszExtrasCandidate.project_namecCst|jj|jS)rh)rrrirrZr&r&r'rLszExtrasCandidate.namecCs|jjSrM)rrFrZr&r&r'rFszExtrasCandidate.versioncCsd|jdt|jS)Nz{} [{}]z, )r]rrmrsortedrrZr&r&r'rmsz ExtrasCandidate.format_for_errorcCs|jjSrM)rrrZr&r&r'rszExtrasCandidate.is_installedcCs|jjSrM)rrrZr&r&r'rszExtrasCandidate.is_editablecCs|jjSrM)rrJrZr&r&r'rJszExtrasCandidate.source_linkrtccs|jj}||jV|sdS|j|jj}|j|jj}t|D]}t d|jj |j |qN|jj |D]$}|t||jj|}|rx|VqxdS)Nz%%s %s does not provide the extra '%s')rrPmake_requirement_from_candidater intersectionrDiter_provided_extras differencerrwarningrLrFrwrxr:rQ)rUrurK valid_extrasinvalid_extrasextrar| requirementr&r&r'rws* z!ExtrasCandidate.iter_dependenciescCsdSrMr&rZr&r&r'r}sz'ExtrasCandidate.get_install_requirement) r_r~rr BaseCandidaterr:rVr[r`rrbrrrgrr rirLrrFrmrrrrrJrrrwrr}r&r&r&r'rs0 rc@seZdZdZdZeeedfddddZe ddd Z e e dd d Z e e dd d Ze edddZe dddZeeeedddZeedddZdS)RequiresPythonCandidateFN.)py_version_infor#cCs>|dk rt|}ntjdd}tddd|D|_dS)N.css|]}t|VqdSrM)r:).0cr&r&r' sz3RequiresPythonCandidate.__init__..)rsys version_infor rrS)rUrrr&r&r'rV s z RequiresPythonCandidate.__init__rWcCs d|jSNzPython rSrZr&r&r'r[szRequiresPythonCandidate.__str__cCstSrMREQUIRES_PYTHON_IDENTIFIERrZr&r&r'risz$RequiresPythonCandidate.project_namecCstSrMrrZr&r&r'rLszRequiresPythonCandidate.namecCs|jSrMrrZr&r&r'rF!szRequiresPythonCandidate.versioncCs d|jSr)rFrZr&r&r'rm%sz(RequiresPythonCandidate.format_for_errorrtcCsdSrvr&)rUrur&r&r'rw(sz)RequiresPythonCandidate.iter_dependenciescCsdSrMr&rZr&r&r'r}+sz/RequiresPythonCandidate.get_install_requirement)r_r~rrrJrrrrVr:r[rr rirLrrFrmrrrrwrr}r&r&r&r'rs r):loggingrtypingrrrrrrrr pip._vendor.packaging.utilsr r Zpip._vendor.packaging.versionr pip._internal.exceptionsr rrpip._internal.metadatarpip._internal.models.linkrrpip._internal.models.wheelrpip._internal.req.constructorsrrZpip._internal.req.req_installr&pip._internal.utils.direct_url_helpersrpip._internal.utils.miscrrrrrrrKr getLoggerr_rrrr(rArCrHrIr!r rrrr&r&r&r'sP(             7CuPK, ]U% 9resolution/resolvelib/__pycache__/reporter.cpython-38.pycnu[U ʗRe @spddlmZddlmZddlmZmZddlmZddl m Z m Z ee Z GdddeZGd d d eZd S) ) defaultdict) getLogger)Any DefaultDict) BaseReporter) Candidate Requirementc@s*eZdZddddZeddddZdS) PipReporterNreturncCstt|_dddd|_dS)Nzpip is looking at multiple versions of {package_name} to determine which version is compatible with other requirements. This could take a while.zThis is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.)r )rintbacktracks_by_package_messages_at_backtrackselfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/reporter.py__init__ s  zPipReporter.__init__ candidater cCsR|j|jd7<|j|j}||jkr.dS|j|}td|j|jddS)NrzINFO: %s) package_name)rnamerloggerinfoformat)rrcountmessagerrr backtracking#s    zPipReporter.backtracking)__name__ __module__ __qualname__rrr rrrrr sr c@seZdZdZddddZeddddZeedd d d Zedd d dZ e e ddddZ e ddddZ e ddddZdS)PipDebuggingReporterz9A reporter that does an info log for every event it sees.Nr cCstddS)NzReporter.starting()rrrrrrstarting1szPipDebuggingReporter.starting)indexr cCstd|dS)NzReporter.starting_round(%r)r%)rr'rrrstarting_round4sz#PipDebuggingReporter.starting_round)r'stater cCstd|dS)Nz Reporter.ending_round(%r, state)r%)rr'r)rrr ending_round7sz!PipDebuggingReporter.ending_round)r)r cCstd|dS)NzReporter.ending(%r)r%)rr)rrrending:szPipDebuggingReporter.ending) requirementparentr cCstd||dS)Nz#Reporter.adding_requirement(%r, %r)r%)rr,r-rrradding_requirement=sz'PipDebuggingReporter.adding_requirementrcCstd|dS)NzReporter.backtracking(%r)r%rrrrrr @sz!PipDebuggingReporter.backtrackingcCstd|dS)NzReporter.pinning(%r)r%r/rrrpinningCszPipDebuggingReporter.pinning)r!r"r#__doc__r&rr(rr*r+r rr.r r0rrrrr$.sr$N) collectionsrloggingrtypingrrZ pip._vendor.resolvelib.reportersrbaserr r!rr r$rrrrs   "PK, ]x< 5resolution/legacy/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdS)Nrrr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/__init__.pyPK, ]Ly:y:5resolution/legacy/__pycache__/resolver.cpython-38.pycnu[U ʗRe^@sdZddlZddlZddlmZddlmZddlmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZdd lmZmZmZmZmZmZmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'm(Z(ddl)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9e:e;Zdee e?e?e?fe@ddddZAGddde,ZBdS)ayDependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) N) defaultdict)chain) DefaultDictIterableListOptionalSetTuple) specifiers) Requirement) WheelCache)BestVersionAlreadyInstalledDistributionNotFound HashError HashErrorsInstallationErrorNoneMetadataErrorUnsupportedPythonVersion) PackageFinder)BaseDistribution)Link)Wheel)RequirementPreparer)InstallRequirementcheck_invalid_constraint_type)RequirementSet) BaseResolverInstallRequirementProvider)compatibility_tags) get_supported)direct_url_from_link) indent_log)normalize_version_info)check_requires_pythonF)dist version_infoignore_requires_pythonreturnc Cszt|j}Wn0tk r>}zt|t|W5d}~XYnXzt||d}Wn:tjk r}ztd|j |WYdSd}~XYnX|rdSd t t|}|rt d|j ||dSt d|j ||dS)a Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. N)r%z-Package %r has an invalid Requires-Python: %s.zBIgnoring failed Requires-Python check for package %r: %s not in %rz8Package {!r} requires a different Python: {} not in {!r})strrequires_pythonFileNotFoundErrorrr#r InvalidSpecifierloggerwarningraw_namejoinmapdebugrformat)r$r%r&r*e is_compatibleexcversionr8/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py_check_dist_requires_python:sD  r:cs4eZdZdZdddhZd$eeeee e e e e e e ee e dfdd fdd Zeee ed d d Zd%eeee eee e eeeefd ddZee dddZeddddZeee dddZeeedddZeddddZeedddZeeeeddd Zeeed!d"d#ZZS)&ResolverzResolves which packages need to be installed/uninstalled to perform the requested operation without breaking the requirements of any package. eageronly-if-neededto-satisfy-onlyN.) preparerfinder wheel_cachemake_install_req use_user_siteignore_dependenciesignore_installedr&force_reinstallupgrade_strategypy_version_infor'c st| |jkst| dkr0tjdd} nt| } | |_||_||_ ||_ | |_ | |_ ||_ ||_||_||_||_tt|_dS)N)super__init___allowed_strategiesAssertionErrorsysr%r"_py_version_infor?r@rArGrFrDrEr&rC_make_install_reqrlist_discovered_dependencies) selfr?r@rArBrCrDrEr&rFrGrH __class__r8r9rKxs" zResolver.__init__) root_reqscheck_supported_wheelsr'c Cst|d}|D]}|jr t||||qg}t}t|j|D]N}z||||WqDt k r}z||_ | |W5d}~XYqDXqD|r||S)aResolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. )rWN) r constraintr_add_requirement_to_setrrall_requirementsextend _resolve_onerreqappend)rSrVrWrequirement_setr]Zdiscovered_reqsZ hash_errorsr6r8r8r9resolves zResolver.resolve)r_ install_reqparent_req_nameextras_requestedr'c Cs||s$td|j|jgdfS|jrf|jjrft|jj}t }|j rf| |sft d|j|jr||dks|td|js|||gdfSz||j}Wntk rd}YnX|dko|o|j o|j|jko|jo|jo|jj|jjk}|rt d|||j|s0|||g|fS|js@|jsHg|fS|joh|jof|jj|jjk } | rt d|jd|_|jrd|_ttt|jt|jB|_td ||j|g|fS) a&Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside the Requirements set. parent_req must already be added. Note that None implies that this is a user supplied requirement, vs an inferred one. :param extras_requested: an iterable of extras used to evaluate the environment markers. :return: Additional requirements to scan. That is either [] if the requirement is not applicable, or [install_req] if the requirement is applicable and has just been added. z6Ignoring %s: markers '%s' don't match your environmentNz-{} is not a supported wheel on this platform.z+a user supplied req shouldn't have a parentz7Double requirement given: {} (already in {}, name={!r})zhCould not satisfy constraints for '{}': installation from path or url cannot be constrained to a versionFTzSetting %s extras to: %s) match_markersr-infonamemarkerslinkis_wheelrfilenamerrrW supportedrr3 user_suppliedrMadd_unnamed_requirementget_requirementKeyErrorrXextrasr] specifieradd_named_requirementpathtuplesortedsetr2) rSr_rarbrcwheeltagsZ existing_reqZhas_conflicting_requirementZdoes_not_satisfy_constraintr8r8r9rYs          z Resolver._add_requirement_to_setr]r'cCs:|jdkrdS|jdkrdS|jdks*t|jp4|jSdS)Nr>Fr<Tr=)rGrMrlrXrSr]r8r8r9_is_upgrade_allowed9s   zResolver._is_upgrade_allowedcCs&|jr|jjr|jjrd|_d|_dS)z4 Set a requirement to be installed. TN)rC satisfied_by in_usersitein_install_pathshould_reinstallrzr8r8r9_set_req_to_reinstallBszResolver._set_req_to_reinstall)req_to_installr'cCs|jr dS||j|js dS|jr4||dS||sP|jdkrLdSdS|jsz|j j |ddWn(t k rYdSt k rYnX||dS)aCheck if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. Nr=z#already satisfied, skipping upgradezalready satisfiedT)upgradezalready up-to-date) rEcheck_if_existsrCr|rFrr{rGrhr@find_requirementr r)rSrr8r8r9_check_skip_installedNs*     zResolver._check_skip_installedcCsR||}|j||}|s dS|j}|jrN|jp4d}dj||d}t||S)Nz zqThe candidate selected for download or install is a yanked version: {candidate} Reason for being yanked: {reason}) candidatereason) r{r@rrh is_yanked yanked_reasonr3r-r.)rSr]rbest_candidaterhrmsgr8r8r9_find_requirement_links   zResolver._find_requirement_linkcCs|jdkr|||_|jdks(|jjr,dS|jj|j|jtd}|dk rt d|j|j|j krr|j rrd|_ |j dk r|j |_nt|j|j d|_|j|_dS)afEnsure that if a link can be found for this, that it is found. Note that req.link may still be None - if the requirement is already installed and not needed to be upgraded based on the return value of _is_upgrade_allowed(). If preparer.require_hashes is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have undeterministic contents due to file modification times. N)rh package_namesupported_tagszUsing cached wheel link: %sT)link_is_in_wheel_cache)rhrrAr?require_hashesget_cache_entryrfrr-r2 original_link persistentoriginal_link_is_in_wheel_cacheorigin download_infor )rSr] cache_entryr8r8r9_populate_links(    zResolver._populate_linkcCs|jr|j|S|jdks t||}|jr>|j||S|||j|}|j sf| |j |jr|j dkp|j p|j p|jjdk}|r||n td||S)zzTakes a InstallRequirement and returns a single AbstractDist representing a prepared variant of the same. Nr>filez.add_req)rbz!Installing extra requirements: %r,z%%s %s does not provide the extra '%s')rc)rXpreparedrr:rOr&r rr)r!has_requirementrfrlrMrYrDrpr-r2r0rurviter_provided_extrasr.r/r7iter_dependencies) rSr_rr$rZmissing_requestedmissingZavailable_requestedrr8rr9r\sR      zResolver._resolve_one)req_setr'cs@gttddfdd |jD] }|q.S)zCreate the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. NrycsN|js|krdS|jrdS|j|jD] }|q2|dS)N)r|rXaddrRrfr^)r]deporderZ ordered_reqsschedulerSr8r9rNs  z1Resolver.get_installation_order..schedule)rvr requirementsvalues)rSrrar8rr9get_installation_order?s   zResolver.get_installation_order)N)NN) __name__ __module__ __qualname____doc__rLrrrr rboolr)r intrKrrrr`rrYr{rrrrrrrr\r __classcell__r8r8rTr9r;qsZ ' )  v   6%0 Sr;)F)CrloggingrN collectionsr itertoolsrtypingrrrrrr Zpip._vendor.packagingr "pip._vendor.packaging.requirementsr pip._internal.cacher pip._internal.exceptionsr rrrrrr"pip._internal.index.package_finderrpip._internal.metadatarpip._internal.models.linkrpip._internal.models.wheelr pip._internal.operations.preparerZpip._internal.req.req_installrrZpip._internal.req.req_setrpip._internal.resolution.baserrZpip._internal.utilsr&pip._internal.utils.compatibility_tagsr&pip._internal.utils.direct_url_helpersr pip._internal.utils.loggingr!pip._internal.utils.miscr"pip._internal.utils.packagingr# getLoggerrr-r)ZDiscoveredDependenciesrrr:r;r8r8r8r9sB      $               7PK, ]%OEOE*index/__pycache__/collector.cpython-38.pycnu[U ʗReMO@sLdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl ZddlmZddlmZddlmZmZmZmZmZmZmZmZmZmZmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%dd l&m'Z'dd l(m)Z)dd l*m+Z+dd l,m-Z-dd l.m/Z/ddl0m1Z1ddl2m3Z3m4Z4ddl5m6Z6ddl7m8Z8m9Z9m:Z:er\ddlm;Z;neZ?ej@jAjBZCeeDeDfZEeDeeDdddZFGdddeGZHe"ddddZIGdddeGZJeDe-dddd ZKeDe-e"dd!d"ZLeEeeDd#d$d%ZMeDeDd&d'd(ZNeDeDd&d)d*ZOe Pd+e jQZReDeSeDd,d-d.ZTeDeDdd/d0ZUeeDeeDfeDeDee)d1d2d3ZVGd4d5d5ZWGd6d7d7e;ZXeXeXd8d9d:ZYeYd;ee)d<d=d>ZZGd?d;d;Z[Gd@dAdAeZ\dQe)eeDeGfeedBddCdDdEZ]dRe"eSe[dGdHdIZ^dSe)ee-ed;dJdKdLZ_GdMdNdNeZ`GdOdPdPZadS)TzO The main purpose of this module is to expose LinkCollector.collect_sources(). N) HTMLParser)Values) TYPE_CHECKINGCallableDictIterableListMutableMapping NamedTupleOptionalSequenceTupleUnion)requests)Response) RetryErrorSSLError)NetworkConnectionError)Link) SearchScope) PipSession)raise_for_status)is_archive_file)pairwiseredact_auth_from_url)vcs)CandidatesFromPage LinkSource build_source)ProtocolurlreturncCs6tjD]*}||r|t|dkr|SqdS)zgLook for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. z+:N)rschemeslower startswithlen)r"schemer)/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/index/collector.py_match_vcs_scheme:s  r+cs&eZdZeeddfdd ZZS)_NotAPIContentN) content_type request_descr#cst||||_||_dSN)super__init__r-r.)selfr-r. __class__r)r*r1Fsz_NotAPIContent.__init__)__name__ __module__ __qualname__strr1 __classcell__r)r)r3r*r,Esr,)responser#cCs6|jdd}|}|dr$dSt||jjdS)z Check the Content-Type header to ensure the response contains a Simple API Response. Raises `_NotAPIContent` if the content type is not a valid content-type. Content-TypeUnknown)z text/htmlz#application/vnd.pypi.simple.v1+html#application/vnd.pypi.simple.v1+jsonN)headersgetr%r&r,requestmethod)r:r-content_type_lr)r)r*_ensure_api_headerLsrCc@s eZdZdS)_NotHTTPN)r5r6r7r)r)r)r*rDbsrD)r"sessionr#cCsFtj|\}}}}}|dkr$t|j|dd}t|t|dS)z Send a HEAD request to the URL, and ensure the response contains a simple API Response. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotAPIContent` if the content type is not a valid content type. >httphttpsT)allow_redirectsN)urllibparseurlsplitrDheadrrC)r"rEr(netlocpathqueryfragmentrespr)r)r*_ensure_api_responsefs rRcCsztt|jrt||dtdt||j|ddddgddd }t |t |td t||j d d |S) aYAccess an Simple API response with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML or Simple API, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotAPIContent` if it is not HTML or a Simple API. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got a Simple API response, and raise `_NotAPIContent` otherwise. rEzGetting page %sz, r=z*application/vnd.pypi.simple.v1+html; q=0.1ztext/html; q=0.01z max-age=0)Acceptz Cache-Control)r>zFetched page %s as %sr;r<) rrfilenamerRloggerdebugrr?joinrrCr>)r"rErQr)r)r*_get_simple_responsexs,   rY)r>r#cCs<|r8d|kr8tj}|d|d<|d}|r8t|SdS)z=Determine if we have any encoding information in our headers.r;z content-typecharsetN)emailmessageMessage get_paramr8)r>mrZr)r)r*_get_encoding_from_headerss    r`)partr#cCstjtj|S)zP Clean a "part" of a URL path (i.e. after splitting on "@" characters). )rIrJquoteunquoterar)r)r*_clean_url_path_partsrecCstjtj|S)z Clean the first part of a URL path that corresponds to a local filesystem path (i.e. the first part after splitting on "@" characters). )rIr@ pathname2url url2pathnamerdr)r)r*_clean_file_url_paths rhz(@|%2F))rN is_local_pathr#cCs^|r t}nt}t|}g}tt|dgD]$\}}|||||q.d |S)z* Clean the path portion of a URL. ) rhre_reserved_chars_resplitr itertoolschainappendupperrX)rNri clean_funcparts cleaned_partsto_cleanreservedr)r)r*_clean_url_paths rvcCs6tj|}|j }t|j|d}tj|j|dS)z Make sure a link is fully quoted. For example, if ' ' occurs in the URL, it will be replaced with "%20", and without double-quoting other characters. )ri)rN)rIrJurlparserMrvrN urlunparse_replace)r"resultrirNr)r)r* _clean_links r{)element_attribspage_urlbase_urlr#cCsL|d}|sdSttj||}|d}|d}t||||d}|S)zW Convert an anchor element's attributes in a simple repository page to a Link. hrefNzdata-requires-pythonz data-yanked) comes_fromrequires_python yanked_reason)r?r{rIrJurljoinr)r|r}r~rr" pyrequirerlinkr)r)r*_create_link_from_elements   rc@s:eZdZdddddZeedddZed d d ZdS) CacheablePageContent IndexContentNpager#cCs|js t||_dSr/)cache_link_parsingAssertionErrorrr2rr)r)r*r1s zCacheablePageContent.__init__)otherr#cCst|t|o|jj|jjkSr/) isinstancetyperr")r2rr)r)r*__eq__szCacheablePageContent.__eq__r#cCs t|jjSr/)hashrr"r2r)r)r*__hash__"szCacheablePageContent.__hash__) r5r6r7r1objectboolrintrr)r)r)r*rsrc@s eZdZdeedddZdS) ParseLinksrrcCsdSr/r)rr)r)r*__call__'szParseLinks.__call__N)r5r6r7rrrr)r)r)r*r&sr)fnr#csLtjddtttdfdd tdttdfdd }|S) z Given a function that parses an Iterable[Link] from an IndexContent, cache the function's result (keyed by CacheablePageContent), unless the IndexContent `page` has `page.cache_link_parsing == False`. N)maxsize)cacheable_pager#cst|jSr/)listr)r)rr)r*wrapper2sz*with_cached_index_content..wrapperrrcs|jrt|St|Sr/)rrr)rrrr)r*wrapper_wrapper6s z2with_cached_index_content..wrapper_wrapper) functools lru_cacherrrwraps)rrr)rr*with_cached_index_content+s  rrrc cs|j}|drt|j}|dgD]r}|d}|dkrDq,|d}|rbt|tsbd}n|sjd}t t t j |j||j|d||did Vq,t|j}|jpd }||j||j}|jp|} |jD]"} t| || d } | dkrq| VqdS) z\ Parse a Simple API's Index Content, and yield its anchor elements as Link objects. r=filesr"Nyankedrjzrequires-pythonhashes)rrrrzutf-8)r}r~)r-r%r&jsonloadscontentr?rr8rr{rIrJrr"HTMLLinkParserencodingfeeddecoder~anchorsr) rrBdatafilefile_urlrparserrr"r~anchorrr)r)r* parse_links?sB          rc@s<eZdZdZd eeeeeeddddZeddd Z dS) rz5Represents one response (or page), along with its URLTN)rr-rr"rr#cCs"||_||_||_||_||_dS)am :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. :param cache_link_parsing: whether links parsed from this page's url should be cached. PyPI index urls should have this set to False, for example. N)rr-rr"r)r2rr-rr"rr)r)r*r1qs zIndexContent.__init__rcCs t|jSr/)rr"rr)r)r*__str__szIndexContent.__str__)T) r5r6r7__doc__bytesr8r rr1rr)r)r)r*rns csneZdZdZeddfdd ZeeeeeefddddZ eeeeefeed d d Z Z S) rzf HTMLParser that keeps the first base HREF and a list of all anchor elements' attributes. Nr!cs$tjdd||_d|_g|_dS)NT)convert_charrefs)r0r1r"r~r)r2r"r3r)r*r1szHTMLLinkParser.__init__)tagattrsr#cCsH|dkr,|jdkr,||}|dk rD||_n|dkrD|jt|dS)Nbasea)r~get_hrefrrodict)r2rrrr)r)r*handle_starttags  zHTMLLinkParser.handle_starttag)rr#cCs"|D]\}}|dkr|SqdS)Nrr))r2rnamevaluer)r)r*rs  zHTMLLinkParser.get_href) r5r6r7rr8r1rr r rrr9r)r)r3r*rs"r).N)rreasonmethr#cCs|dkrtj}|d||dS)Nz%Could not fetch URL %s: %s - skipping)rVrW)rrrr)r)r*_handle_get_simple_failsrT)r:rr#cCs&t|j}t|j|jd||j|dS)Nr;)rr"r)r`r>rrr")r:rrr)r)r*_make_index_contents r)rrEr#c Cs |dkrtd|jddd}t|}|r@td||dStj|\}}}}}}|dkrt j tj |r|ds|d7}tj|d}td |zt||d }WnFtk rtd |Yn4tk r }ztd ||j|jW5d}~XYntk r6}zt||W5d}~XYntk rb}zt||W5d}~XYntk r}z$d } | t|7} t|| tjdW5d}~XYndtjk r}zt|d|W5d}~XYn0tjk rt|dYnXt||j dSdS)Nz?_get_html_page() missing 1 required keyword argument: 'session'#rrzICannot look at %s URL %s because it does not support lookup as web pages.r/z index.htmlz# file: URL is directory, getting %srSz`Skipping page %s because it looks like an archive, and cannot be checked by a HTTP HEAD request.zSkipping page %s because the %s request got Content-Type: %s. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/htmlz4There was a problem confirming the ssl certificate: )rzconnection error: z timed out)r)! TypeErrorr"rlr+rVwarningrIrJrwosrNisdirr@rgendswithrrWrYrDr,r.r-rrrrr8inforConnectionErrorTimeoutrr) rrEr" vcs_schemer(_rNrQexcrr)r)r*_get_index_contents^      rc@s.eZdZUeeeed<eeeed<dS)CollectedSources find_links index_urlsN)r5r6r7r r r__annotations__r)r)r)r*rs rc@sxeZdZdZeeddddZedeee dddd Z e e e d d d Zeeed ddZe eedddZdS) LinkCollectorz Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_sources() method. N)rE search_scoper#cCs||_||_dSr/)rrE)r2rErr)r)r*r1szLinkCollector.__init__F)rEoptionssuppress_no_indexr#cCs`|jg|j}|jr8|s8tdddd|Dg}|jp@g}tj||d}t ||d}|S)z :param session: The Session to use to make requests. :param suppress_no_index: Whether to ignore the --no-index option when constructing the SearchScope object. zIgnoring indexes: %s,css|]}t|VqdSr/)r).0r"r)r)r* 'sz'LinkCollector.create..rr)rEr) index_urlextra_index_urlsno_indexrVrWrXrrcreater)clsrErrrrrlink_collectorr)r)r*rs"   zLinkCollector.creatercCs|jjSr/)rrrr)r)r*r8szLinkCollector.find_links)locationr#cCst||jdS)z> Fetch an HTML page containing package links. rS)rrE)r2rr)r)r*fetch_response<szLinkCollector.fetch_response) project_namecandidates_from_pager#cstfddj|D}tfddjD}ttj rddt ||D}t |d|dg|}t d|tt|t|d S) Nc3s$|]}t|jjdddVqdS)Frpage_validator expand_dirrNrrEis_secure_originrlocrr2r)r*rHsz0LinkCollector.collect_sources..c3s$|]}t|jjdddVqdS)TrNrrrr)r*rRscSs*g|]"}|dk r|jdk rd|jqS)Nz* )r)rsr)r)r* ^s z1LinkCollector.collect_sources..z' location(s) to search for versions of : r) collections OrderedDictrget_index_urls_locationsvaluesrrV isEnabledForloggingDEBUGrmrnr'rWrXrr)r2rrindex_url_sourcesfind_links_sourceslinesr)rr*collect_sourcesBs&   zLinkCollector.collect_sources)F)r5r6r7rrrr1 classmethodrrrpropertyrr8rrr rrrrrr)r)r)r*rs(   r)N)T)N)brr email.messager[rrmrrrre urllib.parserIurllib.requestxml.etree.ElementTreexml html.parserroptparsertypingrrrrrr r r r r r pip._vendorrZpip._vendor.requestsrZpip._vendor.requests.exceptionsrrpip._internal.exceptionsrpip._internal.models.linkr!pip._internal.models.search_scoperpip._internal.network.sessionrpip._internal.network.utilsrpip._internal.utils.filetypesrpip._internal.utils.miscrrpip._internal.vcsrsourcesrrrr r getLoggerr5rVetree ElementTreeElement HTMLElementr8ResponseHeadersr+ Exceptionr,rCrDrRrYr`rerhcompile IGNORECASErkrrvr{rrrrrrrrrrrrr)r)r)r*s  4             ?   .     DPK, ]ܤ qq/index/__pycache__/package_finder.cpython-38.pycnu[U ʗReܒ@sjdZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZddlmZddlmZdd lmZmZmZmZdd lmZmZdd l m!Z!dd l"m#Z#dd l$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddle1e?Z@e e de eAeBffZCe eAeAeAee eAeCfZDd4e%e eAeAeAfeEeEdd d!ZFGd"d#d#ejGZHGd$d%d%ZIe e!e5eBe e!d&d'd(ZJGd)d*d*ZKGd+ddZLGd,d-d-ZMGd.ddZNeBeBeAd/d0d1ZOeBeBe eBd/d2d3ZPdS)5z!Routines related to PyPI, indexesN) FrozenSetIterableListOptionalSetTupleUnion) specifiers)Tag)canonicalize_name) _BaseVersion)parse)BestVersionAlreadyInstalledDistributionNotFoundInvalidWheelFilenameUnsupportedWheel) LinkCollector parse_links)InstallationCandidate) FormatControl)Link) SearchScope)SelectionPreferences) TargetPython)Wheel)InstallRequirement) getLogger)WHEEL_EXTENSION)Hashes) indent_log) build_netloc)check_requires_python)SUPPORTED_EXTENSIONSrBestCandidateResult PackageFinderF)link version_infoignore_requires_pythonreturncCs~zt|j|d}Wn&tjk r8td|j|YnBX|szdtt|}|sht d||j|dStd||j|dS)aa Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. )r'z2Ignoring invalid Requires-Python (%r) for link: %s.z4Link requires a different Python (%s not in: %r): %sFzBIgnoring failed Requires-Python check (%s not in: %r) for link: %sT) r!requires_pythonr InvalidSpecifierloggerdebugjoinmapstrverbose)r&r'r( is_compatibleversionr%r%/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/index/package_finder.py_check_link_requires_python3s8  r6c@sDeZdZeZeZeZeZeZ eZ eZ dS)LinkTypeN) __name__ __module__ __qualname__enumauto candidatedifferent_projectyankedformat_unsupportedformat_invalidplatform_mismatchrequires_python_mismatchr%r%r%r5r7bsr7c @sVeZdZdZedZd eeeee e e e ddddZ e eeefddd ZdS) LinkEvaluatorzD Responsible for evaluating links for a particular project. z-py([123]\.?[0-9]?)$N) project_namecanonical_nameformats target_python allow_yankedr(r)cCs4|dkr d}||_||_||_||_||_||_dS)a :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. NF) _allow_yanked_canonical_name_ignore_requires_python_formats_target_pythonrE)selfrErFrGrHrIr(r%r%r5__init__xszLinkEvaluator.__init__)r&r)c CsBd}|jr*|js*|jpd}tjd|fS|jr@|j}|j}n|\}}|sZtjdfS|t krrtjd|fSd|j kr|t krd|j }tj|fSd|j kr|d krtjd fS|t krXzt|j}Wntk rtjd fYSXt|j|jkrd |j d }tj|fS|j}||sRd|}d|d}tj|fS|j}d|j kr|t krd|j }tj|fS|st||j}|sd|j }tj|fS|j|} | r|d| }| !d} | |jj"krtjdfSt#||jj$|j%d} | s*|d|j&}tj'|fSt()d||tj*|fS)a Determine whether a link is a candidate for installation. :return: A tuple (result, detail), where *result* is an enum representing whether the evaluation found a candidate, or the reason why one is not found. If a candidate is found, *detail* will be the candidate's version string; if one is not found, it contains the reason the link fails to qualify. Nz zyanked for reason: z not a filezunsupported archive format: binaryzNo binaries permitted for macosx10z.zipz macosx10 onezinvalid wheel filenamezwrong project name (not ), znone of the wheel's tags (zB) are compatible (run pip debug --verbose to show compatible tags)sourcezNo sources permitted for zMissing project version for zPython version is incorrect)r'r(z Requires-Python zFound link %s, version: %s)+ is_yankedrJ yanked_reasonr7r? egg_fragmentextsplitextr@r"rMrrEpathrfilenamerrAr namerKr>rNget_tags supportedr/get_formatted_file_tagsrBr4_extract_version_from_fragment_py_version_researchstartgroup py_versionr6py_version_inforLr+rCr-r.r=) rOr&r4reasonegg_inforZwheelsupported_tags file_tagsmatchrgsupports_pythonr%r%r5 evaluate_links                       zLinkEvaluator.evaluate_link)N)r8r9r:__doc__recompilercr1rrboolrrPrrr7rpr%r%r%r5rDls  %rD) candidateshashesrEr)c Cs|stdt||t|Sg}g}d}|D]>}|j}|js@n"|j|drV|d7}n ||q.||q.|rx|}nt|}t|t|krd} n dt|d dd |D} td t|||j |t||| |S) a Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). zJGiven no hashes to check %s links for project %r: discarding no candidatesr)rvrVzdiscarding no candidateszdiscarding {} non-matches: {}z css|]}t|jVqdSN)r1r&).0r=r%r%r5 5sz*filter_unallowed_hashes..zPChecked %s links for project %r against %s hashes (%s matches, %s no digest): %s) r-r.lenlistr&has_hashis_hash_allowedappendformatr/ digest_count) rurvrEmatches_or_no_digest non_matches match_countr=r&filtereddiscard_messager%r%r5filter_unallowed_hashessL      rc@s$eZdZdZdeeddddZdS)CandidatePreferenceszk Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. FN) prefer_binaryallow_all_prereleasesr)cCs||_||_dS)zR :param allow_all_prereleases: Whether to allow all pre-releases. N)rr)rOrrr%r%r5rPMszCandidatePreferences.__init__)FF)r8r9r:rqrtrPr%r%r%r5rFsrc@sTeZdZdZeeeeeeddddZeedddZ eedd d Z dS) r#zA collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. N)ruapplicable_candidatesbest_candidater)cCsHt|t|kst|dkr&|r2tn ||ks2t||_||_||_dS)a :param candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. N)setAssertionError_applicable_candidates _candidatesrrOrurrr%r%r5rP`s   zBestCandidateResult.__init__r)cCs t|jS)zIterate through all candidates.)iterrrOr%r%r5iter_allxszBestCandidateResult.iter_allcCs t|jS)z*Iterate through the applicable candidates.)rrrr%r%r5iter_applicable|sz#BestCandidateResult.iter_applicable) r8r9r:rqrrrrPrrrr%r%r%r5r#Ys c @seZdZdZedeeeeeee j ee ddddZ dee ee j eeee dddd Ze ee ed d d Zeed ddZe eeed ddZe eed ddZdS)CandidateEvaluatorzm Responsible for filtering and sorting candidates for installation based on what tags are valid. NF)rErHrr specifierrvr)cCs:|dkrt}|dkrt}|}|||||||dS)aCreate a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. N)rErlrrrrv)rr SpecifierSetr_)clsrErHrrrrvrlr%r%r5createszCandidateEvaluator.create)rErlrrrrvr)cCs<||_||_||_||_||_||_ddt|D|_dS)z :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). cSsi|]\}}||qSr%r%)rxidxtagr%r%r5 sz/CandidateEvaluator.__init__..N)_allow_all_prereleases_hashes_prefer_binary _project_name _specifier_supported_tags enumerate_wheel_tag_preferences)rOrErlrrrrvr%r%r5rPs zCandidateEvaluator.__init__)rur)csd|jpd}|j}dd|jdd|D|dDfdd|D}t||j|jd }t||jd S) zM Return the applicable candidates from a list of candidates. NcSsh|] }t|qSr%)r1)rxvr%r%r5 sz?CandidateEvaluator.get_applicable_candidates..css|]}t|jVqdSrwr1r4rxcr%r%r5rysz?CandidateEvaluator.get_applicable_candidates..) prereleasescsg|]}t|jkr|qSr%rrversionsr%r5 sz@CandidateEvaluator.get_applicable_candidates..)rurvrEkey)rrfilterrrrsorted _sort_key)rOruallow_prereleasesrrfiltered_applicable_candidatesr%rr5get_applicable_candidatess  z,CandidateEvaluator.get_applicable_candidates)r=r)c Cs|j}t|}d}d}|j}|jrt|j}z|||j }Wn$tk rdt d |jYnX|j rpd}|j dk rt d|j } | } t| d| df}n| }t||j} dt|j} | | ||j||fS)a) Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal r%rzB{} is not a supported wheel for this platform. It can't be sorted.rVNz ^(\d+)(.*)$)rrzr&is_wheelrr]find_most_preferred_tagr ValueErrorrrr build_tagrrrngroupsintr}rrWr4) rOr= valid_tags support_numrbinary_preferencer&rkprirnbuild_tag_groupshas_allowed_hash yank_valuer%r%r5rsF   zCandidateEvaluator._sort_keycCs|sdSt||jd}|S)zy Return the best candidate per the instance's sort order, or None if no candidate is acceptable. Nr)maxr)rOrurr%r%r5sort_best_candidate.sz&CandidateEvaluator.sort_best_candidatecCs"||}||}t|||dS)zF Compute and return a `BestCandidateResult` instance. )rr)rrr#rr%r%r5compute_best_candidate;s  z)CandidateEvaluator.compute_best_candidate)NFFNN)FFN)r8r9r:rq classmethodr1rrrtr BaseSpecifierrrrr rPrrCandidateSortingKeyrrr#rr%r%r%r5rsL(  $F rc @s(eZdZdZd=eeeeeee eeddddZ e d>ee eeddddZ eed d d Zeed d d Zejedddd Zeeed ddZeeed ddZeeed ddZeed ddZdd ddZeed ddZdd ddZeed ddZeed d!d"Zee ee d#d$d%Z!e e"edd&d'd(Z#ee ee$d)d*d+Z%eee ee$d,d-d.Z&e eee$d/d0d1Z'e(j)dd2eee$d d3d4Z*d?eee+j,ee-e.d5d6d7Z/e(j)dd2d@eee+j,ee-e0d5d8d9Z1e2eee$d:d;d<Z3dS)Ar$zThis finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. N)link_collectorrHrIformat_controlcandidate_prefsr(r)cCsP|dkrt}|pttt}||_||_||_||_||_||_t|_ dS)a This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. N) rrrrJ_candidate_prefsrL_link_collectorrNr _logged_links)rOrrHrIrrr(r%r%r5rPTszPackageFinder.__init__)rselection_prefsrHr)cCs8|dkrt}t|j|jd}|||||j|j|jdS)afCreate a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. N)rr)rrrHrIrr()rrrrrIrr()rrrrHrr%r%r5r{szPackageFinder.creatercCs|jSrw)rNrr%r%r5rHszPackageFinder.target_pythoncCs|jjSrwr search_scoperr%r%r5rszPackageFinder.search_scope)rr)cCs ||j_dSrwr)rOrr%r%r5rscCs|jjSrw)r find_linksrr%r%r5rszPackageFinder.find_linkscCs|jjSrw)r index_urlsrr%r%r5rszPackageFinder.index_urlsccs|jjjD]}t|Vq dSrw)rsessionpip_trusted_originsr )rO host_portr%r%r5 trusted_hostsszPackageFinder.trusted_hostscCs|jjSrwrrrr%r%r5rsz#PackageFinder.allow_all_prereleasescCs d|j_dSNTrrr%r%r5set_allow_all_prereleasessz'PackageFinder.set_allow_all_prereleasescCs|jjSrwrrrr%r%r5rszPackageFinder.prefer_binarycCs d|j_dSrrrr%r%r5set_prefer_binaryszPackageFinder.set_prefer_binarycCsdd|jD}t|S)NcSs h|]\}}}|tjkr|qSr%)r7rC)rx_resultdetailr%r%r5rs z@PackageFinder.requires_python_skipped_reasons..)rr)rOreasonsr%r%r5requires_python_skipped_reasonssz-PackageFinder.requires_python_skipped_reasons)rEr)cCs.t|}|j|}t||||j|j|jdS)N)rErFrGrHrIr()r rget_allowed_formatsrDrNrJrL)rOrErFrGr%r%r5make_link_evaluators z!PackageFinder.make_link_evaluator)linksr)cCsPgg}}t}|D]2}||kr|||jr<||q||q||S)z Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates )raddrYr~)rOreggsno_eggsseenr&r%r%r5 _sort_linkss    zPackageFinder._sort_links)r&rrr)cCs2|||f}||jkr.td|||j|dS)NzSkipping link: %s: %s)rr-r.r)rOr&rrentryr%r%r5_log_skipped_links  zPackageFinder._log_skipped_link)link_evaluatorr&r)cCs:||\}}|tjkr*||||dSt|j||dS)z If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. N)r^r&r4)rpr7r=rrrE)rOrr&rrr%r%r5get_install_candidates z#PackageFinder.get_install_candidate)rrr)cCs6g}||D]"}|||}|dk r||q|S)zU Convert links that are candidates to InstallationCandidate objects. N)rrr~)rOrrrur&r=r%r%r5evaluate_linkss   zPackageFinder.evaluate_links) project_urlrr)c CsTtd||j|}|dkr$gStt|}t|j||d}W5QRX|S)Nz-Fetching project page and analyzing links: %s)r)r-r.rfetch_responser{rrr)rOrrindex_response page_links package_linksr%r%r5process_project_urls  z!PackageFinder.process_project_url)maxsizec Cs||}|jj|tj|j|dd}tjdd|D}t |}tjdd|D}| |t |dd}t tjr|rg}|D]F} | jjstz|| jjWqtk r|| jjYqXqt dd |||S) aFind all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. )r)rEcandidates_from_pagecss(|] }|D]}|dk r |Vq qdSrw)page_candidatesrxsourcesrUr%r%r5ry8s z4PackageFinder.find_all_candidates..css(|] }|D]}|dk r |Vq qdSrw) file_linksrr%r%r5ry@s T)reversezLocal files found: %srT)rrcollect_sources functoolspartialr itertoolschain from_iterabler{rrr- isEnabledForloggingDEBUGr&urlrr~ file_path Exceptionr.r/) rOrErcollected_sourcespage_candidates_itr file_links_itfile_candidatespathsr=r%r%r5find_all_candidates$s:     z!PackageFinder.find_all_candidates)rErrvr)cCs"|j}tj||j|j|j||dS)z*Create a CandidateEvaluator object to use.)rErHrrrrv)rrrrNrr)rOrErrvrr%r%r5make_candidate_evaluatorYsz&PackageFinder.make_candidate_evaluatorcCs$||}|j|||d}||S)aFind matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. )rErrv)rrr)rOrErrvrucandidate_evaluatorr%r%r5find_best_candidatejs z!PackageFinder.find_best_candidate)requpgrader)c Cs|jdd}|j|j|j|d}|j}d}|jdk r<|jj}ttt ddd}|dkr|dkrt d||| t d |d}|r|dks|j|krd }|s|dk r|rt d |nt d ||jdS|rt d |||tt d|j|||S)zTry to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a InstallationCandidate if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise F)trust_internet)rrvN) cand_iterr)cSs dtdd|DtdpdS)NrTcSsh|]}t|jqSr%rrr%r%r5rszKPackageFinder.find_requirement.._format_versions..rnone)r/r parse_version)rr%r%r5_format_versionss z8PackageFinder.find_requirement.._format_versionszNCould not find a version that satisfies the requirement %s (from versions: %s)z%No matching distribution found for {}TzLExisting installed version (%s) is most up-to-date and satisfies requirementzUExisting installed version (%s) satisfies requirement (most up-to-date version is %s)z=Installed version (%s) is most up-to-date (past versions: %s)z)Using version %s (newest of versions: %s))rvrr^rr satisfied_byr4rrr1r-criticalrrrr.rr) rOrrrvbest_candidate_resultrinstalled_versionrbest_installedr%r%r5find_requirementsh      zPackageFinder.find_requirement)NNN)N)NN)NN)4r8r9r:rqrrrtrrrrPrrrpropertyrHrrsetterrr1rrrrrrrrrrDrrrr7rrrrrr lru_cacherr rrrrr#rrrr%r%r%r5r$Ms  '      7  )fragmentrFr)cCsNt|D].\}}|dkrqt|d||kr|Sqt|d|dS)aFind the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 -Nz does not match )rr r)r#rFirr%r%r5_find_name_version_seps  r&cCsBzt||d}Wntk r(YdSX||d}|s>dS|S)zParse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. rVN)r&r)r#rF version_startr4r%r%r5rbs rb)F)Qrqr;rrrrrtypingrrrrrrrZpip._vendor.packagingr Zpip._vendor.packaging.tagsr pip._vendor.packaging.utilsr Zpip._vendor.packaging.versionr r rpip._internal.exceptionsrrrrpip._internal.index.collectorrrpip._internal.models.candidater#pip._internal.models.format_controlrpip._internal.models.linkr!pip._internal.models.search_scoper$pip._internal.models.selection_prefsr"pip._internal.models.target_pythonrpip._internal.models.wheelrpip._internal.reqrZpip._internal.utils._logrpip._internal.utils.filetypesrpip._internal.utils.hashesrpip._internal.utils.loggingrpip._internal.utils.miscr pip._internal.utils.packagingr!pip._internal.utils.unpackingr"__all__r8r-rr1BuildTagrrtr6Enumr7rDrrr#rr$r&rbr%r%r%r5sr$                       /  J(MPK, ]vA  )index/__pycache__/__init__.cpython-38.pycnu[U ʗRe@sdZdS)zIndex interaction code N)__doc__rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/index/__init__.pyPK, ]qT>>(index/__pycache__/sources.cpython-38.pycnu[U ʗRe @s0ddlZddlZddlZddlZddlmZmZmZmZddl m Z ddl m Z ddl mZmZddlmZeeZee Zee Zee gee fZee gefZGdddZeed d d ZGd d d eZGdddeZGdddeZGdddeZ eeeeeeeeeefdddZ!dS)N)CallableIterableOptionalTuple)InstallationCandidate)Link) path_to_url url_to_path)is_urlc@s>eZdZeeedddZedddZe dddZ dS) LinkSourcereturncCs tdS)z,Returns the underlying link, if there's one.NNotImplementedErrorselfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/index/sources.pylinkszLinkSource.linkcCs tdS)z9Candidates found by parsing an archive listing HTML file.Nrrrrrpage_candidatesszLinkSource.page_candidatescCs tdS)z,Links found by specifying archives directly.Nrrrrr file_linksszLinkSource.file_linksN) __name__ __module__ __qualname__propertyrrrFoundCandidatesr FoundLinksrrrrrr sr )file_urlr cCstj|ddddkS)NF)strictrz text/html) mimetypes guess_type)rrrr _is_html_file#sr!c@sTeZdZdZeeddddZeee dddZ e dd d Z e dd d ZdS) _FlatDirectorySourcezLink source specified by ``--find-links=``. This looks the content of the directory, and returns: * ``page_candidates``: Links listed on each HTML file in the directory. * ``file_candidates``: Archives in the directory. N)candidates_from_pagepathr cCs||_ttj||_dSN)_candidates_from_pagepathlibPathosr$realpath_path)rr#r$rrr__init__0sz_FlatDirectorySource.__init__r cCsdSr%rrrrrr8sz_FlatDirectorySource.linkccs>|jD].}tt|}t|s$q |t|EdHq dSr%)r+iterdirrstrr!r&rrr$urlrrrr<s  z$_FlatDirectorySource.page_candidatesccs4|jD]$}tt|}t|r$q t|Vq dSr%)r+r-rr.r!rr/rrrrCs  z_FlatDirectorySource.file_links)rrr__doc__CandidatesFromPager.r,rrrrrrrrrrrrr"'s  r"c@sTeZdZdZeeddddZeeedddZ e dd d Z e dd d Z dS) _LocalFileSourceaC``--find-links=`` or ``--[extra-]index-url=``. If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to the option, it is converted to a URL first. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. Nr#rr cCs||_||_dSr%r&_linkrr#rrrrr,Usz_LocalFileSource.__init__r cCs|jSr%r6rrrrr]sz_LocalFileSource.linkccs&t|jjsdS||jEdHdSr%)r!r6r0r&rrrrras z _LocalFileSource.page_candidatesccst|jjrdS|jVdSr%)r!r6r0rrrrrfs z_LocalFileSource.file_linksrrrr1r2rr,rrrrrrrrrrrr3Ks  r3c@sVeZdZdZeeeddddZee edddZ e dd d Z e dd d ZdS) _RemoteFileSourcez``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. N)r#page_validatorrr cCs||_||_||_dSr%)r&_page_validatorr6)rr#r;rrrrr,usz_RemoteFileSource.__init__r cCs|jSr%r8rrrrrsz_RemoteFileSource.linkccs&||jsdS||jEdHdSr%)r<r6r&rrrrrs z!_RemoteFileSource.page_candidatesccs |jVdSr%r8rrrrrsz_RemoteFileSource.file_links)rrrr1r2 PageValidatorrr,rrrrrrrrrrrr:ls  r:c@sTeZdZdZeeddddZeeedddZ e dd d Z e dd d Z dS) _IndexDirectorySourcez``--[extra-]index-url=``. This is treated like a remote URL; ``candidates_from_page`` contains logic for this by appending ``index.html`` to the link. Nr4cCs||_||_dSr%r5r7rrrr,sz_IndexDirectorySource.__init__r cCs|jSr%r8rrrrrsz_IndexDirectorySource.linkccs||jEdHdSr%r5rrrrrsz%_IndexDirectorySource.page_candidatescCsdS)Nrrrrrrrsz _IndexDirectorySource.file_linksr9rrrrr>s r>)locationr#r; expand_dircache_link_parsingr c Csd}d}tj|r"t|}|}n$|dr:|}t|}n t|rF|}|dkrbd}t||dS|dkrt ||t ||dd}||fStj |r|rt ||d}nt |t ||dd}||fStj|rt|t ||dd}||fStd||dfS) Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)rA)r#r;r)r#r$)r#rz?Location '%s' is ignored: it is neither a file nor a directory.)r)r$existsr startswithr r loggerwarningr:risdirr"r>isfiler3) r?r#r;r@rAr$r0msgsourcerrr build_sourcesX          rJ)"loggingrr)r'typingrrrrpip._internal.models.candidaterpip._internal.models.linkrpip._internal.utils.urlsrr pip._internal.vcsr getLoggerrrDrrr2boolr=r r.r!r"r3r:r>rJrrrrs4    $! PK, ]x)utils/__pycache__/egg_link.cpython-38.pycnu[U ʗRe@sddlZddlZddlZddlmZddlmZmZddlm Z m Z ddgZ e e ddd Z e ee dd dZe ee dd dZdS) N)Optional) site_packages user_site)running_under_virtualenvvirtualenv_no_globalegg_link_path_from_sys_pathegg_link_path_from_location)raw_namereturncCstdd|dS)z Convert a Name metadata value to a .egg-link name, by applying the same substitution as pkg_resources's safe_name function. Note: we cannot use canonicalize_name because it has a different logic. z[^A-Za-z0-9.]+-z .egg-link)resub)r r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/egg_link.py_egg_link_namesrcCs:t|}tjD]&}tj||}tj|r|SqdS)zJ Look for a .egg-link file for project name, by walking sys.path. N)rsyspathosjoinisfile)r egg_link_name path_itemegg_linkrrrrs    cCszg}tr*|ttsBtrB|tntr8|t|tt|}|D]&}tj||}tj |rN|SqNdS)a Return the path for the .egg-link file if it exists, otherwise, None. There's 3 scenarios: 1) not in a virtualenv try to find in site.USER_SITE, then site_packages 2) in a no-global virtualenv try to find in site_packages 3) in a yes-global virtualenv try to find in site_packages, then site.USER_SITE (don't look in global location) For #1 and #3, there could be odd cases, where there's an egg-link in 2 locations. This method will just return the first one found. N) rappendrrrrrrrr)r sitesrsiteegglinkrrrr*s       )rr rtypingrpip._internal.locationsrrpip._internal.utils.virtualenvrr__all__strrrrrrrrs   PK, ]3G~&utils/__pycache__/wheel.cpython-38.pycnu[U ʗRe@sdZddlZddlmZddlmZddlmZddlm Z m Z ddl m Z ddl mZd ZeeZe eeeefd d d Ze eed ddZe eedddZe eedddZeeedfdddZeedfeddddZdS)z0Support functions for working with wheel files. N)Message)Parser)Tuple) BadZipFileZipFile)canonicalize_name)UnsupportedWheel)r) wheel_zipnamereturnc Csjz t||}t||}t|}Wn6tk rV}ztd|t|W5d}~XYnXt||||fS)zExtract information from the provided wheel, ensuring it meets basic standards. Returns the name of the .dist-info directory and the parsed WHEEL metadata. z{} has an invalid wheel, {}N)wheel_dist_info_dirwheel_metadata wheel_versionrformatstrcheck_compatibility)r r info_dirmetadataversioner/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/wheel.py parse_wheels   & r)sourcer r cCsdd|D}dd|D}|s,tdt|dkrLtdd||d }t|}t|}||s~td |||S) zReturns the name of the contained .dist-info directory. Raises AssertionError or UnsupportedWheel if not found, >1 found, or it doesn't match the provided name. cSsh|]}|dddqS)/r r)split).0prrr -sz&wheel_dist_info_dir..cSsg|]}|dr|qS)z .dist-info)endswith)rsrrr /s z'wheel_dist_info_dir..z.dist-info directory not foundr z)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r})namelistrlenrjoinr startswith)rr subdirs info_dirsr info_dir_namecanonical_namerrrr &s&  r )rpathr c CsNz ||WStttfk rH}ztd|d|W5d}~XYnXdS)Nzcould not read z file: )readrKeyError RuntimeErrorr)rr+rrrrread_wheel_metadata_fileGs r/)r dist_info_dirr c Csd|d}t||}z |}Wn6tk rV}ztd|d|W5d}~XYnXt|S)ziReturn the WHEEL metadata of an extracted wheel, if possible. Otherwise, raise UnsupportedWheel. z/WHEELzerror decoding z: N)r/decodeUnicodeDecodeErrorrrparsestr)rr0r+wheel_contents wheel_textrrrrrPs   &r.) wheel_datar cCs^|d}|dkrtd|}zttt|dWStk rXtd|YnXdS)zbGiven WHEEL metadata, return the parsed Wheel-Version. Otherwise, raise UnsupportedWheel. z Wheel-VersionNzWHEEL is missing Wheel-Version.zinvalid Wheel-Version: )rstriptuplemapintr ValueError)r6 version_textrrrrrcsr)rr r c CsR|dtdkr.td|dtt|n |tkrNtddtt|dS)aRaises errors or warns if called with an incompatible Wheel-Version. pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given rzB{}'s Wheel-Version ({}) is not compatible with this version of pipr7z*Installing from a newer Wheel-Version (%s)N)VERSION_COMPATIBLErrr%r:rloggerwarning)rr rrrrss r)__doc__logging email.messager email.parserrtypingrzipfilerrpip._vendor.packaging.utilsrpip._internal.exceptionsrr> getLogger__name__r?rrr bytesr/rr;rrrrrrs      ! PK, ]$3utils/__pycache__/compatibility_tags.cpython-38.pycnu[U ʗRe@s*dZddlZddlmZmZmZddlmZmZm Z m Z m Z m Z m Z mZedZeedfeddd Zeeed d d Zeeed d dZeeed ddZeeeeeedddZeedddZdeeeeedddZdeeeeeeeeeeeedddZdS)z3Generate and work with PEP 425 Compatibility Tags. N)ListOptionalTuple) PythonVersionTagcompatible_tags cpython_tags generic_tagsinterpreter_nameinterpreter_version mac_platformsz(.+)_(\d+)_(\d+)_(.+).) version_inforeturncCsdtt|ddS)N)joinmapstr)r r/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/compatibility_tags.pyversion_info_to_nodotsr)archrcsRt|}|rH|\}}}t|t|f}fddt||D}n|g}|S)Ncs$g|]}d|tddqS)z{}_{}macosx_N)formatlen).0rnamerr sz"_mac_platforms..) _osx_arch_patmatchgroupsintr )rr majorminor actual_arch mac_versionarchesrrr_mac_platformss   r(cCsj|g}|d\}}}|dkrL|dkrf|d|||d||n|dkrf|d|||S)N_ manylinux2014>x86_64i686 manylinux2010 manylinux1) partitionappend)rr' arch_prefixarch_sep arch_suffixrrr_custom_manylinux_platforms.sr4cCs@|d\}}}|dr$t|}n|dkr6t|}n|g}|S)Nr)macosx)r*r-)r/ startswithr(r4)rr1r2r3r'rrr_get_custom_platformsCs   r7) platformsrcsT|sdStg}|D]8}|kr$qfddt|D}|||q|S)Ncsg|]}|kr|qSrr)rcseenrrrXsz-_expand_allowed_platforms..)setr7updateextend)r8resultp additionsrr:r_expand_allowed_platformsNs  rB)versionrcCs:t|dkr(t|dt|ddfSt|dfSdS)Nr)rr")rCrrr_get_python_version_s rE)implementationrCrcCs(|dkrt}|dkrt}||S)N)r r )rFrCrrr_get_custom_interpreterfs rG)rCr8implabisrcCs~g}d}|dk rt|}t||}t|}|p2tdk}|rR|t|||dn|t|||d|t|||d|S)aVReturn a list of supported tags for each version specified in `versions`. :param version: a string version, of the form "33" or "32", or None. The version will be assumed to support our ABI. :param platform: specify a list of platforms you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abis: specify a list of abis you want valid tags for, or None. If None, use the local interpreter abi. Ncp)python_versionrIr8) interpreterrIr8)rKrLr8)rErGrBr r>rr r)rCr8rHrI supportedrKrL is_cpythonrrr get_supportedps< rO)NN)NNNN)__doc__retypingrrrZpip._vendor.packaging.tagsrrrrr r r r compilerr"rrr(r4r7rBrErGrOrrrrs8(     PK, ]&1  %utils/__pycache__/_log.cpython-38.pycnu[U ʗRe@sTdZddlZddlmZmZdZGdddejZeeddd Z dd d d Z dS) zCustomize logging Defines custom logger class for the `logger.verbose(...)` method. init_logging() must be called before any other modules that call logging.getLogger. N)Anycastc@s$eZdZdZeeeddddZdS) VerboseLoggerzXCustom Logger, defining a verbose log-level VERBOSE is between INFO and DEBUG. N)msgargskwargsreturncOs|jt|f||S)N)logVERBOSE)selfrrrr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/_log.pyverboseszVerboseLogger.verbose)__name__ __module__ __qualname____doc__strrrr r r rrsr)namer cCsttt|S)zBlogging.getLogger, but ensures our VerboseLogger class is returned)rrlogging getLogger)rr r rrsr)r cCsttttddS)zRegister our VerboseLogger and VERBOSE log level. Should be called before any calls to getLogger(), i.e. in pip._internal.__init__ r N)rsetLoggerClassr addLevelNamer r r r r init_loggings r) rrtypingrrr Loggerrrrrr r r rs  PK, ]ᣬ ,utils/__pycache__/entrypoints.cpython-38.pycnu[U ʗRe @sddlZddlZddlZddlZddlmZmZddlmZddl m Z ddej j dej j dej j gZe rddhZd d eeeDZdeeeeed d dZedddZedddZdS)N)ListOptional)main)WINDOWSpip.z.execCsg|]}d|qS)r)join).0partsr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/entrypoints.py srF)args_nowarnreturncCs|stjdt|S)aCentral wrapper for all old entrypoints. Historically pip has had several entrypoints defined. Because of issues arising from PATH, sys.path, multiple Pythons, their interactions, and most of them having a pip installed, users suffer every time an entrypoint gets moved. To alleviate this pain, and provide a mechanism for warning users and directing them to an appropriate place for help, we now define all of our old entrypoints as wrappers for the current one. aWARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. )sysstderrwriter)rrr r r _wrappers r)rcCstrdnd}tjtj|}tjtjdd tj }tj||k}|rt D]2}t |}|rRtj|tj||rR|SqRtdS)zHTry to figure out the best way to invoke pip in the current environment.ScriptsbinPATHrz -m pip)rospathr rprefixnormcaseenvirongetsplitpathsep_EXECUTABLE_NAMESshutilwhichsamefile#get_best_invocation_for_this_python)binary_directory binary_prefix path_partsexe_are_in_PATHexe_namefound_executabler r r get_best_invocation_for_this_pip/s     r,cCs6tj}tj|}t|}|r2tj||r2|S|S)zs$    PK, ]>gg3utils/__pycache__/direct_url_helpers.cpython-38.pycnu[U ʗRe @sddlmZddlmZmZmZmZddlmZddl m Z ddl m Z ee e dddZe ed d d Zdeee eedddZd S))Optional) ArchiveInfo DirectUrlDirInfoVcsInfo)Link) path_to_url)vcs) direct_urlnamereturncCs||d}g}t|jtr>|d|jj|j|jj7}nHt|jtrl||j7}|jj r| |jj nt|jt s|t ||j7}|j r| d|j |r|dd|7}|S)z0Convert a DirectUrl to a pip requirement string.z @ z{}+{}@{}z subdirectory=#&)validate isinstanceinforformatr url commit_idrhashappendrAssertionError subdirectoryjoin)r r requirement fragmentsr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/direct_url_helpers.py%direct_url_as_pep440_direct_reference s(    r) source_dirr cCstt|tdddS)NT)editable)rr)rrr)rrrrdirect_url_for_editable sr!NF)linkrlink_is_in_wheel_cacher c Cs|jrlt|j}|st||j\}}}|r>|s8t|}n|sFt||}t|t |j ||d|j dS| rt|jt |j dSd}|j} | r| d|j}t|jt|d|j dSdS)N)r rrequested_revision)rrr=)r)is_vcsr get_backend_for_schemeschemerget_url_rev_and_authurl_without_fragment get_revisionrrr subdirectory_fragmentis_existing_dirr hash_namerr) r"rr# vcs_backendrr$_rrr.rrrdirect_url_from_link'sF    r1)NF)typingrpip._internal.models.direct_urlrrrrpip._internal.models.linkrpip._internal.utils.urlsrpip._internal.vcsr strrr!boolr1rrrrs    PK, ]0t_uu/utils/__pycache__/distutils_args.cpython-38.pycnu[U ʗRe[ @s\ddlmZmZddlmZmZddddddd d d d d dg ZeeeeefdddZdS)) GetoptErrorgetopt)DictListz exec-prefix=zhome=z install-base=z install-data=zinstall-headers=z install-lib=zinstall-platlib=zinstall-purelib=zinstall-scripts=zprefix=zroot=user)argsreturnc Cs~i}|D]p}zt|gdtd\}}Wntk r<YqYnX|sDq|d}|ddddd}|dpnd }|||<q|S) zzParse provided arguments, returning an object that has the matched arguments. Any unknown arguments are ignored. )r shortoptslongoptsrN-_true)r_optionsrreplace)rresultarg parsed_optroptionname_from_parsedvalue_from_parsedr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/distutils_args.pyparse_distutils_argss   rN)rrtypingrrrstrrrrrrsPK, ]2A%%)utils/__pycache__/datetime.cpython-38.pycnu[U ʗRe@s$dZddlZeeeedddZdS)z.For when pip wants to check the date or time. N)yearmonthdayreturncCs tj}t|||}||kS)N)datetimedatetoday)rrrrgivenr /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/datetime.pytoday_is_later_thans r )__doc__rintboolr r r r r sPK]̩[index.pynu[PK]WFWF Ocollector.pynu[PK] )))__pycache__/legacy_resolve.cpython-38.pycnu[PK]h,7bb ?__pycache__/index.cpython-38.pycnu[PK]2g *vc__pycache__/locations.cpython-38.opt-1.pycnu[PK]$0Umm o__pycache__/wheel.cpython-38.pycnu[PK] 4_\(\(/__pycache__/legacy_resolve.cpython-38.opt-1.pycnu[PK]ll&y__pycache__/wheel.cpython-38.opt-1.pycnu[PK]$$ s__pycache__/cache.cpython-38.pycnu[PK] Q,,)ݗ__pycache__/download.cpython-38.opt-1.pycnu[PK]:p p $__pycache__/locations.cpython-38.pycnu[PK]^=2&__pycache__/cache.cpython-38.opt-1.pycnu[PK] V77$__pycache__/collector.cpython-38.pycnu[PK]t1:&:&%I%__pycache__/pep425tags.cpython-38.pycnu[PK]goj]*K__pycache__/build_env.cpython-38.opt-1.pycnu[PK]~@i__pycache__/main.cpython-38.pycnu[PK]#pO''#l__pycache__/__init__.cpython-38.pycnu[PK]* N##$o__pycache__/build_env.cpython-38.pycnu[PK]i4,4,(__pycache__/configuration.cpython-38.pycnu[PK]"q4$__pycache__/self_outdated_check.cpython-38.opt-1.pycnu[PK] ,,#__pycache__/download.cpython-38.pycnu[PK]Hx=)=).$__pycache__/configuration.cpython-38.opt-1.pycnu[PK][l:&:&+,__pycache__/pep425tags.cpython-38.opt-1.pycnu[PK]$cNbb&TS__pycache__/index.cpython-38.opt-1.pycnu[PK]&$> > *P__pycache__/pyproject.cpython-38.opt-1.pycnu[PK]q00+__pycache__/exceptions.cpython-38.opt-1.pycnu[PK]2 3AXX$__pycache__/pyproject.cpython-38.pycnu[PK] V77*__pycache__/collector.cpython-38.opt-1.pycnu[PK]u%9__pycache__/main.cpython-38.opt-1.pycnu[PK]!{.K?__pycache__/self_outdated_check.cpython-38.pycnu[PK]ev[v[%>Y__pycache__/exceptions.cpython-38.pycnu[PK]) __pycache__/__init__.cpython-38.opt-1.pycnu[PK]Օ$$2cache.pynu[PK]i6SE>E> Kpep425tags.pynu[PK]/RCRClegacy_resolve.pynu[PK]Z]`]commands/debug.pynu[PK]-*if.wcommands/__pycache__/hash.cpython-38.opt-1.pycnu[PK]1 ط"".commands/__pycache__/list.cpython-38.opt-1.pycnu[PK]qCUU)commands/__pycache__/wheel.cpython-38.pycnu[PK]   /mcommands/__pycache__/wheel.cpython-38.opt-1.pycnu[PK]c}2commands/__pycache__/download.cpython-38.opt-1.pycnu[PK]:z8z81commands/__pycache__/install.cpython-38.opt-1.pycnu[PK]4')commands/__pycache__/debug.cpython-38.pycnu[PK]'$DD)-commands/__pycache__/check.cpython-38.pycnu[PK](3commands/__pycache__/show.cpython-38.pycnu[PK]]j  /Lcommands/__pycache__/check.cpython-38.opt-1.pycnu[PK]s̈́0SRcommands/__pycache__/search.cpython-38.opt-1.pycnu[PK]A 37dcommands/__pycache__/uninstall.cpython-38.opt-1.pycnu[PK]}` ` 0 ocommands/__pycache__/freeze.cpython-38.opt-1.pycnu[PK]`z -zcommands/__pycache__/uninstall.cpython-38.pycnu[PK]B/]''(commands/__pycache__/list.cpython-38.pycnu[PK]c~ ~ ,commands/__pycache__/__init__.cpython-38.pycnu[PK]Ce.ļcommands/__pycache__/show.cpython-38.opt-1.pycnu[PK]ly"y"1commands/__pycache__/configuration.cpython-38.pycnu[PK]GWGmm.commands/__pycache__/completion.cpython-38.pycnu[PK]y~ 4| commands/__pycache__/completion.cpython-38.opt-1.pycnu[PK]` ,commands/__pycache__/download.cpython-38.pycnu[PK]!گ7&commands/__pycache__/configuration.cpython-38.opt-1.pycnu[PK]aq /@commands/__pycache__/debug.cpython-38.opt-1.pycnu[PK],q q *EMcommands/__pycache__/freeze.cpython-38.pycnu[PK]L`@@(Xcommands/__pycache__/help.cpython-38.pycnu[PK]@kk(]commands/__pycache__/hash.cpython-38.pycnu[PK][KK+kfcommands/__pycache__/install.cpython-38.pycnu[PK]7œ.commands/__pycache__/help.cpython-38.opt-1.pycnu[PK]e?$ $ 2commands/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]V * commands/__pycache__/search.cpython-38.pycnu[PK]Scommands/hash.pynu[PK]W/AA:commands/search.pynu[PK]6lcommands/check.pynu[PK] commands/freeze.pynu[PK]qC \ commands/completion.pynu[PK]Ôdistributions/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]ޜޞ 6Adistributions/source/__pycache__/legacy.cpython-38.pycnu[PK]re8Odistributions/source/__pycache__/__init__.cpython-38.pycnu[PK]ޜޞ <Pdistributions/source/__pycache__/legacy.cpython-38.opt-1.pycnu[PK]re>^distributions/source/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]ee_distributions/source/legacy.pynu[PK] odistributions/source/__init__.pynu[PK]Ph[[odistributions/wheel.pynu[PK]h tdistributions/base.pynu[PK]r\ydistributions/installed.pynu[PK]u .ZZ|distributions/__init__.pynu[PK];Ւ// Hpyproject.pynu[PK]d66-operations/__pycache__/prepare.cpython-38.pycnu[PK]w337operations/__pycache__/generate_metadata.cpython-38.pycnu[PK],+@operations/__pycache__/check.cpython-38.pycnu[PK]OfHH1hoperations/__pycache__/check.cpython-38.opt-1.pycnu[PK].!bb2operations/__pycache__/freeze.cpython-38.opt-1.pycnu[PK].operations/__pycache__/__init__.cpython-38.pycnu[PK]w33=operations/__pycache__/generate_metadata.cpython-38.opt-1.pycnu[PK]PHD5**,)operations/__pycache__/freeze.cpython-38.pycnu[PK]/4DBoperations/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]aSZ3HCoperations/__pycache__/prepare.cpython-38.opt-1.pycnu[PK]:e]]Yoperations/prepare.pynu[PK]ͯoperations/check.pynu[PK]ľ *&*&?operations/freeze.pynu[PK]operations/__init__.pynu[PK]j׿[[operations/generate_metadata.pynu[PK]r00*network/__pycache__/session.cpython-38.pycnu[PK]yvG G (5network/__pycache__/cache.cpython-38.pycnu[PK]}v v .^Anetwork/__pycache__/cache.cpython-38.opt-1.pycnu[PK]bM2+2Knetwork/__pycache__/__init__.cpython-38.pycnu[PK]2W88)Lnetwork/__pycache__/xmlrpc.cpython-38.pycnu[PK]w vv'=Unetwork/__pycache__/auth.cpython-38.pycnu[PK];&&/ snetwork/__pycache__/xmlrpc.cpython-38.opt-1.pycnu[PK]8Ml $ $0ynetwork/__pycache__/session.cpython-38.opt-1.pycnu[PK]7S-network/__pycache__/auth.cpython-38.opt-1.pycnu[PK]S1ոnetwork/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]G\A44 network/cache.pynu[PK]aYAYA~network/session.pynu[PK]-{_network/xmlrpc.pynu[PK]=.R//Y network/auth.pynu[PK]J226;network/__init__.pynu[PK]Goo0;cli/__pycache__/main_parser.cpython-38.opt-1.pycnu[PK] Cmm1zDcli/__pycache__/status_codes.cpython-38.opt-1.pycnu[PK]QW҆+HFcli/__pycache__/status_codes.cpython-38.pycnu[PK]''%)Hcli/__pycache__/parser.cpython-38.pycnu[PK]4FKFK/ocli/__pycache__/cmdoptions.cpython-38.opt-1.pycnu[PK]j~""+&cli/__pycache__/parser.cpython-38.opt-1.pycnu[PK]tp+vcli/__pycache__/base_command.cpython-38.pycnu[PK]9]]]])cli/__pycache__/cmdoptions.cpython-38.pycnu[PK]ǭ77'Ucli/__pycache__/__init__.cpython-38.pycnu[PK]~)(w1Wcli/__pycache__/base_command.cpython-38.opt-1.pycnu[PK]x˴-jcli/__pycache__/autocompletion.cpython-38.pycnu[PK]4++42cli/__pycache__/command_context.cpython-38.opt-1.pycnu[PK]*cli/__pycache__/main_parser.cpython-38.pycnu[PK]@0cli/__pycache__/req_command.cpython-38.opt-1.pycnu[PK]qq3cli/__pycache__/autocompletion.cpython-38.opt-1.pycnu[PK]c 3 3*cli/__pycache__/req_command.cpython-38.pycnu[PK]J//.Lcli/__pycache__/command_context.cpython-38.pycnu[PK]E-cli/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]vnn"cli/base_command.pynu[PK]o6 6 cli/main_parser.pynu[PK]ñ$*$* K"cli/parser.pynu[PK]zKttLcli/status_codes.pynu[PK]pcMcli/autocompletion.pynu[PK]%BBfcli/req_command.pynu[PK]IDnncli/cmdoptions.pynu[PK]w4cli/__init__.pynu[PK] fcli/command_context.pynu[PK]ߗmodels/index.pynu[PK]bc  !models/format_control.pynu[PK]@BJ))&@+models/__pycache__/link.cpython-38.pycnu[PK]&'MUmodels/__pycache__/index.cpython-38.pycnu[PK]%v̓ /Zmodels/__pycache__/target_python.cpython-38.pycnu[PK] 0hmodels/__pycache__/format_control.cpython-38.pycnu[PK]MD .smodels/__pycache__/search_scope.cpython-38.pycnu[PK]+0 5܁models/__pycache__/target_python.cpython-38.opt-1.pycnu[PK]#b++*models/__pycache__/__init__.cpython-38.pycnu[PK]Mwzz-Fmodels/__pycache__/index.cpython-38.opt-1.pycnu[PK]@< 4models/__pycache__/search_scope.cpython-38.opt-1.pycnu[PK]Bh<<74models/__pycache__/selection_prefs.cpython-38.opt-1.pycnu[PK]}1רmodels/__pycache__/candidate.cpython-38.opt-1.pycnu[PK]ڀ1models/__pycache__/selection_prefs.cpython-38.pycnu[PK]Ҥ +models/__pycache__/candidate.cpython-38.pycnu[PK]߂m,9models/__pycache__/link.cpython-38.opt-1.pycnu[PK]| p p 6$models/__pycache__/format_control.cpython-38.opt-1.pycnu[PK]ௐ0models/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]0O:models/candidate.pynu[PK]QGe[models/target_python.pynu[PK]Z0tTY&Y&models/link.pynu[PK]ssKmodels/selection_prefs.pynu[PK]{(??#models/__init__.pynu[PK] W7#models/search_scope.pynu[PK]I4+v5vcs/__pycache__/bazaar.cpython-38.opt-1.pycnu[PK]Lo_!_!)tDvcs/__pycache__/subversion.cpython-38.pycnu[PK];Eab1b1",fvcs/__pycache__/git.cpython-38.pycnu[PK]DV))'vcs/__pycache__/__init__.cpython-38.pycnu[PK].dHH3`vcs/__pycache__/versioncontrol.cpython-38.opt-1.pycnu[PK]ESz##(vcs/__pycache__/git.cpython-38.opt-1.pycnu[PK]8&'!'!/vcs/__pycache__/subversion.cpython-38.opt-1.pycnu[PK]c-(vcs/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]$X.*vcs/__pycache__/mercurial.cpython-38.opt-1.pycnu[PK]f1(>vcs/__pycache__/mercurial.cpython-38.pycnu[PK])'ouSS-`Rvcs/__pycache__/versioncontrol.cpython-38.pycnu[PK] XL L %vcs/__pycache__/bazaar.cpython-38.pycnu[PK]oɩQQbvcs/mercurial.pynu[PK]s1!WWvcs/versioncontrol.pynu[PK]A@\) ) vcs/bazaar.pynu[PK]jbL-L-,*vcs/subversion.pynu[PK]_EE Wvcs/git.pynu[PK]/TTvcs/__init__.pynu[PK]?EQEQ download.pynu[PK]Za3a3configuration.pynu[PK]ee3%utils/typing.pynu[PK]ɓ - -)utils/logging.pynu[PK]7#Wutils/__pycache__/inject_securetransport.cpython-38.pycnu[PK] ##.[utils/__pycache__/logging.cpython-38.opt-1.pycnu[PK]8NX/utils/__pycache__/encoding.cpython-38.opt-1.pycnu[PK]ykk.utils/__pycache__/appdirs.cpython-38.opt-1.pycnu[PK]ez00-utils/__pycache__/hashes.cpython-38.opt-1.pycnu[PK]o,HO ,Butils/__pycache__/deprecation.cpython-38.pycnu[PK]c"FF+utils/__pycache__/urls.cpython-38.opt-1.pycnu[PK]wS!U!U%,utils/__pycache__/misc.cpython-38.pycnu[PK]T]V[V[+utils/__pycache__/misc.cpython-38.opt-1.pycnu[PK]-70&Syutils/__pycache__/glibc.cpython-38.pycnu[PK][ 1^utils/__pycache__/filesystem.cpython-38.opt-1.pycnu[PK]a,utils/__pycache__/glibc.cpython-38.opt-1.pycnu[PK]50*utils/__pycache__/unpacking.cpython-38.pycnu[PK]hp--)4utils/__pycache__/ui.cpython-38.opt-1.pycnu[PK]t׀+xutils/__pycache__/filesystem.cpython-38.pycnu[PK]z6:٠-Sutils/__pycache__/marker_files.cpython-38.pycnu[PK] *Putils/__pycache__/filetypes.cpython-38.pycnu[PK].1~utils/__pycache__/subprocess.cpython-38.opt-1.pycnu[PK]z6:٠3 utils/__pycache__/marker_files.cpython-38.opt-1.pycnu[PK]/~7utils/__pycache__/setuptools_build.cpython-38.opt-1.pycnu[PK]J O})utils/__pycache__/__init__.cpython-38.pycnu[PK]M22'Putils/__pycache__/models.cpython-38.pycnu[PK]*h= utils/__pycache__/inject_securetransport.cpython-38.opt-1.pycnu[PK]N0 0 0$utils/__pycache__/packaging.cpython-38.opt-1.pycnu[PK]B-z/utils/__pycache__/models.cpython-38.opt-1.pycnu[PK]v1[7utils/__pycache__/setuptools_build.cpython-38.pycnu[PK]_'n +Iutils/__pycache__/virtualenv.cpython-38.pycnu[PK]uߥV-!Wutils/__pycache__/typing.cpython-38.opt-1.pycnu[PK]PAk˷-\utils/__pycache__/compat.cpython-38.opt-1.pycnu[PK]U%%(wutils/__pycache__/logging.cpython-38.pycnu[PK]>&k --0utils/__pycache__/unpacking.cpython-38.opt-1.pycnu[PK]g{nn1{utils/__pycache__/virtualenv.cpython-38.opt-1.pycnu[PK]a'Jutils/__pycache__/compat.cpython-38.pycnu[PK]G.2MM)utils/__pycache__/encoding.cpython-38.pycnu[PK]yk,,0Nutils/__pycache__/filetypes.cpython-38.opt-1.pycnu[PK]# 2utils/__pycache__/deprecation.cpython-38.opt-1.pycnu[PK]p".".#Futils/__pycache__/ui.cpython-38.pycnu[PK]Bm;}}(utils/__pycache__/appdirs.cpython-38.pycnu[PK]ߔ/ utils/__pycache__/temp_dir.cpython-38.opt-1.pycnu[PK]֬Drr%utils/__pycache__/urls.cpython-38.pycnu[PK]uߥV'#utils/__pycache__/typing.cpython-38.pycnu[PK]QdC/)utils/__pycache__/__init__.cpython-38.opt-1.pycnu[PK]5zff'*utils/__pycache__/hashes.cpython-38.pycnu[PK]TT+>utils/__pycache__/subprocess.cpython-38.pycnu[PK]6HH*mUutils/__pycache__/packaging.cpython-38.pycnu[PK]Yi)^utils/__pycache__/temp_dir.cpython-38.pycnu[PK];[zutils/filesystem.pynu[PK]R=U& & @utils/glibc.pynu[PK]жŎ++utils/deprecation.pynu[PK]7#*Q*Q utils/misc.pynu[PK]; zutils/models.pynu[PK]Pgbutils/hashes.pynu[PK]~ lutils/urls.pynu[PK]ɘJ'J'utils/subprocess.pynu[PK] &__pycache__/cache.cpython-39.pycnu[PK+]- gšGcommands/index.pynu[PK+]V''(kZcommands/__pycache__/list.cpython-39.pycnu[PK+]%=*commands/__pycache__/search.cpython-39.pycnu[PK+]z)חcommands/__pycache__/index.cpython-39.pycnu[PK+]FKxzz(commands/__pycache__/hash.cpython-39.pycnu[PK+]%?::E:E+вcommands/__pycache__/install.cpython-39.pycnu[PK+]'%%)ecommands/__pycache__/debug.cpython-39.pycnu[PK+]ŕ69!9!( commands/__pycache__/show.cpython-39.pycnu[PK+])&)t4 commands/__pycache__/wheel.cpython-39.pycnu[PK+]9>>(G commands/__pycache__/help.cpython-39.pycnu[PK+]gIr r *eM commands/__pycache__/freeze.cpython-39.pycnu[PK+]B B -1X commands/__pycache__/uninstall.cpython-39.pycnu[PK+]M̦ 1d commands/__pycache__/configuration.cpython-39.pycnu[PK+],ׅ commands/__pycache__/download.cpython-39.pycnu[PK+]A[  ,ҕ commands/__pycache__/__init__.cpython-39.pycnu[PK+]ZGp4DD)> commands/__pycache__/check.cpython-39.pycnu[PK+]i i .ۨ commands/__pycache__/completion.cpython-39.pycnu[PK+]ՅGG) commands/__pycache__/cache.cpython-39.pycnu[PK+]8ddB commands/cache.pynu[PK+]c ҈II, req/__pycache__/req_uninstall.cpython-39.pycnu[PK+]Ž[\d4d4'5!req/__pycache__/req_file.cpython-39.pycnu[PK+]nX,X,+j!req/__pycache__/constructors.cpython-39.pycnu[PK+]&,,&9!req/__pycache__/req_set.cpython-39.pycnu[PK+];5Y5Y*!req/__pycache__/req_install.cpython-39.pycnu[PK+]D*J"req/__pycache__/req_tracker.cpython-39.pycnu[PK+]0a" " 'h"req/__pycache__/__init__.cpython-39.pycnu[PK+]_//#"wheel_builder.pynu[PK+]Y%%)S"locations/__pycache__/base.cpython-39.pycnu[PK+]{;/vZ"locations/__pycache__/_sysconfig.cpython-39.pycnu[PK+]``/ls"locations/__pycache__/_distutils.cpython-39.pycnu[PK+]z6))-+"locations/__pycache__/__init__.cpython-39.pycnu[PK+]8 z"locations/_sysconfig.pynu[PK+]Y++R"locations/base.pynu[PK+]őkl8l8"locations/__init__.pynu[PK+]ڝo#locations/_distutils.pynu[PK+]J%#distributions/sdist.pynu[PK+]sΗLL2;#distributions/__pycache__/installed.cpython-39.pycnu[PK+]ޡWuu-wA#distributions/__pycache__/base.cpython-39.pycnu[PK+]`bb.II#distributions/__pycache__/wheel.cpython-39.pycnu[PK+]5OJJ. P#distributions/__pycache__/sdist.cpython-39.pycnu[PK+]TBB1b#distributions/__pycache__/__init__.cpython-39.pycnu[PK+]0%%%,Tf#operations/__pycache__/freeze.cpython-39.pycnu[PK+]^("c9c9-~#operations/__pycache__/prepare.cpython-39.pycnu[PK+]RHB.#operations/__pycache__/__init__.cpython-39.pycnu[PK+]~+޹#operations/__pycache__/check.cpython-39.pycnu[PK+]bo:#operations/build/__pycache__/wheel_editable.cpython-39.pycnu[PK+]Vt;#operations/build/__pycache__/metadata_legacy.cpython-39.pycnu[PK+]ϳ 8#operations/build/__pycache__/wheel_legacy.cpython-39.pycnu[PK+]B:1:#operations/build/__pycache__/wheel.cpython-39.pycnu[PK+]R/=o#operations/build/__pycache__/metadata_editable.cpython-39.pycnu[PK+]T4#operations/build/__pycache__/__init__.cpython-39.pycnu[PK+]d(4 #operations/build/__pycache__/metadata.cpython-39.pycnu[PK+]j%M#operations/build/metadata_editable.pynu[PK+]ȇe ;#operations/build/wheel_legacy.pynu[PK+]}}"r$operations/build/wheel_editable.pynu[PK+]<F''A $operations/build/wheel.pynu[PK+] #$operations/build/metadata_legacy.pynu[PK+]Y0__$operations/build/metadata.pynu[PK+]H$operations/build/__init__.pynu[PK+]5=$operations/install/__pycache__/editable_legacy.cpython-39.pycnu[PK+]΄: 4#$operations/install/__pycache__/legacy.cpython-39.pycnu[PK+] R R31$operations/install/__pycache__/wheel.cpython-39.pycnu[PK+](`++6g$operations/install/__pycache__/__init__.cpython-39.pycnu[PK+] >>$operations/install/legacy.pynu[PK+]Z%$operations/install/editable_legacy.pynu[PK+]X*kk$operations/install/wheel.pynu[PK+]{33H%operations/install/__init__.pynu[PK+]Y?%*%**%network/__pycache__/session.cpython-39.pycnu[PK+]ƚ -H2%network/__pycache__/lazy_wheel.cpython-39.pycnu[PK+]__'S%network/__pycache__/auth.cpython-39.pycnu[PK+]{,k(>q%network/__pycache__/utils.cpython-39.pycnu[PK+]]i+Ow%network/__pycache__/download.cpython-39.pycnu[PK+]<+8%network/__pycache__/__init__.cpython-39.pycnu[PK+]$|&&)%network/__pycache__/xmlrpc.cpython-39.pycnu[PK+].q q (1%network/__pycache__/cache.cpython-39.pycnu[PK+]/P%network/download.pynu[PK+]ӏV1%network/utils.pynu[PK+]w%network/lazy_wheel.pynu[PK+]y4S...%cli/__pycache__/command_context.cpython-39.pycnu[PK+]:(zLXLX)t%cli/__pycache__/cmdoptions.cpython-39.pycnu[PK+]e&F&&%G&cli/__pycache__/parser.cpython-39.pycnu[PK+]k+ln&cli/__pycache__/base_command.cpython-39.pycnu[PK+]+&cli/__pycache__/status_codes.cpython-39.pycnu[PK+]S00-ƈ&cli/__pycache__/autocompletion.cpython-39.pycnu[PK+]yy#S&cli/__pycache__/main.cpython-39.pycnu[PK+]X֖*&cli/__pycache__/main_parser.cpython-39.pycnu[PK+]40\uu'&cli/__pycache__/spinners.cpython-39.pycnu[PK+]q8i0i0*ۿ&cli/__pycache__/req_command.cpython-39.pycnu[PK+]9 ,&cli/__pycache__/progress_bars.cpython-39.pycnu[PK+]O`77''cli/__pycache__/__init__.cpython-39.pycnu[PK+]$%r'cli/spinners.pynu[PK+]jYd| $'cli/main.pynu[PK+]sOl l h.'cli/progress_bars.pynu[PK+]c (O'models/__pycache__/scheme.cpython-39.pycnu[PK+]' 0S'models/__pycache__/format_control.cpython-39.pycnu[PK+]+R$5(5(&^'models/__pycache__/link.cpython-39.pycnu[PK+]'1'models/__pycache__/index.cpython-39.pycnu[PK+]ĕ+}'models/__pycache__/candidate.cpython-39.pycnu[PK+]Chh,'models/__pycache__/direct_url.cpython-39.pycnu[PK+]Tz:'f'models/__pycache__/wheel.cpython-39.pycnu[PK+]sxw w /'models/__pycache__/target_python.cpython-39.pycnu[PK+]++*'models/__pycache__/__init__.cpython-39.pycnu[PK+] 1+'models/__pycache__/selection_prefs.cpython-39.pycnu[PK+]g .1'models/__pycache__/search_scope.cpython-39.pycnu[PK+]I'models/scheme.pynu[PK+]'TA k'models/wheel.pynu[PK+]U=*V'models/direct_url.pynu[PK+] 22(h(metadata/__pycache__/base.cpython-39.pycnu[PK+]V1B(metadata/__pycache__/pkg_resources.cpython-39.pycnu[PK+]º,[(metadata/__pycache__/__init__.cpython-39.pycnu[PK+] /3:c(metadata/pkg_resources.pynu[PK,]._+_+Aw(metadata/base.pynu[PK,] s||(metadata/__init__.pynu[PK,]Ԑ_DD*(resolution/__pycache__/base.cpython-39.pycnu[PK,]at.>(resolution/__pycache__/__init__.cpython-39.pycnu[PK,]kR6 5(resolution/resolvelib/__pycache__/base.cpython-39.pycnu[PK,]K\oHoH;(resolution/resolvelib/__pycache__/candidates.cpython-39.pycnu[PK,]  A)resolution/resolvelib/__pycache__/found_candidates.cpython-39.pycnu[PK,]97&)resolution/resolvelib/__pycache__/provider.cpython-39.pycnu[PK,]<(9B)resolution/resolvelib/__pycache__/resolver.cpython-39.pycnu[PK,]pkJIJI8_)resolution/resolvelib/__pycache__/factory.cpython-39.pycnu[PK,] 9K)resolution/resolvelib/__pycache__/reporter.cpython-39.pycnu[PK,]3=)resolution/resolvelib/__pycache__/requirements.cpython-39.pycnu[PK,]I59)resolution/resolvelib/__pycache__/__init__.cpython-39.pycnu[PK,]jk"G"G#+)resolution/resolvelib/candidates.pynu[PK,]jj *resolution/resolvelib/factory.pynu[PK,]U##!*resolution/resolvelib/provider.pynu[PK,])ZII)5*resolution/resolvelib/found_candidates.pynu[PK,]~p_ !*resolution/resolvelib/reporter.pynu[PK,]\OO%*resolution/resolvelib/requirements.pynu[PK,]"dd*resolution/resolvelib/base.pynu[PK,]Wcl%l%![*resolution/resolvelib/resolver.pynu[PK,]!+resolution/resolvelib/__init__.pynu[PK,]005i+resolution/legacy/__pycache__/resolver.cpython-39.pycnu[PK,]w25N+resolution/legacy/__pycache__/__init__.cpython-39.pycnu[PK,]!4_HHBP+resolution/legacy/resolver.pynu[PK,]+resolution/legacy/__init__.pynu[PK,]˩GG+resolution/base.pynu[PK,]v+resolution/__init__.pynu[PK,]I~D~D+index/collector.pynu[PK,]/>/>*|+index/__pycache__/collector.cpython-39.pycnu[PK,]>k>>(,index/__pycache__/sources.cpython-39.pycnu[PK,]1%mm/;,index/__pycache__/package_finder.cpython-39.pycnu[PK,]Srl  ),index/__pycache__/__init__.cpython-39.pycnu[PK,]WB,index/package_finder.pynu[PK,]+9-index/sources.pynu[PK,]C?K^S-index/__init__.pynu[PK,]G{ %S-vcs/__pycache__/bazaar.cpython-39.pycnu[PK,] )`-vcs/__pycache__/subversion.cpython-39.pycnu[PK,]J"QQ--vcs/__pycache__/versioncontrol.cpython-39.pycnu[PK,]))'--vcs/__pycache__/__init__.cpython-39.pycnu[PK,]rc0c0"-vcs/__pycache__/git.cpython-39.pycnu[PK,]o(b.vcs/__pycache__/mercurial.cpython-39.pycnu[PK,]g+ ).utils/__pycache__/parallel.cpython-39.pycnu[PK,]7'.utils/__pycache__/inject_securetransport.cpython-39.pycnu[PK,]W9222'>,.utils/__pycache__/models.cpython-39.pycnu[PK,]"ii'4.utils/__pycache__/hashes.cpython-39.pycnu[PK,]GAr r *I.utils/__pycache__/packaging.cpython-39.pycnu[PK,]/+&ST.utils/__pycache__/glibc.cpython-39.pycnu[PK,]\)X[.utils/__pycache__/egg_link.cpython-39.pycnu[PK,]j*1d.utils/__pycache__/filetypes.cpython-39.pycnu[PK,]yss._h.utils/__pycache__/pkg_resources.cpython-39.pycnu[PK,]`F;;)0p.utils/__pycache__/encoding.cpython-39.pycnu[PK,]A1%%)u.utils/__pycache__/datetime.cpython-39.pycnu[PK,]0:P%Bx.utils/__pycache__/_log.cpython-39.pycnu[PK,]T&QSQS%~.utils/__pycache__/misc.cpython-39.pycnu[PK,]܇}}(P.utils/__pycache__/appdirs.cpython-39.pycnu[PK,]VЋ)%.utils/__pycache__/temp_dir.cpython-39.pycnu[PK,] ש&.utils/__pycache__/wheel.cpython-39.pycnu[PK,]>3/utils/__pycache__/compatibility_tags.cpython-39.pycnu[PK,]c3 +f/utils/__pycache__/virtualenv.cpython-39.pycnu[PK,]Hgoo/,/utils/__pycache__/distutils_args.cpython-39.pycnu[PK,]D+  '1/utils/__pycache__/compat.cpython-39.pycnu[PK,]E/ZZ,7/utils/__pycache__/entrypoints.cpython-39.pycnu[PK,] 1=/utils/__pycache__/setuptools_build.cpython-39.pycnu[PK,]C(8HH3K/utils/__pycache__/direct_url_helpers.cpython-39.pycnu[PK,]>Yii*>T/utils/__pycache__/unpacking.cpython-39.pycnu[PK,]u:( ,o/utils/__pycache__/deprecation.cpython-39.pycnu[PK,] 88+4|/utils/__pycache__/filesystem.cpython-39.pycnu[PK,]8U1)ǐ/utils/__pycache__/__init__.cpython-39.pycnu[PK,]$9bb%/utils/__pycache__/urls.cpython-39.pycnu[PK,]+/utils/__pycache__/subprocess.cpython-39.pycnu[PK,]*dm$m$(/utils/__pycache__/logging.cpython-39.pycnu[PK,]g/utils/compatibility_tags.pynu[PK,]_jj/utils/entrypoints.pynu[PK,]l=a/utils/datetime.pynu[PK,]>9/utils/pkg_resources.pynu[PK,]9/utils/wheel.pynu[PK,]#/0utils/distutils_args.pynu[PK,]>S| | .0utils/parallel.pynu[PK,]Jx9? 0utils/_log.pynu[PK,]&] $0utils/direct_url_helpers.pynu[PK,][w]00utils/egg_link.pynu[PK, ]:AD$D$(90__pycache__/wheel_builder.cpython-38.pycnu[PK, ].Vy)h^0commands/__pycache__/index.cpython-38.pycnu[PK, ][5)p0commands/__pycache__/cache.cpython-38.pycnu[PK, ]a a +e0commands/__pycache__/inspect.cpython-38.pycnu[PK, ](Q%{. . !0commands/inspect.pynu[PK, ]Q5j/0locations/__pycache__/_distutils.cpython-38.pycnu[PK, ]m /̶0locations/__pycache__/_sysconfig.cpython-38.pycnu[PK, ]Rn11-0locations/__pycache__/__init__.cpython-38.pycnu[PK, ]JZ )1locations/__pycache__/base.cpython-38.pycnu[PK, ]{ . 1distributions/__pycache__/sdist.cpython-38.pycnu[PK, ]kԆ45 1operations/build/__pycache__/metadata.cpython-38.pycnu[PK, ]"h1&1operations/build/__pycache__/wheel.cpython-38.pycnu[PK, ]qV;;9R+1operations/build/__pycache__/build_tracker.cpython-38.pycnu[PK, ]r/4;1operations/build/__pycache__/__init__.cpython-38.pycnu[PK, ]f$¨=K=1operations/build/__pycache__/metadata_editable.cpython-38.pycnu[PK, ]. 8`C1operations/build/__pycache__/wheel_legacy.cpython-38.pycnu[PK, ]R:N1operations/build/__pycache__/wheel_editable.cpython-38.pycnu[PK, ]-  ;T1operations/build/__pycache__/metadata_legacy.cpython-38.pycnu[PK, ]%%!^1operations/build/build_tracker.pynu[PK, ]:fQfQ3n1operations/install/__pycache__/wheel.cpython-38.pycnu[PK, ]X 4Y1operations/install/__pycache__/legacy.cpython-38.pycnu[PK, ]D=h1operations/install/__pycache__/editable_legacy.cpython-38.pycnu[PK, ]md++61operations/install/__pycache__/__init__.cpython-38.pycnu[PK, ]l̾+.1network/__pycache__/download.cpython-38.pycnu[PK, ]Uo& -G1network/__pycache__/lazy_wheel.cpython-38.pycnu[PK, ]3+(s 2network/__pycache__/utils.cpython-38.pycnu[PK, ]rл dd'2cli/__pycache__/spinners.cpython-38.pycnu[PK, ]luu#N&2cli/__pycache__/main.cpython-38.pycnu[PK, ]o,,2cli/__pycache__/progress_bars.cpython-38.pycnu[PK, ]M'32models/__pycache__/wheel.cpython-38.pycnu[PK, ]V=,E2models/__pycache__/direct_url.cpython-38.pycnu[PK, ]s//(b2models/__pycache__/scheme.cpython-38.pycnu[PK, ]޷ 5f2models/__pycache__/installation_report.cpython-38.pycnu[PK, ]0q9 9 n2models/installation_report.pynu[PK, ]n3metadata/importlib/_envs.pynu[PK, ]Am# # 3metadata/_json.pynu[PK, ]L<ډ.[3resolution/__pycache__/__init__.cpython-38.pycnu[PK, ] ]rFF*3resolution/__pycache__/base.cpython-38.pycnu[PK, ]>MKMK8D3resolution/resolvelib/__pycache__/factory.cpython-38.pycnu[PK, ]O=4resolution/resolvelib/__pycache__/requirements.cpython-38.pycnu[PK, ]}Fw9A&4resolution/resolvelib/__pycache__/__init__.cpython-38.pycnu[PK, ]; 9'4resolution/resolvelib/__pycache__/resolver.cpython-38.pycnu[PK, ]Fv9H4resolution/resolvelib/__pycache__/provider.cpython-38.pycnu[PK, ]Z@Af4resolution/resolvelib/__pycache__/found_candidates.cpython-38.pycnu[PK, ]ט5z4resolution/resolvelib/__pycache__/base.cpython-38.pycnu[PK, ]ajII;|4resolution/resolvelib/__pycache__/candidates.cpython-38.pycnu[PK, ]U% 94resolution/resolvelib/__pycache__/reporter.cpython-38.pycnu[PK, ]x< 54resolution/legacy/__pycache__/__init__.cpython-38.pycnu[PK, ]Ly:y:5*4resolution/legacy/__pycache__/resolver.cpython-38.pycnu[PK, ]%OEOE*(5index/__pycache__/collector.cpython-38.pycnu[PK, ]ܤ qq/m5index/__pycache__/package_finder.cpython-38.pycnu[PK, ]vA  )5index/__pycache__/__init__.cpython-38.pycnu[PK, ]qT>>(5index/__pycache__/sources.cpython-38.pycnu[PK, ]x)5utils/__pycache__/egg_link.cpython-38.pycnu[PK, ]3G~&6utils/__pycache__/wheel.cpython-38.pycnu[PK, ]$36utils/__pycache__/compatibility_tags.cpython-38.pycnu[PK, ]&1  %(6utils/__pycache__/_log.cpython-38.pycnu[PK, ]ᣬ ,`/6utils/__pycache__/entrypoints.cpython-38.pycnu[PK, ]>gg3T:6utils/__pycache__/direct_url_helpers.cpython-38.pycnu[PK, ]0t_uu/C6utils/__pycache__/distutils_args.cpython-38.pycnu[PK, ]2A%%)G6utils/__pycache__/datetime.cpython-38.pycnu[PK;;XpJ6