zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
U
H=®d8ã@s@ddlmZddlZddlZddlZddlZddlZddlZddlm    Z    m
Z
ddl m Z ddl mZddlmZddlmZddlmZdd    lmZdd
lmZdd lmZdd lmZdd lmZdd lmZ ddl!m"Z#ddl$m%Z%ddl$m&Z'ddl(m)Z)ddl*m+Z+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@ddlAmBZBddlCmDZDmEZEddlFmGZGddlHmIZIddlJmKZKeGrddlLmMZMmNZNmOZOmPZPmQZQmRZRmSZSddlmTZTdd lUmVZVdd!lWmXZXdd"lYmZZZe [e\¡Z]d#d$„Z^Gd%d&„d&e_ƒZ`d'd(„ZadS))é)Úabsolute_importN)Ú pkg_resourcesÚsix)Ú Requirement)Úcanonicalize_name)ÚVersion)Úparse)ÚPep517HookCaller)ÚNoOpBuildEnvironment)ÚInstallationError)Ú
get_scheme)ÚLink)Úgenerate_metadata)Úinstall_editable)ÚLegacyInstallFailure)Úinstall)Ú install_wheel)Úload_pyproject_tomlÚmake_pyproject_path)ÚUninstallPathSet)Ú
deprecated)Údirect_url_from_link)ÚHashes)Ú
indent_log)    Úask_path_existsÚ
backup_dirÚ display_pathÚdist_in_site_packagesÚdist_in_usersiteÚget_distributionÚget_installed_versionÚhide_urlÚredact_auth_from_url)Ú get_metadata)Ú TempDirectoryÚ tempdir_kinds)ÚMYPY_CHECK_RUNNING)Úrunning_under_virtualenv)Úvcs)ÚAnyÚDictÚIterableÚListÚOptionalÚSequenceÚUnion)ÚBuildEnvironment)Ú Distribution)Ú SpecifierSet)ÚMarkercCs†| tj¡}tj |¡\}}t ||¡}| d¡rJtj}tj     |¡d}n.| d¡sXt
‚tj }tj     |¡d d¡d}||||dS)zQReturn a pkg_resources.Distribution for the provided
    metadata directory.
    z    .egg-inforz
.dist-infoú-)Ú project_nameÚmetadata) ÚrstripÚosÚsepÚpathÚsplitrÚ PathMetadataÚendswithr1ÚsplitextÚAssertionErrorÚDistInfoDistribution)Úmetadata_directoryÚdist_dirÚbase_dirÚ dist_dir_namer6Údist_clsÚ    dist_name©rGúTD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/req/req_install.pyÚ    _get_distDs  
ýrIc @sFeZdZdZdFdd„Zdd„Zd    d
„Zd d „Zed d„ƒZ    edd„ƒZ
edd„ƒZ edd„ƒZ dGdd„Z edd„ƒZdHdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zed&d'„ƒZed(d)„ƒZed*d+„ƒZed,d-„ƒZd.d/„Zd0d1„Zd2d3„Zed4d5„ƒZd6d7„Zd8d9„ZdId:d;„ZdJd<d=„Z dKd>d?„Z!d@dA„Z"dBdC„Z#dLdDdE„Z$dS)MÚInstallRequirementzÆ
    Represents something that may be installed later on, may have information
    about where to fetch the relevant requirement and also contains logic for
    installing the said requirement.
    FNrGcCs~|dkst|tƒst|ƒ‚||_||_| |_||_d|_|jrd|sFt‚|jrdt    j
  t    j
  |j ¡¡|_|dkr€|r€|jr€t|jƒ}||_|_d|_d|_|jr°|jjr°|jj |_| r¼| |_n |rÔdd„|jDƒ|_ntƒ|_|dkrî|rî|j}||_d|_d|_d|_d|_|r|ng|_|    r&|    ng|_|
r6|
ni|_d|_| |_ d|_!||_"t#ƒ|_$d|_%d|_&g|_'d|_(||_)dS)NFcSsh|]}t |¡’qSrG)rÚ
safe_extra©Ú.0ÚextrarGrGrHÚ    <setcomp>˜sz.InstallRequirement.__init__.<locals>.<setcomp>)*Ú
isinstancerr?ÚreqÚ
comes_fromÚ
constraintÚeditableÚ
source_dirÚis_filer8r:ÚnormpathÚabspathÚ    file_pathÚurlr ÚlinkÚ original_linkÚoriginal_link_is_in_wheel_cacheÚlocal_file_pathÚextrasÚsetÚmarkerÚmarkersÚ satisfied_byÚshould_reinstallÚ_temp_build_dirÚinstall_succeededÚinstall_optionsÚglobal_optionsÚ hash_optionsÚpreparedÚ user_suppliedÚsuccessfully_downloadedÚisolatedr
Ú    build_envrAÚpyproject_requiresÚrequirements_to_checkÚpep517_backendÚ
use_pep517)ÚselfrQrRrTr[rbrrrmrgrhrirSr_rkrGrGrHÚ__init__fs\ ÿ
 
ÿ
     zInstallRequirement.__init__cCs¢|jr.t|jƒ}|jrF|d t|jjƒ¡7}n|jrBt|jjƒ}nd}|jdk    rf|d t|jjƒ¡7}|j    ržt
|j    t j ƒr‚|j    }n
|j      ¡}|rž|d |¡7}|S)Nz from {}z<InstallRequirement>z in {}z
 (from {}))rQÚstrr[Úformatr"rZrcrÚlocationrRrPrÚ string_typesÚ    from_path©rsÚsrRrGrGrHÚ__str__Øs 
 
 
zInstallRequirement.__str__cCsd |jjt|ƒ|j¡S)Nz<{} object: {} editable={!r}>)rvÚ    __class__Ú__name__rurT©rsrGrGrHÚ__repr__ís
ÿzInstallRequirement.__repr__cs>t|ƒ‰tˆƒ}‡fdd„t|ƒDƒ}dj|jjd |¡dS)z>An un-tested helper for getting state, for debugging.
        c3s|]}d |ˆ|¡VqdS)z{}={!r}N)rv)rMÚattr©Ú
attributesrGrHÚ    <genexpr>ùsz2InstallRequirement.format_debug.<locals>.<genexpr>z<{name} object: {{{state}}}>z, )ÚnameÚstate)ÚvarsÚsortedrvr}r~Újoin)rsÚnamesr†rGr‚rHÚ format_debugòs
ÿþzInstallRequirement.format_debugcCs"|jdkrdSt t |jj¡¡S©N)rQrÚ
ensure_strrÚ    safe_namer…rrGrGrHr…s
zInstallRequirement.namecCs|jjSrŒ)rQÚ    specifierrrGrGrHr    szInstallRequirement.specifiercCs$|j}t|ƒdko"tt|ƒƒjdkS)z„Return whether I am pinned to an exact version.
 
        For example, some-package==1.2 is pinned; some-package>1.2 is not.
        é>ú==ú===)rÚlenÚnextÚiterÚoperator)rsÚ
specifiersrGrGrHÚ    is_pinneds ÿzInstallRequirement.is_pinnedcCs
t|jƒSrŒ)r r…rrGrGrHÚinstalled_versionsz$InstallRequirement.installed_versioncs0|sd}ˆjdk    r(t‡fdd„|DƒƒSdSdS)N)Úc3s|]}ˆj d|i¡VqdS)rNN)rbÚevaluaterLrrGrHr„%sÿz3InstallRequirement.match_markers.<locals>.<genexpr>T)rbÚany)rsÚextras_requestedrGrrHÚ match_markerss
 þz InstallRequirement.match_markerscCs
t|jƒS)z©Return whether any known-good hashes are specified as options.
 
        These activate --require-hashes mode; hashes specified as part of a
        URL do not.
 
        )ÚboolrirrGrGrHÚhas_hash_options+s    z#InstallRequirement.has_hash_optionsTcCsB|j ¡}|r|jn|j}|r:|jr:| |jg¡ |j¡t|ƒS)a§Return a hash-comparer that considers my option- and URL-based
        hashes to be known-good.
 
        Hashes in URLs--ones embedded in the requirements file, not ones
        downloaded from an index server--are almost peers with ones from
        flags. They satisfy --require-hashes (whether it was implicitly or
        explicitly activated) but do not activate it. md5 and sha224 are not
        allowed in flags, which should nudge people toward good algos. We
        always OR all hashes together, even ones from URLs.
 
        :param trust_internet: Whether to trust URL-based (#md5=...) hashes
            downloaded from the internet, as by populate_link()
 
        )    riÚcopyr[r\ÚhashÚ
setdefaultÚ    hash_nameÚappendr)rsÚtrust_internetÚ good_hashesr[rGrGrHÚhashes6s
 
 
zInstallRequirement.hashescCsR|jdkrdSt|jƒ}|jrNt|jtjƒr4|j}n
|j ¡}|rN|d|7}|S)z@Format a nice indicator to show where this "comes from"
        Nz->)rQrurRrPrrxryrzrGrGrHryLs
 
 
 zInstallRequirement.from_pathcCs¼|dk    s t‚|jdk    r*|jjs"t‚|jjS|jdkrLttjdd|_|jjSt|jƒ}|rld     |t
  ¡j ¡}t j |¡sŽt d|¡t  |¡t j ||¡}|r¤dnd}t||tjddjS)NT)ÚkindÚglobally_managedz{}_{}zCreating directory %sF)r:Údeleter©rª)r?rer:rQr$r%Ú    REQ_BUILDrr…rvÚuuidÚuuid4Úhexr8ÚexistsÚloggerÚdebugÚmakedirsr‰)rsÚ    build_dirÚ
autodeleteÚparallel_buildsÚdir_nameÚactual_build_dirÚ
delete_argrGrGrHÚensure_build_location\s0 
 
ÿ
 
 üz(InstallRequirement.ensure_build_locationcCsn|jdkst‚|jdk    st‚|jdk    s*t‚tt|jdƒtƒrDd}nd}td |jd||jdg¡ƒ|_dS)z3Set requirement after generating metadata.
        Nrr‘r’ršÚName)    rQr?r6rUrPÚ parse_versionrrr‰)rsÚoprGrGrHÚ_set_requirement‚sýÿz#InstallRequirement._set_requirementcCsDt|jdƒ}t|jjƒ|kr"dSt d|j||j¡t|ƒ|_dS)Nr»zeGenerating metadata for package %s produced metadata for project name %s. Fix your #egg=%s fragments.)rr6rQr…r±Úwarningr)rsÚ metadata_namerGrGrHÚwarn_on_mismatching_name˜süz+InstallRequirement.warn_on_mismatching_namecCsž|jdkrdSt|jjƒ}|s"dS|j}|jjj|dds€d|_|rxt|ƒrTd|_q~t    ƒr~t
|ƒr~t d  |j |j¡ƒ‚qšd|_n|jr”d|_d|_n||_dS)z¬Find an installed distribution that satisfies or conflicts
        with this requirement, and set self.satisfied_by or
        self.should_reinstall appropriately.
        NT)Ú prereleaseszVWill not install to the user site because it will lack sys.path precedence to {} in {})rQrr…Úparsed_versionrÚcontainsrcrrdr'rr rvr5rwrT)rsÚ use_user_siteÚ existing_distÚexisting_versionrGrGrHÚcheck_if_exists¨s2
 ÿþÿz"InstallRequirement.check_if_existscCs|js
dS|jjS)NF)r[Úis_wheelrrGrGrHrÉÍszInstallRequirement.is_wheelcCstj |j|jr|jjpd¡S)Nrš)r8r:r‰rUr[Úsubdirectory_fragmentrrGrGrHÚunpacked_source_directoryÕsþz,InstallRequirement.unpacked_source_directorycCsH|jstd |¡ƒ‚tj |jd¡}tjrDt    |tj
ƒrD|  t   ¡¡}|S)NúNo source dir for {}zsetup.py)rUr?rvr8r:r‰rËrÚPY2rPÚ    text_typeÚencodeÚsysÚgetfilesystemencoding)rsÚsetup_pyrGrGrHÚ setup_py_pathÜs
z InstallRequirement.setup_py_pathcCs|jstd |¡ƒ‚t|jƒS)NrÌ)rUr?rvrrËrrGrGrHÚpyproject_toml_pathèsz&InstallRequirement.pyproject_toml_pathcCs^t|j|j|jt|ƒƒ}|dkr*d|_dSd|_|\}}}}||_||_t|j||d|_    dS)aALoad the pyproject.toml file.
 
        After calling this routine, all of the attributes related to PEP 517
        processing for this requirement have been set. In particular, the
        use_pep517 attribute can be used to determine whether we should
        follow the PEP 517 or legacy (setup.py) code path.
        NFT)Ú backend_path)
rrrrÔrÓrurpror    rËrq)rsÚpyproject_toml_dataÚrequiresÚbackendÚcheckrÕrGrGrHrîs$    ü ÿz&InstallRequirement.load_pyproject_tomlcCsV|js8|jst‚t|j|j|j|j|jp2d |j    ¡dS|j
dk    sFt‚t |j|j
dS)zKInvokes metadata generator functions, with the required arguments.
        zfrom {})rnrÓrUrmÚdetailsN)rnrØ) rrrËr?Úgenerate_metadata_legacyrnrÓrmr…rvr[rqrrrGrGrHÚ_generate_metadata
s
ûþz%InstallRequirement._generate_metadatac    CsJ|js
t‚tƒ| ¡|_W5QRX|js6| ¡n| ¡| ¡dS)z³Ensure that project metadata is available.
 
        Under PEP 517, call the backend hook to prepare the metadata.
        Under legacy processing, call setup.py egg-info.
        N)    rUr?rrÜrAr…r¾rÁÚassert_source_matches_versionrrGrGrHÚprepare_metadata s
 
z#InstallRequirement.prepare_metadatacCst|dƒst| ¡ƒ|_|jS)NÚ    _metadata)Úhasattrr#Úget_distrßrrGrGrHr64s
zInstallRequirement.metadatacCs
t|jƒSrŒ)rIrArrGrGrHrá<szInstallRequirement.get_distcCsR|js
t‚|jd}|jjr8||jjkr8t d||¡nt dt|jƒ||¡dS)NÚversionz'Requested %s, but installing version %sz;Source in %s has version %s, which satisfies requirement %s)    rUr?r6rQrr±r¿r²r)rsrârGrGrHrÝ@s
 
ýüz0InstallRequirement.assert_source_matches_versioncCs |jdkr|j|||d|_dS)aAEnsure that a source_dir is set.
 
        This will create a temporary build dir if the name of the requirement
        isn't known yet.
 
        :param parent_dir: The ideal pip parent_dir for the source_dir.
            Generally src_dir for editables and build_dir for sdists.
        :return: self.source_dir
        N)rµr¶)rUrº)rsÚ
parent_dirrµr¶rGrGrHÚensure_has_source_dirSs 
ýz(InstallRequirement.ensure_has_source_dircCs|jst d|j¡dS|js"t‚|js,t‚|jjdkr<dSd|jjksZtdjft    ƒŽƒ‚|jj 
dd¡\}}t   |¡}|rì|jj s¸d |jj¡}d}|jj d¡r¨d}t||d    d
d t|jjƒ}|rÚ|j|j|d n|j|j|d nd std |j|¡ƒ‚dS)Nz>Cannot update repository at %s; repository location is unknownÚfileú+zbad url: {self.link.url!r}rz5This form of VCS requirement is being deprecated: {}.zgit+git@zmgit+https://git@example.com/..., git+ssh://git@example.com/..., or the insecure git+git://git@example.com/...z21.0i‚)Úgone_inÚissue)rZrz+Unexpected version control type (in {}): {})r[r±r²rUrTr?ÚschemerZrvÚlocalsr;r(Ú get_backendÚis_vcsÚ
startswithrr!ÚobtainÚexport)rsrîÚvc_typerZÚ vcs_backendÚreasonÚ replacementÚ
hidden_urlrGrGrHÚupdate_editableksHý
 
  ÿ
ÿýÿ ÿÿz"InstallRequirement.update_editablecCsR|js
t‚t|jjƒ}|s,t d|j¡dSt d|¡t |¡}|     ||¡|S)a¥
        Uninstall the distribution currently satisfying this requirement.
 
        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.
 
        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.
 
        z#Skipping %s as it is not installed.NzFound existing installation: %s)
rQr?rr…r±r¿ÚinforÚ    from_distÚremove)rsÚ auto_confirmÚverboseÚdistÚuninstalled_pathsetrGrGrHÚ    uninstall—s
 
 zInstallRequirement.uninstallcCs.dd„}tj ||¡}|||ƒ}|jd|S)NcSsL| |tjj¡s$tdjftƒŽƒ‚|t|ƒdd…}| tjjd¡}|S)Nz2name {name!r} doesn't start with prefix {prefix!r}rú/)    rír8r:r9r?rvrêr“Úreplace)r…ÚprefixrGrGrHÚ_clean_zip_name³sÿÿz=InstallRequirement._get_archive_name.<locals>._clean_zip_namerþ)r8r:r‰r…)rsr:Ú    parentdirÚrootdirrr…rGrGrHÚ_get_archive_name°s
 
z$InstallRequirement._get_archive_namec    Cs¨|js
t‚d}d |j|jd¡}tj ||¡}tj |¡rÈt    d t
|ƒ¡dƒ}|dkr^d}nj|dkr‚t   d    t
|ƒ¡t  |¡nF|d
kr¶t|ƒ}t   d t
|ƒt
|ƒ¡t ||¡n|d krÈt d ¡|sÐdStj|dtjdd}|¦tj tj |j¡¡}t |¡D]~\}    }
} |
D]6} |j| |    |d} t | d¡}d|_| |d¡q| D]0}|j||    |d}tj |    |¡}| ||¡qTq
W5QRXt  dt
|ƒ¡dS)z}Saves archive to provided build_dir.
 
        Used for saving downloaded VCS requirements as part of `pip download`.
        Tz    {}-{}.ziprâz8The file {} exists. (i)gnore, (w)ipe, (b)ackup, (a)bort )ÚiÚwÚbÚarFrz Deleting %srzBacking up %s to %sréÿÿÿÿN)Ú
allowZip64)rrrþiíršzSaved %s) rUr?rvr…r6r8r:r‰r°rrr±r¿rørÚshutilÚmoverÐÚexitÚzipfileÚZipFileÚ ZIP_DEFLATEDÚnormcaserXrËÚwalkrÚZipInfoÚ external_attrÚwritestrÚwriterö)rsr´Úcreate_archiveÚ archive_nameÚ archive_pathÚresponseÚ    dest_fileÚ
zip_outputÚdirÚdirpathÚdirnamesÚ    filenamesÚdirnameÚ dir_arcnameÚzipdirÚfilenameÚ file_arcnamerGrGrHÚarchiveÁsr
 þü ý
ÿ ÿÿÿzInstallRequirement.archivec     Csjt|j||||j|d}    |dk    r$|ng}|jr^t||||||j|j|j|j|jd
d|_dS|j    r¸|j
snt ‚d}
|j rŠt |j |j|jƒ}
t|j|j
|    t|jƒ|||
|jdd|_dSt|ƒ|j}t|ƒ|j}z8t||||||||    |j|j|j|j|jt|jƒd} WnRtk
rB} zd|_tj| jŽW5d} ~ XYntk
r^d|_‚YnX| |_dS)N)ÚuserÚhomeÚrootrmr)rr(rÅr…rÓrmrnrËT)réÚreq_descriptionÚ    pycompileÚwarn_script_locationÚ
direct_urlÚ    requested)rgrhr)r(rrÅr+rérÓrmÚreq_namernrËr*F)r r…rmrTÚinstall_editable_legacyrÓrnrËrfrÉr^r?r\rrUr]rrurQrkÚlistrhrgÚinstall_legacyrrÚreraiseÚparentÚ    Exception) rsrgrhr)r(rr,rÅr+rér-ÚsuccessÚexcrGrGrHrþsŽ ú    ö 
ýø
    ò
zInstallRequirement.install) FNNNFNNNFrGF)N)T)FF)T)FF)NNNNTFT)%r~Ú
__module__Ú __qualname__Ú__doc__rtr|r€r‹Úpropertyr…rr˜r™ržr r¨ryrºr¾rÁrÈrÉrËrÓrÔrrÜrÞr6rárÝrärõrýrr&rrGrGrGrHrJ_s~
ò
r
 
 
 
 
 
 
 
 
&%
 
 
 
 
ü
 
,
@÷rJcCs>d}|jsd}n|jrd}n
|jr&d}|r:tddddd|S)    Nršz3Unnamed requirements are not allowed as constraintsz$Links are not allowed as constraintszConstraints cannot have extrasaConstraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms.z,replacing the constraint with a requirement.i )ròrórçrè)r…r[r_r)rQÚproblemrGrGrHÚcheck_invalid_constraint_type_sór=)bÚ
__future__rÚloggingr8r rÐr­rÚ pip._vendorrrZ"pip._vendor.packaging.requirementsrZpip._vendor.packaging.utilsrÚpip._vendor.packaging.versionrrr¼Úpip._vendor.pep517.wrappersr    Úpip._internal.build_envr
Úpip._internal.exceptionsr Úpip._internal.locationsr Úpip._internal.models.linkr Ú'pip._internal.operations.build.metadatarÚ.pip._internal.operations.build.metadata_legacyrÛÚ0pip._internal.operations.install.editable_legacyrr0Ú'pip._internal.operations.install.legacyrrr2Ú&pip._internal.operations.install.wheelrÚpip._internal.pyprojectrrÚpip._internal.req.req_uninstallrÚpip._internal.utils.deprecationrÚ&pip._internal.utils.direct_url_helpersrÚpip._internal.utils.hashesrÚpip._internal.utils.loggingrÚpip._internal.utils.miscrrrrrrr r!r"Úpip._internal.utils.packagingr#Úpip._internal.utils.temp_dirr$r%Úpip._internal.utils.typingr&Úpip._internal.utils.virtualenvr'Úpip._internal.vcsr(Útypingr)r*r+r,r-r.r/r0Zpip._vendor.pkg_resourcesr1Z pip._vendor.packaging.specifiersr2Zpip._vendor.packaging.markersr3Ú    getLoggerr~r±rIÚobjectrJr=rGrGrGrHÚ<module>sd                     ,    $