Issue #23968: Make OS X installer build script aware of renamed platform

directory and sysconfigdata file name.  This is a workaround for 3.6.0a4
pending resolution of other #23968 items.
This commit is contained in:
Ned Deily 2016-08-15 14:37:14 -04:00
parent 0a891d70de
commit 652bad4f4a
1 changed files with 26 additions and 22 deletions

View File

@ -1249,6 +1249,8 @@ def buildPython():
LDVERSION = LDVERSION.replace('$(VERSION)', VERSION) LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS) LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
config_suffix = '-' + LDVERSION config_suffix = '-' + LDVERSION
if getVersionMajorMinor() >= (3, 6):
config_suffix = config_suffix + '-darwin'
else: else:
config_suffix = '' # Python 2.x config_suffix = '' # Python 2.x
@ -1274,7 +1276,7 @@ def buildPython():
fp.write(data) fp.write(data)
fp.close() fp.close()
# fix _sysconfigdata if it exists # fix _sysconfigdata
# #
# TODO: make this more robust! test_sysconfig_module of # TODO: make this more robust! test_sysconfig_module of
# distutils.tests.test_sysconfig.SysconfigTestCase tests that # distutils.tests.test_sysconfig.SysconfigTestCase tests that
@ -1288,28 +1290,30 @@ def buildPython():
# _sysconfigdata.py). # _sysconfigdata.py).
import pprint import pprint
path = os.path.join(path_to_lib, '_sysconfigdata.py') if getVersionMajorMinor() >= (3, 6):
if os.path.exists(path): path = os.path.join(path_to_lib, 'plat-darwin', '_sysconfigdata_m.py')
fp = open(path, 'r') else:
data = fp.read() path = os.path.join(path_to_lib, '_sysconfigdata.py')
fp.close() fp = open(path, 'r')
# create build_time_vars dict data = fp.read()
exec(data) fp.close()
vars = {} # create build_time_vars dict
for k, v in build_time_vars.items(): exec(data)
if type(v) == type(''): vars = {}
for p in (include_path, lib_path): for k, v in build_time_vars.items():
v = v.replace(' ' + p, '') if type(v) == type(''):
v = v.replace(p + ' ', '') for p in (include_path, lib_path):
vars[k] = v v = v.replace(' ' + p, '')
v = v.replace(p + ' ', '')
vars[k] = v
fp = open(path, 'w') fp = open(path, 'w')
# duplicated from sysconfig._generate_posix_vars() # duplicated from sysconfig._generate_posix_vars()
fp.write('# system configuration generated and used by' fp.write('# system configuration generated and used by'
' the sysconfig module\n') ' the sysconfig module\n')
fp.write('build_time_vars = ') fp.write('build_time_vars = ')
pprint.pprint(vars, stream=fp) pprint.pprint(vars, stream=fp)
fp.close() fp.close()
# Add symlinks in /usr/local/bin, using relative links # Add symlinks in /usr/local/bin, using relative links
usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin') usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin')