U n a;@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZmZmZmZddlmZddlm Z ddl!m"Z"m#Z#ddl$m%Z%ddl&m'Z'e'r^ddl(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl$m9Z9m:Z:e;e<Z=Gddde Z>Gdddee>Z?e%j@e%jAe%jBgZCdd ZDGd!d"d"e?ZEdS)#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) PackageFinder)SelectionPreferences) Downloader) PipSession)RequirementPreparer)install_req_from_editableinstall_req_from_line#install_req_from_parsed_requirementinstall_req_from_req_string)parse_requirements)RequirementSet)make_link_collectorpip_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__^C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\cli\req_command.pyr&;szSessionCommandMixin.__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(r4r+r+r,get_default_sessionOs 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_hostsr5)r=https) cache_dirospathisabsr;r joinr?r@r8certverify client_certtimeoutproxyproxiesno_inputauth prompting)r(r4r?rJsessionr+r+r,r:Zs,   z"SessionCommandMixin._build_session)NN) __name__ __module__ __qualname____doc__r& classmethodr8r<r: __classcell__r+r+r)r,r#6s    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?rJ)hasattrr;disable_pip_version_checkr-r:minrJr)r(r4rPr+r+r,handle_pip_version_checks  z*IndexGroupCommand.handle_pip_version_checkN)rQrRrSrTr\r+r+r+r,rWsrWcsddfdd}|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(r4argsrafuncr+r,wrappers  zwith_cleanup..wrapperr+)rfrgr+rer, with_cleanupsrhc sXeZdZfddZedddZedd d Zdd d Zed dZdddZ Z S)RequirementCommandcs&tt|j|||jtdSr$)r%rir&cmd_opts add_optionrrc)r(rdkwr)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 rmrDr;r rorrrv) temp_build_dirr4rsrPrurwrprqrttemp_build_dir_pathr+r+r,make_requirement_preparers z,RequirementCommand.make_requirement_preparerFTto-satisfy-onlyc Cs~tt|j| d} d|jkrLddl} | jjjjj |||| ||j ||||| d Sddl } | jjj jj |||| ||j ||||| d S)zF Create a Resolver instance for the given parameters. isolated use_pep517resolverrN) preparerru wheel_cachemake_install_reqrwignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info) rr isolated_modeunstable_features,pip._internal.resolution.resolvelib.resolver _internal resolution resolvelibrResolverr(pip._internal.resolution.legacy.resolverlegacy) rrur4rrwrrrrr~rrpipr+r+r, make_resolversD    z RequirementCommand.make_resolverc Csjt|d}|jD]:}t|d|||dD]"}t||jd} d| _|| q&q|D](} t| d|j|jd} d| _|| qP|j D]&} t | |j|jd} d| _|| q|j D]<}t||||dD]&}t||j|jd} d| _|| qq|j } t dd | Dr d|_|sf|j sf|j sfd |ji} |jrVtd jft| d |jd ntdjf| | S)zS Parse command-line arguments into the corresponding requirements. )check_supported_wheelsT) constraintrur4rP)r}Nr|)rur4rPcss|] }|jVqdSr$)has_hash_options).0reqr+r+r, `sz6RequirementCommand.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}"))r constraintsrrr is_directadd_requirementrr~ editablesr requirementsall_requirementsanyrvr find_linksrformatdictrF) r(rdr4rurPrrequirement_setfilename parsed_req req_to_addrroptsr+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)rur locationsr+r+r,trace_basic_infoqsz#RequirementCommand.trace_basic_infocCs4t||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. )r4T) allow_yankedformat_controlallow_all_prereleases prefer_binaryr)link_collectorselection_prefs target_python)rr rprerrcreate)r(r4rPrrrrr+r+r,_build_package_finder}s z(RequirementCommand._build_package_finder)NN)NFTFFr{NN)T)NN) rQrRrSr& staticmethodrzrrrrrVr+r+r)r,ris,   = L ri)FrTloggingrC functoolsrZpip._internal.clirpip._internal.cli.base_commandr!pip._internal.cli.command_contextrpip._internal.exceptionsrr"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.constructorsr rrrZpip._internal.req.req_filerZpip._internal.req.req_setr!pip._internal.self_outdated_checkrrpip._internal.utils.temp_dirrpip._internal.utils.typingroptparsertypingrrrrpip._internal.cacher"pip._internal.models.target_pythonrZpip._internal.req.req_installrpip._internal.req.req_trackerrpip._internal.resolution.baser r!r" getLoggerrQrr#rW BUILD_ENVEPHEM_WHEEL_CACHE REQ_BUILDr]rhrir+r+r+r,sH                    L