zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
U
H=®d;ã@s²dZddlZddlZddlmZddlmZddlmZddl    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;¡Z<Gdd„de
ƒZ=Gdd„dee=ƒ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)Ú CommandErrorÚPreviousBuildDirError)Ú LinkCollector)Ú PackageFinder)ÚSelectionPreferences)Ú
Downloader)Ú
PipSession)ÚRequirementPreparer)Úinstall_req_from_editableÚinstall_req_from_lineÚ#install_req_from_parsed_requirementÚinstall_req_from_req_string)Úparse_requirements)Úpip_self_version_check)Ú tempdir_kinds)ÚMYPY_CHECK_RUNNING)ÚValues)ÚAnyÚListÚOptionalÚTuple)Ú
WheelCache)Ú TargetPython)ÚInstallRequirement)ÚRequirementTracker)Ú BaseResolver)Ú TempDirectoryÚTempDirectoryTypeRegistrycs>eZdZdZ‡fdd„Zedd„ƒZdd„Zd d    d
„Z‡Z    S) ÚSessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    cstt|ƒ ¡d|_dS©N)Úsuperr"Ú__init__Ú_session)Úself©Ú    __class__©úTD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/cli/req_command.pyr%8szSessionCommandMixin.__init__cCsLg}t|ddƒs*t|ddƒ}|r*| |¡t|ddƒ}|rD| |¡|pJdS)z7Return a list of index urls from user-provided options.Úno_indexFÚ    index_urlNÚextra_index_urls)ÚgetattrÚappendÚextend)ÚclsÚoptionsÚ
index_urlsÚurlÚurlsr*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_sessionÚAssertionError)r'r3r*r*r+Úget_default_sessionLs
z'SessionCommandMixin.get_default_sessionNcCs´|jrtj |j¡st‚t|jr0tj |jd¡nd|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)NÚhttp)ÚcacheÚretriesÚ trusted_hostsr4)r<Úhttps)Ú    cache_dirÚosÚpathÚisabsr:r Újoinr>r?r7ÚcertÚverifyÚ client_certÚtimeoutÚproxyÚproxiesÚno_inputÚauthÚ    prompting)r'r3r>rIÚsessionr*r*r+r9Ws,ÿù 
ÿþ z"SessionCommandMixin._build_session)NN)
Ú__name__Ú
__module__Ú __qualname__Ú__doc__r%Ú classmethodr7r;r9Ú __classcell__r*r*r(r+r"3s  
 r"c@seZdZdZdd„ZdS)Ú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|dƒst‚|js|jrdS|j|dtd|jƒd}|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,r9ÚminrIr)r'r3rOr*r*r+Úhandle_pip_version_check‡s 
ýz*IndexGroupCommand.handle_pip_version_checkN)rPrQrRrSr[r*r*r*r+rVsrVcsdd„‰‡‡fdd„}|S)zNDecorator for common logic related to managing temporary
    directories.
    cSstD]}| |d¡qdS)NF)ÚKEEPABLE_TEMPDIR_TYPESÚ
set_delete)ÚregistryÚtr*r*r+Úconfigure_tempdir_registryªsz0with_cleanup.<locals>.configure_tempdir_registrycsR|jdk    st‚|jrˆ|jƒzˆ|||ƒWStk
rLˆ|jƒ‚YnXdSr#)Útempdir_registryr:Úno_cleanr)r'r3Úargs©r`Úfuncr*r+Úwrapper¯s
 
zwith_cleanup.<locals>.wrapperr*)rerfr*rdr+Ú with_cleanup¥srgc    sVeZdZ‡fdd„Zeddd„ƒZedd    d
„ƒZd d „Zed d„ƒZddd„Z    ‡Z
S)ÚRequirementCommandcs&tt|ƒj||Ž|j t ¡¡dSr#)r$rhr%Úcmd_optsÚ
add_optionrrb)r'rcÚkwr(r*r+r%ÃszRequirementCommand.__init__Nc
CsBt||jd}|j}    |    dk    s t‚t|    |j|||j||||j|d
S)zQ
        Create a RequirementPreparer instance for the given parameters.
        )Ú progress_barN)
Ú    build_dirÚsrc_dirÚ download_dirÚwheel_download_dirÚbuild_isolationÚ req_trackerÚ
downloaderÚfinderÚrequire_hashesÚ use_user_site)r rlrCr:r rnrqru)
Útemp_build_dirr3rrrOrtrvrorprsÚtemp_build_dir_pathr*r*r+Úmake_requirement_preparerÉs öz,RequirementCommand.make_requirement_preparerFTúto-satisfy-onlyc Cs†tt|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_cacheÚmake_install_reqrvÚignore_dependenciesÚignore_installedÚignore_requires_pythonÚforce_reinstallÚupgrade_strategyÚpy_version_infoÚ
lazy_wheel) r}rtr~rrvr€rr‚rƒr„r…) rrÚ isolated_modeÚfeatures_enabledÚ,pip._internal.resolution.resolvelib.resolverÚ    _internalÚ
resolutionÚ
resolvelibÚresolverÚResolverr€Ú(pip._internal.resolution.legacy.resolverÚlegacy) r}rtr3r~rvrr‚rƒr„r|r…rÚpipr*r*r+Ú make_resolverêsFý
 ô õz RequirementCommand.make_resolverc CsLg}|jD]6}t|d|||dD]}t||jdd}| |¡q q
|D]$}    t|    d|j|jdd}| |¡qF|jD]"}    t|    d|j|jd}| |¡qr|j    D]8}t||||dD]"}t||j|jdd}| |¡q°qœt
d    d
„|Dƒƒrîd|_ |sH|jsH|j    sHd |j i}
|j r8td jft|
d  |j ¡dŽƒ‚ntdjf|
Žƒ‚|S)zS
        Parse command-line arguments into the corresponding requirements.
        T)Ú
constraintrtr3rOF)r{Ú user_suppliedN)r{r|r”)r”r{r|)rtr3rOcss|] }|jVqdSr#)Úhas_hash_options)Ú.0Úreqr*r*r+Ú    <genexpr>Zsz6RequirementCommand.get_requirements.<locals>.<genexpr>Ú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}"))Ú constraintsrrr‡r0rr|Ú    editablesrÚ requirementsÚanyrur™Ú
find_linksrÚformatÚdictrE) r'rcr3rtrOržÚfilenameÚ
parsed_reqÚ
req_to_addr—Úoptsr*r*r+Úget_requirements#s| 
ý
ýý 
ü 
þ
ü
þÿÿÿz#RequirementCommand.get_requirementscCs |j}| ¡}|rt |¡dS)zE
        Trace basic information about the provided objects.
        N)Ú search_scopeÚget_formatted_locationsÚloggerÚinfo)rtr¨Ú    locationsr*r*r+Útrace_basic_infoksz#RequirementCommand.trace_basic_infocCs6tj||d}td|j|j|j|d}tj|||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.
        )r3T)Ú allow_yankedÚformat_controlÚallow_all_prereleasesÚ prefer_binaryr‚)Úlink_collectorÚselection_prefsÚ target_python)rÚcreater
r¯Úprer±r    )r'r3rOr´r‚r²r³r*r*r+Ú_build_package_finderwsûýz(RequirementCommand._build_package_finder)NN)NFTFFrzNN)NN) rPrQrRr%Ú staticmethodryr’r§r­r·rUr*r*r(r+rhÁs* ø  õ 8H
ûrh)ErSÚloggingrBÚ    functoolsrZpip._internal.clirÚpip._internal.cli.base_commandrÚ!pip._internal.cli.command_contextrÚpip._internal.exceptionsrrÚpip._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_checkrÚpip._internal.utils.temp_dirrÚpip._internal.utils.typingrÚoptparserÚtypingrrrrÚpip._internal.cacherÚ"pip._internal.models.target_pythonrZpip._internal.req.req_installrÚpip._internal.req.req_trackerrÚpip._internal.resolution.baserr r!Ú    getLoggerrPrªr"rVÚ    BUILD_ENVÚEPHEM_WHEEL_CACHEÚ    REQ_BUILDr\rgrhr*r*r*r+Ú<module>sH                    
L ý