U
e5dé� ã @ sl d Z dZdZddlZddlZddlZddlZddddddd d d
d
dœ
Ze d¡Z d
d„ Z
e dej¡Zdwdd„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_¡Z0i Z1d€d`da„Z2dbdc„ Z3ddde„ Z4dfdg„ Z5dhdi„ Z6djdk„ Z7dldm„ Z8dndo„ Z9i Z: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 C sb g }t | ¡D ]N}|dkrzt|dƒ}d}W n tk
rL t |d¡}Y nX | ||f¡ q|S )Nz._+-r éd r )Ú
_component_reÚsplitÚintÚ
ValueErrorÚ_ver_stagesÚgetÚextend)ÚversionÚresultÚvÚt© r ú /usr/lib64/python3.8/platform.pyÚ_comparable_version‹ s
r sC (__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)Ú é @ c
C sð | dkrZz0t d¡}|jdd�}t|ƒdkr6t|ƒW S W n tttfk
rR Y nX tj } t
}tt jdƒrvt j
| ¡} 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Þdd
„ |
¡ 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’W 5 Q R X ||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Úrbr s libcs GLIBCiè c S s" g | ]}|d k r| d¡n|‘qS )NÚlatin1)Údecode)Ú.0Úsr r r Ú
Ñ s ÿzlibc_ver..ZlibcÚglibc)ÚosÚconfstrr ÚlenÚtupleÚAttributeErrorr ÚOSErrorÚsysÚ
executabler ÚhasattrÚpathr" ÚopenÚreadÚ_libc_searchÚsearchÚendÚmaxÚgroups)r1 Úlibr Z chunksizeÚverÚpartsÚVÚfZbinaryÚposÚmÚchunkZlibcinitr) ZglibcversionZsoZthreadsZ soversionr r r Úlibc_verŸ s^
þ
rC c C s` | d¡}|r| |¡ zttttt|ƒƒƒ}W n tk
rH |}Y nX d |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Ústrr r Újoin)r ÚbuildÚlZstringsr r r Ú
_norm_versionæ s
rM z'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])©Úwin32Úwin16Údosc C sè t j|kr| ||fS ddl}dD ]R}z|j||jddd�}W n0 t|jfk
rl } zW Y ¢q W 5 d}~X Y q X q~q | ||fS | ¡ }t |¡}|dk rÞ|
¡ \} }}|d dkr¾|dd… }|d dkrÖ|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.
r N)r<