U v_;@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|_dSN)superr"__init___session)self __class__/builddir/build/BUILDROOT/alt-python38-pip-20.2.4-1.el7.x86_64/opt/alt/python38/lib/python3.8/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'r3r*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_hostsr4)r<https) cache_dirospathisabsr:r joinr>r?r7certverify client_certtimeoutproxyproxiesno_inputauth prompting)r'r3r>rIsessionr*r*r+r9Ws,   z"SessionCommandMixin._build_session)NN) __name__ __module__ __qualname____doc__r% classmethodr7r;r9 __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||W5QRXdS)z Do the pip version check if not disabled. This overrides the default behavior of not doing the check. r,Nr)r>rI)hasattrr:disable_pip_version_checkr,r9minrIr)r'r3rOr*r*r+handle_pip_version_checks  z*IndexGroupCommand.handle_pip_version_checkN)rPrQrRrSr[r*r*r*r+rVsrVcsddfdd}|S)zNDecorator for common logic related to managing temporary directories. cSstD]}||dqdS)NF)KEEPABLE_TEMPDIR_TYPES set_delete)registrytr*r*r+configure_tempdir_registrysz0with_cleanup..configure_tempdir_registrycsR|jdk st|jr|jz|||WStk rL|jYnXdSr#)tempdir_registryr:no_cleanr)r'r3argsr`funcr*r+wrappers  zwith_cleanup..wrapperr*)rerfr*rdr+ with_cleanupsrgc sVeZdZfddZedddZedd d Zd d Zed dZdddZ Z S)RequirementCommandcs&tt|j|||jtdSr#)r$rhr%cmd_opts add_optionrrb)r'rckwr(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 rlrCr:r rnrqru) temp_build_dirr3rrrOrtrvrorprstemp_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) preparerrt wheel_cachemake_install_reqrvignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info lazy_wheel) r}rtr~rrvrrrrrr) rr isolated_modefeatures_enabled,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibresolverResolverr(pip._internal.resolution.legacy.resolverlegacy) r}rtr3r~rvrrrrr|rrpipr*r*r+ make_resolversF   z RequirementCommand.make_resolverc CsLg}|jD]6}t|d|||dD]}t||jdd}||q q |D]$} t| d|j|jdd}||qF|jD]"} t| d|j|jd}||qr|j D]8}t||||dD]"}t||j|jdd}||qqt d d |Drd|_ |sH|jsH|j sHd |j i} |j r8td jft| d |j dntdjf| |S)zS Parse command-line arguments into the corresponding requirements. T) constraintrtr3rOF)r{ user_suppliedN)r{r|r)rr{r|)rtr3rOcss|] }|jVqdSr#)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}")) constraintsrrrr0rr| editablesr requirementsanyrur find_linksrformatdictrE) r'rcr3rtrOrfilename 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)rtr 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. )r3T) allow_yankedformat_controlallow_all_prereleases prefer_binaryr)link_collectorselection_prefs target_python)rcreater rprerr )r'r3rOrrrrr*r*r+_build_package_finderwsz(RequirementCommand._build_package_finder)NN)NFTFFrzNN)NN) rPrQrRr% staticmethodryrrrrrUr*r*r(r+rhs*   8H rh)ErSloggingrB 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! getLoggerrPrr"rV BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDr\rgrhr*r*r*r+sH                     L