o _aV@sdZddlZddlZddlZddlZddlmZdejvZej ej Z ej ej Zej ejZej ejZdejvrHej ejdZnejrWej ej ejZneZddZeed dZejd krvd d ZeeZeeZd dZeZdZ zesej!Z Wn e"yYnwddZ#d1ddZ$ddZ%d2ddZ&ddZ'ddZ(dZ)ddZ*d3dd Z+e,d!Z-e,d"Z.e,d#Z/d3d$d%Z0d&d'Z1da2d(Z3d)d*Z4d+d,Z5d-d.Z6d/d0Z7dS)4aProvide 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__pypy___PYTHON_PROJECT_BASEcCs,dD]}tjtj|d|rdSqdS)N)Setupz Setup.localModulesTF)ospathisfilejoin)dfnrA/usr/lib/python3/dist-packages/setuptools/_distutils/sysconfig.py_is_python_source_dir,s r_homentcCs0|rtj|tjtjtdrtS|S)NPCbuild)rr normcase startswithr PREFIX)r rrr _fix_pcbuild5s rcCstrttSttSN) _sys_homer project_baserrrr _python_build=srcCsdtjddS)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_inforrrrget_python_versionQsr cCs|dur |rtp t}tjdkrItrtjdkrtj|dSt r4|r%t p$t Stjt dd}tj |Str8dnd}|tt}tj|d|Stjd krit rbtj|dtjjtj|d Stj|dStd tj) 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'. NposixincludesrcdirIncludepypypythonrPCzFI don't know where Python installs its C header files on platform '%s')BASE_EXEC_PREFIX BASE_PREFIXrnameIS_PYPYrrr r python_buildrrget_config_varnormpathr build_flagspathsepr) plat_specificprefixincdirimplementation python_dirrrrget_python_incYs0      r9cCs|r|Stj|dS)N site-packages)rr r ) standard_lib libpython early_prefixr5rrr _posix_libsr>cCstr!tjdkr!|dur t}|rtj|dtjdStj|dS|}|dur6|r0|r-tp.t }n|r4t p5t}tj dkr`|s?|rFt tdd}nd}trLd nd }tj|||t }t||||Stj d krv|rntj|d Stj|d dStd tj )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'. r"Nz lib-pythonrr:r! platlibdirlibr(r)rLibz?I don't know where Python installs its library on platform '%s')r.rrrrr r versionr+r, EXEC_PREFIXr-getattrr r>r)r4r;r5r=libdirr7r<rrrget_python_libs:     rFc Cs|jdkrtjdkrtdsddl}|tdtd<tddd d d d d d\}}}}}}}} dtj vrOtj d} d tj vrM| |rM| |t |d}| }dtj vrYtj d}d tj vrctj d }dtj vrntj d} n|d} dtj vr|dtj d}d tj vr|dtj d }|dtj d }dtj vr| dtj d} |dtj d}|dtj d}d tj vrtj d }dtj vr|dtj d} n|d| } |d|} |j | | | d||||| ddtj vr|j ddr|j tj dd||_dSdS)zDo any platform-specific customization of a CCompiler instance. Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile. unixdarwinCUSTOMIZED_OSX_COMPILERrNTrueCCCXXCFLAGSCCSHAREDLDSHARED SHLIB_SUFFIXARARFLAGSCPPz -ELDFLAGS CPPFLAGS) preprocessorcompiler compiler_so compiler_cxx linker_so linker_exearchiverRANLIBranlib)r_) compiler_typerplatformr0 _osx_supportcustomize_compiler _config_varsget_config_varsrenvironrlenset_executables executablesgetshared_lib_extension)rXrbcccxxcflagsccsharedldshared shlib_suffixarar_flagsnewcccppr]cc_cmdrrrrcsh                         rccCsDtrtjdkrtjtp td}n tpt}ntdd}tj|dS)z2Return full pathname of installed pyconfig.h file.rr*rr4z pyconfig.h)r/rr-r r rrr9)inc_dirrrrget_config_h_filenames    ryz+config-{python_ver}{build_flags}{multiarch}cCs`tr tjtptdStddd}ttj drdtj j nd}t j t t|d}tj||dS) zAReturn full pathname of installed Makefile from the Python build.Makefilerrr4r; _multiarchz-%sr) python_verr2 multiarch)r/rr r rrrFhasattrrr7r|_makefile_tmplformatr r2)lib_dirr~ config_filerrrget_makefile_filenames  rcCs|duri}td}td} |}|s |S||}|r>|dd\}}zt|}Wn ty8Ynw|||<n||}|rLd||d<q)zParse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. Nz"#define ([A-Z][A-Za-z0-9_]+) (.*) z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/ Trrr)recompilereadlinematchgroupint ValueError)fpg define_rxundef_rxlinemnvrrrparse_config_h0s&     rz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}c Csddlm}||ddddd}|duri}i}i} |}|dur#n?t|}|ra|dd\}} | } | d d } d | vrE| ||<nzt| } Wnt y\| d d ||<Ynw| ||<qd } |r1t |D]} || } t | pzt | }|r+|d}d}||vrt||}n>||vrd }n7|tjvrtj|}n,|| vr| dr| dd| vrd }nd||vrd }nt|d|}nd ||<}|r*| |d}| d|||} d |vr| || <qkzt| } Wnt y| || <Ynw| || <|| =| dr*| dd| vr*| dd} | |vr*| || <qk|| =qk|sg||D]\}} t| trI| ||<q9|||S)zParse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. r)TextFilersurrogateescape)strip_comments skip_blanks join_lineserrorsNTrz$$r$)rMrTrVFPY_r#)distutils.text_filerr _variable_rxrrstripreplacerrlist _findvar1_rxsearch _findvar2_rxstrrrfrendstartcloseitems isinstanceupdate)r rrrdonenotdonerrrrtmpvrenamed_variablesr-valuefounditemafterkrrrparse_makefileSs                2   rcCsX t|p t|}|r(|\}}|d|||d||d}n |Sq)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'. TrrN)rrrspanrjr)svarsrbegrrrrexpand_makefile_varss *rz+_sysconfigdata_{abi}_{platform}_{multiarch}c Cstjdtjtjtjttj ddd}z t |t t dgd}Wnt y5t dt t dgd}Ynw|j}iat|dS) z7Initialize the module as appropriate for POSIX systems._PYTHON_SYSCONFIGDATA_NAMEr|r)abirar~build_time_varsr_sysconfigdataN)rrfrj_sysconfig_name_tmplrrabiflagsrarDr7 __import__globalslocals ImportErrorrrdr)r-_temprrrr _init_posixs$  rcCs~i}tddd|d<tddd|d<tdd|d<td|d<d |d <td d |d <tjtj t j |d<|a dS)z+Initialize the module as appropriate for NTrrr{LIBDEST BINLIBDESTrw INCLUDEPY EXT_SUFFIXz.exeEXE.rVERSIONBINDIRN) rFr9_impextension_suffixesr rrr dirnameabspathr executablerd)rrrr_init_ntsrcGsLtdurtdtj}|r|niattd<ttd<tstd}|dur,|td<tdt}tjdkrOt rHtj t }tj ||}ntj t }tj tj |td<t rtjdkrt}tj tds|tkrtj |td}tj |td<tjd krd dl}|t|rg}|D] }|t|q|StS) aWith no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. N_init_r5 exec_prefixrSOr&r!rHr)rdrrjrr-rrCr.rr/r rrr rr1isabsgetcwdrrarbcustomize_config_varsappend)argsfuncrr&baserbvalsr-rrrresB       recCs*|dkrddl}|dtdt|S)zReturn the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) rrNz SO is deprecated, use EXT_SUFFIXr)warningswarnDeprecationWarningrerj)r-rrrrr0Qs r0)rN)rrNr)8__doc__rrrrrrbuiltin_module_namesr.r r1r5rrrC base_prefixr,base_exec_prefixr+rfrrrrrrrDrr-rrr/r2rAttributeErrorr r9r>rFrcryrrrrrrrrrrdrrrrer0rrrrsh        , 7K     j K