a *eg/@s^dZddlZddlmZddlmZddlmZmZm Z m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0m1Z1e2e3Z4e1j5e1j6e1j7gZ8eedddZ9GdddeZ:dS)zContains the RequirementCommand base class. This class is in a separate module so the commands that do not always need PackageFinder capability don't unnecessarily import the PackageFinder machinery and all its vendored dependencies, etc. N)partial)Values)AnyListOptionalTuple) WheelCache) cmdoptions)IndexGroupCommand)SessionCommandMixin) 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) TempDirectoryTempDirectoryTypeRegistry tempdir_kinds)funcreturncs6tddddttttttdfdd }|S)zNDecorator for common logic related to managing temporary directories. N)registryr cSstD]}||dqdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)r!tr%G/usr/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.pyconfigure_tempdir_registry7sz0with_cleanup..configure_tempdir_registry)selfoptionsargsr csP|jdusJ|jr|jz|||WStyJ|jYn0dSN)tempdir_registryno_cleanr )r(r)r*r'rr%r&wrapper;s   zwith_cleanup..wrapper)rRequirementCommandrrrrint)rr/r%r.r& with_cleanup2s  r2cseZdZeeddfdd ZeeedddZe de ee e e eeeeed d d Ze dee eeeeeeeeeeeeedfed ddZeeee e eedddZee ddddZdee eeeee dddZZS)r0N)r*kwr cs&tj|i||jtdSr+)super__init__cmd_opts add_optionr r-)r(r*r3 __class__r%r&r5OszRequirementCommand.__init__)r)r cCsd|jvrdSdS)zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy resolvelib)deprecated_features_enabledr)r%r%r&determine_resolver_variantTs z-RequirementCommand.determine_resolver_variantr) temp_build_dirr) build_trackersessionfinder use_user_site download_dir verbosityr c Cs|j} | dusJd} ||} | dkrBd|jv} | r^tdnd} d} d|jvr^tdt| |j||j|j|||j ||j || || dS) zQ Create a RequirementPreparer instance for the given parameters. NFr;z 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.Tz;fast-deps has no effect when used with the legacy resolver.) build_dirsrc_dirrDbuild_isolationcheck_build_depsr@rA progress_barrBrequire_hashesrC lazy_wheelrElegacy_resolver) pathr>features_enabledloggerwarningrrGrHrIrJrK) clsr?r)r@rArBrCrDrEtemp_build_dir_pathrMresolver_variantrLr%r%r&make_requirement_preparer\s@    z,RequirementCommand.make_requirement_preparerFTto-satisfy-only.) preparerrBr) wheel_cacherCignore_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. )isolatedr]r;rN) rWrBrXmake_install_reqrCignore_dependenciesrYrZr[r\r^) rr isolated_moder>,pip._internal.resolution.resolvelib.resolver _internal resolutionr;resolverResolverra(pip._internal.resolution.legacy.resolverr:)rRrWrBr)rXrCrYrZr[r\r]r^r`rTpipr%r%r& make_resolversF    z RequirementCommand.make_resolver)r*r)rBrAr c Cs~g}|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]L}t||||d D]6}t||j|jd|j r|j dndd }||qqt d d |Drd|_|sz|jsz|j szd |ji} |jrftdjfit| d|jdntdjfi| |S)zS Parse command-line arguments into the corresponding requirements. T) constraintrBr)rAF)r_ user_suppliedNconfig_settings) comes_fromr_r]rlrm)rlr_r]rm)rBr)rA)r_r]rlrmcss|] }|jVqdSr+)has_hash_options).0reqr%r%r& z6RequirementCommand.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}")) constraintsrrrbappendrr]getattr editablesr requirementsr)getanyrKrt find_linksr formatdictjoin) r(r*r)rBrAr{filename parsed_req req_to_addrqoptsr%r%r&get_requirementss            z#RequirementCommand.get_requirements)rBr cCs |j}|}|rt|dS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsrPinfo)rBr locationsr%r%r&trace_basic_info$sz#RequirementCommand.trace_basic_info)r)rA target_pythonrZr 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_binaryrZ)link_collectorselection_prefsr)rcreaterrprerr)r(r)rArrZrrr%r%r&_build_package_finder/s z(RequirementCommand._build_package_finder)Nr)NFTFFrVNN)NN)__name__ __module__ __qualname__rr5 staticmethodrstrr> classmethodrrrrboolrr1rrUrrrrjrrrrrr __classcell__r%r%r8r&r0Nsr 6< Vr0);__doc__logging functoolsroptparsertypingrrrrpip._internal.cacherZpip._internal.clir Zpip._internal.cli.index_commandr r 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.sessionrZ,pip._internal.operations.build.build_trackerr pip._internal.operations.preparerpip._internal.req.constructorsrrrrZpip._internal.req.req_filerZpip._internal.req.req_installrpip._internal.resolution.baserpip._internal.utils.temp_dirrrr getLoggerrrP BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDr"r2r0r%r%r%r&s8