B Re;@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZmZmZmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&e&rZddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl#m8Z8m9Z9e:e;Ze$j?e$j@e$jAgZBdd ZCGd!d"d"e>ZDdS)#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) cmdoptions)Command)CommandContextMixIn) CommandErrorPreviousBuildDirError) LinkCollector) PackageFinder)SelectionPreferences) Downloader) PipSession)RequirementPreparer)install_req_from_editableinstall_req_from_line#install_req_from_parsed_requirementinstall_req_from_req_string)parse_requirements)pip_self_version_check) tempdir_kinds)MYPY_CHECK_RUNNING)Values)AnyListOptionalTuple) WheelCache) TargetPython)InstallRequirement)RequirementTracker) BaseResolver) TempDirectoryTempDirectoryTypeRegistrycs>eZdZdZfddZeddZddZd d d ZZ S) SessionCommandMixinzE A class mixin for command classes needing _build_session(). cstt|d|_dS)N)superr"__init___session)self) __class__/builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/cli/req_command.pyr$8szSessionCommandMixin.__init__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)clsoptions index_urlsurlurlsr(r(r)_get_index_urls=s     z#SessionCommandMixin._get_index_urlscCs0|jdkr*||||_|jdk s*t|jS)zGet a default-managed session.N)r% enter_context_build_sessionAssertionError)r&r1r(r(r)get_default_sessionLs z'SessionCommandMixin.get_default_sessionNcCs|jrtj|jstt|jr0tj|jdnd|dk r>|n|j|j| |d}|j rb|j |_ |j rp|j |_ |j sz|r|dk r|n|j |_ |jr|j|jd|_|j |j_|S)Nhttp)cacheretries trusted_hostsr2)r:https) cache_dirospathisabsr8r joinr<r=r5certverify client_certtimeoutproxyproxiesno_inputauth prompting)r&r1r<rGsessionr(r(r)r7Ws"   z"SessionCommandMixin._build_session)NN) __name__ __module__ __qualname____doc__r$ classmethodr5r9r7 __classcell__r(r()r'r)r"3s    r"c@seZdZdZddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. c CsTt|dst|js|jrdS|j|dtd|jd}|t||WdQRXdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r*Nr)r<rG)hasattrr8disable_pip_version_checkr*r7minrGr)r&r1rMr(r(r)handle_pip_version_checks z*IndexGroupCommand.handle_pip_version_checkN)rNrOrPrQrYr(r(r(r)rTsrTcsddfdd}|S)zNDecorator for common logic related to managing temporary directories. cSsxtD]}||dqWdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)registrytr(r(r)configure_tempdir_registrys z0with_cleanup..configure_tempdir_registrycsP|jdk st|jr|jy |||Stk rJ|jYnXdS)N)tempdir_registryr8no_cleanr)r&r1args)r^funcr(r)wrappers   zwith_cleanup..wrapperr()rbrcr()r^rbr) with_cleanupsrdc sVeZdZfddZedddZedd d Zd d Zed dZdddZ Z S)RequirementCommandcs&tt|j|||jtdS)N)r#rer$cmd_opts add_optionrr`)r&rakw)r'r(r)r$szRequirementCommand.__init__Nc CsBt||jd}|j} | dk s tt| |j|||j||||j|d S)zQ Create a RequirementPreparer instance for the given parameters. ) progress_barN) build_dirsrc_dir download_dirwheel_download_dirbuild_isolation req_tracker downloaderfinderrequire_hashes use_user_site)r rirAr8r rkrnrr) temp_build_dirr1rorMrqrsrlrmrptemp_build_dir_pathr(r(r)make_requirement_preparers z,RequirementCommand.make_requirement_preparerFTto-satisfy-onlyc Cstt|j| d} d|jkrTddl} | jjjjj |||| ||j ||||| d|jkd Sddl } | jjj jj |||| ||j ||||| d S)zF Create a Resolver instance for the given parameters. )isolated use_pep517z 2020-resolverrNz fast-deps) preparerrq wheel_cachemake_install_reqrsignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info lazy_wheel) rzrqr{r|rsr}r~rrrr) rr isolated_modefeatures_enabled,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibresolverResolverr}(pip._internal.resolution.legacy.resolverlegacy) rzrqr1r{rsr~rrrryrr|pipr(r(r) make_resolvers@   z RequirementCommand.make_resolverc Csfg}xD|jD]:}x4t|d|||dD]}t||jdd}||q$Wq Wx,|D]$} t| d|j|jdd}||qPWx,|jD]"} t| d|j|jd}||qWxF|j D]<}x6t||||dD]"}t||j|jdd}||qWqWt d d |Drd|_ |sb|jsb|j sbd |j i} |j rRtd jft| d |j dntdjf| |S)zS Parse command-line arguments into the corresponding requirements. T) constraintrqr1rMF)rx user_suppliedN)rxryr)rrxry)rqr1rMcss|] }|jVqdS)N)has_hash_options).0reqr(r(r) Zsz6RequirementCommand.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.rry editablesr requirementsanyrrr find_linksrformatdictrC) r&rar1rqrMrfilename parsed_req req_to_addroptsr(r(r)get_requirements#s\        z#RequirementCommand.get_requirementscCs |j}|}|rt|dS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsloggerinfo)rqr locationsr(r(r)trace_basic_infoksz#RequirementCommand.trace_basic_infocCs6tj||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. )r1T) allow_yankedformat_controlallow_all_prereleases prefer_binaryr)link_collectorselection_prefs target_python)rcreater rprerr )r&r1rMrrrrr(r(r)_build_package_finderwsz(RequirementCommand._build_package_finder)NN)NFTFFrwNN)NN) rNrOrPr$ staticmethodrvrrrrrSr(r()r'r)res"   -H re)ErQloggingr@ functoolsrZpip._internal.clirpip._internal.cli.base_commandr!pip._internal.cli.command_contextrpip._internal.exceptionsrrpip._internal.index.collectorr"pip._internal.index.package_finderr $pip._internal.models.selection_prefsr pip._internal.network.downloadr pip._internal.network.sessionr pip._internal.operations.preparer pip._internal.req.constructorsrrrrZpip._internal.req.req_filer!pip._internal.self_outdated_checkrpip._internal.utils.temp_dirrpip._internal.utils.typingroptparsertypingrrrrpip._internal.cacher"pip._internal.models.target_pythonrZpip._internal.req.req_installrpip._internal.req.req_trackerrpip._internal.resolution.baserr r! getLoggerrNrr"rT BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDrZrdrer(r(r(r)sF                     L