Re;@sPdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZmZmZmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&e&rddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl#m8Z8m9Z9ej:e;Z<Gddde Z=Gdddee=Z>e$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) TempDirectoryTempDirectoryTypeRegistrycsXeZdZdZfddZeddZddZddd d ZS) SessionCommandMixinzE A class mixin for command classes needing _build_session(). cs tt|jd|_dS)N)superr"__init___session)self) __class__/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/req_command.pyr$8szSessionCommandMixin.__init__cCslg}t|dds=t|dd}|r=|j|t|dd}|rb|j||pkdS)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_urlscCsF|jdkr?|j|j||_|jdk s?t|jS)zGet a default-managed session.N)r% enter_context_build_sessionAssertionError)r&r1r(r(r)get_default_sessionLsz'SessionCommandMixin.get_default_sessionNc Cs|j s%tjj|js%ttd|jrLtjj|jdndd|dk rd|n|jd|jd|j |}|j r|j |_ |j r|j |_ |j s|r|dk r|n|j |_ |jrd|jd|ji|_|j |j_|S)Ncachehttpretries trusted_hostsr2https) cache_dirospathisabsr8r joinr<r=r5certverify client_certtimeoutproxyproxiesno_inputauth prompting)r&r1r<rGsessionr(r(r)r7Ws"%'       z"SessionCommandMixin._build_session) __name__ __module__ __qualname____doc__r$ classmethodr5r9r7r(r()r'r)r"3s  r"c@s"eZdZdZddZdS)IndexGroupCommandz Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. c Csqt|dst|js'|jr+dS|j|dddtd|j}|t||WdQRXdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r*Nr<rrG)hasattrr8disable_pip_version_checkr*r7minrGr)r&r1rMr(r(r)handle_pip_version_checksz*IndexGroupCommand.handle_pip_version_checkN)rNrOrPrQrXr(r(r(r)rSs rScs%ddfdd}|S)zNDecorator for common logic related to managing temporary directories. cSs%xtD]}|j|dqWdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)registrytr(r(r)configure_tempdir_registrys z0with_cleanup..configure_tempdir_registryc sh|jdk st|jr+|jy|||SWn"tk rc|jYnXdS)N)tempdir_registryr8no_cleanr)r&r1args)r]funcr(r)wrappers    zwith_cleanup..wrapperr()rarbr()r]rar) with_cleanups rcc seZdZfddZeddddZeddddddddd d Zd d Zed dZddddZ S)RequirementCommandcs3tt|j|||jjtjdS)N)r#rdr$cmd_opts add_optionrr_)r&r`kw)r'r(r)r$szRequirementCommand.__init__Nc Cs|t|d|j}|j} | dk s0ttd| d|jd|d|d|jd|d |d |d |jd | 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 rhrAr8r rjrmrq) temp_build_dirr1rnrMrprrrkrlrotemp_build_dir_pathr(r(r)make_requirement_preparers    z,RequirementCommand.make_requirement_preparerFTzto-satisfy-onlyc Csttd|jd| } d|jkrddl} | jjjjj d|d|d|d | d |d |j d |d |d|d|d| dd|jk Sddl } | jjj jj d|d|d|d | d |d |j d |d |d|d|d| S)zF Create a Resolver instance for the given parameters. isolated use_pep517z 2020-resolverrNpreparerrp wheel_cachemake_install_reqrrignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info lazy_wheelz fast-deps) rr isolated_modefeatures_enabled,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibresolverResolverr{(pip._internal.resolution.legacy.resolverlegacy) rxrpr1ryrrr|r}r~rrwrrzpipr(r(r) make_resolvers@      z RequirementCommand.make_resolverc Csg}xh|jD]]}xTt|ddd|d|d|D].}t|d|jdd}|j|q;WqWxB|D]:} t| d d|jd |jdd}|j|qxWxB|jD]7} t| ddd|jd |j}|j|qWxk|j D]`}xWt|d|d|d|D]7}t|d|jd |jdd}|j|q*WqWt d d |Drd|_ |p|jp|j sd |j i} |j rtdjt| ddj|j ntdj| |S)zS Parse command-line arguments into the corresponding requirements. constraintTrpr1rMrv user_suppliedFNrwcss|]}|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}"?)links zHYou must give at least one requirement to {name} (see "pip help {name}")) constraintsrrrr.rrw editablesr requirementsanyrqr find_linksrformatdictrC) r&r`r1rprMrfilename parsed_req req_to_addroptsr(r(r)get_requirements#s\              ' z#RequirementCommand.get_requirementscCs,|j}|j}|r(tj|dS)zE Trace basic information about the provided objects. N) search_scopeget_formatted_locationsloggerinfo)rpr locationsr(r(r)trace_basic_infoks  z#RequirementCommand.trace_basic_infoc Csatj|d|}tddd|jd|jd|jd|}tjd|d |d |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. r1 allow_yankedTformat_controlallow_all_prereleases prefer_binaryr}link_collectorselection_prefs target_python)rcreater rprerr )r&r1rMrr}rrr(r(r)_build_package_finderws     z(RequirementCommand._build_package_finder) rNrOrPr$ staticmethodrurrrrr(r()r'r)rds" - Hrd)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"rS BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDrYrcrdr(r(r(r)sF  ""L