o bcu6@sVdZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z mZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(e&Z)ej*dkrbddl m+Z+ej,d e-d d dd d Zee#ddZ.eee)Zeee)Z/dddZ0dZ1zesej2Z1Wn e3yYnwddZ4ddZ5dddZ6dddZ7dS)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)partial)DistutilsPlatformError)_PREFIX _BASE_PREFIX _EXEC_PREFIX_BASE_EXEC_PREFIX _PROJECT_BASE _PYTHON_BUILD _init_posixparse_config_h_init_non_posix_is_python_source_dir _sys_home _variable_rx _findvar1_rx _findvar2_rxexpand_makefile_varsis_python_buildget_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_python_versionnt) _fix_pcbuildzCThe distutils.sysconfig module is deprecated, use sysconfig instead) stacklevelcCs t||dS)N)vars)sysconfig_parse_config_h)fpgr"*/usr/lib/python3.10/distutils/sysconfig.pyr Cs r T) check_homec Csddlm}||ddddd}|duri}i}i} |}|dur#n@tt|}|rb|dd\}} | } | d d } d | vrF| ||<nzt | } Wnt y]| d d ||<Ynw| ||<qd } |r4t |D]} || } t t | p}t t| }|r.|d}d}||vrt||}n>||vrd }n7|tjvrtj|}n,|| vr| dr| dd| vrd }nd||vrd }nt|d|}nd ||<}|r-| |d}| d|||} d |vr| || <qlzt | } Wnt y| || <Ynw| || <|| =| dr-| dd| vr-| dd} | |vr-| || <ql|| =ql|sh||D]\}} t| trL| ||<q<|||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$$$)CFLAGSLDFLAGSCPPFLAGSFPY_)distutils.text_filer%readlinerematchrgroupstripreplaceint ValueErrorlistsearchrrstrosenviron startswithendstartcloseitems isinstanceupdate)fnr!r%r donenotdonelinemnvtmpvrenamed_variablesnamevaluefounditemafterkr"r"r#parse_makefileNs                2   rVr+c Cs|jdkrGtjdkrtdsddl}|tdtd<tddd d d d d dddd \ }}}}}}}} } } } dtj vr[tj d} tjdkrYd tj vrY| |rY| |t |d}| }dtj vretj d}t ||gdr| dd} |dd}|dd}d tj vrtj d }dtj vrtj d}n|d}dtj vr|dtj d}n| r|d| }d tj vr|dtj d }|dtj d }n| r|d| }|d| }dtj vr|dtj d}|dtj d}|dtj d}n| r |d| }|d| }|d| }d tj vrtj d }dtj vr&|dtj d}n|d| }|d|}|j|||d|||||d||_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_COMPILERrNTrueCCCXXr-CCSHAREDLDSHARED SHLIB_SUFFIXARARFLAGSCONFIGURE_CPPFLAGSCONFIGURE_CFLAGSCONFIGURE_LDFLAGSz *-4.[0-8]z-fstack-protector-strongz-fstack-protectorCPPz -Er. r/) preprocessorcompiler compiler_so compiler_cxx linker_so linker_exearchiver) compiler_typesysplatform _config_varsget _osx_supportcustomize_compilerrr>r?r@lenfnmatchfilterr8set_executablesshared_lib_extension)rhrscccxxcflagsccsharedldshared shlib_suffixarar_flagsconfigure_cppflagsconfigure_cflagsconfigure_ldflagsnewcccpprmcc_cmdr"r"r#rts                                  rtcCstjtjkp ttdS)N real_prefix)ro base_prefixprefixhasattrr"r"r"r#is_virtual_environmentsrcCs|dur |rtp t}tjdkrBtr&|rtptStjt dd}tj |Sdt t }ts:|r:ddl }|dStj|d|Stjd krbtr[tj|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'. NposixsrcdirIncludepythonr platincludeincluderPCzFI don't know where Python installs its C header files on platform '%s')BASE_EXEC_PREFIX BASE_PREFIXr>rP python_buildr project_basepathjoinrnormpathr build_flags sysconfigget_pathpathsepr) plat_specificrincdir python_dirrr"r"r#get_python_inc!s0      rcCs| p tj|dv}|dur|r|rtpt}n|rtpt}tjdkrQ|s'|r+tj }nd}tj ||dt }|r<|S|rJt sJtj |dddStj |dStjd krg|r_tj |d Stj |d dSt d 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'. )z/usrz /usr/localNrlibrpython3z dist-packagesz site-packagesrLibz?I don't know where Python installs its library on platform '%s')r>rrrr EXEC_PREFIXPREFIXrPro platlibdirrrrr)r standard_libris_default_prefixlibdir libpythonr"r"r#get_python_libLs4     r)N)rN)rrN)8__doc___impr>r4rowarningsrv functoolsrr*rrrrrrrrrrr rr rr sysconfig_init_posixr rr rrrrrrrrrrrrrqrPrwarnDeprecationWarning _python_build_init_ntrVrabiflagsAttributeErrorrtrrrr"r"r"r#sF   \       o V +