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

Skip to content

Commit c45c3d9

Browse files
Merged revisions 80179 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r80179 | ronald.oussoren | 2010-04-18 16:01:05 +0200 (Sun, 18 Apr 2010) | 5 lines Add check to build-installer.py to ensure that the right version of Tcl/Tk is available (on OSX) Fixes issue #5651 ........
1 parent 501aeff commit c45c3d9

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Mac/BuildScript/build-installer.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,23 @@ def captureCommand(commandline):
377377

378378
return data
379379

380+
def getTclTkVersion(configfile, versionline):
381+
"""
382+
search Tcl or Tk configuration file for version line
383+
"""
384+
try:
385+
f = open(configfile, "r")
386+
except:
387+
fatal("Framework configuration file not found: %s" % configfile)
388+
389+
for l in f:
390+
if l.startswith(versionline):
391+
f.close()
392+
return l
393+
394+
fatal("Version variable %s not found in framework configuration file: %s"
395+
% (versionline, configfile))
396+
380397
def checkEnvironment():
381398
"""
382399
Check that we're running on a supported system.
@@ -392,6 +409,38 @@ def checkEnvironment():
392409
fatal("Please install the latest version of Xcode and the %s SDK"%(
393410
os.path.basename(SDKPATH[:-4])))
394411

412+
# Because we only support dynamic load of only one major/minor version of
413+
# Tcl/Tk, ensure:
414+
# 1. there are no user-installed frameworks of Tcl/Tk with version
415+
# higher than the Apple-supplied system version
416+
# 2. there is a user-installed framework in /Library/Frameworks with the
417+
# same version as the system version. This allows users to choose
418+
# to install a newer patch level.
419+
420+
for framework in ['Tcl', 'Tk']:
421+
fw = dict(lower=framework.lower(),
422+
upper=framework.upper(),
423+
cap=framework.capitalize())
424+
fwpth = "Library/Frameworks/%(cap)s.framework/%(lower)sConfig.sh" % fw
425+
sysfw = os.path.join('/System', fwpth)
426+
libfw = os.path.join('/', fwpth)
427+
usrfw = os.path.join(os.getenv('HOME'), fwpth)
428+
version = "%(upper)s_VERSION" % fw
429+
if getTclTkVersion(libfw, version) != getTclTkVersion(sysfw, version):
430+
fatal("Version of %s must match %s" % (libfw, sysfw) )
431+
if os.path.exists(usrfw):
432+
fatal("Please rename %s to avoid possible dynamic load issues."
433+
% usrfw)
434+
435+
# Remove inherited environment variables which might influence build
436+
environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
437+
'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
438+
for ev in list(os.environ):
439+
for prefix in environ_var_prefixes:
440+
if ev.startswith(prefix) :
441+
print "INFO: deleting environment variable %s=%s" % (
442+
ev, os.environ[ev])
443+
del os.environ[ev]
395444

396445

397446
def parseOptions(args=None):
@@ -1084,6 +1133,8 @@ def main():
10841133
shutil.rmtree(WORKDIR)
10851134
os.mkdir(WORKDIR)
10861135

1136+
os.environ['LC_ALL'] = 'C'
1137+
10871138
# Then build third-party libraries such as sleepycat DB4.
10881139
buildLibraries()
10891140

0 commit comments

Comments
 (0)