Reh@sdZddlZddlZddlZddlZddlmZmZyddlZWne k r|ddl ZYnXdddddd d d d d dg Z ddZ ej rejje ej Zne ejZejdkr/dedHdjkr/e ejjeeZejdkrxdedIdjkrxe ejjeeeZejdkrdedJdjkre ejjeeeZddZeZdaddZejZejdZddZd ejdd!Zd"ejdd#Z d$ejdd#Z!ejj"ej#Z$ejj"ej%Z&da'dZ(d%d&Z)d'd(Z*d)d*Z+d+d,Z,d-d.Z-d/d0Z.dd1d2Z/d3dZ0d4d5Z1d6d7Z2dd8dZ3d9dZ4d:d Z5d;d Z6e-dd<d=d Z7e-dd<d>dZ8d?dZ9d@dZ:dAd Z;dBd Z<dCdDZ=dEdFZ>e?dGkre>dS)Kz-Access to Python's configuration information.N)pardirrealpathget_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_pathget_path_names get_paths get_platformget_python_versionget_scheme_namesparse_config_hc Cs+yt|SWntk r&|SYnXdS)N)rOSError)pathr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/_backport/sysconfig.py_safe_realpath"s rntZpcbuildz\pc\v z\pcbuild\amd64cCs=x6dD].}tjjtjjtd|rdSqWdS)N Setup.dist Setup.localModulesTF)rr)osrisfilejoin _PROJECT_BASE)fnrrris_python_build:s $r Fc Cstsddlm}tjddd}||}|jd}|sYtd|j}tj |WdQRXt rx4dD],}tj |d d tj |d d qWdadS)N)finder.rz sysconfig.cfgzsysconfig.cfg exists posix_prefix posix_homeincludez{srcdir}/Include platincludez{projectbase}/.T)r%r&) _cfg_read resourcesr"__name__rsplitfindAssertionError as_stream_SCHEMESreadfp _PYTHON_BUILDset)r"Zbackport_packageZ_finderZ_cfgfilesschemerrr_ensure_cfg_readDs  r6z \{([^{]*?)\}cs*t|jdr(|jd}n t}|j}x\|D]T}|dkrYqDx<|D]4\}}|j||rq`|j|||q`WqDW|jdxz|jD]l}t|j|fdd}x<|j|D]+\}}|j||t j ||qWqWdS)Nglobalscs0|jd}|kr#|S|jdS)Nr$r)group)matchobjname) variablesrr _replaceros z"_expand_globals.._replacer) r6 has_sectionitemstuplesections has_optionr3remove_sectiondict _VAR_REPLsub)configr7r@sectionoptionvaluer<r)r;r_expand_globalsYs$     rJz%s.%s.%sz%s.%sr!z%s%scs"fdd}tj||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. csJ|jd}|kr#|S|tjkr=tj|S|jdS)Nr$r)r8renviron)r9r:) local_varsrrr<s   z_subst_vars.._replacer)rDrE)rrMr<r)rMr _subst_varssrNcCsF|j}x3|jD]%\}}||kr4q|||) target_dict other_dict target_keyskeyrIrrr _extend_dicts   rTcCsi}|dkri}t|tx]tj|D]L\}}tjdkretjj|}tjjt ||||rr:r expandusernormpathrN)r5varsresrSrIrrr _expand_varss #rZcs"fdd}tj||S)Ncs0|jd}|kr#|S|jdS)Nr$r)r8)r9r:)rXrrr<s zformat_value.._replacer)rDrE)rIrXr<r)rXr format_valuesr[cCstjdkrdStjS)NrUr%)rr:rrrr_get_default_schemesr\cCstjjdd}dd}tjdkr_tjjdpEd}|rR|S||dStjdkrtd }|r|r|S|dd |d tjdd S|r|S|dd SdS)NPYTHONUSERBASEcWstjjtjj|S)N)rrrVr)argsrrrjoinusersz_getuserbase..joinuserrAPPDATA~PythondarwinPYTHONFRAMEWORKLibraryz%d.%dr!z.local)rrLgetr:sysplatformr version_info)env_baser_base frameworkrrr _getuserbases"   rmcCstjd}tjd}tjd}|dkr?i}i}i}tj|dddd}|j}WdQRXx|D]} | jd s| jd krq|j| } | r| jd d \} } | j} | j d d } d| kr| || isinstanceupdate)filenamerX _variable_rx _findvar1_rx _findvar2_rxdonenotdoneflineslinemnvtmpvr;renamed_variablesr:rIfounditemafterkrrr_parse_makefiles   !                     rcCs`trtjjtdSttdr>dttjf}nd}tjjt d|dS)z Return the path of the Makefile.Makefileabiflagsz config-%s%srFstdlib) r2rrrrhasattrrg_PY_VERSION_SHORTrr)config_dir_namerrrrKs cCst}yt||Wn[tk rw}z;d|}t|drY|d|j}t|WYdd}~XnXt}y't|}t||WdQRXWn[tk r}z;d|}t|dr|d|j}t|WYdd}~XnXtr|d|d)r5rXexpandrrrr s cCst||||S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )r:r5rXrrrrrscGsutdkr6iattdd$D]D}t|}tjdd|}tjdd|}|t|krd3}qb|d?krd4}qbtd5|fnN|d-kr8tjd@krbd/}n*|dAkrbtjdBkr\d2}nd.}d9|||fS)CaReturn 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 (r$)amd64z win-amd64itaniumzwin-ia64rUr/rrr_-Nlinuxz%s-%ssunosr5solarisz%d.%srKr!irixaixz%s-%s.%scygwinz[\d.]+rcMACOSX_DEPLOYMENT_TARGETz0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)r#macosxz10.4.z-archrtfatz -arch\s+(\S+)i386ppcx86_64intelZfat3ppc64fat64 universalz%Don't know machine value for archs=%r PowerPCPower_Macintoshz%s-%s-%s)rr)rr)rrr)rr)rrrrl)rrl) rr:rgrr-rhrlowerrrrrrxryrr8rrfr{rrreadcloserrr~findallr?rr3rmaxsize)rijlookosnamehostreleasermachinerel_rerZcfgvarsZmacverZ macreleasercflagsZarchsrrrr Ys #  +     +!               cCstS)N)rrrrrr scCsaxZtt|jD]@\}\}}|dkrEtd|td||fqWdS)Nrz%s: z %s = "%s") enumeraterr>print)titledataindexrSrIrrr _print_dicts+ rcCsetdttdttdtttdtttdtdS)z*Display all information sysconfig detains.zPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"Paths VariablesN)rr r r\rr rrrrr_mainsr__main__iii)@__doc__rzrrxrgos.pathrr configparser ImportError ConfigParser__all__rrrrrrr:rrr r2r)r6RawConfigParserr0ryrDrJrirrrrWrrrrr _USER_BASErNrTrZr[r\rmrrrrrrr r r rrrr r rrr+rrrrs        +++     !    v