Your IP : 3.145.2.137


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/platform.pyo

�
�mec
@s�dZdZdZddlZddlZddlZddlZy
ejZWn/e	k
r�ej
dZkrwd	Zq�d
ZnXejd�Zej
ddd
d�Zd�Zejd�Zejd�Zejd�Zd[Zd �Zddded!d"�Zddded#�Zd$d\d%��YZd&dd'�Zdd(�Zejd)�Zdddd]d*�Zdd+�Zddddd,�Zdd-�Zd.�Z d/�Z!d0�Z"dd^dd1�Z#d2�Z$ddd_d`d3�Z%d4�Z&d5�Z'dd6�Z(e)ej*d7�sAej*j+ej*j,ej-ej*j.d8�Z/nej*j0Z/d9�Z1dd:�Z2dd;�Z3idad6dbd6dcd6Z4ejd?�j5Z6ej
ddd@�Z7da8dA�Z9dB�Z:dC�Z;dD�Z<dE�Z=dF�Z>dG�Z?ejdH�Z@ejdI�ZAejdJ�ZBiZCddK�ZDdL�ZEdM�ZFdN�ZGdO�ZHdP�ZIdQ�ZJdR�ZKiZLdSdSdT�Z
eMdUkr�dVejNkp�dWejNkZOdXejNko�dYejNkZPe
ePeO�GHejQdS�ndS(ds8 This module tries to retrieve as much platform-identifying data as
    possible. It makes this information available via function APIs.

    If called from the command line, it prints the platform
    information concatenated as single string to stdout. The output
    format is useable as part of a filename.

s
    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com

    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee or royalty is hereby granted,
    provided that the above copyright notice appear in all copies and that
    both that copyright notice and this permission notice appear in
    supporting documentation or portions thereof, including modifications,
    that you make.

    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !

s1.0.7i����Ntdostwin32twin16tos2tNULs	/dev/nullsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)ticCs~ttjd�r'tjj|�}nt|d�}|j|�}d}xtj||�}|s�|j|�}|sPnd}qNn|j�\}}	}
}}}
|r�|r�d}n�|	r�|dkr�d}|
}q[|
|kr[|
}q[nc|r[|dkr[d}|
r+|
|kr+|
}n|rX|t	|�|krX||}qXq[n|j
�}qN|j�||fS(s Tries to determine the libc version that the file executable
        (which defaults to the Python interpreter) is linked against.

        Returns a tuple of strings (lib,version) which default to the
        given parameters in case the lookup fails.

        Note that the function has intimate knowledge of how different
        libc versions add symbols to the executable and thus is probably
        only useable for executables compiled using gcc.

        The file is read and scanned in chunks of chunksize bytes.

    trealpathtrbitlibctglibc(thasattrtostpathRtopentreadt_libc_searchtsearchtgroupstlentendtclose(t
executabletlibtversiont	chunksizetftbinarytpostmtlibcinitR	tglibcversiontsotthreadst	soversion((s /usr/lib64/python2.7/platform.pytlibc_ver�s@
			
cCs�tjjd�r�td�j�}d}x�|D]�}tj|�}t|�dkr1|\}}nq1|dkr�tj|�}q1|dkr1tj|d�}|d}q1q1W|||fStjjd�rAtd�j�}xV|D]K}tj|d�}	t|	�dkr�|	dd	kr�d	|	d
|fSq�Wntjj	d�r�tj
d�}
xBtt|
�d
dd�D]$}|
|d
 dkr|
|=qqW|
r�|
j�d}|
dd
}|||fSn|||fS(s� Tries some special tricks to get the distribution
        information in case the default method fails.

        Currently supports older SuSE Linux, Caldera OpenLinux and
        Slackware Linux distributions.

    s/var/adm/inst-log/infotSuSEitMIN_DIST_VERSIONt
DIST_IDENTt-s/etc/.installedit	OpenLinuxis/usr/lib/setupi����isslack-version-t	slackware(
RRtexistsR
t	readlineststringtsplitRtstriptisdirtlistdirtrangetsort(tdistnameRtidtinfotlinettvttagtvaluetvaluestpkgtverfilestn((s /usr/lib64/python2.7/platform.pyt_dist_try_harder�s>	


"#
s(\w+)[-_](release|version)s'(.+) release ([\d.]+)[^(]*(?:\((.+)\))?s1([^0-9]+)(?: release )?([\d.]+)[^(]*(?:\((.+)\))?R#tdebiantfedoratredhattcentostmandraketmandrivatrocksR(t	yellowdogtgentootUnitedLinuxt
turbolinuxcCs�d}d}tj|�}|dk	r7t|j��Stj|�}|dk	rbt|j��Stjtj|��}|r�|d}t	|�dkr�|d}q�nd||fS(NRii(
t_lsb_release_versiontmatchtNonettupleRt_release_versionR+R,R-R(t	firstlineRR3Rtl((s /usr/lib64/python2.7/platform.pyt_parse_release_files
icCs#ytjd�}Wntjk
r3|||fSX|j�xd|D]L}tj|�}|dk	rE|j�\}}	||kr�|}Pq�qEqEWt|||�St	d|d�}
|
j
�}|
j�t|�\}}}
|r�|r�|}n|r|}n|
r|
}n|||fS(s� Tries to determine the name of the Linux OS distribution name.

        The function first looks for a distribution release file in
        /etc and then reverts to _dist_try_harder() in case no
        suitable files are found.

        supported_dists may be given to define the set of Linux
        distributions to look for. It defaults to a list of currently
        supported Linux distributions identified by their release file
        name.

        If full_distribution_name is true (default), the full
        distribution read from the OS is returned. Otherwise the short
        name taken from supported_dists is used.

        Returns a tuple (distname,version,id) which default to the
        args given as parameters.

    s/etcs/etc/trN(
RR/terrorR1t_release_filenameRJRKRR=R
treadlineRRP(R2RR3tsupported_diststfull_distribution_nametetctfileRt	_distnametdummyRRNt_versiont_id((s /usr/lib64/python2.7/platform.pytlinux_distribution#s0


			cCst|||d|dd�S(sQ Tries to determine the name of the Linux OS distribution name.

        The function first looks for a distribution release file in
        /etc and then reverts to _dist_try_harder() in case no
        suitable files are found.

        Returns a tuple (distname,version,id) which default to the
        args given as parameters.

    RURVi(R](R2RR3RU((s /usr/lib64/python2.7/platform.pytdist[st_popencBsbeZdZdZdZdZdZddd�Zd�Z	d�Z
ejej
d�ZeZRS(s Fairly portable (alternative) popen implementation.

        This is mostly needed in case os.popen() is not available, or
        doesn't work as advertised, e.g. in Win9X GUI programs like
        PythonWin or IDLE.

        Writing to the pipe is currently not supported.

    RRQcCst|dkrtd�nddl}|j�|_}tj|d|�t|d�|_||_||_	dS(NRQs)popen()-emulation only supports read modei����s > %sR(
t
ValueErrorttempfiletmktempttmpfileRtsystemR
tpipetbufsizetmode(tselftcmdRgRfRaRc((s /usr/lib64/python2.7/platform.pyt__init__}s	cCs
|jj�S(N(ReR(Rh((s /usr/lib64/python2.7/platform.pyR�scCs |jdk	r|jj�SdS(N(RfRKReR*(Rh((s /usr/lib64/python2.7/platform.pyR*�scCsV|jr|jj�}nd}|jrRy||j�WqR|k
rNqRXn|S(Ni�(ReRRc(RhtremoveRRtrc((s /usr/lib64/python2.7/platform.pyR�s		
N(t__name__t
__module__t__doc__RcRKReRfRgRjRR*RtunlinkRRRt__del__(((s /usr/lib64/python2.7/platform.pyR_ms
		RQcCs�d}tjjdd�dkrQyddl}Wntk
rDqQX|j}n|dkr�ttd�r�tj}tj	dkr�y|d�Wq�tj
k
r�t}q�Xq�q�t}n|dkr�|||�S||||�SdS(s! Portable popen() interface.
    tOSRt
Windows_NTi����NtpopenR(RKRtenvirontgett	win32pipetImportErrorRtR
tsystplatformRRR_(RiRgRfRtRw((s /usr/lib64/python2.7/platform.pyRt�s&
		
cCs~tj|d�}|r(|j|�nytt|�}Wntk
rT|}nXtt|�}tj|d d�}|S(s� Normalize the version and build strings and return a single
        version string using the format major.minor.build (or patchlevel).
    t.i(R+R,tappendtmaptintR`tstrtjoin(RtbuildROtintststrings((s /usr/lib64/python2.7/platform.pyt
_norm_version�s

s'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])c	Cs8tj|kr|||fSx�dD]o}y7t|�}|j�}|j�r_tjd�nWn.tjk
r{}q#q#tk
r�}q#q#XPq#W|||fStj	|�}t
j|�}|dk	r+|j
�\}}}|ddkr�|d }n|ddkr|d }nt|�}n|||fS(	s2 Tries to figure out the OS version used and returns
        a tuple (system,release,version).

        It uses the "ver" shell command for this which is known
        to exists on Windows, DOS and OS/2. XXX Others too ?

        In case this fails, the given parameters are used as
        defaults.

    tverscommand /c vers
cmd /c verscommand failedi����R{(R�scommand /c vers
cmd /c verN(RyRzRtRRRRRtIOErrorR+R-t_ver_outputRJRKRR�(	RdtreleaseRtsupported_platformsRiReR4twhyR((s /usr/lib64/python2.7/platform.pyt_syscmd_ver�s0




cCs]yddlm}Wn&tk
r<ddl}|j}nXy|||�SWn|SXdS(se Read a value for name from the registry key.

        In case this fails, default is returned.

    i����(tRegQueryValueExN(twin32apiR�Rxt_winregtQueryValueEx(tkeytnametdefaultR�R�((s /usr/lib64/python2.7/platform.pyt_win32_getvalues

cCsCyTddl}ddlm}m}m}m}ddlm}	m}
m}m	}Wn�t
k
r�ytjWnt
k
r�||||fSXddl}
tj}|
j}|
j}|
j}|
j}	d}d}
d}d}d}nX|�}|\}}}}}d|||d	@f}t|d
�rQ|jdkrrd|j}qrn!|d
 dkrrd|d
}n||kr�d}|dkr�|dkr�d}q�|dkr�d}q�|dkr�d}q�d}q�|dkr�d}q�n�||
kr�d}|dkrd}q�|dkrk|dkr8d}q�|dkrMd}q�|dkrbd}q�d}q�|d kr�t|d!�r�|j}nl|}yR||	|�}||d"�\}}||kr�|jd#�dkr�|}nWntk
r�nX|dkr(||krd$}q�d%}q�|dkrR||krId&}q�d'}q�|dkr|||krsd(}q�d)}q�d*}q�n)|s�d+||f}n||||fSy ||	|�}||d,�Wn||||fSXt|d-d/�d}t|d.|df�d}t||�}||�||||fS(0s  Get additional version information from the Windows Registry
        and return a tuple (version,csd,ptype) referring to version
        number, CSD level (service pack), and OS type (multi/single
        processor).

        As a hint: ptype returns 'Uniprocessor Free' on single
        processor NT machines and 'Multiprocessor Free' on multi
        processor machines. The 'Free' refers to the OS version being
        free of debugging code. It could also state 'Checked' which
        means the OS version uses debugging code, i.e. code that
        checks arguments, ranges, etc. (Thomas Heller).

        Note: this function works best with Mark Hammond's win32
        package installed, but also on Python 2.3 and later. It
        obviously only runs on Win32 compatible platforms.

    i����N(R�tRegOpenKeyExtRegCloseKeytGetVersionEx(tHKEY_LOCAL_MACHINEtVER_PLATFORM_WIN32_NTtVER_PLATFORM_WIN32_WINDOWStVER_NT_WORKSTATIONiiis%i.%i.%ii��tservice_packRsSP%si
s
Service Pack tSPs)SOFTWARE\Microsoft\Windows\CurrentVersioniit95i
t98iZtMetpostMeit2000s,SOFTWARE\Microsoft\Windows NT\CurrentVersiontNTtXPt
2003Servertpost2003itproduct_typetProductNametServertVistat
2008Servert7t2008ServerR2t8t
2012Servertpost2012Servers%i.%it
SystemRoottCurrentBuildNumbertCurrentType(Ri(R�R�R�R�R�twin32conR�R�R�R�RxRytgetwindowsversiontAttributeErrorR�R�t	OpenKeyExtCloseKeyR
R�tservice_pack_majorR�tfindtWindowsErrorR�R�(R�RtcsdtptypeR�R�R�R�R�R�R�R�R�R�t
VER_NT_SERVERtREG_SZtwinvertmajtmintbuildnotplattregkeyR�R�R�ttypet	keyCurVerR�((s /usr/lib64/python2.7/platform.pyt	win32_ver)s�"&

					
										!

						

cCs{ddlm}ddl}g}|j}xI|D]A}y|||��Wq2t|jfk
rr||�q2Xq2W|S(Ni����(tgestalt(R�tMacOSR|tRuntimeErrortError(t	selectorsR�R�R�ROR|tselector((s /usr/lib64/python2.7/platform.pyt_mac_ver_lookup�s	
cCst|�dS(Ni(thex(tbcd((s /usr/lib64/python2.7/platform.pyt_bcd2str�sc
Csyddl}ddl}Wntk
r0dSXtd�\}}|r�|d@d?}|d@d?}|d	@}||fdkr�td�\}}}d|||f}q�dt|�||f}n|r�idd6dd6dd
6j|d�}nd}	||	|fS(s�
        Thanks to Mark R. Levinson for mailing documentation links and
        code examples for this function. Documentation for the
        gestalt() API is available online at:

           http://www.rgaros.nl/gestalt/
    i����Ntsysvtsysai�ii�iii
tsys1tsys2tsys3s%i.%i.%is%s.%i.%it68kitPowerPCiti386R(ssysvssysa(i
i(R�R�R�(RRR(R�R�RxRKR�R�Rv(
R�R�R�R�tmajortminortpatchR�tmachinetversioninfo((s /usr/lib64/python2.7/platform.pyt_mac_ver_gestalt�s(	


cCs�d}tjj|�sdSyddl}Wntk
r@dSX|j|�}|d}d	}tj�d}|d
kr�d}n|||fS(Ns0/System/Library/CoreServices/SystemVersion.plisti����tProductVersionRitppcsPower MacintoshR�(RRR(R�sPower Macintosh(RRR)RKtplistlibRxt	readPlisttuname(tfnR�tplR�R�R�((s /usr/lib64/python2.7/platform.pyt_mac_ver_xmls

	cCs?t�}|dk	r|St�}|dk	r2|S|||fS(s; Get MacOS version information and return it as tuple (release,
        versioninfo, machine) with versioninfo being a tuple (version,
        dev_stage, non_release_version).

        Entries which cannot be determined are set to the paramter values
        which default to ''. All tuple entries are strings.
    N(R�RKR�(R�R�R�R4((s /usr/lib64/python2.7/platform.pytmac_vers		cCsPddlm}y'|j|�}|dkr2|S|SWntk
rK|SXdS(Ni����(tSystem(t	java.langR�tgetPropertyRKR�(R�R�R�R8((s /usr/lib64/python2.7/platform.pyt
_java_getprop6s
cCs�yddl}Wntk
r0||||fSXtd|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}}	}
td|
�}
td	|�}td
|	�}	||	|
f}||||fS(sV Version interface for Jython.

        Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being
        a tuple (vm_name,vm_release,vm_vendor) and osinfo being a
        tuple (os_name,os_version,os_arch).

        Values which cannot be determined are set to the defaults
        given as parameters (which all default to '').

    i����Nsjava.vendorsjava.versionsjava.vm.namesjava.vm.vendorsjava.vm.versionsjava.os.archsjava.os.namesjava.os.version(R�RxR�(R�tvendortvminfotosinfotjavatvm_namet
vm_releaset	vm_vendortos_namet
os_versiontos_arch((s /usr/lib64/python2.7/platform.pytjava_verAs"

cCs|dkrd|||fS|dkr�|dkrB|||fStj|d�}|r�yt|d�}Wntk
r�q�X|d}t|�|d<tj|d�}n|dkr�d	}qd	}nC|d
kr�d}|r�|d}qd
}n|dkrd}n|||fS(s� Returns (system,release,version) aliased to common
        marketing names used for some systems.

        It also does some reordering of the information in some cases
        where it would otherwise cause confusion.

    tRhapsodysMacOS X ServertSunOSt5R{iit6tSolaristIRIX64tIRIXs (64bit)t64bitRRtWindows(swin32R(R+R,R~R`RR�(RdR�RROR�((s /usr/lib64/python2.7/platform.pytsystem_aliasds2	


		
		cGs%tjttjtt|��d�}tj}||dd�}||dd�}||dd�}||dd�}||dd�}||dd�}||d	d�}||d
d�}||dd�}x+||d
d�}||kr�Pn|}q�x|ddkr |d }qW|S(sq Helper to format the platform string in a filename
        compatible format e.g. "system-version-machine".
    R&t t_t/s\t:t;t"t(t)tunknownRs--i����(R+R�R}R-tfilterRtreplace(targsRzRtcleaned((s /usr/lib64/python2.7/platform.pyt	_platform�s,				cCsOyddl}Wntk
r$|SXy|j�SWn|jk
rJ|SXdS(s8 Helper to determine the node name of this machine.
    i����N(tsocketRxtgethostnameRR(R�R((s /usr/lib64/python2.7/platform.pyt_node�s
tabspathcCs+||�s!||�|�}n||�S(N((RtisabsR�tgetcwdtnormpath((s /usr/lib64/python2.7/platform.pyt_abspath�scCs_t|�}xLtjj|�rZtjjtjjtjj|�tj|���}qW|S(sT In case filepath is a symlink, follow it until a
        real file is reached.
    (RRRtislinkRR�tdirnametreadlink(tfilepath((s /usr/lib64/python2.7/platform.pyt_follow_symlinks�s
	1cCs�tjdkr|Sytjd|tf�}Wnttjfk
rM|SXtj|j	��}|j
�}|s||r�|S|SdS(s. Interface to the system's uname command.
    RRRRsuname %s 2> %sN(Rswin32swin16sos2(RyRzRRttDEV_NULLR�RRR+R-RR(toptionR�RtoutputRl((s /usr/lib64/python2.7/platform.pyt
_syscmd_uname�s
cCs�ddl}tjdkr|St|�}y+|jd|gd|jd	|j�}Wnttj	fk
rs|SX|j
�d
}|j�}|s�|r�|S|SdS(s& Interface to the system's file command.

        The function uses the -b option of the file command to have it
        ommit the filename in its output and if possible the -L option
        to have the command follow symlinks. It returns default in
        case the command should fail.

    i����NRRRRRXtstdouttstderri(sdosswin32swin16sos2(t
subprocessRyRzRtPopentPIPEtSTDOUTR�RRRtcommunicatetwait(ttargetR�R#tprocRRl((s /usr/lib64/python2.7/platform.pyt_syscmd_file�s
t	WindowsPERtMSDOSs[\s,]c	Cs�|sbddl}y|jd�}Wn#|jk
rJ|jd�}nXt|d�d}n|rzt|d�}nd}|r�|tjkr�tjtkr�ttj\}}|r�|}n|r�|}q�n||fSt	|�d}d	|kr	||fSd
|krd}n*d|kr3d
}nd|krHd}nd|kr]d}nTd|kr�d|kr~d}q�d}n*d|kr�d}nd|kr�d}n||fS(s� Queries the given executable (defaults to the Python interpreter
        binary) for various architecture information.

        Returns a tuple (bits,linkage) which contains information about
        the bit architecture and the linkage format used for the
        executable. Both values are returned as strings.

        Values that cannot be determined are returned as given by the
        parameter presets. If bits is given as '', the sizeof(pointer)
        (or sizeof(long) on Python version < 1.5.2) is used as
        indicator for the supported pointer size.

        The function relies on the system's "file" command to do the
        actual work. This is available on most if not all Unix
        platforms. On some non-Unix platforms where the "file" command
        does not exist and the executable is set to the Python interpreter
        binary defaults from _default_architecture are used.

    i����NtPROitbitRiRs32-bitt32bittN32tn32bits64-bitR�tELFtPERR,tCOFFsMS-DOSR-(
tstructtcalcsizeRRRR+RyRRzt_default_architecturet_architecture_split(	RtbitstlinkageR6tsizeRtbROtfileout((s /usr/lib64/python2.7/platform.pytarchitecture5sN	

								cCs�d}tdk	rtSd}ytj�\}}}}}Wntk
rTd}nX|sztd|||||f�rG|r�tj}d}d}t�}d}nd}|dkrIt	�\}}}}	|r�|r�d}n|s(dtj
krtj
jdd�}q(tj
jdd�}n|sItj
jd|�}qIn|r�t|�\}}}|dkryd	}q�|d
kr�|d	kr�d	}d|d kr�d
}q�d}q�n|dkr�|s�|dkr�d}q�d}nd	}qG|d dkrGt
�\}}
}}d}tj|d�}|sD|
}qDqGn|dkr�|sf|dkru|}d}nyddl}
Wntk
r�q�X|
jdd�\}}|dkr�d}q�d}n|s�tdd�}n|dkr�d}n|dkrd}n|dkr&d}n|dkr;d}n|dkrPd}n|dkred}n|d
kr�|d	kr�d	}d
}n||||||fatS( si Fairly portable uname interface. Returns a tuple
        of strings (system,node,release,version,machine,processor)
        identifying the underlying platform.

        Note that unlike the os.uname function this also returns
        possible processor information as an additional tuple entry.

        Entries which cannot be determined are set to ''.

    iRiRtPROCESSOR_ARCHITEW6432tPROCESSOR_ARCHITECTUREtPROCESSOR_IDENTIFIERsMicrosoft WindowsRt	Microsofts6.0iR�RR0t16bitiR�tJavas, tOpenVMSt0i����NsSYI$_CPUi�tAlphatVAXs-pR
(swin32swin16(t_uname_cacheRKRR�R�RRyRzRR�RuRvR�R�R+R�tvms_libRxtgetsyiR (tno_os_unamet	processorRdtnodeR�RR�tuse_syscmd_verR�R�R�R�R�RKtcsidt
cpu_number((s /usr/lib64/python2.7/platform.pyR��s�


%										
									cCst�dS(s� Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

        An empty string is returned if the value cannot be determined.

    i(R�(((s /usr/lib64/python2.7/platform.pyRdscCst�dS(s� Returns the computer's network name (which may not be fully
        qualified)

        An empty string is returned if the value cannot be determined.

    i(R�(((s /usr/lib64/python2.7/platform.pyRO scCst�dS(s� Returns the system's release, e.g. '2.2.0' or 'NT'

        An empty string is returned if the value cannot be determined.

    i(R�(((s /usr/lib64/python2.7/platform.pyR�*scCst�dS(s� Returns the system's release version, e.g. '#3 on degas'

        An empty string is returned if the value cannot be determined.

    i(R�(((s /usr/lib64/python2.7/platform.pyR3scCst�dS(st Returns the machine type, e.g. 'i386'

        An empty string is returned if the value cannot be determined.

    i(R�(((s /usr/lib64/python2.7/platform.pyR�<scCst�dS(s Returns the (true) processor name, e.g. 'amdk6'

        An empty string is returned if the value cannot be
        determined. Note that many platforms do not provide this
        information or simply return the same value as for machine(),
        e.g.  NetBSD does this.

    i(R�(((s /usr/lib64/python2.7/platform.pyRNEs
sB([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[([^\]]+)\]?s;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)sE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs�|dkrtj}ntj|d�}|dk	r:|S|d dkr�d}tj|�}|dkr�tdt|���n|j	�\}}}d}d}n>tj
d dkrd}tj|�}|dkr�tdt|���n|j	�\}}}}	}
tj
}n�d	|kr�d	}tj|�}|dkrbtd
t|���n|j	�\}}}}	d}nctj|�}|dkr�tdt|���n|j	�\}}}}	}d}|d
|	}t
td�r
tj\}
}}nd}d}tj|d�}
t|
�dkr\|
jd�tj|
d�}n|||||||f}|t|<|S(s� Returns a parsed version of Python's sys.version as tuple
        (name, version, branch, revision, buildno, builddate, compiler)
        referring to the Python implementation name, version, branch,
        revision, build number, build date/time as string and the compiler
        identification string.

        Note that unlike the Python sys.version, the returned value
        for the Python version will always include the patchlevel (it
        defaults to '.0').

        The function returns empty strings for tuple entries that
        cannot be determined.

        sys_version may be given to parse an alternative version
        string, e.g. if the version was read from a different Python
        interpreter.

    i
t
IronPythons*failed to parse IronPython sys.version: %sRiR�tJythons&failed to parse Jython sys.version: %stPyPys$failed to parse PyPy sys.version: %ss'failed to parse CPython sys.version: %stCPythonRt
subversionR{iRGN(RKRyRt_sys_version_cacheRvt_ironpython_sys_version_parserRJR`treprRRzt_sys_version_parsert_pypy_sys_version_parserR
RWR+R,RR|R�(tsys_versiontresultR�RJRtalt_versiontcompilerR�t	builddatet	buildtimeRtbranchtrevisionRO((s /usr/lib64/python2.7/platform.pyt_sys_versionesf		

cCst�dS(sR Returns a string identifying the Python implementation.

        Currently, the following implementations are identified:
          'CPython' (C implementation of Python),
          'IronPython' (.NET implementation of Python),
          'Jython' (Java implementation of Python),
          'PyPy' (Python implementation of Python).

    i(Re(((s /usr/lib64/python2.7/platform.pytpython_implementation�scCst�dS(s� Returns the Python version as string 'major.minor.patchlevel'

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    i(Re(((s /usr/lib64/python2.7/platform.pytpython_version�scCsttjt�dd��S(s� Returns the Python version as tuple (major, minor, patchlevel)
        of strings.

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    iR{(RLR+R,Re(((s /usr/lib64/python2.7/platform.pytpython_version_tuple�s	cCst�dS(s� Returns a string identifying the Python implementation
        branch.

        For CPython this is the Subversion branch from which the
        Python binary was built.

        If not available, an empty string is returned.

    i(Re(((s /usr/lib64/python2.7/platform.pyt
python_branch�scCst�dS(s� Returns a string identifying the Python implementation
        revision.

        For CPython this is the Subversion revision from which the
        Python binary was built.

        If not available, an empty string is returned.

    i(Re(((s /usr/lib64/python2.7/platform.pytpython_revision�scCst�dd!S(sh Returns a tuple (buildno, builddate) stating the Python
        build number and date as strings.

    ii(Re(((s /usr/lib64/python2.7/platform.pytpython_build�scCst�dS(sS Returns a string identifying the compiler used for compiling
        Python.

    i(Re(((s /usr/lib64/python2.7/platform.pytpython_compilersic
Cs[tj||fd�}|dk	r(|St�\}}}}}}||krXd}n|r|t|||�\}}}n|dkr�t|�\}	}
}}|r�t||�}
qGt||||�}
nw|d	krYtd�\}}}|r"|r"t||||d|||�}
qGtt	j
�\}}t||||d||�}
n�|dkr�t�\}}}\}}}|s�|r�t|||�}
qGt|||d|||�}
n�|dkr�|r�t||�}
qGt|||�}
nH|rt||�}
n0tt	j
�\}}t||||||�}
|
t||f<|
S(
s� Returns a single string identifying the underlying platform
        with as much useful information as possible (but no more :).

        The output is intended to be human readable rather than
        machine parseable. It may look different on different
        platforms and this is intended.

        If "aliased" is true, the function will use aliases for
        various platforms that report system names which differ from
        their common names, e.g. SunOS will be reported as
        Solaris. The system_alias() function is used to implement
        this.

        Setting terse to true causes the function to return only the
        absolute minimum information needed to identify the platform.

    RRtLinuxtwithREtonR�N(Rm(
t_platform_cacheRvRKR�RR�RR^R"RyRR�R?(taliasedtterseR^RdROR�RR�RNtreltversR�R�RzR2tdistversiontdistidtlibcnametlibcversionRQtvR�R�R�R�R:R;((s /usr/lib64/python2.7/platform.pyRzsP	

t__main__Rrs--terset
nonaliaseds--nonaliased(sdosswin32swin16sos2(
sSuSER>R?R@RARBRCRDs	slackwareRERFRGRH((swin32swin16sdossos2(RRR(RRR(RRR(Rs	WindowsPE(RsWindows(RsMSDOS(RRot
__copyright__t__version__RyR+RtretdevnullRR�RztcompileRRR"R=RSRIRMt_supported_distsRPR]R^R_RKRtR�R�R�R�R�R�R�R�R�R�R�R�RRRR
RRR�RRRRRR R+R8R,R9R?RJR�RdROR�RR�RNR[RYR\RXReRfRgRhRiRjRkRlRpRmtargvRrRqtexit(((s /usr/lib64/python2.7/platform.pyt<module>
s�f0

	
3	2		5	6!
	2�
		)		#	6	$	3
W	�			
										]	
	
			
		
R