summaryrefslogtreecommitdiffstats
path: root/Mac/BuildScript
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/BuildScript')
-rwxr-xr-xMac/BuildScript/build-installer.py63
-rwxr-xr-xMac/BuildScript/scripts/postflight.documentation3
-rwxr-xr-xMac/BuildScript/scripts/postflight.patch-profile21
3 files changed, 51 insertions, 36 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index 083209b..8bdebe6 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -10,9 +10,10 @@ 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
-INCLUDE_TIMESTAMP=1
-VERBOSE=1
+INCLUDE_TIMESTAMP = 1
+VERBOSE = 1
from plistlib import Plist
@@ -32,7 +33,7 @@ except ImportError:
def shellQuote(value):
"""
- Return the string value in a form that can savely be inserted into
+ Return the string value in a form that can safely be inserted into
a shell command.
"""
return "'%s'"%(value.replace("'", "'\"'\"'"))
@@ -55,28 +56,28 @@ def getFullVersion():
raise RuntimeError, "Cannot find full version??"
-# The directory we'll use to create the build, will be erased and recreated
-WORKDIR="/tmp/_py"
+# The directory we'll use to create the build (will be erased and recreated)
+WORKDIR = "/tmp/_py"
-# The directory we'll use to store third-party sources, set this to something
+# 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.join(WORKDIR, 'third-party')
+DEPSRC = os.path.expanduser('~/Universal/other-sources')
# Location of the preferred SDK
-SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
-#SDKPATH="/"
+SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
+#SDKPATH = "/"
-ARCHLIST=('i386', 'ppc',)
+ARCHLIST = ('i386', 'ppc',)
# Source directory (asume we're in Mac/BuildScript)
-SRCDIR=os.path.dirname(
+SRCDIR = os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__
))))
-USAGE=textwrap.dedent("""\
+USAGE = textwrap.dedent("""\
Usage: build_python [options]
Options:
@@ -91,7 +92,7 @@ USAGE=textwrap.dedent("""\
# Instructions for building libraries that are necessary for building a
# batteries included python.
-LIBRARY_RECIPES=[
+LIBRARY_RECIPES = [
dict(
name="Bzip2 1.0.3",
url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz",
@@ -183,7 +184,7 @@ LIBRARY_RECIPES=[
# Instructions for building packages inside the .mpkg.
-PKG_RECIPES=[
+PKG_RECIPES = [
dict(
name="PythonFramework",
long_name="Python Framework",
@@ -200,7 +201,7 @@ PKG_RECIPES=[
long_name="GUI Applications",
source="/Applications/MacPython %(VER)s",
readme="""\
- This package installs IDLE (an interactive Python IDLE),
+ This package installs IDLE (an interactive Python IDE),
Python Launcher and Build Applet (create application bundles
from python scripts).
@@ -256,8 +257,7 @@ PKG_RECIPES=[
readme="""\
This package updates the system python installation on
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.
+ using that copy of python after installing this version.
""",
postflight="../Tools/fixapplepython23.py",
topdir="/Library/Frameworks/Python.framework",
@@ -323,7 +323,7 @@ def checkEnvironment():
-def parseOptions(args = None):
+def parseOptions(args=None):
"""
Parse arguments and update global settings.
"""
@@ -636,15 +636,15 @@ def buildPython():
print "Running make"
runCommand("make")
- print "Runing make frameworkinstall"
+ print "Running make frameworkinstall"
runCommand("make frameworkinstall DESTDIR=%s"%(
shellQuote(rootDir)))
- print "Runing make frameworkinstallextras"
+ print "Running make frameworkinstallextras"
runCommand("make frameworkinstallextras DESTDIR=%s"%(
shellQuote(rootDir)))
- print "Copy required shared libraries"
+ print "Copying required shared libraries"
if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')):
runCommand("mv %s/* %s"%(
shellQuote(os.path.join(
@@ -657,9 +657,13 @@ def buildPython():
print "Fix file modes"
frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
+ gid = grp.getgrnam('admin').gr_gid
+
for dirpath, dirnames, filenames in os.walk(frmDir):
for dn in dirnames:
os.chmod(os.path.join(dirpath, dn), 0775)
+ os.chown(os.path.join(dirpath, dn), -1, gid)
+
for fn in filenames:
if os.path.islink(fn):
@@ -668,7 +672,8 @@ def buildPython():
# "chmod g+w $fn"
p = os.path.join(dirpath, fn)
st = os.stat(p)
- os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP)
+ os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP)
+ os.chown(p, -1, gid)
# We added some directories to the search path during the configure
# phase. Remove those because those directories won't be there on
@@ -729,8 +734,8 @@ def patchScript(inPath, outPath):
def packageFromRecipe(targetDir, recipe):
curdir = os.getcwd()
try:
- # 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
+ # The major version (such as 2.5) is included in the package name
+ # because having two version of python installed at the same time is
# common.
pkgname = '%s-%s'%(recipe['name'], getVersion())
srcdir = recipe.get('source')
@@ -904,7 +909,7 @@ def installSize(clear=False, _saved=[]):
def buildDMG():
"""
- Create DMG containing the rootDir
+ Create DMG containing the rootDir.
"""
outdir = os.path.join(WORKDIR, 'diskimage')
if os.path.exists(outdir):
@@ -917,7 +922,7 @@ def buildDMG():
imagepath = imagepath + '.dmg'
os.mkdir(outdir)
- runCommand("hdiutil create -volname 'Univeral MacPython %s' -srcfolder %s %s"%(
+ runCommand("hdiutil create -volname 'Universal MacPython %s' -srcfolder %s %s"%(
getFullVersion(),
shellQuote(os.path.join(WORKDIR, 'installer')),
shellQuote(imagepath)))
@@ -945,6 +950,10 @@ def setIcon(filePath, icnsPath):
ref, isDirectory = Carbon.File.FSPathMakeRef(filePath)
if isDirectory:
+ # There is a problem with getting this into the pax(1) archive,
+ # just ignore directory icons for now.
+ return
+
tmpPath = os.path.join(filePath, "Icon\r")
if not os.path.exists(tmpPath):
fp = open(tmpPath, 'w')
diff --git a/Mac/BuildScript/scripts/postflight.documentation b/Mac/BuildScript/scripts/postflight.documentation
index 85d400f..9f5918e 100755
--- a/Mac/BuildScript/scripts/postflight.documentation
+++ b/Mac/BuildScript/scripts/postflight.documentation
@@ -1,6 +1,5 @@
#!/bin/sh
-# FIXME
PYVER="@PYVER@"
if [ -d /Developer/Documentation ]; then
@@ -8,5 +7,5 @@ if [ -d /Developer/Documentation ]; then
mkdir -p /Developer/Documentation/Python
fi
- ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation"
+ ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation @PYVER@"
fi
diff --git a/Mac/BuildScript/scripts/postflight.patch-profile b/Mac/BuildScript/scripts/postflight.patch-profile
index c42e11e..5e82f33 100755
--- a/Mac/BuildScript/scripts/postflight.patch-profile
+++ b/Mac/BuildScript/scripts/postflight.patch-profile
@@ -47,22 +47,29 @@ done
echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough"
case "${BSH}" in
*csh)
+ if [ -f "${HOME}/.tcshrc" ]; then
+ RC="${HOME}/.tcshrc"
+ else
+ RC="${HOME}/.cshrc"
+ fi
# Create backup copy before patching
- if [ -f "${HOME}/.cshrc" ]; then
- cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave"
+ if [ -f "${RC}" ]; then
+ cp -fp "${RC}" "${RC}.pysave"
fi
- echo "" >> "${HOME}/.cshrc"
- echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc"
- echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc"
- echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc"
+ echo "" >> "${RC}"
+ echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}"
+ echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}"
+ echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}"
if [ `id -ur` = 0 ]; then
- chown "${USER}" "${HOME}/.cshrc"
+ chown "${USER}" "${RC}"
fi
exit 0
;;
bash)
if [ -e "${HOME}/.bash_profile" ]; then
PR="${HOME}/.bash_profile"
+ elif [ -e "${HOME}/.bash_login" ]; then
+ PR="${HOME}/.bash_login"
elif [ -e "${HOME}/.profile" ]; then
PR="${HOME}/.profile"
else