U ÀÒ.eRC ã @ sF d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m Z mZmZm Z mZ ddlmZ ddlmZmZmZmZ dd lmZmZ dd lmZ e�rddlmZmZmZmZm Z m!Z! ddl"m#Z# dd l$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ee0e-ge-f Z1e 2e3¡Z4ddd„Z5G dd„ de6ƒZ7dS )ay 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) é N)Údefaultdict)Úchain)Ú specifiers)ÚBestVersionAlreadyInstalledÚDistributionNotFoundÚ HashErrorÚ HashErrorsÚUnsupportedPythonVersion)Ú indent_log)Údist_in_install_pathÚdist_in_usersiteÚ ensure_dirÚnormalize_version_info)Úcheck_requires_pythonÚget_requires_python)ÚMYPY_CHECK_RUNNING)ÚCallableÚDefaultDictÚListÚOptionalÚSetÚTuple)Ú pkg_resources)ÚAbstractDistribution)Ú PipSession)Ú PackageFinder)ÚRequirementPreparer)ÚInstallRequirement)ÚRequirementSetFc C sž t | ƒ}zt||d�}W n: tjk rR } zt d| j|¡ W Y ¢dS d}~X Y nX |r\dS d tt |ƒ¡}|r†t d| j||¡ dS td | 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}) r r r ZInvalidSpecifierÚloggerÚwarningZproject_nameÚjoinÚmapÚstrÚdebugr Úformat)Údistr Úignore_requires_pythonZrequires_pythonZ is_compatibleÚexcÚversion© r, ú@/usr/lib/python3.8/site-packages/pip/_internal/legacy_resolve.pyÚ_check_dist_requires_python> s> ÿ þ ý ÿÿr. c sd e Zd ZdZdddhZd‡ fdd„ Zdd „ Zd d„ Zdd „ Zdd„ Z dd„ Z dd„ Zdd„ Z‡ Z S )ÚResolverz–Resolves which packages need to be installed/uninstalled to perform the requested operation without breaking the requirements of any package. Úeagerúonly-if-neededúto-satisfy-onlyNc s„ t t| ƒ ¡ |d kr&tjd d… }nt|ƒ}|| _|| _|| _|| _ d | _ | | _| | _|| _ || _|| _|| _|| _ttƒ| _d S )Né )Úsuperr/ Ú__init__Úsysr r Ú_py_version_infoÚpreparerÚfinderÚsessionÚrequire_hashesÚupgrade_strategyÚforce_reinstallÚignore_dependenciesÚignore_installedr) Ú use_user_siteÚ_make_install_reqr ÚlistÚ_discovered_dependencies)Úselfr8 r: r9 Zmake_install_reqr@ r> r? r) r= r<