U
ʗReF @ s d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m
Z
mZmZm
Z
ddlmZ ddlmZ ddlmZ dd lmZ dd
lmZmZ ddlmZ ddlmZ dd
lmZ ddlm Z ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9 e r^ddl:m;Z; eed dddZ?G dd deZ@G d d! d!ee@ZAe7jBe7jCe7jDgZEddd"d#ZFe
e
d$d%d&ZGG d'd( d(eAZHdS ))a Contains 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)Values)
TYPE_CHECKINGAnyListOptionalTuple)
WheelCache)
cmdoptions)Command)CommandContextMixIn)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)pip_self_version_check)
TempDirectoryTempDirectoryTypeRegistry
tempdir_kinds)running_under_virtualenv)
SSLContextr" returnc C sv t jdk rtdzdd l} W n tk
r> td Y d S X zdd l}W n tk
rh tdY nX || j S )N)
z9The truststore feature is only available for Python 3.10+r z1Disabling truststore since ssl support is missingz]To use the truststore feature, 'truststore' must be installed into pip's current environment.)
sysversion_infor
sslImportErrorloggerwarning
truststorer" PROTOCOL_TLS_CLIENT)r) r- r/ /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/cli/req_command.py_create_truststore_ssl_context2 s
r1 c sr e Zd ZdZdd fddZeeeee dddZ
eedd d
Zdeee
ee
eedd
dZ ZS )SessionCommandMixinzE
A class mixin for command classes needing _build_session().
Nr# c s t d | _d S N)super__init___session)self __class__r/ r0 r5 M s
zSessionCommandMixin.__init__optionsr$ c C sL g }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)clsr;
index_urlsurlurlsr/ r/ r0 _get_index_urlsQ s
z#SessionCommandMixin._get_index_urlsc C s0 | j dkr*| | || _ | j dk s*t| j S )zGet a default-managed session.N)r6
enter_context_build_sessionAssertionError)r7 r; r/ r/ r0 get_default_session_ s
z'SessionCommandMixin.get_default_sessionF)r; retriestimeoutfallback_to_certifir$ c C s |j }|rtj|std|jkrPz
t }W qT tk
rL |sD d }Y qTX nd }t|rhtj |dnd |d k rv|n|j
|j| ||d}|j
r|j
|_|jr|j|_
|js|r|d k r|n|j|_|jr|j|jd|_|j |j_|S )Nr- http)cacherK
trusted_hostsrC ssl_context)rN https) cache_dirospathisabsrI features_enabledr1 Exceptionr joinrK rP rF certverifyclient_certrL proxyproxiesno_inputauth prompting)r7 r; rK rL rM rS rQ sessionr/ r/ r0 rH i s:
z"SessionCommandMixin._build_session)NNF)__name__
__module____qualname____doc__r5 classmethodr r r strrF r rJ intboolrH
__classcell__r/ r/ r8 r0 r2 G s
r2 c @ s e Zd ZdZeddddZdS )IndexGroupCommandz
Abstract base class for commands with the index_group options.
This also corresponds to the commands that permit the pip version check.
Nr: c C sV t |dst|js|jrdS | j|dtd|jdd}| t|| W 5 Q R X dS )z
Do the pip version check if not disabled.
This overrides the default behavior of not doing the check.
r<