U e5dé�ã @sldZdZdZddlZddlZddlZddlZddddddd d d d d œ Ze d ¡Z d d„Z e dej ¡Z dwdd„Z dxdd„Ze d¡Zdydd„Zddddddd d!d"d#d$d%œ Zdd&d'd(d)d*d+œZd,d-„Zd.d/„Zdzd0d1„Zd2d3„Zd{d5d6„Zd7d8„Zd|d9d:„Zd;d<„Zd=d>„Zd}d?d@„ZdAdB„Zd~dCdD„ZddEdF„ZdGdHdIdœZ ej!ddfdJdK„Z"e #dLdM¡Z$da%dNdO„Z&dPdQ„Z'dRdS„Z(dTdU„Z)dVdW„Z*dXdY„Z+dZd[„Z,e d\ej ¡Z-e d]ej ¡Z.e d^¡Z/e d_¡Z0iZ1d€d`da„Z2dbdc„Z3ddde„Z4dfdg„Z5dhdi„Z6djdk„Z7dldm„Z8dndo„Z9iZ:d�dpdq„Z;eduej=k�oNdvej=kZ?e@e;e?e>ƒƒe Ad¡dS)‚a8 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. a 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 ! z1.0.8éNé ééé(é2éÈ) ZdevZalphaÚaZbetaÚbÚcZRCZrcÚplÚpz([0-9]+|[._+-])c Csbg}t |¡D]N}|dkrzt|dƒ}d}Wn tk rLt |d¡}YnX| ||f¡q|S)Nz._+-rédr)Ú _component_reÚsplitÚintÚ ValueErrorÚ _ver_stagesÚgetÚextend)ÚversionÚresultÚvÚt©rú /usr/lib64/python3.8/platform.pyÚ_comparable_version‹s rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)Úé@c Csð|dkrZz0t d¡}|jdd�}t|ƒdkr6t|ƒWSWntttfk rRYnXtj }t }t tj dƒrvtj   |¡}t|dƒ��`}| |¡}d} | t|ƒk�rÞd |ks°d |kr¾t || ¡} nd} | rØ|  ¡t|ƒk�r| |¡} | �r |t| t|ƒd ƒd…| }d} q’| �s�qÞd d „|  ¡Dƒ\} } }}}}| �rF|�sFd}nŽ| �rx|dk�r`d}|}n||ƒ||ƒk�rÔ|}n\|�rÔ|dk�rÔd}|�r®|�rª||ƒ||ƒk�r®|}|�rÔ|t|ƒ d…|k�rÔ||}|  ¡} q’W5QRX||fS)a 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. NÚCS_GNU_LIBC_VERSIONé)ÚmaxsplitéÚrealpathÚrbrslibcsGLIBCiècSs"g|]}|dk r| d¡n|‘qS)NÚlatin1)Údecode)Ú.0ÚsrrrÚ Ñsÿzlibc_ver..ZlibcÚglibc)ÚosÚconfstrrÚlenÚtupleÚAttributeErrorrÚOSErrorÚsysÚ executablerÚhasattrÚpathr"ÚopenÚreadÚ _libc_searchÚsearchÚendÚmaxÚgroups)r1ÚlibrZ chunksizeÚverÚpartsÚVÚfZbinaryÚposÚmÚchunkZlibcinitr)Z glibcversionZsoZthreadsZ soversionrrrÚlibc_verŸs^       þ   rCcCs`| d¡}|r| |¡zttttt|ƒƒƒ}Wntk rH|}YnXd |dd…¡}|S)zŒ Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). Ú.Né)rÚappendÚlistÚmapÚstrrrÚjoin)rÚbuildÚlZstringsrrrÚ _norm_versionæs   rMz'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])©Úwin32Úwin16Údosc Csètj|kr|||fSddl}dD]R}z|j||jddd�}Wn0t|jfk rl}z WY¢q W5d}~XYq Xq~q |||fS| ¡}t  |¡}|dk rÞ|  ¡\}}}|ddkr¾|dd…}|ddkrÖ|dd…}t |ƒ}|||fS)a+ 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. XXX Others too ? In case this fails, the given parameters are used as defaults. rN)r<zcommand /c verz cmd /c verT)ÚstderrÚtextÚshelléÿÿÿÿrD) r0ÚplatformÚ subprocessÚ check_outputÚDEVNULLr/ÚCalledProcessErrorÚstripÚ _ver_outputÚmatchr:rM) ÚsystemÚreleaserZsupported_platformsrWÚcmdÚinfoZwhyrArrrÚ _syscmd_vers0  ý       rbZ2000ZXPZ 2003ServerZpost2003ÚVistaÚ7Ú8z8.1zpost8.1Z10Zpost10) )ér)rfr©rfr!)rfN©ér©rir©rir!©rirE©riN)rr)rNZ 2008ServerZ 2008ServerR2Z 2012ServerZ 2012ServerR2Zpost2012ServerR2)rgrhrjrkrlrmcCs tƒdkS)N)ZIoTUAPZ NanoServerZWindowsCoreHeadlessZ IoTEdgeOS)Ú win32_editionrrrrÚ win32_is_iotOsroc Csšz.z ddl}Wntk r*ddl}YnXWntk rBYnTXz(sz_platform..ú Ú_ú/ú\ú:ú;ú"ú(ú)Úunknownrz--rUN)rJÚfilterr,Úreplace)ÚargsrVZcleanedrrrÚ _platform"s"           r²cCsNz ddl}Wntk r$|YSXz | ¡WStk rH|YSXdS)z8 Helper to determine the node name of this machine. rN)ÚsocketrrZ gethostnamer/)r‘r³rrrÚ_nodeBs   r´cCsBtj |¡}tj |¡r>tj tj tj |¡t |¡¡¡}q |S)zT In case filepath is a symlink, follow it until a real file is reached. )r*r3ÚabspathÚislinkÚnormpathrJÚdirnameÚreadlink)ÚfilepathrrrÚ_follow_symlinksQs   ÿr»c Cs\tjdkr|Sddl}z|jd|f|jdd�}Wnt|jfk rN|YSX| ¡pZ|S)z. Interface to the system's uname command. ©rQrOrPrNrˆT)rRrS)r0rVrWrXrYr/rZr[)Zoptionr‘rWÚoutputrrrÚ _syscmd_uname\s  þ  r¾c Csztjdkr|Sddl}t|ƒ}ttjdd�}z|jdd|g|j|d�}Wnt |j fk rf|YSX|sp|S|  d ¡S) zð Interface to the system's file command. The function uses the -b option of the file command to have it omit the filename in its output. Follow the symlinks. It returns default in case the command should fail. r¼rNÚC)ÚLC_ALLÚfilez-b)rRÚenvzlatin-1) r0rVrWr»Údictr*ÚenvironrXrYr/rZr%)Útargetr‘rWrÂr½rrrÚ _syscmd_filems  þ  rÆ)rÚ WindowsPE)rr )rÚMSDOScCs|s&ddl}| d¡}t|dƒd}|r6t|dƒ}nd}|sx|tjkrxtjtkrpttj\}}|rh|}|rp|}||fSd|kr�d|kr�||fSd |kržd }nd |kr¬d }n d |kr¸d}d|krÆd}n8d|krâd|krÜd}qþd}nd|krðd}nd|krþd}n||fS)a” 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. rNÚPéÚbitrr1z shared objectz32-bitÚ32bitZN32Zn32bitz64-bitržZELFZPEr rÇZCOFFzMS-DOSrÈ)ÚstructZcalcsizerIrÆr0r1rVÚ_default_architecture)r1ÚbitsÚlinkagerÍÚsizeZfileoutr rLrrrÚ architecture–sH  ÿ rÒÚ uname_resultz-system node release version machine processorcCsœd}tdk rtSd}zt ¡\}}}}}Wntk rBd}YnX|sbttd|||||fƒƒ�sœ|r~tj}d}d}tƒ}d}d}|dkrât ƒ\}}}} |r¤|r¤d}|sÐdtj krÂtj   dd¡}ntj   dd¡}|sâtj   d|¡}|�r:t |ƒ\}}}|d k�rd }n4|d k�r:|d k�r:d }d |dd …k�r6d}nd}|dk�rd|�s^|dk�rZd}nd}d }n8|dd…dk�rœt ƒ\}} } } d}d | ¡}|�sœ| }|dk�r|�r¶|dk�r¾|}d}z ddl} Wntk �ràYn&X|  dd¡\}}|dk�rd}nd}|�stddƒ}|dk�r$d}|dk�r2d}|dk�r@d}|dk�rNd}|dk�r\d}|dk�rjd}|d k�r†|d k�r†d }d}t||||||ƒatS)an 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 ''. rNrrrOZPROCESSOR_ARCHITEW6432ZPROCESSOR_ARCHITECTUREZPROCESSOR_IDENTIFIERzMicrosoft Windowsr Z Microsoftz6.0rErcrŸrÌZ16bitér—ÚJavaz, ZOpenVMSÚ0zSYI$_CPUé€ZAlphaZVAXz-pr®)Ú _uname_cacher*rˆr.rGr¯r0rVr´rƒrÄrrbr›rJÚvms_librrZgetsyir¾rÓ)Z no_os_unameÚ processorr^Únoder_rr‰Zuse_syscmd_verrr€r”r•r–rÙZcsidZ cpu_numberrrrrˆës¢                  ÿrˆcCstƒjS)z� Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. An empty string is returned if the value cannot be determined. )rˆr^rrrrr^usr^cCstƒjS)z� Returns the computer's network name (which may not be fully qualified) An empty string is returned if the value cannot be determined. )rˆrÛrrrrrÛ~srÛcCstƒjS)z� Returns the system's release, e.g. '2.2.0' or 'NT' An empty string is returned if the value cannot be determined. )rˆr_rrrrr_ˆsr_cCstƒjS)z‡ Returns the system's release version, e.g. '#3 on degas' An empty string is returned if the value cannot be determined. )rˆrrrrrr‘srcCstƒjS)zt Returns the machine type, e.g. 'i386' An empty string is returned if the value cannot be determined. )rˆr‰rrrrr‰šsr‰cCstƒjS)a 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. )rˆrÚrrrrrÚ£s rÚzL([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?\)\s*\[([^\]]+)\]?z;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)zU([\d.]+)\s*\(IronPython\s*[\d.]+\s*\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)zE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs|dkrtj}t |d¡}|dk r&|Sd|kr‚d}| d¡rHt |¡}n t |¡}|dkrjtdt |ƒƒ‚|  ¡\}}}d}d}nütj  d¡rÚd}t  |¡}|dkr´tdt |ƒƒ‚|  ¡\}}}} } |dkrÒd}tj }n¤d|k�r"d}t  |¡}|dk�r td t |ƒƒ‚|  ¡\}}}} d}n\t  |¡}|dk�rFtd t |ƒƒ‚|  ¡\}}}} }d }|dk�rld}n| �r~|d | }ttd ƒ�r˜tj\} } } n"ttdƒ�r²tj\} } } nd} d} | d¡} t| ƒdk�ræ|  d¡d | ¡}||| | |||f}|t|<|S)aÛ 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. NZ IronPythonz*failed to parse IronPython sys.version: %srr—ZJythonz&failed to parse Jython sys.version: %sZPyPyz$failed to parse PyPy sys.version: %sz'failed to parse CPython sys.version: %sZCPythonr¥Ú_gitÚ _mercurialrDr!rÖ)r0rÚ_sys_version_cacherÚ startswithÚ_ironpython_sys_version_parserr]Ú _ironpython26_sys_version_parserrÚreprr:rVÚ_sys_version_parserÚ_pypy_sys_version_parserr2rÜrÝrr,rFrJ)Ú sys_versionrr�r]rZ alt_versionZcompilerZbuildnoZ builddateZ buildtimer¦ÚbranchZrevisionrLrrrÚ _sys_versionÍsˆ    ÿÿ  ÿÿ   ÿ  ÿÿÿ        rçcCs tƒdS)aR 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). r©rçrrrrÚpython_implementation5s récCs tƒdS)zÈ 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). rrèrrrrÚpython_versionBsrêcCsttƒd d¡ƒS)zÝ 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). rrD)r-rçrrrrrÚpython_version_tupleLs rëcCs tƒdS)zá Returns a string identifying the Python implementation branch. For CPython this is the SCM branch from which the Python binary was built. If not available, an empty string is returned. r!rèrrrrÚ python_branchWs rìcCs tƒdS)zå Returns a string identifying the Python implementation revision. For CPython this is the SCM revision from which the Python binary was built. If not available, an empty string is returned. rErèrrrrÚpython_revisiones rícCstƒdd…S)zh Returns a tuple (buildno, builddate) stating the Python build number and date as strings. rÔrirèrrrrÚ python_buildrsrîcCs tƒdS)zS Returns a string identifying the compiler used for compiling Python. rirèrrrrÚpython_compilerzsrïcCsbt ||fd¡}|dk r|Stƒ\}}}}}}||kr:d}|rPt|||ƒ\}}}|dkrntƒd} | rnd}| }|dkr¦t|ƒ\} } } } |r–t||ƒ}nt|||| ƒ}n¬|dkrÔttj ƒ\}}t||||d||ƒ}n~|d k�r t ƒ\}}}\}}}|sü|�s t|||ƒ}nt|||d |||ƒ}n2|�r2t||ƒ}n t tj ƒ\}}t||||||ƒ}|t||f<|S) aË 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. NrZDarwinrZmacOSr )ZLinuxÚwithrÕZon) Ú_platform_cacherrˆr¡r�rƒr²rCr0r1r›rÒ)ÚaliasedÚterserr^rÛr_rr‰rÚZ macos_releaseZrelZversrr€rVZlibcnameZ libcversionÚrrr•r˜r™ršrÏrÐrrrrV†sX   þ  þ ÿ rVÚ__main__róz--terseZ nonaliasedz --nonaliased)Nrrr)r)rrrrN)rrrr)rr„r)rrr„r„)r)r)r)N)rr)BÚ__doc__Z __copyright__Ú __version__Ú collectionsr*Úrer0rÚcompilerrÚASCIIr6rCrMr\rbr|r~rornrƒrŒr�r“r›r¡r²r´r»r¾rÆrÎr1rÒÚ namedtuplerÓrØrˆr^rÛr_rr‰rÚrãràrárärÞrçrérêrërìrírîrïrñrVÚ__name__ÚargvróròÚprintÚexitrrrrÚsÖY ø ü G  þ 1ñù  3  #4   $ýPÿ      ûüÿÿ h      L