_dIfdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z dejvZ ejjej Zejjej$Zejjej(Zejjej,Zdej0vr)ejj3ej0dZn\ej6r?ejj9ejj3ej6Znej:Zd Zeed dZ d Z!ejDd k(re d Z#e#eZe#e Z dZ$e$Z%dZ& e%s ejNZ&dZ)d%dZ*e dZ+dZ,dZ-dZ.dZ/dZ0dZ1d&dZ2dZ3dZ4dZ5d'dZ6ejndZ8ejndZ9ejnd Z:d'd!Z;d"Zd$Z?y#e($rYwxYw)(aProvide access to Python's configuration information. The specific configuration variables available depend heavily on the platform and configuration. The values may be retrieved using get_config_var(name), and the list of variables is available via get_config_vars().keys(). Additional convenience functions are also available. Written by: Fred L. Drake, Jr. Email: N)DistutilsPlatformError) py39compat) pass_none__pypy___PYTHON_PROJECT_BASEcttj|jdtfddDS)z] Return True if the target directory appears to point to an un-installed Python. Modulesc3\K|]#}j|j%ywN)joinpathis_file).0fnmoduless A/usr/lib/python3/dist-packages/setuptools/_distutils/sysconfig.py z(_is_python_source_dir..2s%Q"w#++-Qs),)Setupz Setup.local)pathlibPathr any)drs @r_is_python_source_dirr,s/ ll1o&&y1G Q8PQ QQ_homectjj|jtjj|S)z, Return True if a is a parent of b. )ospathnormcase startswith)dir_adir_bs r _is_parentr#8s3 77  E " - -bgg.>.>u.E FFrntcJttf}fd|D}t|S)Nc3vK|]0}ttjj|dr|2yw)PCbuildN)r#rrjoin)rprefixrs rrz_fix_pcbuild..Es2 !RWW\\&)<=  s69)PREFIX BASE_PREFIXnext)rprefixesmatcheds` r _fix_pcbuildr/As-;& "  GQrcJtrttSttSr ) _sys_homer project_baserr _python_buildr4Ps$Y//  ..rc.dtjddzS)zReturn a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. z%d.%dN)sys version_infor3rrget_python_versionr:fs S%%bq) ))rc|rtnt}||n|} tdtj}||||S#t $rt dtjzwxYw)aReturn the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pyconfig.h). If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. _get_python_inc_zFI don't know where Python installs its C header files on platform '%s')BASE_EXEC_PREFIXr+globalsrnameKeyErrorr) plat_specificr)default_prefixresolved_prefixgetters rget_python_incrEnsw*7%KN & 2fO -bggY78 /6= 99  $ !# )   s >&A$cHtjj|r|SdS)z5 Replace path with None if it doesn't exist. N)rrexists)rs r_extantrHs 77>>$'41T1rctr3tjdkr tjj |dSt |xs"tt||xs t|S)Ninclude) IS_PYPYr8r9rrr(_get_python_inc_posix_pythonrH_get_python_inc_from_config_get_python_inc_posix_prefixr) spec_prefixrAs r_get_python_inc_posixrTsV3##f,ww||FI..$]3 0 .}kJ K 0 ' /rctsy|rtxstStjj t dd}tjj|S)z Assume the executable is in the build directory. The pyconfig.h file should be in the same directory. Since the build directory may not be the source directory, use "srcdir" from the makefile to find the "Include" directory. NsrcdirInclude) python_buildr1r2rrr(get_config_varnormpath)rAincdirs rrOrOsF (L( WW\\.2I >F 77  F ##rc*|td|zdzSy)aj If no prefix was explicitly specified, provide the include directory from the config vars. Useful when cross-compiling, since the config vars may come from the host platform Python installation, while the current Python executable is from the build platform installation. >>> monkeypatch = getfixture('monkeypatch') >>> gpifc = _get_python_inc_from_config >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower) >>> gpifc(False, '/usr/bin/') >>> gpifc(False, '') >>> gpifc(False, None) 'includepy' >>> gpifc(True, None) 'confincludepy' NCONF INCLUDEPY)rY)rArSs rrPrPs$&f}4{BCCrctrdnd}|tztz}tjj |d|S)NpypypythonrM)rNr: build_flagsrrr()r)implementation python_dirs rrQrQs5&VHN"4"66DJ 77<< : 66rctr\tjj|dtjjztjj|dzStjj|dS)NrMPC)rXrrr(pathseprRs r_get_python_inc_ntrhs\ GGLL +ggoo ggll64( ) 77<< **rcJ|r|Stjj|dS)N site-packages)rrr() standard_lib libpython early_prefixr)s r _posix_librns ww||I77rctrotjdkr\|t}|r2tj j |dtjdStj j |dS|}|'|r|xrtxst}n|xrtxst}tjdk(r\|s|rttdd}nd}trdnd }tj j |||tz}t||||Stjd k(rC|r tj j |d Stj j |d dStd tjz) aSReturn the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_lib' is true, return the directory containing standard Python library modules; otherwise, return the directory for site-specific modules. If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. rJz lib-pythonrrjposix platlibdirlibr`rar$Libz?I don't know where Python installs its library on platform '%s')rNr8r9r*rrr(versionr=r+ EXEC_PREFIXr?getattrr:rnr)rArkr)rmlibdirrcrls rget_python_librxs:3##f, >F 77<< ckk!nE Eww||FO44L ~ "7'7F;F"2{>H 2:: D!B  "Cx"**Y"77HCx(*HcF"   x/ !  rzz !h&:&:&>&>x&N  $ $BJJx,@ $ A(4%g(rctrntjdk(r-tjj t xst d}nt xst }tjj |dStjS)z2Return full pathname of installed pyconfig.h file.r$rfz pyconfig.h) rXrr?rr(r1r2 sysconfigget_config_h_filename)inc_dirs rrrjsW 77d?ggll9#< dCG/O2O!g- % #4 ?3%''DGd!!%%'),E!+AGGI.5=Ee|(- /$'JE*/DJ#DM??51d12hBS6S#'8D#4/-2T DM]. " bHHJ  1 a ggiDG HHTN HO"3iic2DG3` *7).DJ7s$ I2 JI>=I>J J c tj|xstj|}|r@|j\}}|d||j |j dz||dz}n |Sr)aExpand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars' is the output of 'parse_makefile()', you're fine. Returns a variable-expanded version of 's'. rrN)rrrspanrr)srrbegrs rexpand_makefile_varsrsr     " rs6  *! 00 0   #** %ggs/ ggs/ 77##C$8$89 RZZ'77??2::.D#EFL ~~wwrwws~~'FG !ryy{ R C$ ' G77d?   -LY'I/    ll *:. 2 2 $ D.7 +83 lY5x 1- 0rzz?@ rzz:; rzz89 i X 2 O$ 'M   s"H((H0/H0