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
U
H=®d¿Mã@s:dZddlZddlZddlZddlZddlmZddlmZddl    m
Z
ddl m Z m Z mZmZmZmZmZddlmZddlmZdd    lmZdd
lmZmZmZmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%e!r¾ddl&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,ddlm-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddlm8Z8er†e,de'e9e(e9ge(e9fe:dœddZ;n8e,de'e9e9gdfe'e9e(e9ge(e9fe:e:dœddZ;e <e=¡Z>dd„Z?dd „Z@Gd!d"„d"eAƒZBd3d#d$„ZCd%d&„ZDd'd(„ZEd4d)d*„ZFd5d+d,„ZGd-d.„ZHd/d0„ZIGd1d2„d2eAƒZJdS)6z)Prepares a distribution for installation
éN)ÚPY2)Ú)make_distribution_for_install_requirement)ÚInstalledDistribution)ÚDirectoryUrlHashUnsupportedÚ HashMismatchÚ HashUnpinnedÚInstallationErrorÚNetworkConnectionErrorÚPreviousBuildDirErrorÚVcsHashUnsupported)Ú copy2_fixed)Ú MissingHashes)Ú
indent_log)Ú display_pathÚhide_urlÚpath_to_displayÚrmtree)Ú TempDirectory)ÚMYPY_CHECK_RUNNING)Ú unpack_file)Úvcs)ÚCallableÚListÚOptionalÚTuple)Ú    TypedDict)ÚAbstractDistribution)Ú PackageFinder)ÚLink)Ú
Downloader)ÚInstallRequirement)ÚRequirementTracker)ÚHashesÚCopytreeKwargs©ÚignoreÚsymlinksF)Útotal)Ú copy_functionr%Úignore_dangling_symlinksr&c    Cs.t|ƒ}| |¡| ||¡W5QRX|S)z-Prepare a distribution for installation.
    )rÚtrackÚprepare_distribution_metadata)ÚreqÚ req_trackerÚfinderÚbuild_isolationÚ abstract_dist©r1úWD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/operations/prepare.pyÚ_get_prepared_distributionPs     r3cCs0t |j¡}|dk    st‚|j|t|jƒddS)N)Úurl)rÚget_backend_for_schemeÚschemeÚAssertionErrorÚunpackrr4)ÚlinkÚlocationÚ vcs_backendr1r1r2Úunpack_vcs_link_s  r<c@seZdZdd„ZdS)ÚFilecCs||_||_dS©N)ÚpathÚ content_type)Úselfr?r@r1r1r2Ú__init__gsz File.__init__N)Ú__name__Ú
__module__Ú __qualname__rBr1r1r1r2r=fsr=cCsVtddd}d}|r t|||ƒ}|r8|}t |¡d}nt|||j|ƒ\}}t||ƒS)Nr8T)ÚkindÚglobally_managedr)rÚ_check_download_dirÚ    mimetypesÚ
guess_typeÚ_download_http_urlr?r=)r9Ú
downloaderÚ download_dirÚhashesÚtemp_dirÚalready_downloaded_pathÚ    from_pathr@r1r1r2Ú get_http_urlms$ ÿÿrRc
CsTzt||ƒWn@tjk
rN}z t dt|ƒt|ƒt|ƒ¡W5d}~XYnXdS)zÆCopying special files is not supported, but as a convenience to users
    we skip errors copying them. This supports tools that may create e.g.
    socket files in the project source directory.
    z>Ignoring special file error '%s' encountered copying %s to %s.N)r ÚshutilÚSpecialFileErrorÚloggerÚwarningÚstrr)ÚsrcÚdestÚer1r1r2Ú_copy2_ignoring_special_filesˆsür[cs`tj |¡}tj |¡‰tj |¡‰‡‡‡fdd„}t|dd}tsLt|d<tj    ˆ|f|ŽdS)Ncs6g}|ˆkr|ddg7}tj |¡ˆkr2|ˆg7}|S)Nz.toxz.nox)Úosr?Úabspath)ÚdÚnamesÚskipped©ÚsourceÚtarget_basenameÚtarget_dirnamer1r2r%£s  
z!_copy_source_tree.<locals>.ignoreTr$r()
r\r?r]ÚbasenameÚdirnameÚdictrr[rSÚcopytree)rbÚtargetÚtarget_abspathr%Úkwargsr1rar2Ú_copy_source_trees    rlcCsJd}|rt|||ƒ}|r|}n|j}|r2| |¡t |¡d}t||ƒS)z,Get file and optionally check its hash.
    Nr)rHÚ    file_pathÚcheck_against_pathrIrJr=)r9rMrNrPrQr@r1r1r2Ú get_file_url½s    ÿ
rocCs€|jrt||ƒdS| ¡r@tj |¡r0t|ƒt|j|ƒdS|j    rVt
|||d}nt ||||d}|j s|t |j||jƒ|S)a_Unpack link into location, downloading if required.
 
    :param hashes: A Hashes object, one of whose embedded hashes must match,
        or HashMismatch will be raised. If the Hashes is empty, no matches are
        required, and unhashable types of requirements (like VCS ones, which
        would ordinarily raise HashUnsupported) are allowed.
    N©rN)Úis_vcsr<Úis_existing_dirr\r?ÚisdirrrlrmÚis_filerorRÚis_wheelrr@)r9r:rLrMrNÚfiler1r1r2Ú
unpack_urlÞs&
  ü    rwc    Csf||ƒ}tj ||j¡}t|dƒ}|jD]}| |¡q*W5QRX|rR| |¡||jj     
dd¡fS)z6Download link url into temp_dir using provided sessionÚwbz content-typeÚ) r\r?ÚjoinÚfilenameÚopenÚchunksÚwriternÚresponseÚheadersÚget)r9rLrOrNÚdownloadrmÚ content_fileÚchunkr1r1r2rKs 
 
rKcCsptj ||j¡}tj |¡s dSt d|¡|rlz| |¡Wn,tk
rjt     d|¡t 
|¡YdSX|S)z† Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.) r\r?rzr{ÚexistsrUÚinfornrrVÚunlink)r9rMrNÚ download_pathr1r1r2rH#s  ý
rHcs^eZdZdZ‡fdd„Zedd„ƒZdd„Zdd    „Zd
d „Z    dd d„Z
dd„Z dd„Z ‡Z S)ÚRequirementPreparerzPrepares a Requirement
    c sNtt|ƒ ¡||_||_||_||_||_||_||_    ||_
|    |_ |
|_ dSr>) Úsuperr‰rBÚsrc_dirÚ    build_dirr-rLr.rMÚwheel_download_dirr/Úrequire_hashesÚ use_user_site) rArŒrMr‹rr/r-rLr.rŽr©Ú    __class__r1r2rBAszRequirementPreparer.__init__cCs:|js
dStj |j¡rdSt d¡td |j¡ƒ‚dS)NFTz!Could not find download directoryz0Could not find or access download directory '{}')rMr\r?r…rUÚcriticalrÚformat)rAr1r1r2Ú_download_should_savens
ÿÿz)RequirementPreparer._download_should_savecCs8|jjr"|jj}t dt|ƒ¡nt d|jp0|¡dS)zLog the way the link prepared.z Processing %sz Collecting %sN)r9rtrmrUr†rr,)rAr,r?r1r1r2Ú_log_preparing_link|sz'RequirementPreparer._log_preparing_linkcCsZ|jjr dS|jdkst‚|j|jd|dtj tj     |jd¡¡rVt
d  ||j¡ƒ‚dS)z1Ensure source_dir of a linked InstallRequirement.NT)Ú
autodeleteÚparallel_buildszsetup.pyzípip can't proceed with requirements '{}' due to apre-existing build directory ({}). This is likely due to a previous installation that failed . pip is being responsible and not assuming it can delete this. Please delete it and try again.) r9ruÚ
source_dirr7Úensure_has_source_dirrŒr\r?r…rzr
r“)rAr,rMr—r1r1r2Ú_ensure_link_req_src_dir…sý üÿz,RequirementPreparer._ensure_link_req_src_dircCsX|js|jddS|jjr tƒ‚|j ¡r0tƒ‚|jdkrF|jsFt    ƒ‚|jddpVt
ƒS)NT)Útrust_internetF) rŽrNr9rqr rrrÚ original_linkÚ    is_pinnedrr )rAr,r1r1r2Ú_get_linked_req_hashes£s 
z*RequirementPreparer._get_linked_req_hashesFc
CsL|js
t‚|j}| |¡|jr.|jr.|j}n|j}tƒ| |||¡z t||j    |j
||  |¡d}Wn4t k
r }zt d |||¡ƒ‚W5d}~XYnX|r®|j|_t||j|j|jƒ}|r"| ¡rÜt d¡nF|r"tj ||j¡}tj |¡s"t |j|¡t|ƒ}    t d|    ¡|jr>|j r>| !|j¡W5QRX|S)z3Prepare a requirement to be obtained from req.link.rpzDCould not install requirement {} because of HTTP error {} for URL {}Nz*Link is a directory, ignoring download_dirzSaved %s)"r9r7r•rurrMrršrwr˜rLržr    rr“r?Úlocal_file_pathr3r-r.r/rrrUr†r\rzr{r…rSÚcopyrr”rqÚarchive)
rAr,r—r9rMÚ
local_fileÚexcr0Údownload_locationrˆr1r1r2Úprepare_linked_requirementÄs`
 
 
þ
ÿÿÿ ÿ z.RequirementPreparer.prepare_linked_requirementc    Cs|jstdƒ‚t d|¡tƒf|jr6td |¡ƒ‚| |j    ¡| 
|j ¡t ||j |j|jƒ}|j rv| |j¡| |j¡W5QRX|S)z(Prepare an editable requirement
        z-cannot prepare a non-editable req as editablez Obtaining %szoThe editable requirement {} cannot be installed when requiring hashes, because there is no single file to hash.)Úeditabler7rUr†rrŽrr“r™r‹Úupdate_editabler”r3r-r.r/r¡rMÚcheck_if_existsr)rAr,r0r1r1r2Úprepare_editable_requirementøs* þÿ ÿ z0RequirementPreparer.prepare_editable_requirementc    Csh|jstdƒ‚|dk    s&td |j¡ƒ‚t d|||jj¡tƒ|jrRt d¡t    |ƒ}W5QRX|S)z1Prepare an already-installed requirement
        z(req should have been satisfied but isn'tNzAdid not get skip reason skipped but req.satisfied_by is set to {}zRequirement %s: %s (%s)z§Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.)
Ú satisfied_byr7r“rUr†ÚversionrrŽÚdebugr)rAr,Ú skip_reasonr0r1r1r2Úprepare_installed_requirements&
ÿÿþÿz1RequirementPreparer.prepare_installed_requirement)F)rCrDrEÚ__doc__rBÚpropertyr”r•ršržr¥r©r®Ú __classcell__r1r1rr2r‰=s -
    !
4r‰)NN)NN)NN)Kr¯ÚloggingrIr\rSZpip._vendor.sixrÚpip._internal.distributionsrÚ%pip._internal.distributions.installedrÚpip._internal.exceptionsrrrrr    r
r Úpip._internal.utils.filesystemr Úpip._internal.utils.hashesr Úpip._internal.utils.loggingrÚpip._internal.utils.miscrrrrÚpip._internal.utils.temp_dirrÚpip._internal.utils.typingrÚpip._internal.utils.unpackingrÚpip._internal.vcsrÚtypingrrrrZmypy_extensionsrrÚ"pip._internal.index.package_finderrÚpip._internal.models.linkrÚpip._internal.network.downloadrZpip._internal.req.req_installr Úpip._internal.req.req_trackerr!r"rWÚboolr#Ú    getLoggerrCrUr3r<Úobjectr=rRr[rlrorwrKrHr‰r1r1r1r2Ú<module>sz   $                   þú    üø
 
"ý
%û
0