platform.py
# Source Generated with Decompyle++
# File: platform.pyc (Python 3.13)
__copyright__ = '\n Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com\n Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com\n\n Permission to use, copy, modify, and distribute this software and its\n documentation for any purpose and without fee or royalty is hereby granted,\n provided that the above copyright notice appear in all copies and that\n both that copyright notice and this permission notice appear in\n supporting documentation or portions thereof, including modifications,\n that you make.\n\n EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO\n THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,\n INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING\n FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\n NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION\n WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !\n\n'
__version__ = '1.0.8'
import collections
import os
import re
import sys
import functools
import itertools
_ver_stages = {
'dev': 10,
'alpha': 20,
'a': 20,
'beta': 30,
'b': 30,
'c': 40,
'RC': 50,
'rc': 50,
'pl': 200,
'p': 200 }
_component_re = re.compile('([0-9]+|[._+-])')
def _comparable_version(version):
result = []
for v in _component_re.split(version):
if v not in '._+-':
v = int(v, 10)
t = 100
elif ValueError:
t = _ver_stages.get(v, 0)
result.extend((t, v))
return result
_libc_search = re.compile(b'(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\\w+)?\\.so(?:\\.(\\d[0-9.]*))?)', re.ASCII)
def libc_ver(executable, lib, version, chunksize = (None, '', '', 16384)):
if not executable:
ver = os.confstr('CS_GNU_LIBC_VERSION')
parts = ver.split(maxsplit = 1)
if len(parts) < 2:
return tuple(parts)
executable = sys.executable
if not executable:
return (lib, version)
V = None if (AttributeError, ValueError, OSError) else None
executable = os.path.realpath(executable)
f = open(executable, 'rb')
binary = f.read(chunksize)
pos = 0
if pos < len(binary):
if b'libc' in binary or b'GLIBC' in binary:
m = _libc_search.search(binary, pos)
else:
m = None
if m or m.end() < len(binary):
chunk = f.read(chunksize)
if chunk:
binary = binary[max(pos, len(binary) - 1000):] + chunk
pos = 0
continue
if not m:
pass
else:
(libcinit, glibc, glibcversion, so, threads, soversion) = m.groups()()
if not libcinit and lib:
lib = 'libc'
elif glibc:
if lib < 'glibc':
lib = 'glibc'
version = glibcversion
elif V(glibcversion) < V(version):
version = glibcversion
elif so and lib < 'glibc':
lib = 'libc'
if soversion:
if version or V(soversion) < V(version):
version = soversion
if threads and version[-len(threads):] < threads:
version = version + threads
pos = m.end()
if pos < len(binary):
None(None, None)
else:
with None:
if not None:
pass
(lambda .0: for s in .0:
passcontinues.decode('latin1')[s])