"JdBdZddlZddlZddlZddlmZddlmZddlm 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:ej;e<Z=GddeZ>Gddee>Z?e8j@e8jAe8jBgZCd$dZDd e de fd!ZEGd"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 eZdZdZd fd Zededeee fdZ dede fdZ d dedee d ee de fd ZxZS) SessionCommandMixinzE A class mixin for command classes needing _build_session(). returnNcVtd|_dSN)super__init___session)self __class__s P/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/cli/req_command.pyr)zSessionCommandMixin.__init__6s$ .2 optionscg}t|dds(t|dd}|r||t|dd}|r|||pdS)z7Return a list of index urls from user-provided options.no_indexF index_urlNextra_index_urls)getattrappendextend)clsr/ index_urlsurlurlss r-_get_index_urlsz#SessionCommandMixin._get_index_urls:s w E22 '';55C '!!#&&&w 2D99  $   d # # #!T!r.c|j6||||_|jJ|jS)zGet a default-managed session.)r* enter_context_build_session)r+r/s r-get_default_sessionz'SessionCommandMixin.get_default_sessionHsE =  ..t/B/B7/K/KLLDM=,,,}r.retriestimeoutc|jr&tj|jsJt |jr%tj|jdnd||n|j|j||}|j r |j |_ |j r |j |_ |j s|r||n|j |_ |j r|j |j d|_|j |j_|S)Nhttp)cacher@ trusted_hostsr8)rChttps) cache_dirospathisabsrjoinr@rEr;certverify client_certrAproxyproxiesno_inputauth prompting)r+r/r@rAsessions r-r>z"SessionCommandMixin._build_sessionRs $H g6G(H(HHHH;B;LV W.777RV&2GG!/++G44     < *$\GN   /".GL ? Rg R)0) __classcell__r,s@r-r$r$0s333333 "f "$s)1D " " "[ "6j"&!% &&&#&# &  &&&&&&&&r.r$c"eZdZdZdeddfdZdS)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%Nct|dsJ|js|jrdS||dt d|j}|5t ||ddddS#1swxYwYdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r1Nr)r@rA)hasattrdisable_pip_version_checkr1r>minrAr)r+r/rTs r-handle_pip_version_checkz*IndexGroupCommand.handle_pip_version_checksw +++++  , 0@  F%% QAw(?(?&   5 5 "7G 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5sA..A25A2)rWrXrYrZrrgr.r-rara{s@ 554555555r.rar%ctrdSttdsdStjdkstjdkrdStjdkrdSt ddS)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"rdrHsysplatformrjloggerwarningrhr.r-warn_if_run_as_rootrqs !! 2x   |w#,(":": y{{a NN ,r.funcc dtddfddtdtdttdt t ffd }|S) zNDecorator for common logic related to managing temporary directories. registryr%NcFtD]}||ddS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)rtts r-configure_tempdir_registryz0with_cleanup..configure_tempdir_registrys4' * *A   5 ) ) ) ) * *r.r+r/argsc|jJ|jr|j |||S#t$r|jwxYwr')tempdir_registryno_cleanr)r+r/rzryrrs r-wrapperzwith_cleanup..wrappers$000   > & &t'< = = = 4gt,, ,$    ' &t'< = = =   s 0A )r RequirementCommandrrrrr])rrr~rys` @r- with_cleanuprsy *-F*4**** +19=c # Nr.ceZdZdededdffd ZededefdZe d de ded e d e d e d ed eedefdZe d!ded e dedeed edededededeedeeedfdefdZdeeded e d e deef dZed e ddfdZ d"ded e deedeede f dZxZS)#rrzkwr%Nctj|i||jt jdSr')r(r)cmd_opts add_optionr r})r+rzrr,s r-r)zRequirementCommand.__init__sD$%"%%%   !4!6!677777r.r/cd|jvrdSdS)zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy 2020-resolver)deprecated_features_enabledr/s r-determine_resolver_variantz-RequirementCommand.determine_resolver_variants  C C C8r.temp_build_dir req_trackerrTfinder use_user_site download_dirc|j}|J||} | dkr&d|jv} | rtdn%d} d|jvrtdd|jv} d|jvrt d d d d|jvrt d dd t||j||j |||j ||j || |  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.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_isolationrrT progress_barrrequire_hashesr lazy_wheel in_tree_build) rIrfeatures_enabledrorprrrrrrr) r7rr/rrTrrrtemp_build_dir_pathresolver_variantrrs r-make_requirement_preparerz,RequirementCommand.make_requirement_preparersL-1"...99'BB  . .$(@@J "Jg666Q,73VV g6 6 6 <L     '"E E E ;      #)O%#3# -"1'!'    r.FTto-satisfy-onlypreparer wheel_cacheignore_installedignore_requires_pythonforce_reinstallupgrade_strategy use_pep517py_version_info.c dtt|j| } ||} | dkr=ddl}|jjjj |||| ||j |||| |  Sddl }|jjj j |||| ||j |||| |  S)zF Create a Resolver instance for the given parameters. )isolatedrrrN) rrrmake_install_reqrignore_dependenciesrrrrr) rr isolated_moder,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibresolverResolverr(pip._internal.resolution.legacy.resolverr)r7rrr/rrrrrrrrrrpips r- make_resolverz RequirementCommand.make_resolver&s$# '*!    99'BB  . . ? ? ? ?=+6?HH!'!1+$+$?!1'= /!1 /I    8777}'.7@@#-' ' ;-#9+-+A   r.c fg}|jD]E}t|d|||D].}t||jd}||/F|D]5} t | d|j|jd}||6|jD]4} t| d|j|j}||5|j D]J}t||||D]4}t||j|jd}||5Ktd |Drd|_ |sy|jsr|j skd |j i} |j rAtd jdit!| d |j  tdjdi| |S)zS Parse command-line arguments into the corresponding requirements. T) constraintrr/rTF)r user_suppliedN)rrr)rrr)rr/rTc3$K|] }|jV dSr')has_hash_options).0reqs r- z6RequirementCommand.get_requirements..s%<<s#<<<<<>Dt388G4F+G+GHHH#5..4==7;== r.cx|j}|}|rt|dSdS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsroinfo)rr locationss r-trace_basic_infoz#RequirementCommand.trace_basic_infosG *  88::  # KK " " " " " # #r. target_pythonctj||}td|j|j|j|}t j|||S)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)r+r/rTrrrrs r-_build_package_finderz(RequirementCommand._build_package_findersi'-gwGGG."1")+!/#9    #)+'    r.r')NFTFFrNNrV)rWrXrYrr) staticmethodrr\rr[rrrrboolrrrr rr]rrrrrrrrr^r_s@r-rrs8c88888888 Fs\'+= = %= = ( =  =  = = sm=  = = = [= ~ -1#!%', % 1%)598 8 %8 8  8 j) 8  8 8 !%8 8 8 TN8 "%S/28  8 8 8 [8 tM3iMM M  M  ! MMMM^##4###\#1515      -  !)           r.rrU)GrZloggingrHrm functoolsroptparsertypingrrrrpip._internal.cacher pip._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.preparerpip._internal.req.constructorsrrrrpip._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_dirrr r!pip._internal.utils.virtualenvr" getLoggerrWror$ra BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDrvrqrrrhr.r-rs5 ------------******((((((222222AAAAAAHHHHHHHH777777<<<<<<EEEEEE;;;;;;444444@@@@@@ :99999<<<<<<<<<<<<666666DDDDDD666666 DCCCCC  8 $ $HHHHH-HHHV55555!4555:#<ss8} } } } } *} } } } } r.