8000 [3.8] bpo-41100: Support macOS 11 Big Sur and Apple Silicon Macs by ned-deily · Pull Request #25806 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.8] bpo-41100: Support macOS 11 Big Sur and Apple Silicon Macs #25806

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

Merged
merged 11 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is …
…a string (GH-24341) (GH-24410)

* bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a string
(cherry picked from commit 49926cf)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
  • Loading branch information
2 people authored and ned-deily committed Apr 29, 2021
commit 96d18f428f573e261b96b1af38df6c5cb56234be
4 changes: 2 additions & 2 deletions Lib/distutils/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0):
global _cfg_target, _cfg_target_split
if _cfg_target is None:
from distutils import sysconfig
_cfg_target = str(sysconfig.get_config_var(
'MACOSX_DEPLOYMENT_TARGET') or '')
_cfg_target = sysconfig.get_config_var(
'MACOSX_DEPLOYMENT_TARGET') or ''
if _cfg_target:
_cfg_target_split = [int(x) for x in _cfg_target.split('.')]
if _cfg_target:
Expand Down
4 changes: 2 additions & 2 deletions Lib/distutils/tests/test_build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def test_deployment_target_higher_ok(self):
deptarget = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
if deptarget:
# increment the minor version number (i.e. 10.6 -> 10.7)
deptarget = [int(x) for x in str(deptarget).split('.')]
deptarget = [int(x) for x in deptarget.split('.')]
deptarget[-1] += 1
deptarget = '.'.join(str(i) for i in deptarget)
self._try_compile_deployment_target('<', deptarget)
Expand Down Expand Up @@ -488,7 +488,7 @@ def _try_compile_deployment_target(self, operator, target):

# get the deployment target that the interpreter was built with
target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
target = tuple(map(int, str(target).split('.')[0:2]))
target = tuple(map(int, target.split('.')[0:2]))
# format the target value as defined in the Apple
# Availability Macros. We can't use the macro names since
# at least one value we test with will not exist yet.
Expand Down
12 changes: 12 additions & 0 deletions Lib/sysconfig.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
'parse_config_h',
]

# Keys for get_config_var() that are never converted to Python integers.
_ALWAYS_STR = {
'MACOSX_DEPLOYMENT_TARGET',
}

_INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{installed_base}/lib/python{py_version_short}',
Expand Down Expand Up @@ -242,6 +247,9 @@ def _parse_makefile(filename, vars=None):
notdone[n] = v
else:
try:
if n in _ALWAYS_STR:
raise ValueError

v = int(v)
except ValueError:
# insert literal `$'
Expand Down Expand Up @@ -300,6 +308,8 @@ def _parse_makefile(filename, vars=None):
notdone[name] = value
else:
try:
if name in _ALWAYS_STR:
raise ValueError
value = int(value)
except ValueError:
done[name] = value.strip()
Expand Down Expand Up @@ -461,6 +471,8 @@ def parse_config_h(fp, vars=None):
if m:
n, v = m.group(1, 2)
8000 try:
if n in _ALWAYS_STR:
raise ValueError
v = int(v)
except ValueError:
pass
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def test_getgroups(self):
if sys.platform == 'darwin':
import sysconfig
dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0'
if tuple(int(n) for n in str(dt).split('.')[0:2]) < (10, 6):
if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6):
raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")

# 'id -G' and 'os.getgroups()' should return the same
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ensure that the value of
sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') is always a string,
even in when the value is parsable as an integer.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ def detect_readline_curses(self):
os_release = int(os.uname()[2].split('.')[0])
dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
if (dep_target and
(tuple(int(n) for n in str(dep_target).split('.')[0:2])
(tuple(int(n) for n in dep_target.split('.')[0:2])
< (10, 5) ) ):
os_release = 8
if os_release < 9:
Expand Down
0