ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
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
M\¬Qc@s»dZddlZddlZddlZddlmZddlZddlZddlZyddl    m
Z
Wne k
r‹dZ
nXyddl mZWne k
r¹dZnXdddd    d
d d d dddddddddgZdefd„ƒYZdefd„ƒYZdefd„ƒYZyeWnek
rVdZnXd?d„Zd„Zd„Zd„Zd „Zd!„Zd"„Zd#„Zedd$„Zedd%„Z d&„Z!d'„Z"d(„Z#d)„Z$d*„Z%d+d,d,dddd-„Z&eed.„Z'd,d,dd/„Z(ie&d@gd1fd26e&dAgd4fd56e&dBgd6fd76e(gd8fd96Z)d:„Z*dd;d<„Z+d=„Z,ddd,d,dddd>„Z-dS(Cs—Utility functions for copying and archiving files and directory trees.
 
XXX The functions here don't copy the resource fork or other metadata on Mac.
 
iÿÿÿÿN(tabspath(tgetpwnam(tgetgrnamt copyfileobjtcopyfiletcopymodetcopystattcopytcopy2tcopytreetmovetrmtreetErrortSpecialFileErrort    ExecErrort make_archivetget_archive_formatstregister_archive_formattunregister_archive_formattignore_patternscBseZRS((t__name__t
__module__(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR scBseZdZRS(s|Raised when trying to do a kind of operation (e.g. copying) which is
    not supported on a special file (e.g. a named pipe)(RRt__doc__(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR "scBseZdZRS(s+Raised when a command could not be executed(RRR(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR&siicCs0x)|j|ƒ}|sPn|j|ƒqdS(s=copy data from file-like object fsrc to file-like object fdstN(treadtwrite(tfsrctfdsttlengthtbuf((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR.s
cCs{ttjdƒrAytjj||ƒSWqAtk
r=tSXntjjtjj|ƒƒtjjtjj|ƒƒkS(Ntsamefile(thasattrtostpathRtOSErrortFalsetnormcaseR(tsrctdst((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt    _samefile6s c CsÌt||ƒr(td||fƒ‚nx`||gD]R}ytj|ƒ}Wntk
raq5Xtj|jƒr5td|ƒ‚q5q5Wt|dƒ,}t|dƒ}t    ||ƒWdQXWdQXdS(sCopy data from src to dsts`%s` and `%s` are the same files`%s` is a named pipetrbtwbN(
R&R RtstatR!tS_ISFIFOtst_modeR topenR(R$R%tfntstRR((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRBs cCsGttdƒrCtj|ƒ}tj|jƒ}tj||ƒndS(sCopy mode bits from src to dsttchmodN(RRR)tS_IMODER+R/(R$R%R.tmode((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRVscCstj|ƒ}tj|jƒ}ttdƒrOtj||j|jfƒnttdƒrqtj||ƒnttdƒrþt|dƒrþytj    ||j
ƒWqþt k
rú}x@dD]1}tt |ƒr¿|j t t |ƒkr¿Pq¿q¿W‚qþXndS(    sCCopy all stat info (mode bits, atime, mtime, flags) from src to dsttutimeR/tchflagstst_flagst
EOPNOTSUPPtENOTSUPN(R5R6(RR)R0R+RR2tst_atimetst_mtimeR/R3R4R!terrnotgetattr(R$R%R.R1twhyterr((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR]s 'cCsTtjj|ƒr6tjj|tjj|ƒƒ}nt||ƒt||ƒdS(sVCopy data and mode bits ("cp src dst").
 
    The destination may be a directory.
 
    N(RR tisdirtjointbasenameRR(R$R%((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRos$ cCsTtjj|ƒr6tjj|tjj|ƒƒ}nt||ƒt||ƒdS(s]Copy data and all stat info ("cp -p src dst").
 
    The destination may be a directory.
 
    N(RR R=R>R?RR(R$R%((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRzs$ cs‡fd†}|S(sFunction that can be used as copytree() ignore parameter.
 
    Patterns is a sequence of glob-style patterns
    that are used to exclude filescs:g}x'ˆD]}|jtj||ƒƒq Wt|ƒS(N(textendtfnmatchtfiltertset(R tnamest ignored_namestpattern(tpatterns(sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt_ignore_patternsŠs ((RGRH((RGsN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR…sc CsØtj|ƒ}|dk    r-|||ƒ}n    tƒ}tj|ƒg}x|D] }||krhqPntjj||ƒ}tjj||ƒ}    ys|rÏtjj|ƒrÏtj|ƒ}
tj    |
|    ƒn5tjj
|ƒr÷t ||    ||ƒn t ||    ƒWqPt k
r.} |j| jdƒqPtk
r\} |j||    t| ƒfƒqPXqPWyt||ƒWnMtk
rÁ} tdk    r¢t| tƒr¢qÂ|j||t| ƒfƒnX|rÔt |‚ndS(sÇRecursively copy a directory tree using copy2().
 
    The destination directory must not already exist.
    If exception(s) occur, an Error is raised with a list of reasons.
 
    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied.
 
    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():
 
        callable(src, names) -> ignored_names
 
    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.
 
    XXX Consider this example code rather than the ultimate tool.
 
    iN(RtlistdirtNoneRCtmakedirsR R>tislinktreadlinktsymlinkR=R    RR R@targstEnvironmentErrortappendtstrRR!t WindowsErrort
isinstance( R$R%tsymlinkstignoreRDREterrorstnametsrcnametdstnametlinktoR<R;((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR    ‘s<        $ cCsÎ|rd„}n|dkr*d„}ny%tjj|ƒrNtdƒ‚nWn.tk
r|tjj|tjƒƒdSXg}ytj|ƒ}Wn/tjk
rÊ}|tj|tjƒƒnXx»|D]³}tjj    ||ƒ}ytj
|ƒj }Wntjk
rd}nXt j |ƒrBt|||ƒqÒytj|ƒWqÒtjk
r„}|tj|tjƒƒqÒXqÒWytj|ƒWn-tjk
rÉ|tj|tjƒƒnXdS(sÁRecursively delete a directory tree.
 
    If ignore_errors is set, errors are ignored; otherwise, if onerror
    is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If ignore_errors
    is false and onerror is None, an exception is raised.
 
    cWsdS(N((RO((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pytonerrorÞscWs‚dS(N((RO((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR\áss%Cannot call rmtree on a symbolic linkNi(RJRR RLR!tsystexc_infoRIterrorR>tlstatR+R)tS_ISDIRR tremovetrmdir(R t ignore_errorsR\RDR<RXtfullnameR1((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR Òs>      
!cCstjj|jtjjƒƒS(N(RR R?trstriptsep(R ((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt    _basenamescCs|}tjj|ƒr{t||ƒr;tj||ƒdStjj|t|ƒƒ}tjj|ƒr{td|‚q{nytj||ƒWn‚t    k
rtjj|ƒröt
||ƒrÖtd||f‚nt ||dt ƒt |ƒqt||ƒtj|ƒnXdS(s“Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command.
 
    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.
 
    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.
 
    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed.
    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.
 
    Ns$Destination path '%s' already existss.Cannot move a directory '%s' into itself '%s'.RU(RR R=R&trenameR>RhtexistsR R!t
_destinsrcR    tTrueR Rtunlink(R$R%treal_dst((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyR
s$   cCsut|ƒ}t|ƒ}|jtjjƒs@|tjj7}n|jtjjƒsh|tjj7}n|j|ƒS(N(RtendswithRR Rgt
startswith(R$R%((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRk0s  cCs^tdks|dkrdSyt|ƒ}Wntk
rEd}nX|dk    rZ|dSdS(s"Returns a gid, given a group name.iN(RRJtKeyError(RXtresult((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt_get_gid9s 
 cCs^tdks|dkrdSyt|ƒ}Wntk
rEd}nX|dk    rZ|dSdS(s"Returns an uid, given a user name.iN(RRJRq(RXRr((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt_get_uidEs 
 tgzipicssidd6dd6dd 6}idd6dd6}    |d k    rY||    jƒkrYtd‚n|d    |    j|dƒ}
tjj|
ƒ} tjj| ƒsÏ|d k    r¶|jd
| ƒn|sÏtj    | ƒqÏnd d l
} |d k    r÷|jd ƒnt ˆƒ‰t ˆƒ‰‡‡‡‡fd†} |so| j |
d||ƒ}z|j|d| ƒWd |jƒXn|
S(síCreate a (possibly compressed) tar file from all the files under
    'base_dir'.
 
    'compress' must be "gzip" (the default), "bzip2", or None.
 
    '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_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", or ".bz2").
 
    Returns the output filename.
    tgzRutbz2tbzip2ts.gzs.bz2s9bad value for 'compress': must be None, 'gzip' or 'bzip2's.tars creating %siÿÿÿÿNsCreating tar archivecsFˆdk    r!ˆ|_ˆ|_nˆdk    rBˆ|_ˆ|_n|S(N(RJtgidtgnametuidtuname(ttarinfo(RztgrouptownerR|(sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt _set_uid_gid|s            sw|%sRB(RJtkeyst
ValueErrortgetRR tdirnameRjtinfoRKttarfileRtRsR,taddtclose(t    base_nametbase_dirtcompresstverbosetdry_runR€Rtloggerttar_compressiont compress_extt archive_namet archive_dirR‡Rttar((RzRR€R|sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt _make_tarballQs0             cCsz|rd}nd}ddlm}ddlm}y |d|||gd|ƒWn|k
rutd|‚nXdS(    Ns-rs-rqiÿÿÿÿ(tDistutilsExecError(tspawntzipRŽskunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utility(tdistutils.errorsR–tdistutils.spawnR—R(R‹t zip_filenameRRŽt
zipoptionsR–R—((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt_call_external_zipŽs      cCsŸ|d}tjj|ƒ}tjj|ƒsf|dk    rM|jd|ƒn|sftj|ƒqfnyddl}Wntk
rd}nX|dkr²t    ||||ƒné|dk    rÔ|jd||ƒn|s›|j
|dd|j ƒ}x–tj |ƒD]…\}    }
} xs| D]k} tjj tjj|    | ƒƒ} tjj| ƒr|j| | ƒ|dk    r†|jd| ƒq†qqWqW|jƒn|S(    smCreate 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 ExecError.  Returns the name of the output zip
    file.
    s.zips creating %siÿÿÿÿNs#creating '%s' and adding '%s' to ittwt compressions adding '%s'(RR R…RjRJR†RKtzipfilet ImportErrorRtZipFilet ZIP_DEFLATEDtwalktnormpathR>tisfileRR‰(RŠR‹RRŽRR›R“R R˜tdirpathtdirnamest    filenamesRXR ((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt _make_zipfile s8    
 
         !  RŒsgzip'ed tar-filetgztarRxsbzip2'ed tar-filetbztarsuncompressed tar fileR”sZIP fileR˜cCs=gtjƒD]\}}||df^q }|jƒ|S(s‘Returns a list of supported formats for archiving and unarchiving.
 
    Each element of the returned sequence is a tuple (name, description)
    i(t_ARCHIVE_FORMATStitemstsort(RXtregistrytformats((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRÖs,
RycCs½|dkrg}nt|tjƒs:td|ƒ‚nt|ttfƒs^tdƒ‚nxE|D]=}t|ttfƒ s“t|ƒdkretdƒ‚qeqeW|||ft|<dS(suRegisters an archive format.
 
    name is the name of the format. function is the callable that will be
    used to create archives. If provided, extra_args is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_archive_formats() function.
    sThe %s object is not callables!extra_args needs to be a sequenceis+extra_args elements are : (arg_name, value)N(    RJRTt collectionstCallablet    TypeErrorttupletlisttlenR­(RXtfunctiont
extra_argst descriptiontelement((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRàs          (cCs t|=dS(N(R­(RX((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRõsc    Cshtjƒ}    |d
k    rb|d
k    r7|jd|ƒntjj|ƒ}|sbtj|ƒqbn|d
krztj}ni|d6|d6}
yt|} Wnt    k
r¼t
d|‚nX| d} x"| dD]\} }||
| <qÒW|dkr||
d<||
d    <nz| |||
}Wd
|d
k    rc|d
k    rS|jd |    ƒntj|    ƒnX|S( sê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", "bztar"
    or "gztar".
 
    '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.
    schanging into '%s'RŽRsunknown archive format '%s'iiR˜R€RNschanging back to '%s'( RtgetcwdRJtdebugR RtchdirtcurdirR­RqRƒ(RŠtformattroot_dirR‹RRŽR€RRtsave_cwdtkwargst format_infotfunctargtvaltfilename((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyRøs6      
 
   i@(scompresssgzip(scompresssbzip2(scompressN(.RRR]R)tos.pathRRAR²R9tpwdRR¡RJtgrpRt__all__RPR R RRSt    NameErrorRR&RRRRRRR"R    R RhR
RkRsRtR•RRªR­RRRR(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/shutil.pyt<module>sp       
 
         
                              A1        (                    </