Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-38021: Modify AIX platform_tag so it provides PEP425 needs #17303

Merged
merged 14 commits into from
Dec 15, 2019
Merged
Prev Previous commit
Next Next commit
Cosmetic fixes to AIX support code
  • Loading branch information
ncoghlan committed Dec 15, 2019
commit cc9011a1eb31e1d30d603f05a97d4007772a7012
29 changes: 17 additions & 12 deletions Lib/_aix_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@
import sys
from sysconfig import get_config_var

# subprocess is not available early in the build process
# if not available, the config_vars are also not available
# subprocess is not necessarily available early in the build process
# if not available, the config_vars are also definitely not available
# supply substitutes to bootstrap the build
try:
import subprocess

_subprocess_rdy = True
_tmp = str(get_config_var("AIX_BUILDDATE"))
_have_subprocess = True
_tmp_bd = get_config_var("AIX_BUILDDATE")
_bgt = get_config_var("BUILD_GNU_TYPE")
except ImportError: # pragma: no cover
_subprocess_rdy = False
_tmp = "None"
_have_subprocess = False
_tmp_bd = None
_bgt = "powerpc-ibm-aix6.1.7.0"


# if get_config_var("AIX_BUILDDATE") was unknown, provide a substitute,
# impossible builddate to specify 'unknown'
_bd = 9898 if (_tmp == "None") else int(_tmp)
_sz = 32 if sys.maxsize == 2147483647 else 64
_MISSING_BD = 9898
try:
_bd = int(_tmp_bd)
else TypeError:
_bd = _MISSING_BD

# Infer the ABI bitwidth from maxsize (assuming 64 bit as the default)
_sz = 32 if sys.maxsize == (2**31-1) else 64


def _aix_tag(vrtl, bd):
Expand All @@ -44,7 +48,8 @@ def _aix_bosmp64():
The fileset bos.mp64 is the AIX kernel. It's VRMF and builddate
reflect the current ABI levels of the runtime environment.
"""
if _subprocess_rdy:
if _have_subprocess:
# We expect all AIX systems to have lslpp installed in this location
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.mp64"])
out = out.decode("utf-8").strip().split(":") # type: ignore
# Use str() and int() to help mypy see types
Expand All @@ -53,7 +58,7 @@ def _aix_bosmp64():
from os import uname

osname, host, release, version, machine = uname()
return "{}.{}.0.0".format(version, release), 9898
return "{}.{}.0.0".format(version, release), _MISSING_BD


def aix_platform():
Expand Down