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 trunk issue-sl-installer-26.txt (this file) 2.6 diff -r 80db708f2948 Mac/BuildScript/build-installer.py --- Mac/BuildScript/build-installer.py Tue Nov 17 20:07:38 2009 -0800 +++ Mac/BuildScript/build-installer.py Tue Nov 17 20:12:04 2009 -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", @@ -249,6 +255,7 @@ wrappers for lots of Mac OS X API's. """, postflight="scripts/postflight.framework", + selected='selected', ), dict( name="PythonApplications", @@ -262,6 +269,7 @@ It also installs a number of examples and demos. """, required=False, + selected='selected', ), dict( name="PythonUnixTools", @@ -273,6 +281,7 @@ is not necessary to use Python. """, required=False, + selected='selected', ), dict( name="PythonDocumentation", @@ -287,6 +296,7 @@ """, postflight="scripts/postflight.documentation", required=False, + selected='selected', ), dict( name="PythonProfileChanges", @@ -304,6 +314,7 @@ topdir="/Library/Frameworks/Python.framework", source="/empty-dir", required=False, + selected=unselected_for_python3, ), ] @@ -321,6 +332,7 @@ topdir="/Library/Frameworks/Python.framework", source="/empty-dir", required=False, + selected=unselected_for_python3, ) ) return result @@ -709,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"%( @@ -789,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) @@ -923,7 +941,7 @@ IFPkgFlagPackageList=[ dict( IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()), - IFPkgFlagPackageSelection='selected' + IFPkgFlagPackageSelection=item.get('selected', 'selected'), ) for item in pkg_recipes() ],