diff options
-rwxr-xr-x | Mac/BuildScript/build-installer.py | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 95319e5400..51f240845a 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -10,7 +10,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4) Usage: see USAGE variable in the script. """ import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd -import grp +import grp, md5 INCLUDE_TIMESTAMP=1 VERBOSE=1 @@ -62,7 +62,7 @@ WORKDIR="/tmp/_py24" # The directory we'll use to store third-party sources. Set this to something # else if you don't want to re-fetch required libraries every time. DEPSRC=os.path.join(WORKDIR, 'third-party') -DEPSRC=os.path.expanduser('~/Universal/other-sources') +DEPSRC=os.path.expanduser('/tmp/other-sources') # Location of the preferred SDK SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk" @@ -94,8 +94,9 @@ 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", + name="Bzip2 1.0.4", + url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz", + checksum="fc310b254f6ba5fbb5da018f04533688", configure=None, install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( shellQuote(os.path.join(WORKDIR, 'libraries')), @@ -106,6 +107,7 @@ LIBRARY_RECIPES=[ dict( name="ZLib 1.2.3", url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz", + checksum="debc62758716a169df9f62e6ab2bc634", configure=None, install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( shellQuote(os.path.join(WORKDIR, 'libraries')), @@ -117,6 +119,7 @@ LIBRARY_RECIPES=[ # 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" , + checksum="7ee5a692db88b30ca48927a13fd60e46", patchlevel='0', patches=[ # The readline maintainers don't do actual micro releases, but @@ -131,6 +134,7 @@ LIBRARY_RECIPES=[ dict( name="NCurses 5.5", url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz", + checksum='e73c1ac10b4bfc46db43b2ddfd6244ef', configure_pre=[ "--without-cxx", "--without-ada", @@ -159,6 +163,7 @@ LIBRARY_RECIPES=[ dict( name="Sleepycat DB 4.4", url="http://downloads.sleepycat.com/db-4.4.20.tar.gz", + checksum='d84dff288a19186b136b0daf7067ade3', #name="Sleepycat DB 4.3.29", #url="http://downloads.sleepycat.com/db-4.3.29.tar.gz", buildDir="build_unix", @@ -308,6 +313,19 @@ def checkEnvironment(): fatal("Please install the latest version of Xcode and the %s SDK"%( os.path.basename(SDKPATH[:-4]))) + if os.path.exists('/sw'): + fatal("Detected Fink, please remove before building Python") + + if os.path.exists('/opt/local'): + fatal("Detected MacPorts, please remove before building Python") + + if not os.path.exists('/Library/Frameworks/Tcl.framework') or \ + not os.path.exists('/Library/Frameworks/Tk.framework'): + + fatal("Please install a Universal Tcl/Tk framework in /Library from\n\thttp://tcltkaqua.sourceforge.net/") + + + def parseOptions(args = None): @@ -444,6 +462,17 @@ def downloadURL(url, fname): except: pass +def verifyChecksum(path, checksum): + summer = md5.md5() + fp = open(path, 'rb') + block = fp.read(10240) + while block: + summer.update(block) + block = fp.read(10240) + + return summer.hexdigest() == checksum + + def buildRecipe(recipe, basedir, archList): """ Build software using a recipe. This function does the @@ -465,13 +494,16 @@ def buildRecipe(recipe, basedir, archList): os.mkdir(DEPSRC) - if os.path.exists(sourceArchive): + if os.path.exists(sourceArchive) and verifyChecksum(sourceArchive, recipe['checksum']): print "Using local copy of %s"%(name,) else: print "Downloading %s"%(name,) downloadURL(url, sourceArchive) print "Archive for %s stored as %s"%(name, sourceArchive) + if not verifyChecksum(sourceArchive, recipe['checksum']): + fatal("Download for %s failed: bad checksum"%(url,)) + print "Extracting archive for %s"%(name,) buildDir=os.path.join(WORKDIR, '_bld') |