K iF8dZddlmZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZmZmZddlmZmZddlmZddlmZdd lmZdd lmZmZdd lmZerdd lm Z m!Z!e d Z"d$dZ#d$dZ$e jJdk(rda&dZ'dZ(dZ)dZ*d%dZ+ed&dZ, d'dZ-ej\d(dZ/d)dZ0dZ1d*d+dZ2dxa3xa4a5dZ6d,dZ7 d- d.dZ8d/dZ9 d0 d1d Z:d2d!Z;d3d"Z-@@  rdarwinMACOSX_DEPLOYMENT_TARGETcday)zFor testing only. Do not call.N)_syscfg_macosx_verrrr_clear_cached_macosx_verr,Cs rcbt$ddlm}|jtxsd}|r|atS)zGet the version of macOS latched in the Python interpreter configuration. Returns the version as a string or None if can't obtain one. Cached.r)r)r+ distutilsrget_config_varMACOSX_VERSION_VAR)rvers r!get_macosx_target_ver_from_syscfgr3Is4!'&i&&'9:@b !$  rct}tjjt}|rB|r>t |ddgk\r.t |ddgkrdtzd|d|dz}t ||S|S)aReturn the version of macOS for which we are building. The target version defaults to the version in sysconfig latched at time the Python interpreter was built, unless overridden by an environment variable. If neither source has a value, then None is returned $z mismatch: now "z" but "z*" during configure; must use 10.3 or later)r3r"r$r%r1 split_versionr) syscfg_verenv_vermy_msgs rget_macosx_target_verr<Vs34Jjjnn/0G j)b!W4g&"a0((,y |4),))  )0 0 rc\|jdDcgc] }t|c}Scc}w)zEConvert a dot-separated string into a list of numbers for comparisons.)splitint)sns rr8r8vs"GGCL )qCF )) )s)cRtjtj|S)a. Allow for pathlib.Path inputs, coax to a native path string. If None is passed, will just pass it through as Setuptools relies on this behavior. >>> convert_path(None) is None True Removes empty paths. >>> convert_path('foo/./bar').replace('\\', '/') 'foo/bar' )r"fspathpathlibPurePath)pathnames r convert_pathrH{s 99W%%h/ 00rctjdk(rbtjj|s tjj ||Stjj ||ddStjdk(r]tjj |\}}|dtj k(r|dd}tjj ||Stdtjd)a 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. posixr Nrrznothing known about platform '')r"r#pathisabsjoin splitdrivesepr)new_rootrGdriverLs r change_rootrSs ww'ww}}X&77<<(3 377<<(12,7 7 D**84  7bff 8Dww||Hd++ #A"''!!L MMrcLtjdk(rNdtjvr< ddl}|j tj dtjd<dtjvrttjd<yy#t tf$rY@wxYw)aLEnsure 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()') rJHOMErNPLAT) r"r#r$pwdgetpwuidgetuid ImportErrorKeyErrorr)rXs r check_environr]s ww'fBJJ6  !$biik!:1!=BJJv  RZZ)^ 6 X&   s;BB#"B#ctttj}|j d|j D t |j|S#t$r}td|d}~wwxYw)a Perform variable substitution on 'string'. Variables are indicated by format-style braces ("{var}"). 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'. c3<K|]\}}|t|fywNstr).0r#values r zsubst_vars..sKu4U$Kszinvalid variable N) r]dictr"r$updateitems _subst_compat format_mapr\ ValueError)rA local_varslookupvars r subst_varsrospO "** F MMK 8H8H8JKK4Q**622 4,SE2334s A%% B.A<<Bcxd}tjd||}||k7rddl}|jdt|S)zb Replace shell/Perl-style variable substitution with format-style. For compatibility. c,d|jddS)N{r })group)matchs r_substz_subst_compat.._substsEKKN#2&&rz\$([a-zA-Z_][a-zA-Z_0-9]*)rNz-shell/Perl-style substitutions are deprecated)resubwarningswarnDeprecationWarning)rArvreplrys rriris? ' 66/ ;D qy ;   Krc|t|zSr`ra)excprefixs rgrok_environment_errorrs CH rctjdtjdatjdatjday)Nz[^\\\'\"z ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")rwcompilestring whitespace _wordchars_re _squote_re _dquote_rerrr _init_regexrs>JJ(6+<+<*=SABM01J01Jrc.t t|j}g}d}|rmtj||}|j }|t |k(r|j |d| |S||tjvr*|j |d|||dj}d}n||dk(r|d|||dzdz}|dz}n||dk(rtj||}n1||dk(rtj||}ntd||d|td ||d |j\}}|d|||dz|dz z||dz}|j d z }|t |k\r|j | |S|rm|S) aSplit 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. Nr\r rK"zthis can't happen (bad char 'z')zbad string (mismatched z quotes?))rrstripruendlenappendrrlstriprr RuntimeErrorrkspan)rAwordsposmrbegs r split_quotedrs   A E C   3 'eeg #a&= LL4C ! D LA S6V&& & LL4C !#$ AC sVt^$3!C!GI,&A'Cv}$$Q,33$$Q,"%B1S6("#MNNy #:1S6()!LMMJS#$3!C!GcAg..348A%%'A+C #a&= LLO  LO N Lrc| |j|}|dddk(r|dddz}tj||s||yy)a} Perform some action that affects the outside world (e.g. by writing to the filesystem). Such actions are special because they are disabled by the 'dry_run' flag. This method handles that complication; simply supply the function to call and an argument tuple for it (to embody the "external action" being performed) and an optional message to emit. Nz,)r))__name__r info)funcargsmsgverbosedry_runs rexecuter7sR  {x( rs8t a)c/CHHSM  d  rcR|j}|dvry|dvrytd|)zConvert 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. )yyesttrueon1T)rBnoffalseoff0Fzinvalid truth value )lowerrk)vals r strtoboolrQs: ))+C 22 5 5/w788rctjr td||dk(}|s*tjd\}} t j d| |stj|dd} | 5| jd | jd jtt|d z| jd |d |d|d|d|d dddtjg} | jtj | j#| t%| |t'tj(| fd| |yddlm} |D]} | dddk7r |dk\r+|dk(rdn|}t.j0j3| |}nt.j0j3| }| }|r0| dt5||k7rt7d| d||t5|d}|r tj8j||}tj8j;|}|s|s t=| |r&t j d| ||r| | ||t j>d| |!y#1swYxYw)a~Byte-compile a collection of Python source files to .pyc files in a __pycache__ subdirectory. '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 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. zbyte-compiling is disabled.Nrz.pyz$writing byte-compilation script '%s'wzutf-8)encodingz2from distutils.util import byte_compile files = [ z, z] z byte_compile(files, optimize=z, force=z, prefix=z , base_dir=z, verbose=z+, dry_run=False, direct=True) )rz removing )rr.) optimizationzinvalid prefix: filename z doesn't start with zbyte-compiling %s to %sz%skipping byte-compilation of %s to %s) sysdont_write_bytecoder tempfilemkstempr rr"fdopenwriterNmaprepr executableextend subprocess"_optim_args_from_interpreter_flagsrrrremove py_compiler importlibutilcache_from_sourcerrkrLbasenamer debug)py_filesoptimizeforcerbase_dirrrdirect script_fd script_namescriptcmdrfileoptcfiledfile cfile_bases r byte_compileraslP '(EFF~'1} #+#3#3E#: K 7EYYy#@F  " UZZD((;Y{m+DgV ' YDBCyE! 1}$Mbx!88C8P!88>E #f+&&0$3D8;OPVzZc&km, Xu5))%0JE$.HH6jI"eU3IIEtZX? YS  s 0A$I;;Jcd}|jd}|xr|djd|dk7}|r|nd}|j||zS)zReturn a version of the string escaped for inclusion in an RFC-822 header, by ensuring there are 8 spaces space after each newline. z T)keependsrr.) splitlinesrN)headerindentlinesends_in_newlinesuffixs r rfc822_escapers`F   t  ,EFb 4 4 6q 9U2Y FO&VBF ;;u  &&rc^tjdk(xrtjdS)zReturns True if the current platform is mingw. Python compiled with Mingw-w64 has sys.platform == 'win32' and get_platform() starts with 'mingw'. rmingw)rplatformr startswithrrris_mingwrs% <<7 " I|~'@'@'IIrc>ttjdS)zKReturn True if the Python interpreter is built with free threading support.Py_GIL_DISABLED)boolrr0rrris_freethreadedrs  (():; <__doc__ __future__r functoolsimportlib.utilrr"rErwrrrrrcollections.abcrrrtypingrrjaraco.functoolsr _logr _modifiedr errorsr rrtyping_extensionsrrrrrrr+r1r,r3r<r8rHrS lru_cacher]rorirrrrrrrrrrrrrrrrs #   77(&E6 u C $ <<8/ @*  1 1$N*N6RN N. ,,,4&(+/. . Z2<J  )       4 9$HYHYHY HY  HY  HY  HYHY HY HYV 'J=r