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$