Skip to content

Commit 91a1fcb

Browse files
committed
update to boost 1.75 and python 3.9.4
1 parent 8d293a7 commit 91a1fcb

File tree

416 files changed

+13924
-7702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

416 files changed

+13924
-7702
lines changed

PythonLib/full/_aix_support.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""Shared AIX support functions."""
2+
3+
import sys
4+
import sysconfig
5+
6+
try:
7+
import subprocess
8+
except ImportError: # pragma: no cover
9+
# _aix_support is used in distutils by setup.py to build C extensions,
10+
# before subprocess dependencies like _posixsubprocess are available.
11+
import _bootsubprocess as subprocess
12+
13+
14+
def _aix_tag(vrtl, bd):
15+
# type: (List[int], int) -> str
16+
# Infer the ABI bitwidth from maxsize (assuming 64 bit as the default)
17+
_sz = 32 if sys.maxsize == (2**31-1) else 64
18+
# vrtl[version, release, technology_level]
19+
return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], bd, _sz)
20+
21+
22+
# extract version, release and technology level from a VRMF string
23+
def _aix_vrtl(vrmf):
24+
# type: (str) -> List[int]
25+
v, r, tl = vrmf.split(".")[:3]
26+
return [int(v[-1]), int(r), int(tl)]
27+
28+
29+
def _aix_bosmp64():
30+
# type: () -> Tuple[str, int]
31+
"""
32+
Return a Tuple[str, int] e.g., ['7.1.4.34', 1806]
33+
The fileset bos.mp64 is the AIX kernel. It's VRMF and builddate
34+
reflect the current ABI levels of the runtime environment.
35+
"""
36+
# We expect all AIX systems to have lslpp installed in this location
37+
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.mp64"])
38+
out = out.decode("utf-8")
39+
out = out.strip().split(":") # type: ignore
40+
# Use str() and int() to help mypy see types
41+
return (str(out[2]), int(out[-1]))
42+
43+
44+
def aix_platform():
45+
# type: () -> str
46+
"""
47+
AIX filesets are identified by four decimal values: V.R.M.F.
48+
V (version) and R (release) can be retreived using ``uname``
49+
Since 2007, starting with AIX 5.3 TL7, the M value has been
50+
included with the fileset bos.mp64 and represents the Technology
51+
Level (TL) of AIX. The F (Fix) value also increases, but is not
52+
relevant for comparing releases and binary compatibility.
53+
For binary compatibility the so-called builddate is needed.
54+
Again, the builddate of an AIX release is associated with bos.mp64.
55+
AIX ABI compatibility is described as guaranteed at: https://www.ibm.com/\
56+
support/knowledgecenter/en/ssw_aix_72/install/binary_compatability.html
57+
58+
For pep425 purposes the AIX platform tag becomes:
59+
"aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(v, r, tl, builddate, bitsize)
60+
e.g., "aix-6107-1415-32" for AIX 6.1 TL7 bd 1415, 32-bit
61+
and, "aix-6107-1415-64" for AIX 6.1 TL7 bd 1415, 64-bit
62+
"""
63+
vrmf, bd = _aix_bosmp64()
64+
return _aix_tag(_aix_vrtl(vrmf), bd)
65+
66+
67+
# extract vrtl from the BUILD_GNU_TYPE as an int
68+
def _aix_bgt():
69+
# type: () -> List[int]
70+
gnu_type = sysconfig.get_config_var("BUILD_GNU_TYPE")
71+
if not gnu_type:
72+
raise ValueError("BUILD_GNU_TYPE is not defined")
73+
return _aix_vrtl(vrmf=gnu_type)
74+
75+
76+
def aix_buildtag():
77+
# type: () -> str
78+
"""
79+
Return the platform_tag of the system Python was built on.
80+
"""
81+
# AIX_BUILDDATE is defined by configure with:
82+
# lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }'
83+
build_date = sysconfig.get_config_var("AIX_BUILDDATE")
84+
try:
85+
build_date = int(build_date)
86+
except (ValueError, TypeError):
87+
raise ValueError(f"AIX_BUILDDATE is not defined or invalid: "
88+
f"{build_date!r}")
89+
return _aix_tag(_aix_bgt(), build_date)

PythonLib/full/_bootsubprocess.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
"""
2+
Basic subprocess implementation for POSIX which only uses os functions. Only
3+
implement features required by setup.py to build C extension modules when
4+
subprocess is unavailable. setup.py is not used on Windows.
5+
"""
6+
import os
7+
8+
9+
# distutils.spawn used by distutils.command.build_ext
10+
# calls subprocess.Popen().wait()
11+
class Popen:
12+
def __init__(self, cmd, env=None):
13+
self._cmd = cmd
14+
self._env = env
15+
self.returncode = None
16+
17+
def wait(self):
18+
pid = os.fork()
19+
if pid == 0:
20+
# Child process
21+
try:
22+
if self._env is not None:
23+
os.execve(self._cmd[0], self._cmd, self._env)
24+
else:
25+
os.execv(self._cmd[0], self._cmd)
26+
finally:
27+
os._exit(1)
28+
else:
29+
# Parent process
30+
_, status = os.waitpid(pid, 0)
31+
self.returncode = os.waitstatus_to_exitcode(status)
32+
33+
return self.returncode
34+
35+
36+
def _check_cmd(cmd):
37+
# Use regex [a-zA-Z0-9./-]+: reject empty string, space, etc.
38+
safe_chars = []
39+
for first, last in (("a", "z"), ("A", "Z"), ("0", "9")):
40+
for ch in range(ord(first), ord(last) + 1):
41+
safe_chars.append(chr(ch))
42+
safe_chars.append("./-")
43+
safe_chars = ''.join(safe_chars)
44+
45+
if isinstance(cmd, (tuple, list)):
46+
check_strs = cmd
47+
elif isinstance(cmd, str):
48+
check_strs = [cmd]
49+
else:
50+
return False
51+
52+
for arg in check_strs:
53+
if not isinstance(arg, str):
54+
return False
55+
if not arg:
56+
# reject empty string
57+
return False
58+
for ch in arg:
59+
if ch not in safe_chars:
60+
return False
61+
62+
return True
63+
64+
65+
# _aix_support used by distutil.util calls subprocess.check_output()
66+
def check_output(cmd, **kwargs):
67+
if kwargs:
68+
raise NotImplementedError(repr(kwargs))
69+
70+
if not _check_cmd(cmd):
71+
raise ValueError(f"unsupported command: {cmd!r}")
72+
73+
tmp_filename = "check_output.tmp"
74+
if not isinstance(cmd, str):
75+
cmd = " ".join(cmd)
76+
cmd = f"{cmd} >{tmp_filename}"
77+
78+
try:
79+
# system() spawns a shell
80+
status = os.system(cmd)
81+
exitcode = os.waitstatus_to_exitcode(status)
82+
if exitcode:
83+
raise ValueError(f"Command {cmd!r} returned non-zero "
84+
f"exit status {exitcode!r}")
85+
86+
try:
87+
with open(tmp_filename, "rb") as fp:
88+
stdout = fp.read()
89+
except FileNotFoundError:
90+
stdout = b''
91+
finally:
92+
try:
93+
os.unlink(tmp_filename)
94+
except OSError:
95+
pass
96+
97+
return stdout

0 commit comments

Comments
 (0)