mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #9516: Port the revised deployment target processing for OSX from
distutils to packaging.
This commit is contained in:
parent
5c727cb978
commit
fceb4120fc
1 changed files with 23 additions and 0 deletions
|
@ -757,6 +757,9 @@ def split_leading_dir(path):
|
||||||
else:
|
else:
|
||||||
return path, ''
|
return path, ''
|
||||||
|
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
_cfg_target = None
|
||||||
|
_cfg_target_split = None
|
||||||
|
|
||||||
def spawn(cmd, search_path=True, verbose=0, dry_run=False, env=None):
|
def spawn(cmd, search_path=True, verbose=0, dry_run=False, env=None):
|
||||||
"""Run another program specified as a command list 'cmd' in a new process.
|
"""Run another program specified as a command list 'cmd' in a new process.
|
||||||
|
@ -781,6 +784,26 @@ def spawn(cmd, search_path=True, verbose=0, dry_run=False, env=None):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
logging.debug('dry run, no process actually spawned')
|
logging.debug('dry run, no process actually spawned')
|
||||||
return
|
return
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
global _cfg_target, _cfg_target_split
|
||||||
|
if _cfg_target is None:
|
||||||
|
_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:
|
||||||
|
# ensure that the deployment target of build process is not less
|
||||||
|
# than that used when the interpreter was built. This ensures
|
||||||
|
# extension modules are built with correct compatibility values
|
||||||
|
env = env or os.environ
|
||||||
|
cur_target = env.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
|
||||||
|
if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
|
||||||
|
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
|
||||||
|
'now "%s" but "%s" during configure'
|
||||||
|
% (cur_target, _cfg_target))
|
||||||
|
raise PackagingPlatformError(my_msg)
|
||||||
|
env = dict(env, MACOSX_DEPLOYMENT_TARGET=cur_target)
|
||||||
|
|
||||||
exit_status = subprocess.call(cmd, env=env)
|
exit_status = subprocess.call(cmd, env=env)
|
||||||
if exit_status != 0:
|
if exit_status != 0:
|
||||||
msg = "command %r failed with exit status %d"
|
msg = "command %r failed with exit status %d"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue