zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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%ã@stdZddlmZddlZddlZddlZddlZddlZddlZddl    m
Z
ddl m Z m Z mZmZddlmZddlmZer¨ddlmZmZmZmZmZdd    lmZe e¡Zee ZzddlZee 7ZWne k
rìe !d
¡YnXzddl"Z"ee7ZWn e k
r"e !d ¡YnXd d „Z#dd„Z$dd„Z%dd„Z&dd„Z'dd„Z(ddd„Z)dd„Z*d dd„Z+dS)!zUtilities related archives.
é)Úabsolute_importN)ÚInstallationError)ÚBZ2_EXTENSIONSÚTAR_EXTENSIONSÚ XZ_EXTENSIONSÚZIP_EXTENSIONS)Ú
ensure_dir)ÚMYPY_CHECK_RUNNING)ÚIterableÚListÚOptionalÚTextÚUnion)ÚZipInfozbz2 module is not availablezlzma module is not availablecCst d¡}t |¡|S)zBGet the current umask which involves having to set it temporarily.r)ÚosÚumask)Úmask©rúTD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/utils/unpacking.pyÚ current_umask/s
 
rcCsh| d¡ d¡}d|krHd|kr4| d¡| d¡ks<d|krH| dd¡Sd|kr\| dd¡S|dgSdS)Nú/ú\éÚ)ÚlstripÚfindÚsplit©ÚpathrrrÚsplit_leading_dir7sÿþþý  rcCsDd}|D]6}t|ƒ\}}|s"dS|dkr0|}q||krdSqdS)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r)ÚpathsÚ common_prefixrÚprefixÚrestrrrÚhas_leading_dirGs r$cCs0tj |¡}tj |¡}tj ||g¡}||kS)zL
    Return true if the absolute path of target is within the directory
    )rrÚabspathÚ commonprefix)Ú    directoryÚtargetÚ abs_directoryÚ
abs_targetr"rrrÚis_within_directoryWs  r+cCst |dtƒ@dB¡dS)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    iÿéIN)rÚchmodrrrrrÚ2set_extracted_file_to_default_mode_plus_executablecsr.cCs$|jd?}t|o t |¡o |d@ƒS)Nér,)Ú external_attrÚboolÚstatÚS_ISREG)ÚinfoÚmoderrrÚzip_item_is_executablels
r6Tc
Cst|ƒt|dƒ}zøtj|dd}t| ¡ƒo0|}| ¡D]Ì}|j}|}|rXt    |ƒd}t
j   ||¡}t
j   |¡}    t||ƒs’d}
t|
 |||¡ƒ‚| d¡s¦| d¡r°t|ƒq:t|    ƒ| |¡} z&t|dƒ} t | | ¡W5QRXW5|  ¡t|ƒrt|ƒXq:W5| ¡Xd    S)
aŸ
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    ÚrbT)Ú
allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rrÚwbN)rÚopenÚcloseÚzipfileÚZipFiler$ÚnamelistÚinfolistÚfilenamerrrÚjoinÚdirnamer+rÚformatÚendswithr6r.ÚshutilÚ copyfileobj) r@ÚlocationÚflattenÚzipfpÚzipÚleadingr4ÚnameÚfnÚdirÚmessageÚfpÚdestfprrrÚ
unzip_filets6
 
 
ÿ
 
 
rRc Cs*t|ƒ| ¡ d¡s$| ¡ d¡r*d}nL| ¡ t¡r>d}n8| ¡ t¡rRd}n$| ¡ d¡rfd}nt d|¡d    }t ||¡}z–t
d
d „|  ¡Dƒƒ}|  ¡D]p}|j }|rÀt |ƒd }tj ||¡}t||ƒsîd }t| |||¡ƒ‚| ¡rt|ƒq¤| ¡r^z| ||¡Wn>tk
rZ}    zt d||j |    ¡WY¢q¤W5d}    ~    XYnXq¤z| |¡}
WnBttfk
r®}    zt d||j |    ¡WY¢q¤W5d}    ~    XYnXttj |¡ƒ|
dk    sÎt‚t|dƒ} t |
| ¡W5QRX|
     ¡| ||¡|j d@r¤t!|ƒq¤W5|     ¡XdS)aŸ
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tarÚrz-Cannot determine compression type for file %szr:*cSsg|]
}|j‘qSr)rL)Ú.0ÚmemberrrrÚ
<listcomp>½szuntar_file.<locals>.<listcomp>rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNr9r,)"rÚlowerrDrrÚloggerÚwarningÚtarfiler:r;r$Ú
getmembersrLrrrrAr+rrCÚisdirÚissymÚ_extract_memberÚ    ExceptionÚ extractfileÚKeyErrorÚAttributeErrorrBÚAssertionErrorrErFÚutimer5r.) r@rGr5ÚtarrKrUrMrrOÚexcrPrQrrrÚ
untar_file£s|
ÿ ÿ 
ÿ ÿ
 
 
þþ  
rgcCsštj |¡}|dks,| ¡ t¡s,t |¡rDt||| d¡ dnR|dkslt     
|¡sl| ¡ t t t ¡rxt||ƒnt d|||¡td |¡ƒ‚dS)Nzapplication/zipz.whl)rHzapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of {})rrÚrealpathrWrDrr<Ú
is_zipfilerRrZÚ
is_tarfilerrrrgrXÚcriticalrrC)r@rGÚ content_typerrrÚ unpack_fileös< ÿ þý
ýÿþ
ÿý ýÿrm)T)N),Ú__doc__Ú
__future__rÚloggingrrEr2rZr<Úpip._internal.exceptionsrÚpip._internal.utils.filetypesrrrrÚpip._internal.utils.miscrÚpip._internal.utils.typingr    Útypingr
r r r rrÚ    getLoggerÚ__name__rXÚSUPPORTED_EXTENSIONSÚbz2Ú ImportErrorÚdebugÚlzmarrr$r+r.r6rRrgrmrrrrÚ<module>sH     
       
/Vý