tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
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
[\¬Qc@s1dZdZddlZddlZddlZddlZddlmZddlm    Z    ddl
m Z ddl m Z ddlmZd    „Zd
„Zd „Zd ad „Zd„Zdd„Zdaaad„Zd„Zdd d d„Zd„Zd d dddd dd„Zd„ZdS(sudistutils.util
 
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
s$Id$iÿÿÿÿN(tDistutilsPlatformError(tnewer(tspawn(tlog(tDistutilsByteCompileErrorcCsËtjdkrœd}tjtj|ƒ}|dkr=tjStjtjd|ƒ}tj|t|ƒ|!jƒ}|dkr…dS|dkr•dStjSd    tj    kr¶tj    d    Stjd
ksÕt
td ƒ rÜtjStj ƒ\}}}}}tj|ƒ}tj |d d ƒ}tj |ddƒ}tj |d dƒ}|d dkrcd||fS|d dkrÚ|ddkrºd}dt |dƒd|df}idd6dd6}    |d|    tj7}qºnà|d  d!krød||fS|d d"krd#|||fS|d$ d%kred%}tjd&ƒ}
|
j|ƒ} | rº| jƒ}qºnU|d$ d'krºdd(l} dd(l} | j| jjƒ|||ƒ\}}}nd)|||fS(*s«Return a string that identifies the current platform.  This is used
    mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name
    and version and the architecture (as supplied by 'os.uname()'),
    although the exact information included depends on the OS; eg. for IRIX
    the architecture isn't particularly important (IRIX only runs on SGI
    hardware), but for Linux the kernel version isn't particularly
    important.
 
    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u
       irix-5.3
       irix64-6.2
 
    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win-ia64 (64bit Windows on Itanium)
       win32 (all others - specifically, sys.platform is returned)
 
    For other non-POSIX platforms, currently just returns 'sys.platform'.
    tnts bit (iÿÿÿÿt)tamd64s    win-amd64titaniumswin-ia64t_PYTHON_HOST_PLATFORMtposixtunamet/tt t_t-itlinuxs%s-%stsunosit5tsolariss%d.%siit32bitiÿÿÿt64bitIÿÿÿÿÿÿÿs.%sitirixtaixs%s-%s.%sitcygwins[\d.]+tdarwinNs%s-%s-%s(tostnametstringtfindtsystversiontplatformtlentlowertenvironthasattrR treplacetinttmaxinttretcompiletmatchtgroupt _osx_supporttdistutils.sysconfigtget_platform_osxt    sysconfigtget_config_vars(tprefixtitjtlooktosnamethosttreleaseR tmachinetbitnesstrel_retmR-t    distutils((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt get_platformsZ     " cCs tjdkr|S|s|S|ddkr=td|‚n|ddkr]td|‚ntj|dƒ}xd|krŽ|jdƒqrW|sœtjSt|ƒdkrû|djdƒrût    j
dkrût    j j d    ƒdkrû|dcd
7<ntj j|ŒS( sÎReturn 'pathname' as a name that will work on the native filesystem,
    i.e. split it on '/' and put it back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    R ispath '%s' cannot be absoluteiÿÿÿÿspath '%s' cannot end with '/'t.t:twin32tGCCs\(Rtsept
ValueErrorRtsplittremovetcurdirR"tendswithRR!R Rtpathtjoin(tpathnametpaths((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt convert_pathns"    %'cCstjdkrNtjj|ƒs4tjj||ƒStjj||dƒSnÁtjdkr¥tjj|ƒ\}}|ddkr’|d}ntjj||ƒStjdkrÿtjj|ƒ\}}|dtjkrì|d}ntjj||ƒStdtj‚dS(    s    Return 'pathname' with 'new_root' prepended.  If 'pathname' is
    relative, this is equivalent to "os.path.join(new_root,pathname)".
    Otherwise, it requires making 'pathname' relative and then joining the
    two, which is tricky on DOS/Windows and Mac OS.
    R
iRis\tos2s!nothing known about platform '%s'N(RRRItisabsRJt
splitdriveRCR(tnew_rootRKtdriveRI((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt change_root‘s   icCsƒtr
dStjdkrWdtjkrWddl}|jtjƒƒdtjd<ndtjkrytƒtjd<ndadS(sLEnsure that 'os.environ' has all the environment variables we
    guarantee that users can use in config files, command-line options,
    etc.  Currently this includes:
      HOME - user's home directory (Unix only)
      PLAT - description of the current platform, including hardware
             and OS (see 'get_platform()')
    NR
tHOMEiÿÿÿÿitPLATi(t_environ_checkedRRR$tpwdtgetpwuidtgetuidR>(RW((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt check_environ¯s     #cCsQtƒ|d„}ytjd||ƒSWn tk
rL}td|‚nXdS(sàPerform shell/Perl-style variable substitution on 'string'.  Every
    occurrence of '$' followed by a name is considered a variable, and
    variable is substituted by the value found in the 'local_vars'
    dictionary, or in 'os.environ' if it's not in 'local_vars'.
    'os.environ' is first checked/augmented to guarantee that it contains
    certain values: see 'check_environ()'.  Raise ValueError for any
    variables not found in either 'local_vars' or 'os.environ'.
    cSs8|jdƒ}||kr)t||ƒStj|SdS(Ni(R,tstrRR$(R+t
local_varstvar_name((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt_substÏs s\$([a-zA-Z_][a-zA-Z_0-9]*)sinvalid variable '$%s'N(RZR)tsubtKeyErrorRD(tsR\R^tvar((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt
subst_varsÅs     serror: cCspt|dƒrXt|dƒrX|jrD|d|j|jf}ql|d|j}n|t|dƒ}|S(sŒGenerate a useful error message from an EnvironmentError (IOError or
    OSError) exception object.  Handles Python 1.5.1 and 1.5.2 styles, and
    does what it can to deal with exception objects that don't have a
    filename (which happens when the error is due to a two-file operation,
    such as 'rename()' or 'link()'.  Returns the error message as a string
    prefixed with 'prefix'.
    tfilenametstrerrors%s: %ss%siÿÿÿÿ(R%RdReR[(texcR2terror((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pytgrok_environment_errorÞs        cCs8tjdtjƒatjdƒatjdƒadS(Ns [^\\\'\"%s ]*s'(?:[^'\\]|\\.)*'s"(?:[^"\\]|\\.)*"(R)R*Rt
whitespacet _wordchars_ret
_squote_ret
_dquote_re(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt _init_regexöscCsßtd    krtƒntj|ƒ}g}d}x§|rÚtj||ƒ}|jƒ}|t|ƒkr|j|| ƒPn||tj    kr¿|j|| ƒtj
||ƒ}d}nõ||dkrò|| ||d}|d}nÂ||dkrt j||ƒ}n6||dkr<t j||ƒ}nt d||‚|d    krmtd||‚n|jƒ\}}|| ||d|d!||}|jƒd}|t|ƒkr4|j|ƒPq4q4W|S(
sSplit a string up according to Unix shell-like rules for quotes and
    backslashes.  In short: words are delimited by spaces, as long as those
    spaces are not escaped by a backslash, or inside a quoted string.
    Single and double quotes are equivalent, and the quote characters can
    be backslash-escaped.  The backslash is stripped from any two-character
    escape sequence, leaving only the escaped character.  The quote
    characters are stripped from any quoted string.  Returns a list of
    words.
    is\it't"s!this can't happen (bad char '%c')s"bad string (mismatched %s quotes?)iN(RjtNoneRmRtstripR+tendR"tappendRitlstripRkRlt RuntimeErrorRDtspan(RatwordstposR<Rrtbeg((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt split_quotedüsD
           % cCsj|dkrFd|j|f}|ddkrF|dd!d}qFntj|ƒ|sf||ŒndS(sœPerform some action that affects the outside world (eg.  by
    writing to the filesystem).  Such actions are special because they
    are disabled by the 'dry_run' flag.  This method takes care of all
    that bureaucracy for you; all you have to do is supply the
    function to call and an argument tuple for it (to embody the
    "external action" being performed), and an optional message to
    print.
    s%s%riþÿÿÿs,)iRN(Rpt__name__Rtinfo(tfunctargstmsgtverbosetdry_run((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pytexecute;s      cCsCtj|ƒ}|dkrdS|dkr/dStd|f‚dS(sôConvert a string representation of truth to true (1) or false (0).
 
    True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
    are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
    'val' is anything else.
    tytyesttttruetont1itntnotftfalsetofft0isinvalid truth value %rN(RƒR„R…R†R‡Rˆ(R‰snoR‹RŒRRŽ(RR#RD(tval((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt    strtoboolNs   ic    Csîtjrtdƒ‚n|dkr9to3|dk}n|sÂy&ddlm}|dƒ\}    }
Wn4tk
r›ddlm} d| dƒ}    }
nXt    j
d|
ƒ|sB|    dk    rÓt j |    dƒ} nt |
dƒ} | jd    ƒ| jtjtt|ƒd
ƒd ƒ| jd |||||fƒ| jƒntj|
g} |d krp| jd dƒn|dkr| jd dƒnt| d|ƒtt j|
fd|
d|ƒn(ddlm}x|D] }|ddkrõqÙn|trdpd}|}|rV|t|ƒ |krCtd||f‚n|t|ƒ}n|rtt jj||ƒ}nt jj|ƒ}|rÙ|s¡t||ƒrÐt    j
d||ƒ|sã||||ƒqãqæt    j d||ƒqÙqÙWdS(s”Byte-compile a collection of Python source files to either .pyc
    or .pyo files in the same directory.  'py_files' is a list of files
    to compile; any files that don't end in ".py" are silently skipped.
    'optimize' must be one of the following:
      0 - don't optimize (generate .pyc)
      1 - normal optimization (like "python -O")
      2 - extra optimization (like "python -OO")
    If 'force' is true, all files are recompiled regardless of
    timestamps.
 
    The source filename encoded in each bytecode file defaults to the
    filenames listed in 'py_files'; you can modify these with 'prefix' and
    'basedir'.  'prefix' is a string that will be stripped off of each
    source filename, and 'base_dir' is a directory name that will be
    prepended (after 'prefix' is stripped).  You can supply either or both
    (or neither) of 'prefix' and 'base_dir', as you wish.
 
    If 'dry_run' is true, doesn't actually do anything that would
    affect the filesystem.
 
    Byte-compilation is either done directly in this interpreter process
    with the standard py_compile module, or indirectly by writing a
    temporary script and executing it.  Normally, you should let
    'byte_compile()' figure out to use direct compilation or not (see
    the source for details).  The 'direct' flag is used by the script
    generated in indirect mode; unless you know what you're doing, leave
    it set to None.
    sbyte-compiling is disabled.iiÿÿÿÿ(tmkstemps.py(tmktemps$writing byte-compilation script '%s'tws2from distutils.util import byte_compile
files = [
s,
s]
byte_compile(files, optimize=%r, force=%r,
             prefix=%r, base_dir=%r,
             verbose=%r, dry_run=0,
             direct=1)
is-Ois-OORs removing %s(R*iýÿÿÿtctos1invalid prefix: filename %r doesn't start with %rsbyte-compiling %s to %ss%skipping byte-compilation of %s to %sN(!Rtdont_write_bytecodeRRpt    __debug__ttempfileR‘t ImportErrorR’RR|RtfdopentopentwriteRRJtmaptreprtcloset
executabletinsertRR‚RFt
py_compileR*R"RDRItbasenameRtdebug(tpy_filestoptimizetforceR2tbase_dirR€RtdirectR‘t    script_fdt script_nameR’tscripttcmdR*tfiletcfiletdfilet
cfile_base((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt byte_compile^sh"       &   
     cCs,tj|dƒ}tj|ddƒ}|S(sŒReturn a version of the string escaped for inclusion in an
    RFC-822 header, by ensuring there are 8 spaces space after each newline.
    s
iRs        (RRERJ(theadertlines((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt rfc822_escapeís( t__doc__t __revision__RRRR)tdistutils.errorsRtdistutils.dep_utilRtdistutils.spawnRR=RRR>RMRSRVRZRcRhRpRjRkRlRmRzR‚RR²Rµ(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/distutils/util.pyt<module>s00    ^    #                     ?     ‹