issue-sl-installer OS X installer: fix installer builds on 10.6 (Snow Leopard) Patch 0: this patch merges and resolves the minor differences between the python2 and python3 versions of the OS X installer build script, build-installer.py. Having a common build script base simplifies subsequent patches and future maintenance. Specific differences for py3 builds and installs: 1. Installer packages "PythonProfileChanges" and "PythonSystemFixes" default to "not selected for install" 2. Include "--with-computed-gotos" on configure. 3. Do not change Framework/Current link during install. APPLIES py3k, 3.1, trunk, 2.6 NOTE issue-sl-installer-py3k-31.txt py3k, 3.1 issue-sl-installer-trunk.txt (this file) trunk issue-sl-installer-26.txt 2.6 diff -r 27927546795c Mac/BuildScript/build-installer.py --- Mac/BuildScript/build-installer.py Thu Mar 04 16:55:21 2010 -0800 +++ Mac/BuildScript/build-installer.py Thu Mar 04 16:56:52 2010 -0800 @@ -40,16 +40,19 @@ if ln.startswith(variable): value = ln[len(variable):].strip() return value[1:-1] + raise RuntimeError, "Cannot find variable %s" % variable[:-1] def getVersion(): return grepValue(os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION') +def getVersionTuple(): + return tuple([int(n) for n in getVersion().split('.')]) + def getFullVersion(): fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h') for ln in open(fn): if 'PY_VERSION' in ln: return ln.split()[-1][1:-1] - raise RuntimeError, "Cannot find full version??" # The directory we'll use to create the build (will be erased and recreated) @@ -114,6 +117,8 @@ CC = target_cc_map[DEPTARGET] +PYTHON_3 = getVersionTuple() >= (3, 0) + USAGE = textwrap.dedent("""\ Usage: build_python [options] @@ -238,6 +243,7 @@ # Instructions for building packages inside the .mpkg. def pkg_recipes(): + unselected_for_python3 = ('selected', 'unselected')[PYTHON_3] result = [ dict( name="PythonFramework", @@ -275,7 +281,7 @@ is not necessary to use Python. """, required=False, - selected='unselected', + selected='selected', ), dict( name="PythonDocumentation", @@ -308,7 +314,7 @@ topdir="/Library/Frameworks/Python.framework", source="/empty-dir", required=False, - selected='selected', + selected=unselected_for_python3, ), ] @@ -326,7 +332,7 @@ topdir="/Library/Frameworks/Python.framework", source="/empty-dir", required=False, - selected='selected', + selected=unselected_for_python3, ) ) return result @@ -715,19 +721,21 @@ print "Running configure..." runCommand("%s -C --enable-framework --enable-universalsdk=%s " "--with-universal-archs=%s " + "%s " "LDFLAGS='-g -L%s/libraries/usr/local/lib' " "OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%( shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH), UNIVERSALARCHS, + (' ', '--with-computed-gotos ')[PYTHON_3], shellQuote(WORKDIR)[1:-1], shellQuote(WORKDIR)[1:-1])) print "Running make" runCommand("make") - print "Running make frameworkinstall" - runCommand("make frameworkinstall DESTDIR=%s"%( - shellQuote(rootDir))) + print "Running make install" + runCommand("make install DESTDIR=%s"%( + shellQuote(rootDir))) print "Running make frameworkinstallextras" runCommand("make frameworkinstallextras DESTDIR=%s"%( @@ -795,7 +803,11 @@ os.chdir(curdir) - + if PYTHON_3: + # Remove the 'Current' link, that way we don't accidently mess + # with an already installed version of python 2 + os.unlink(os.path.join(rootDir, 'Library', 'Frameworks', + 'Python.framework', 'Versions', 'Current')) def patchFile(inPath, outPath): data = fileContents(inPath)