0{YNi@sdZddlZddlZddlZddlZddlmZmZyddlZWne k r|ddl ZYnXdddddd d d d d dg Z ddZ ej rejje ej Zne ejZejdkr2dedEdjkr2e ejjeeZnejdkr~dedFdjkr~e ejjeeeZnejdkrdedGdjkre ejjeeeZnddZeZdaddZejZejdZddZejjdZ ejdd Z!e de d!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,d-Z/dd.d/Z0d0dZ1d1d2Z2d3d4Z3dd5dZ4d6dZ5d7d Z6d8d Z7e.dd9d:d Z8e.dd9d;dZ9d<dZ:d=dZ;d>d Z<d?d Z=d@dAZ>dBdCZ?e@dDkre?ndS)Hz-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)pathrB/tmp/pip-ok8sy_ze-build/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 |WdQXt rx7dD],}tj |d d tj |d d qWndandS)N)finder.rz sysconfig.cfgzsysconfig.cfg exists posix_prefix posix_homeincludez{srcdir}/Include platincludez{projectbase}/.T)z posix_prefixz posix_home) _cfg_read resourcesr"__name__rsplitfindAssertionError as_stream_SCHEMESreadfp _PYTHON_BUILDset)r"Zbackport_packageZ_finderZ_cfgfilesschemerrr_ensure_cfg_readDs  r6z \{([^{]*?)\}cs0t|jdr(|jd}n t}|j}xb|D]Z}|dkr\qDnx?|D]7\}}|j||rqcn|j|||qcWqDW|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$     rJr!cs"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_varssrNcCsI|j}x6|jD](\}}||kr7qn|||) target_dict other_dict target_keyskeyrIrrr _extend_dicts   rTcCsi}|dkri}nt|tx`tj|D]O\}}tjdkrktjj|}ntjjt ||||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}tjdkrbtjjdpEd}|rR|S||dSntjdkrtd }|r|r|S|dd |d tjdd Sqn|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}|dkrBi}ni}i}tj|dddd}|j}WdQXx|D]} | jd s| jd krqn|j| } | r| jd d \} } | j} | j d d } d| kr| || tj| }nx| |kr|jdrx|dd|krxd }qd| |krd}qt|d| }nd || <}|r|| jd}|d| j||}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_namerrrrMs cCs&t}yt||Wn^tk rz}z>d|}t|dr\|d|j}nt|WYdd}~XnXt}y&t|}t||WdQXWn^tk r }z>d|}t|dr|d|j}nt|WYdd}~XnXtr"|d|d)r5rXexpandrrrr s cCst||||S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )r:r5rXrrrrrscGstdkrTiattdkrd3}qt|d?kr d4}qttd5|fqw|d-krGtjd@krtd/}qtqw|dAkrwtjdBkrkd2}qtd.}qwqznd9|||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-archrtZfatz -arch\s+(\S+)i386ppcx86_64ZintelZfat3ppc64Zfat64 universalz%Don't know machine value for archs=%r PowerPCPower_Macintoshz%s-%s-%s)rppc)rr)rrr)rr)rrrrl)zPowerPCzPower_Macintoshl) rr:rgrr-rhrlowerrrrrrxryrr8rrfr{rrreadcloserrr~findallr?rr3rmaxsize)rijlookosnamehostreleasermachinerel_rerZcfgvarsZmacverZ macreleasercflagsZarchsrrrr [s #  .     . !               cCstS)N)rrrrrr scCsdx]tt|jD]C\}\}}|dkrHtd|ntd||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)A__doc__rzrrxrgos.pathrr configparser ImportError ConfigParser__all__rrrrrrr:rrr r2r)r6RawConfigParserr0ryrDrJrrrrrrWrrrrr _USER_BASErNrTrZr[r\rmrrrrrrr r r rrrr r rrr+rrrrs        ++!+!     #    v