Merged revisions 74981 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74981 | ronald.oussoren | 2009-09-20 22:16:11 +0200 (Sun, 20 Sep 2009) | 3 lines

  * Make it easier to build custom installers (such as a 3-way universal build)
  * Upgrade bzip dependency to 1.0.5
........
This commit is contained in:
Ronald Oussoren 2009-09-20 20:17:15 +00:00
parent ba0aa6b544
commit 3aeda28b22
2 changed files with 200 additions and 182 deletions

View File

@ -61,12 +61,25 @@ DEPSRC = os.path.join(WORKDIR, 'third-party')
DEPSRC = os.path.expanduser('~/Universal/other-sources')
# Location of the preferred SDK
if int(os.uname()[2].split('.')[0]) == 8:
# Explicitly use the 10.4u (universal) SDK when
# building on 10.4, the system headers are not
# useable for a universal build
SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
#SDKPATH = "/"
else:
SDKPATH = "/"
universal_opts_map = { '32-bit': ('i386', 'ppc',),
'64-bit': ('x86_64', 'ppc64',),
'intel': ('i386', 'x86_64'),
'3-way': ('ppc', 'i386', 'x86_64'),
'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
default_target_map = {
'64-bit': '10.5',
'3-way': '10.5',
'intel': '10.5',
'all': '10.5',
}
UNIVERSALOPTS = tuple(universal_opts_map.keys())
@ -104,11 +117,14 @@ USAGE = textwrap.dedent("""\
# [The recipes are defined here for convenience but instantiated later after
# command line options have been processed.]
def library_recipes():
return [
result = []
if DEPTARGET < '10.5':
result.extend([
dict(
name="Bzip2 1.0.4",
url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz",
checksum='fc310b254f6ba5fbb5da018f04533688',
name="Bzip2 1.0.5",
url="http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz",
checksum='3c15a0c8d1d3ee1c46a1634d00617b1a',
configure=None,
install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')),
@ -142,7 +158,6 @@ def library_recipes():
'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004',
]
),
dict(
name="SQLite 3.6.11",
url="http://www.sqlite.org/sqlite-3.6.11.tar.gz",
@ -155,7 +170,6 @@ def library_recipes():
'--disable-tcl',
]
),
dict(
name="NCurses 5.5",
url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
@ -185,6 +199,9 @@ def library_recipes():
getVersion(),
),
),
])
result.extend([
dict(
name="Sleepycat DB 4.7.25",
url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
@ -195,11 +212,14 @@ def library_recipes():
'--includedir=/usr/local/include/db4',
]
),
]
])
return result
# Instructions for building packages inside the .mpkg.
PKG_RECIPES = [
def pkg_recipes():
result = [
dict(
name="PythonFramework",
long_name="Python Framework",
@ -266,6 +286,10 @@ PKG_RECIPES = [
source="/empty-dir",
required=False,
),
]
if DEPTARGET < '10.4':
result.append(
dict(
name="PythonSystemFixes",
long_name="Fix system Python",
@ -279,7 +303,8 @@ PKG_RECIPES = [
source="/empty-dir",
required=False,
)
]
)
return result
def fatal(msg):
"""
@ -327,10 +352,10 @@ def checkEnvironment():
"""
if platform.system() != 'Darwin':
fatal("This script should be run on a Mac OS X 10.4 system")
fatal("This script should be run on a Mac OS X 10.4 (or later) system")
if platform.release() <= '8.':
fatal("This script should be run on a Mac OS X 10.4 system")
if int(platform.release().split('.')[0]) <= 8:
fatal("This script should be run on a Mac OS X 10.4 (or later) system")
if not os.path.exists(SDKPATH):
fatal("Please install the latest version of Xcode and the %s SDK"%(
@ -360,6 +385,7 @@ def parseOptions(args=None):
print "Additional arguments"
sys.exit(1)
deptarget = None
for k, v in options:
if k in ('-h', '-?', '--help'):
print USAGE
@ -379,11 +405,16 @@ def parseOptions(args=None):
elif k in ('--dep-target', ):
DEPTARGET=v
deptarget=v
elif k in ('--universal-archs', ):
if v in UNIVERSALOPTS:
UNIVERSALARCHS = v
ARCHLIST = universal_opts_map[UNIVERSALARCHS]
if deptarget is None:
# Select alternate default deployment
# target
DEPTARGET = default_target_map.get(v, '10.3')
else:
raise NotImplementedError, v
@ -873,7 +904,7 @@ def makeMpkgPlist(path):
IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()),
IFPkgFlagPackageSelection='selected'
)
for item in PKG_RECIPES
for item in pkg_recipes()
],
IFPkgFormatVersion=0.10000000149011612,
IFPkgFlagBackgroundScaling="proportional",
@ -900,7 +931,7 @@ def buildInstaller():
pkgroot = os.path.join(outdir, 'Python.mpkg', 'Contents')
pkgcontents = os.path.join(pkgroot, 'Packages')
os.makedirs(pkgcontents)
for recipe in PKG_RECIPES:
for recipe in pkg_recipes():
packageFromRecipe(pkgcontents, recipe)
rsrcDir = os.path.join(pkgroot, 'Resources')
@ -948,9 +979,9 @@ def buildDMG():
shutil.rmtree(outdir)
imagepath = os.path.join(outdir,
'python-%s-macosx'%(getFullVersion(),))
'python-%s-macosx%s'%(getFullVersion(),DEPTARGET))
if INCLUDE_TIMESTAMP:
imagepath = imagepath + '%04d-%02d-%02d'%(time.localtime()[:3])
imagepath = imagepath + '-%04d-%02d-%02d'%(time.localtime()[:3])
imagepath = imagepath + '.dmg'
os.mkdir(outdir)
@ -1054,11 +1085,8 @@ def main():
print >> fp, "# By:", pwd.getpwuid(os.getuid()).pw_gecos
fp.close()
# And copy it to a DMG
buildDMG()
if __name__ == "__main__":
main()

View File

@ -16,16 +16,6 @@ FWK="/Library/Frameworks/Python.framework/Versions/@PYVER@"
-x badsyntax -x site-packages \
"${FWK}/lib/python${PYVER}"
"${FWK}/bin/python@PYVER@" -Wi -tt \
"${FWK}/lib/python${PYVER}/compileall.py" \
-x badsyntax -x site-packages \
"${FWK}/Mac/Tools"
"${FWK}/bin/python@PYVER@" -Wi -tt -O \
"${FWK}/lib/python${PYVER}/compileall.py" \
-x badsyntax -x site-packages \
"${FWK}/Mac/Tools"
chgrp -R admin "${FWK}"
chmod -R g+w "${FWK}"