o ƚReh@sdZddlZddlZddlZddlZddlmZmZzddlZWn e y-ddl ZYnwgdZ ddZ ej rCeje ej Zne eZejdkraded dvrae ejeeZejdkrzd ed dvrze ejeeeZejdkrd ed dvre ejeeeZddZeZdaddZeZedZddZdejddZdejddZ dejddZ!ej"ej#Z$ej"ej%Z&da'dZ(ddZ)ddZ*dd Z+d!d"Z,d#d$Z-d%d&Z.dId'd(Z/d)d*Z0d+d,Z1d-d.Z2dId/d0Z3d1d2Z4d3d4Z5d5d6Z6e-dd7fd8d9Z7e-dd7fd:d;Z8dd?Z:d@dAZ;dBdCZe?dHkrHe>dSdS)Jz-Access to Python's configuration information.N)pardirrealpath) get_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_pathget_path_names get_paths get_platformget_python_versionget_scheme_namesparse_config_hcCs"zt|WSty|YSwN)rOSError)pathr/builddir/build/BUILDROOT/alt-python310-pip-21.3.1-3.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_vendor/distlib/_backport/sysconfig.py_safe_realpath"s   rntZpcbuildiz\pc\viz\pcbuild\amd64icCs,dD]}tjtjtd|rdSqdS)N)z Setup.distz Setup.localModulesTF)osrisfilejoin _PROJECT_BASE)fnrrris_python_build:s rFcCstsQddlm}tddd}||}|d}|sJd| }t|Wdn1s3wYt rMdD]}t |d d t |d d q._replacer) r2 has_sectionitemstuplesections has_optionr.remove_sectiondict _VAR_REPLsub)configr3rAsectionoptionvaluer<rr:r_expand_globalsYs*       rKz%s.%s.%sz%s.%srz%s%scfdd}t||S)zIn the string `path`, replace tokens like {some.thing} with the corresponding value from the map `local_vars`. If there is no corresponding value, leave the token unchanged. cs8|d}|vr |S|tjvrtj|S|dSr5)r7renvironr8 local_varsrrr<s    z_subst_vars.._replacerrErF)rrPr<rrOr _subst_varss  rRcCs0|}|D] \}}||vrq|||<qdSr)keysr?) target_dict other_dict target_keyskeyrJrrr _extend_dicts  rXcCs`i}|duri}t|tt|D]\}}tjdvr"tj|}tjt ||||<q|S)N)posixr) rXrr+r?rr9r expandusernormpathrR)r1varsresrWrJrrr _expand_varss   r^crM)Ncr4r5r6r8r\rrr<r=zformat_value.._replacerrQ)rJr\r<rr_r format_values  r`cCstjdkrdStjS)NrYr!)rr9rrrr_get_default_schemes racCstjdd}dd}tjdkr!tjdpd}|r|S||dStjdkr>td }|r>|r0|S|dd |d tjdd S|rB|S|dd S)NPYTHONUSERBASEcWstjtjj|Sr)rrrZr)argsrrrjoinusersz_getuserbase..joinuserrAPPDATA~PythondarwinPYTHONFRAMEWORKLibraryz%d.%drz.local)rrNgetr9sysplatformr version_info)env_baserdbaseZ frameworkrrr _getuserbases$      rqc Cstd}td}td}|duri}i}i}tj|ddd }|}Wdn1s0wY|D]L} | dsD| d krEq7|| } | r| d d \} } | } | d d } d | vrg| || <q7zt | } Wnt y~| d d || <Yq7w| || <q7t | }d}t|dkrlt|D]}||}||p||} | dur\| d } d}| |vrt|| }n>| |vrd}n7| tjvrtj| }n,| |vr|dr|dd|vrd }nd| |vrd}nt|d| }nd || <}|r[|| d}|d| ||}d |vr|||<qzt |}Wnt y3|||<Ynw|||<|||dr[|dd|vr[|dd}||vr[|||<q|||<||qt|dks|D]\}} t| tr| ||<qp|||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. z"([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_]*)}Nzutf-8surrogateescape)encodingerrors#r rz$$$)CFLAGSLDFLAGSCPPFLAGSrTFPY_rL)recompilecodecsopen readlines startswithstripmatchr7replaceint ValueErrorlistrSlenr@searchstrrrNendstartremover? isinstanceupdate)filenamer\ _variable_rx _findvar1_rx _findvar2_rxdonenotdoneflineslinemnvtmpvr;renamed_variablesr9rJfounditemafterkrrr_parse_makefiles                          :   rcCsDtr tjtdSttdrdttjf}nd}tjt d|dS)z Return the path of the Makefile.Makefileabiflagsz config-%s%srGstdlib) r-rrrrhasattrrl_PY_VERSION_SHORTrr)config_dir_namerrrrKs  rc Cst}zt||Wn ty*}zd|}t|dr"|d|j}t|d}~wwt}zt| }t||Wdn1sCwYWn tyi}zd|}t|dra|d|j}t|d}~wwtrt|d|d<dSdS)z7Initialize the module as appropriate for POSIX systems.z.invalid Python installation: unable to open %sstrerrorz (%s)N BLDSHAREDLDSHARED) rrIOErrorrrrrrr-)r\makefileemsgconfig_hrrrr _init_posixVs4    rcCsVtd|d<td|d<td|d<d|d<d |d <t|d <tjttj|d <d S)z+Initialize the module as appropriate for NTrLIBDEST platstdlib BINLIBDESTr# INCLUDEPYz.pydSOz.exeEXEVERSIONBINDIRN)r_PY_VERSION_SHORT_NO_DOTrrdirnamerrl executabler_rrr_init_non_posixrs   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_]+) [*]/ Tr rr)r|r}readlinerr7rr)fpr\ define_rxundef_rxrrrrrrrrs,       rcCs:trtjdkrtjtd}nt}ntd}tj|dS)zReturn the path of pyconfig.h.rPCr$z pyconfig.h)r-rr9rrrr)inc_dirrrrrs  rcCstttS)z,Return a tuple containing the schemes names.)r@sortedr+rArrrrr sr cCs tdS)z*Return a tuple containing the paths names.r!)r+optionsrrrrr s r TcCs"t|r t||Stt|S)zReturn a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. )r2r^rDr+r?)r1r\expandrrrr s r cCst||||S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )r9r1r\rrrrrsrcGstdur3iattd<ttd<ttd<ttd<tdtdtd<ttd <ttd <ttd <ztjtd <Wn tyAd td <Ynwt j dvrKt tt j dkrTt ttj dkr^ttd<dtvrgttd<nttdtd<trt j dkrt}zt }Wn tyd}Ynwt jtds||krt j|td}t j|td<tjdkr3t d}t|dd}|dkrdD]}t|}tdd|}tdd|}|t|<qnWdt jvrt jd}dD]}t|}tdd|}|d|}|t|<qtdd } td| } | dur3| d} t j!| s3dD]}t|}tdd|}|t|<q |rHg} |D] } | "t| q:| StS)ayWith no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS 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. Nprefix exec_prefix py_versionpy_version_shortrrpy_version_nodotrpplatbase projectbaserrv)rZos2rYz2.6userbasesrcdirrhr)ry BASECFLAGSrx PY_CFLAGSrz -arch\s+\w+\s z-isysroot [^ ]*Z ARCHFLAGSrxz-isysroot\s+(\S+)r z-isysroot\s+\S+(\s|$))# _CONFIG_VARS_PREFIX _EXEC_PREFIX _PY_VERSIONrrrlrAttributeErrorrr9rrversionrqrr-getcwdrrisabsrr[rmunamersplitr|rFrNrkrr7existsappend)rcrpcwdrZkernel_version major_versionrWflagsarchrxrZsdkvalsr9rrrrs                     rcCs t|S)zReturn the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) )rrk)r9rrrrPs rcCsTtjdkr7d}tj|}|dkrtjStjd|}tj|t||}|dkr.dS|dkr4dStjStjd ksAttd sDtjSt \}}}}}| d d }| d d}| d d}|dddkrod||fS|dddkr|ddkrd}dt |dd|ddf}n|dddkrd||fS|dddkrd|||fS|ddd krd }t d!} | |} | r| }n|ddd"krt} | d#} | } ztd%}Wn tyYn)wzt d&|} W|n|w| durd'| d(d'dd} | s| } | r| }d)}| d'd*krd+td,d vrd-}td,}t d.|}ttt|}t|d(krV|d}nM|d/kr^d-}nE|d0krfd1}n=|d2krnd3}n5|d4krvd5}n-|d6kr~d7}n%td8|f|d9krtjd:krd;}n|d}d?|||fS)@aReturn 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'. rz bit ()amd64z win-amd64Zitaniumzwin-ia64rYr/rvr_-Nlinuxz%s-%ssunosr5solarisz%d.%srLrZirixaixz%s-%s.%scygwinz[\d.]+rhMACOSX_DEPLOYMENT_TARGETTz0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)rr macosxz10.4.z-archrxfatz -arch\s+(\S+))i386ppc)rx86_64intel)rrrZfat3)ppc64rfat64)rrrr universalz%Don't know machine value for archs=%rrlr)PowerPCPower_Macintoshrrz%s-%s-%s) rr9rlrr)rmrlowerrrrrr|r}rr7rrkrrrreadcloserrrfindallr@rr.rmaxsize)rijZlookosnamehostreleasermachinerel_rerZcfgvarsZmacverZ macreleasercflagsZarchsrrrr Ys                          r cCstSr)rrrrrr sr cCsFtt|D]\}\}}|dkrtd|td||fqdS)Nrz%s: z %s = "%s") enumeraterr?print)titledataindexrWrJrrr _print_dicts  rcCsRtdttdttdtttdtttdtdS)z*Display all information sysconfig detains.zPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"Paths VariablesN)rr r rarr rrrrr_mains r__main__r)@__doc__r~rr|rlos.pathrr configparser ImportError ConfigParser__all__rrrrrrr9rrrr-r%r2RawConfigParserr+r}rErKrnrrrr[rrrrr _USER_BASErRrXr^r`rarqrrrrrrr r r rrrr r rrr'rrrrs~     !   v     #