summaryrefslogtreecommitdiffstats
path: root/Mac/BuildScript/build-installer.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/BuildScript/build-installer.py')
-rwxr-xr-xMac/BuildScript/build-installer.py120
1 files changed, 75 insertions, 45 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index 05afe98..083209b 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -67,6 +67,8 @@ DEPSRC=os.path.expanduser('~/Universal/other-sources')
SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
#SDKPATH="/"
+ARCHLIST=('i386', 'ppc',)
+
# Source directory (asume we're in Mac/BuildScript)
SRCDIR=os.path.dirname(
os.path.dirname(
@@ -91,6 +93,26 @@ USAGE=textwrap.dedent("""\
# batteries included python.
LIBRARY_RECIPES=[
dict(
+ name="Bzip2 1.0.3",
+ url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz",
+ configure=None,
+ install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
+ shellQuote(os.path.join(WORKDIR, 'libraries')),
+ ' -arch '.join(ARCHLIST),
+ SDKPATH,
+ ),
+ ),
+ dict(
+ name="ZLib 1.2.3",
+ url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
+ configure=None,
+ install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
+ shellQuote(os.path.join(WORKDIR, 'libraries')),
+ ' -arch '.join(ARCHLIST),
+ SDKPATH,
+ ),
+ ),
+ dict(
# Note that GNU readline is GPL'd software
name="GNU Readline 5.1.4",
url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
@@ -236,7 +258,7 @@ PKG_RECIPES=[
Mac OS X 10.3 to ensure that you can build new python extensions
using that copy of python after installing this version of
python.
- """
+ """,
postflight="../Tools/fixapplepython23.py",
topdir="/Library/Frameworks/Python.framework",
source="/empty-dir",
@@ -486,48 +508,49 @@ def buildRecipe(recipe, basedir, archList):
runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1),
shellQuote(fn),))
- configure_args = [
- "--prefix=/usr/local",
- "--enable-static",
- "--disable-shared",
- #"CPP=gcc -arch %s -E"%(' -arch '.join(archList,),),
- ]
-
- if 'configure_pre' in recipe:
- args = list(recipe['configure_pre'])
- if '--disable-static' in args:
- configure_args.remove('--enable-static')
- if '--enable-shared' in args:
- configure_args.remove('--disable-shared')
- configure_args.extend(args)
-
- if recipe.get('useLDFlags', 1):
- configure_args.extend([
- "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
- ' -arch '.join(archList),
- shellQuote(SDKPATH)[1:-1],
- shellQuote(basedir)[1:-1],),
- "LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%(
- shellQuote(SDKPATH)[1:-1],
- shellQuote(basedir)[1:-1],
- ' -arch '.join(archList)),
- ])
- else:
- configure_args.extend([
- "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
- ' -arch '.join(archList),
+ if configure is not None:
+ configure_args = [
+ "--prefix=/usr/local",
+ "--enable-static",
+ "--disable-shared",
+ #"CPP=gcc -arch %s -E"%(' -arch '.join(archList,),),
+ ]
+
+ if 'configure_pre' in recipe:
+ args = list(recipe['configure_pre'])
+ if '--disable-static' in args:
+ configure_args.remove('--enable-static')
+ if '--enable-shared' in args:
+ configure_args.remove('--disable-shared')
+ configure_args.extend(args)
+
+ if recipe.get('useLDFlags', 1):
+ configure_args.extend([
+ "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
+ ' -arch '.join(archList),
+ shellQuote(SDKPATH)[1:-1],
+ shellQuote(basedir)[1:-1],),
+ "LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%(
shellQuote(SDKPATH)[1:-1],
- shellQuote(basedir)[1:-1],),
- ])
+ shellQuote(basedir)[1:-1],
+ ' -arch '.join(archList)),
+ ])
+ else:
+ configure_args.extend([
+ "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
+ ' -arch '.join(archList),
+ shellQuote(SDKPATH)[1:-1],
+ shellQuote(basedir)[1:-1],),
+ ])
- if 'configure_post' in recipe:
- configure_args = configure_args = list(recipe['configure_post'])
+ if 'configure_post' in recipe:
+ configure_args = configure_args = list(recipe['configure_post'])
- configure_args.insert(0, configure)
- configure_args = [ shellQuote(a) for a in configure_args ]
+ configure_args.insert(0, configure)
+ configure_args = [ shellQuote(a) for a in configure_args ]
- print "Running configure for %s"%(name,)
- runCommand(' '.join(configure_args) + ' 2>&1')
+ print "Running configure for %s"%(name,)
+ runCommand(' '.join(configure_args) + ' 2>&1')
print "Running install for %s"%(name,)
runCommand('{ ' + install + ' ;} 2>&1')
@@ -550,7 +573,7 @@ def buildLibraries():
os.makedirs(os.path.join(universal, 'usr', 'local', 'include'))
for recipe in LIBRARY_RECIPES:
- buildRecipe(recipe, universal, ('i386', 'ppc',))
+ buildRecipe(recipe, universal, ARCHLIST)
@@ -686,6 +709,9 @@ def patchFile(inPath, outPath):
data = data.replace('$MACOSX_DEPLOYMENT_TARGET', '10.3 or later')
data = data.replace('$ARCHITECTURES', "i386, ppc")
data = data.replace('$INSTALL_SIZE', installSize())
+
+ # This one is not handy as a template variable
+ data = data.replace('$PYTHONFRAMEWORKINSTALLDIR', '/Library/Frameworks/Python.framework')
fp = open(outPath, 'wb')
fp.write(data)
fp.close()
@@ -703,7 +729,10 @@ def patchScript(inPath, outPath):
def packageFromRecipe(targetDir, recipe):
curdir = os.getcwd()
try:
- pkgname = recipe['name']
+ # The major version (such as 2.5) is included in the pacakge name
+ # because haveing two version of python installed at the same time is
+ # common.
+ pkgname = '%s-%s'%(recipe['name'], getVersion())
srcdir = recipe.get('source')
pkgroot = recipe.get('topdir', srcdir)
postflight = recipe.get('postflight')
@@ -804,7 +833,7 @@ def makeMpkgPlist(path):
IFPkgFlagComponentDirectory="Contents/Packages",
IFPkgFlagPackageList=[
dict(
- IFPkgFlagPackageLocation='%s.pkg'%(item['name']),
+ IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()),
IFPkgFlagPackageSelection='selected'
)
for item in PKG_RECIPES
@@ -812,6 +841,7 @@ def makeMpkgPlist(path):
IFPkgFormatVersion=0.10000000149011612,
IFPkgFlagBackgroundScaling="proportional",
IFPkgFlagBackgroundAlignment="left",
+ IFPkgFlagAuthorizationAction="RootAuthorization",
)
writePlist(pl, path)
@@ -859,7 +889,7 @@ def buildInstaller():
else:
patchFile(os.path.join('resources', fn), os.path.join(rsrcDir, fn))
- shutil.copy("../../../LICENSE", os.path.join(rsrcDir, 'License.txt'))
+ shutil.copy("../../LICENSE", os.path.join(rsrcDir, 'License.txt'))
def installSize(clear=False, _saved=[]):
@@ -990,7 +1020,7 @@ def main():
buildPythonDocs()
fn = os.path.join(WORKDIR, "_root", "Applications",
"MacPython %s"%(getVersion(),), "Update Shell Profile.command")
- shutil.copy("scripts/postflight.patch-profile", fn)
+ patchFile("scripts/postflight.patch-profile", fn)
os.chmod(fn, 0755)
folder = os.path.join(WORKDIR, "_root", "Applications", "MacPython %s"%(
@@ -1005,7 +1035,7 @@ def main():
patchFile('resources/ReadMe.txt', os.path.join(WORKDIR, 'installer', 'ReadMe.txt'))
# Ditto for the license file.
- shutil.copy('../../../LICENSE', os.path.join(WORKDIR, 'installer', 'License.txt'))
+ shutil.copy('../../LICENSE', os.path.join(WORKDIR, 'installer', 'License.txt'))
fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w')
print >> fp, "# BUILD INFO"