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
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
U
G=®d|!ã@sDdZddlZddlmZddlZz ddlZWnek
rDdZYnXddlmZddl    m
Z
ddl m Z ddl mZzddlmZWnek
rždZYnXzdd    lmZWnek
rÈdZYnXd
d „Zd d „Zd#dd„Zd$dd„ZedgdfedgdfedgdfedgdfedgdfegdfdœZdd „Zd%d!d"„ZdS)&zodistutils.archive_util
 
Utility functions for creating archive files (tarballs, zip files,
that sort of thing).éN)Úwarn)ÚDistutilsExecError)Úspawn)Úmkpath)Úlog)Úgetpwnam)ÚgetgrnamcCsNtdks|dkrdSz t|ƒ}Wntk
r8d}YnX|dk    rJ|dSdS)z"Returns a gid, given a group name.Né)rÚKeyError©ÚnameÚresult©rúYD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/archive_util.pyÚ_get_gids 
rcCsNtdks|dkrdSz t|ƒ}Wntk
r8d}YnX|dk    rJ|dSdS)z"Returns an uid, given a user name.Nr    )rr
r rrrÚ_get_uid+s 
rÚgzipcs.ddddddœ}dddd    d
œ}|d k    r:|| ¡kr:td ƒ‚|d }    |dkrZ|    | |d¡7}    ttj |    ¡|ddd l}
t     d¡t
ˆƒ‰t ˆƒ‰‡‡‡‡fdd„} |sØ|
  |    d||¡} z| j|| dW5|   ¡X|dkr*tdtƒ|    ||} tjdkr||    | g}n
|d|    g}t||d| S|    S)a=Create a (possibly compressed) tar file from all the files under
    'base_dir'.
 
    'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or
    None.  ("compress" will be deprecated in Python 3.2)
 
    'owner' and 'group' can be used to define an owner and a group for the
    archive that is being built. If not provided, the current owner and group
    will be used.
 
    The output tar file will be named 'base_dir' +  ".tar", possibly plus
    the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z").
 
    Returns the output filename.
    ÚgzÚbz2ÚxzÚ)rÚbzip2rNÚcompressz.gzz.bz2z.xzz.Z)rrrrNzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarr©Údry_runrzCreating tar archivecs,ˆdk    rˆ|_ˆ|_ˆdk    r(ˆ|_ˆ|_|S)N)ÚgidÚgnameÚuidÚuname)Útarinfo©rÚgroupÚownerrrrÚ _set_uid_gidasz"make_tarball.<locals>._set_uid_gidzw|%s)Úfilterz'compress' will be deprecated.Úwin32z-f)ÚkeysÚ
ValueErrorÚgetrÚosÚpathÚdirnameÚtarfilerÚinforrÚopenÚcloseÚaddrÚPendingDeprecationWarningÚsysÚplatformr)Ú    base_nameÚbase_dirrÚverboserr"r!Útar_compressionÚ compress_extÚ archive_namer,r#ÚtarÚcompressed_nameÚcmdrr rÚ make_tarball7sBÿÿÿ
    
 
 
 
 r=c
Cs¬|d}ttj |¡|dtdkrp|r.d}nd}ztd|||g|dWn tk
rjtd|ƒ‚YnXn8t d||¡|s¨ztj    |d    tj
d
}Wn&t k
rÀtj    |d    tj d
}YnX|Ü|tj krtj tj |d ¡¡}| ||¡t d |¡t |¡D]\}}    }
|    D]6} tj tj || d ¡¡}| ||¡t d |¡q|
D]B} tj tj || ¡¡}tj |¡rV| ||¡t d |¡qVq W5QRX|S) avCreate a zip file from all the files under 'base_dir'.
 
    The output zip file will be named 'base_name' + ".zip".  Uses either the
    "zipfile" Python module (if available) or the InfoZIP "zip" utility
    (if installed and found on the default search path).  If neither tool is
    available, raises DistutilsExecError.  Returns the name of the output zip
    file.
    z.ziprNz-rz-rqÚzipzkunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilityz#creating '%s' and adding '%s' to itÚw)Ú compressionrz adding '%s')rr)r*r+Úzipfilerrrr-ÚZipFileÚ ZIP_DEFLATEDÚ RuntimeErrorÚ
ZIP_STOREDÚcurdirÚnormpathÚjoinÚwriteÚwalkÚisfile) r4r5r6rÚ zip_filenameÚ
zipoptionsr>r*ÚdirpathÚdirnamesÚ    filenamesr rrrÚ make_zipfilesV     ÿ
þÿÿ
ÿ      rQ)rrzgzip'ed tar-file)rrzbzip2'ed tar-file)rrzxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)ÚgztarÚbztarÚxztarÚztarr:r>cCs|D]}|tkr|SqdS)zqReturns the first format from the 'format' list that is unknown.
 
    If all formats are known, returns None
    N)ÚARCHIVE_FORMATS)ÚformatsÚformatrrrÚcheck_archive_formatsÄs
rYc
Csìt ¡}|dk    r6t d|¡tj |¡}|s6t |¡|dkrDtj}d|i}    z t|}
Wn t    k
rxt
d|ƒ‚YnX|
d} |
dD]\} } | |    | <qŠ|dkr´||    d<||    d    <z| ||f|    Ž}W5|dk    ræt d
|¡t |¡X|S) aüCreate an archive file (eg. zip or tar).
 
    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "gztar",
    "bztar", "xztar", or "ztar".
 
    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.
 
    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.
    Nzchanging into '%s'rzunknown archive format '%s'rér>r"r!zchanging back to '%s') r)ÚgetcwdrÚdebugr*ÚabspathÚchdirrFrVr
r')r4rXÚroot_dirr5r6rr"r!Úsave_cwdÚkwargsÚ format_infoÚfuncÚargÚvalÚfilenamerrrÚ make_archiveÎs2  
 
  rg)rrrNN)rr)NNrrNN)Ú__doc__r)Úwarningsrr2rAÚ ImportErrorÚdistutils.errorsrÚdistutils.spawnrÚdistutils.dir_utilrÚ    distutilsrÚpwdrÚgrprrrr=rQrVrYrgrrrrÚ<module>sN  
 
 
  ÿ
H
=
 
 
 
 
ú    
ÿ