Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 652bad4

Browse files
committed
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.
1 parent 0a891d7 commit 652bad4

1 file changed

Lines changed: 27 additions & 23 deletions

File tree

Mac/BuildScript/build-installer.py

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,8 @@ def buildPython():
12491249
LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
12501250
LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
12511251
config_suffix = '-' + LDVERSION
1252+
if getVersionMajorMinor() >= (3, 6):
1253+
config_suffix = config_suffix + '-darwin'
12521254
else:
12531255
config_suffix = '' # Python 2.x
12541256

@@ -1274,7 +1276,7 @@ def buildPython():
12741276
fp.write(data)
12751277
fp.close()
12761278

1277-
# fix _sysconfigdata if it exists
1279+
# fix _sysconfigdata
12781280
#
12791281
# TODO: make this more robust! test_sysconfig_module of
12801282
# distutils.tests.test_sysconfig.SysconfigTestCase tests that
@@ -1288,28 +1290,30 @@ def buildPython():
12881290
# _sysconfigdata.py).
12891291

12901292
import pprint
1291-
path = os.path.join(path_to_lib, '_sysconfigdata.py')
1292-
if os.path.exists(path):
1293-
fp = open(path, 'r')
1294-
data = fp.read()
1295-
fp.close()
1296-
# create build_time_vars dict
1297-
exec(data)
1298-
vars = {}
1299-
for k, v in build_time_vars.items():
1300-
if type(v) == type(''):
1301-
for p in (include_path, lib_path):
1302-
v = v.replace(' ' + p, '')
1303-
v = v.replace(p + ' ', '')
1304-
vars[k] = v
1305-
1306-
fp = open(path, 'w')
1307-
# duplicated from sysconfig._generate_posix_vars()
1308-
fp.write('# system configuration generated and used by'
1309-
' the sysconfig module\n')
1310-
fp.write('build_time_vars = ')
1311-
pprint.pprint(vars, stream=fp)
1312-
fp.close()
1293+
if getVersionMajorMinor() >= (3, 6):
1294+
path = os.path.join(path_to_lib, 'plat-darwin', '_sysconfigdata_m.py')
1295+
else:
1296+
path = os.path.join(path_to_lib, '_sysconfigdata.py')
1297+
fp = open(path, 'r')
1298+
data = fp.read()
1299+
fp.close()
1300+
# create build_time_vars dict
1301+
exec(data)
1302+
vars = {}
1303+
for k, v in build_time_vars.items():
1304+
if type(v) == type(''):
1305+
for p in (include_path, lib_path):
1306+
v = v.replace(' ' + p, '')
1307+
v = v.replace(p + ' ', '')
1308+
vars[k] = v
1309+
1310+
fp = open(path, 'w')
1311+
# duplicated from sysconfig._generate_posix_vars()
1312+
fp.write('# system configuration generated and used by'
1313+
' the sysconfig module\n')
1314+
fp.write('build_time_vars = ')
1315+
pprint.pprint(vars, stream=fp)
1316+
fp.close()
13131317

13141318
# Add symlinks in /usr/local/bin, using relative links
13151319
usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin')

0 commit comments

Comments
 (0)