o aiB@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@e8jAe8jBgZCd&dd ZDd!e de fd"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_virtualenvc szeZdZdZdfdd Zededeee fddZ dede fd d Z  dded ee d ee de fd dZZS)SessionCommandMixinzE A class mixin for command classes needing _build_session(). returnNcstd|_dSN)super__init___session)self __class__/builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/cli/req_command.pyr&6s  zSessionCommandMixin.__init__optionscCsLg}t|ddst|dd}|r||t|dd}|r"|||p%dS)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||||_|jdusJ|jS)zGet a default-managed session.N)r' enter_context_build_session)r(r-r+r+r,get_default_sessionHs z'SessionCommandMixin.get_default_sessionretriestimeoutcCs|jr tj|js Jt|jrtj|jdnd|dur|n|j|j||d}|j r1|j |_ |j r8|j |_ |j s=|rG|durC|n|j |_ |j rR|j |j d|_|j |j_|S)Nhttp)cacher< trusted_hostsr5)r>https) cache_dirospathisabsrjoinr<r@r8certverify client_certr=proxyproxiesno_inputauth prompting)r(r-r<r=sessionr+r+r,r:Rs&   z"SessionCommandMixin._build_sessionr#NNN)__name__ __module__ __qualname____doc__r& classmethodrrrstrr8rr;intr: __classcell__r+r+r)r,r"0s"  r"c@s"eZdZdZdeddfddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. r-r#NcCsjt|dsJ|js |jrdS|j|dtd|jd}|t||WddS1s.wYdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r.Nr)r<r=)hasattrdisable_pip_version_checkr.r:minr=r)r(r-rOr+r+r,handle_pip_version_checks  "z*IndexGroupCommand.handle_pip_version_check)rRrSrTrUrr_r+r+r+r,rZ{srZr#cCsNtrdSttds dStjdkstjdkrdStdkr 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\rCsysplatformr`loggerwarningr+r+r+r,warn_if_run_as_roots  rgfuncc s>dtddfdddtdtdttdttffd d }|S) zNDecorator for common logic related to managing temporary directories. registryr#NcSstD]}||dqdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)ritr+r+r,configure_tempdir_registrysz0with_cleanup..configure_tempdir_registryr(r-argscsH|jdusJ|jr|jz|||WSty#|jwr$)tempdir_registryno_cleanr )r(r-rnrmrhr+r,wrappers   zwith_cleanup..wrapper)rRequirementCommandrrrrrX)rhrrr+rqr, with_cleanupsrtcsBeZdZdededdffdd Zededefdd Ze d'd e ded e d e d e dedeedefddZe        d(ded e dedeededededededeedeeedfdefddZdeeded e d e deef d d!Zed e ddfd"d#Z  d)ded e d$eedeede f d%d&ZZS)*rsrnkwr#Ncs&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_varianttemp_build_dir req_trackerrOfinder use_user_site download_dirc Cs|j}|dus J||} | dkrd|jv} | rtdn d} d|jvr+tdd|jv} d|jvrsz6RequirementCommand.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}")r+) constraintsrrrr2rr editablesr requirementsanyrr find_linksr formatdictrF) r(rnr-rrOrfilename parsed_req req_to_addroptsr+r+r,get_requirementsas           z#RequirementCommand.get_requirementscCs$|j}|}|rt|dSdS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsreinfo)rr locationsr+r+r,trace_basic_infos z#RequirementCommand.trace_basic_info target_pythoncCs6tj||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-rOrrrrr+r+r,_build_package_finders z(RequirementCommand._build_package_finderr$)NFTFFrNNrQ)rRrSrTrr& staticmethodrrWr|rVrrrrboolrrrrrrXrrrrrrrrrYr+r+r)r,rss  ?     : OrsrP)GrUloggingrCrc functoolsroptparsertypingrrrrpip._internal.cacherpip._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_filerpip._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,sJ                    K