annotate Mac/BuildScript/build-installer.py @ 57114:d3a81051663b

importlib.test.source.util referenced variables in the 'finally' part of a try/finally which may not have been set.
author Brett Cannon <bcannon@gmail.com>
date Thu, 05 Nov 2009 01:17:22 +0000
parents d71fa6c468cc
children acc3e3583fac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1 #!/usr/bin/python
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
2 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
3 This script is used to build the "official unofficial" universal build on
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
4 Mac OS X. It requires Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK to do its
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
5 work. 64-bit or four-way universal builds require at least OS X 10.5 and
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
6 the 10.5 SDK.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
7
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
8 Please ensure that this script keeps working with Python 2.3, to avoid
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
9 bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
10
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
11 Usage: see USAGE variable in the script.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
12 """
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
13 import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
14 import grp
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
15
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
16 INCLUDE_TIMESTAMP = 1
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
17 VERBOSE = 1
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
18
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
19 from plistlib import Plist
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
20
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
21 import MacOS
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
22
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
23 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
24 from plistlib import writePlist
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
25 except ImportError:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
26 # We're run using python2.3
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
27 def writePlist(plist, path):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
28 plist.write(path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
29
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
30 def shellQuote(value):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
31 """
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
32 Return the string value in a form that can safely be inserted into
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
33 a shell command.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
34 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
35 return "'%s'"%(value.replace("'", "'\"'\"'"))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
36
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
37 def grepValue(fn, variable):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
38 variable = variable + '='
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
39 for ln in open(fn, 'r'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
40 if ln.startswith(variable):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
41 value = ln[len(variable):].strip()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
42 return value[1:-1]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
43
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
44 def getVersion():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
45 return grepValue(os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
46
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
47 def getFullVersion():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
48 fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
49 for ln in open(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
50 if 'PY_VERSION' in ln:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
51 return ln.split()[-1][1:-1]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
52
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
53 raise RuntimeError, "Cannot find full version??"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
54
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
55 # The directory we'll use to create the build (will be erased and recreated)
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
56 WORKDIR = "/tmp/_py"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
57
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
58 # The directory we'll use to store third-party sources. Set this to something
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
59 # else if you don't want to re-fetch required libraries every time.
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
60 DEPSRC = os.path.join(WORKDIR, 'third-party')
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
61 DEPSRC = os.path.expanduser('~/Universal/other-sources')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
62
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
63 # Location of the preferred SDK
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
64 SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
65 #SDKPATH = "/"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
66
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
67 universal_opts_map = { '32-bit': ('i386', 'ppc',),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
68 '64-bit': ('x86_64', 'ppc64',),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
69 'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
70
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
71 UNIVERSALOPTS = tuple(universal_opts_map.keys())
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
72
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
73 UNIVERSALARCHS = '32-bit'
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
74
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
75 ARCHLIST = universal_opts_map[UNIVERSALARCHS]
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
76
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
77 # Source directory (asume we're in Mac/BuildScript)
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
78 SRCDIR = os.path.dirname(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
79 os.path.dirname(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
80 os.path.dirname(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
81 os.path.abspath(__file__
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
82 ))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
83
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
84 # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
85 DEPTARGET = '10.3'
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
86
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
87 USAGE = textwrap.dedent("""\
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
88 Usage: build_python [options]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
89
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
90 Options:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
91 -? or -h: Show this message
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
92 -b DIR
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
93 --build-dir=DIR: Create build here (default: %(WORKDIR)r)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
94 --third-party=DIR: Store third-party sources here (default: %(DEPSRC)r)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
95 --sdk-path=DIR: Location of the SDK (default: %(SDKPATH)r)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
96 --src-dir=DIR: Location of the Python sources (default: %(SRCDIR)r)
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
97 --dep-target=10.n OS X deployment target (default: %(DEPTARGET)r)
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
98 --universal-archs=x universal architectures (options: %(UNIVERSALOPTS)r, default: %(UNIVERSALARCHS)r)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
99 """)% globals()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
100
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
101
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
102 # Instructions for building libraries that are necessary for building a
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
103 # batteries included python.
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
104 # [The recipes are defined here for convenience but instantiated later after
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
105 # command line options have been processed.]
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
106 def library_recipes():
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
107 return [
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
108 dict(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
109 name="Bzip2 1.0.4",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
110 url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
111 checksum='fc310b254f6ba5fbb5da018f04533688',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
112 configure=None,
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
113 install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
114 shellQuote(os.path.join(WORKDIR, 'libraries')),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
115 ' -arch '.join(ARCHLIST),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
116 SDKPATH,
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
117 ),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
118 ),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
119 dict(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
120 name="ZLib 1.2.3",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
121 url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
122 checksum='debc62758716a169df9f62e6ab2bc634',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
123 configure=None,
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
124 install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
125 shellQuote(os.path.join(WORKDIR, 'libraries')),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
126 ' -arch '.join(ARCHLIST),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
127 SDKPATH,
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
128 ),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
129 ),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
130 dict(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
131 # Note that GNU readline is GPL'd software
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
132 name="GNU Readline 5.1.4",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
133 url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
134 checksum='7ee5a692db88b30ca48927a13fd60e46',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
135 patchlevel='0',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
136 patches=[
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
137 # The readline maintainers don't do actual micro releases, but
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
138 # just ship a set of patches.
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
139 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-001',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
140 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-002',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
141 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-003',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
142 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
143 ]
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
144 ),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
145
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
146 dict(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
147 name="SQLite 3.6.11",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
148 url="http://www.sqlite.org/sqlite-3.6.11.tar.gz",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
149 checksum='7ebb099696ab76cc6ff65dd496d17858',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
150 configure_pre=[
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
151 '--enable-threadsafe',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
152 '--enable-tempstore',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
153 '--enable-shared=no',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
154 '--enable-static=yes',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
155 '--disable-tcl',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
156 ]
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
157 ),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
158
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
159 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
160 name="NCurses 5.5",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
161 url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
162 checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
163 configure_pre=[
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
164 "--without-cxx",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
165 "--without-ada",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
166 "--without-progs",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
167 "--without-curses-h",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
168 "--enable-shared",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
169 "--with-shared",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
170 "--datadir=/usr/share",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
171 "--sysconfdir=/etc",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
172 "--sharedstatedir=/usr/com",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
173 "--with-terminfo-dirs=/usr/share/terminfo",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
174 "--with-default-terminfo-dir=/usr/share/terminfo",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
175 "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
176 "--enable-termcap",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
177 ],
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
178 patches=[
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
179 "ncurses-5.5.patch",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
180 ],
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
181 useLDFlags=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
182 install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
183 shellQuote(os.path.join(WORKDIR, 'libraries')),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
184 shellQuote(os.path.join(WORKDIR, 'libraries')),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
185 getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
186 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
187 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
188 ]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
189
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
190 # Instructions for building packages inside the .mpkg.
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
191 PKG_RECIPES = [
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
192 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
193 name="PythonFramework",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
194 long_name="Python Framework",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
195 source="/Library/Frameworks/Python.framework",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
196 readme="""\
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
197 This package installs Python.framework, that is the python
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
198 interpreter and the standard library. This also includes Python
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
199 wrappers for lots of Mac OS X API's.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
200 """,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
201 postflight="scripts/postflight.framework",
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
202 selected='selected',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
203 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
204 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
205 name="PythonApplications",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
206 long_name="GUI Applications",
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46222
diff changeset
207 source="/Applications/Python %(VER)s",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
208 readme="""\
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
209 This package installs IDLE (an interactive Python IDE),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
210 Python Launcher and Build Applet (create application bundles
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
211 from python scripts).
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
212
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
213 It also installs a number of examples and demos.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
214 """,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
215 required=False,
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
216 selected='selected',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
217 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
218 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
219 name="PythonUnixTools",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
220 long_name="UNIX command-line tools",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
221 source="/usr/local/bin",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
222 readme="""\
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
223 This package installs the unix tools in /usr/local/bin for
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
224 compatibility with older releases of Python. This package
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
225 is not necessary to use Python.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
226 """,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
227 required=False,
54359
d71fa6c468cc * Adapt framework install makefiles to 2to3 tool
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 54202
diff changeset
228 selected='selected',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
229 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
230 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
231 name="PythonDocumentation",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
232 long_name="Python Documentation",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
233 topdir="/Library/Frameworks/Python.framework/Versions/%(VER)s/Resources/English.lproj/Documentation",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
234 source="/pydocs",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
235 readme="""\
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
236 This package installs the python documentation at a location
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
237 that is useable for pydoc and IDLE. If you have installed Xcode
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
238 it will also install a link to the documentation in
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
239 /Developer/Documentation/Python
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
240 """,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
241 postflight="scripts/postflight.documentation",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
242 required=False,
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
243 selected='selected',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
244 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
245 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
246 name="PythonProfileChanges",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
247 long_name="Shell profile updater",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
248 readme="""\
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
249 This packages updates your shell profile to make sure that
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
250 the Python tools are found by your shell in preference of
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
251 the system provided Python tools.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
252
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
253 If you don't install this package you'll have to add
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
254 "/Library/Frameworks/Python.framework/Versions/%(VER)s/bin"
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
255 to your PATH by hand.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
256 """,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
257 postflight="scripts/postflight.patch-profile",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
258 topdir="/Library/Frameworks/Python.framework",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
259 source="/empty-dir",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
260 required=False,
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
261 selected='unselected',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
262 ),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
263 dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
264 name="PythonSystemFixes",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
265 long_name="Fix system Python",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
266 readme="""\
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
267 This package updates the system python installation on
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
268 Mac OS X 10.3 to ensure that you can build new python extensions
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
269 using that copy of python after installing this version.
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
270 """,
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
271 postflight="../Tools/fixapplepython23.py",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
272 topdir="/Library/Frameworks/Python.framework",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
273 source="/empty-dir",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
274 required=False,
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
275 selected='unselected',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
276 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
277 ]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
278
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
279 def fatal(msg):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
280 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
281 A fatal error, bail out.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
282 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
283 sys.stderr.write('FATAL: ')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
284 sys.stderr.write(msg)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
285 sys.stderr.write('\n')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
286 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
287
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
288 def fileContents(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
289 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
290 Return the contents of the named file
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
291 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
292 return open(fn, 'rb').read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
293
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
294 def runCommand(commandline):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
295 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
296 Run a command and raise RuntimeError if it fails. Output is surpressed
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
297 unless the command fails.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
298 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
299 fd = os.popen(commandline, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
300 data = fd.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
301 xit = fd.close()
46222
aed698c8647b Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 43102
diff changeset
302 if xit is not None:
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
303 sys.stdout.write(data)
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
304 raise RuntimeError, "command failed: %s"%(commandline,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
305
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
306 if VERBOSE:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
307 sys.stdout.write(data); sys.stdout.flush()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
308
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
309 def captureCommand(commandline):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
310 fd = os.popen(commandline, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
311 data = fd.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
312 xit = fd.close()
46222
aed698c8647b Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 43102
diff changeset
313 if xit is not None:
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
314 sys.stdout.write(data)
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
315 raise RuntimeError, "command failed: %s"%(commandline,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
316
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
317 return data
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
318
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
319 def checkEnvironment():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
320 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
321 Check that we're running on a supported system.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
322 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
323
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
324 if platform.system() != 'Darwin':
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
325 fatal("This script should be run on a Mac OS X 10.4 system")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
326
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
327 if platform.release() <= '8.':
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
328 fatal("This script should be run on a Mac OS X 10.4 system")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
329
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
330 if not os.path.exists(SDKPATH):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
331 fatal("Please install the latest version of Xcode and the %s SDK"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
332 os.path.basename(SDKPATH[:-4])))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
333
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
334
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
335
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
336 def parseOptions(args=None):
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
337 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
338 Parse arguments and update global settings.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
339 """
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
340 global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
341 global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
342
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
343 if args is None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
344 args = sys.argv[1:]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
345
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
346 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
347 options, args = getopt.getopt(args, '?hb',
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
348 [ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir=',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
349 'dep-target=', 'universal-archs=', 'help' ])
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
350 except getopt.error, msg:
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
351 print msg
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
352 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
353
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
354 if args:
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
355 print "Additional arguments"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
356 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
357
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
358 for k, v in options:
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
359 if k in ('-h', '-?', '--help'):
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
360 print USAGE
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
361 sys.exit(0)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
362
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
363 elif k in ('-d', '--build-dir'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
364 WORKDIR=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
365
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
366 elif k in ('--third-party',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
367 DEPSRC=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
368
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
369 elif k in ('--sdk-path',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
370 SDKPATH=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
371
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
372 elif k in ('--src-dir',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
373 SRCDIR=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
374
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
375 elif k in ('--dep-target', ):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
376 DEPTARGET=v
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
377
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
378 elif k in ('--universal-archs', ):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
379 if v in UNIVERSALOPTS:
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
380 UNIVERSALARCHS = v
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
381 ARCHLIST = universal_opts_map[UNIVERSALARCHS]
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
382 else:
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
383 raise NotImplementedError, v
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
384
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
385 else:
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
386 raise NotImplementedError, k
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
387
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
388 SRCDIR=os.path.abspath(SRCDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
389 WORKDIR=os.path.abspath(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
390 SDKPATH=os.path.abspath(SDKPATH)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
391 DEPSRC=os.path.abspath(DEPSRC)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
392
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
393 print "Settings:"
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
394 print " * Source directory:", SRCDIR
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
395 print " * Build directory: ", WORKDIR
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
396 print " * SDK location: ", SDKPATH
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
397 print " * Third-party source:", DEPSRC
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
398 print " * Deployment target:", DEPTARGET
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
399 print " * Universal architectures:", ARCHLIST
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
400 print ""
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
401
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
402
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
403
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
404
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
405 def extractArchive(builddir, archiveName):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
406 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
407 Extract a source archive into 'builddir'. Returns the path of the
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
408 extracted archive.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
409
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
410 XXX: This function assumes that archives contain a toplevel directory
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
411 that is has the same name as the basename of the archive. This is
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
412 save enough for anything we use.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
413 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
414 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
415 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
416 os.chdir(builddir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
417 if archiveName.endswith('.tar.gz'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
418 retval = os.path.basename(archiveName[:-7])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
419 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
420 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
421 fp = os.popen("tar zxf %s 2>&1"%(shellQuote(archiveName),), 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
422
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
423 elif archiveName.endswith('.tar.bz2'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
424 retval = os.path.basename(archiveName[:-8])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
425 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
426 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
427 fp = os.popen("tar jxf %s 2>&1"%(shellQuote(archiveName),), 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
428
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
429 elif archiveName.endswith('.tar'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
430 retval = os.path.basename(archiveName[:-4])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
431 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
432 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
433 fp = os.popen("tar xf %s 2>&1"%(shellQuote(archiveName),), 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
434
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
435 elif archiveName.endswith('.zip'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
436 retval = os.path.basename(archiveName[:-4])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
437 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
438 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
439 fp = os.popen("unzip %s 2>&1"%(shellQuote(archiveName),), 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
440
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
441 data = fp.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
442 xit = fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
443 if xit is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
444 sys.stdout.write(data)
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
445 raise RuntimeError, "Cannot extract %s"%(archiveName,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
446
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
447 return os.path.join(builddir, retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
448
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
449 finally:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
450 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
451
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
452 KNOWNSIZES = {
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
453 "http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz": 7952742,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
454 "http://downloads.sleepycat.com/db-4.4.20.tar.gz": 2030276,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
455 }
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
456
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
457 def downloadURL(url, fname):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
458 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
459 Download the contents of the url into the file.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
460 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
461 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
462 size = os.path.getsize(fname)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
463 except OSError:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
464 pass
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
465 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
466 if KNOWNSIZES.get(url) == size:
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
467 print "Using existing file for", url
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
468 return
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
469 fpIn = urllib2.urlopen(url)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
470 fpOut = open(fname, 'wb')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
471 block = fpIn.read(10240)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
472 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
473 while block:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
474 fpOut.write(block)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
475 block = fpIn.read(10240)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
476 fpIn.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
477 fpOut.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
478 except:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
479 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
480 os.unlink(fname)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
481 except:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
482 pass
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
483
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
484 def buildRecipe(recipe, basedir, archList):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
485 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
486 Build software using a recipe. This function does the
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
487 'configure;make;make install' dance for C software, with a possibility
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
488 to customize this process, basically a poor-mans DarwinPorts.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
489 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
490 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
491
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
492 name = recipe['name']
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
493 url = recipe['url']
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
494 configure = recipe.get('configure', './configure')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
495 install = recipe.get('install', 'make && make install DESTDIR=%s'%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
496 shellQuote(basedir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
497
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
498 archiveName = os.path.split(url)[-1]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
499 sourceArchive = os.path.join(DEPSRC, archiveName)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
500
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
501 if not os.path.exists(DEPSRC):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
502 os.mkdir(DEPSRC)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
503
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
504
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
505 if os.path.exists(sourceArchive):
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
506 print "Using local copy of %s"%(name,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
507
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
508 else:
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
509 print "Did not find local copy of %s"%(name,)
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
510 print "Downloading %s"%(name,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
511 downloadURL(url, sourceArchive)
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
512 print "Archive for %s stored as %s"%(name, sourceArchive)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
513
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
514 print "Extracting archive for %s"%(name,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
515 buildDir=os.path.join(WORKDIR, '_bld')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
516 if not os.path.exists(buildDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
517 os.mkdir(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
518
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
519 workDir = extractArchive(buildDir, sourceArchive)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
520 os.chdir(workDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
521 if 'buildDir' in recipe:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
522 os.chdir(recipe['buildDir'])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
523
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
524
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
525 for fn in recipe.get('patches', ()):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
526 if fn.startswith('http://'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
527 # Download the patch before applying it.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
528 path = os.path.join(DEPSRC, os.path.basename(fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
529 downloadURL(fn, path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
530 fn = path
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
531
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
532 fn = os.path.join(curdir, fn)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
533 runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
534 shellQuote(fn),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
535
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
536 if configure is not None:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
537 configure_args = [
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
538 "--prefix=/usr/local",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
539 "--enable-static",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
540 "--disable-shared",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
541 #"CPP=gcc -arch %s -E"%(' -arch '.join(archList,),),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
542 ]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
543
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
544 if 'configure_pre' in recipe:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
545 args = list(recipe['configure_pre'])
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
546 if '--disable-static' in args:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
547 configure_args.remove('--enable-static')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
548 if '--enable-shared' in args:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
549 configure_args.remove('--disable-shared')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
550 configure_args.extend(args)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
551
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
552 if recipe.get('useLDFlags', 1):
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
553 configure_args.extend([
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
554 "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
555 ' -arch '.join(archList),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
556 shellQuote(SDKPATH)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
557 shellQuote(basedir)[1:-1],),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
558 "LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
559 shellQuote(SDKPATH)[1:-1],
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
560 shellQuote(basedir)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
561 ' -arch '.join(archList)),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
562 ])
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
563 else:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
564 configure_args.extend([
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
565 "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
566 ' -arch '.join(archList),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
567 shellQuote(SDKPATH)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
568 shellQuote(basedir)[1:-1],),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
569 ])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
570
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
571 if 'configure_post' in recipe:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
572 configure_args = configure_args = list(recipe['configure_post'])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
573
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
574 configure_args.insert(0, configure)
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
575 configure_args = [ shellQuote(a) for a in configure_args ]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
576
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
577 print "Running configure for %s"%(name,)
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
578 runCommand(' '.join(configure_args) + ' 2>&1')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
579
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
580 print "Running install for %s"%(name,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
581 runCommand('{ ' + install + ' ;} 2>&1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
582
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
583 print "Done %s"%(name,)
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
584 print ""
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
585
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
586 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
587
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
588 def buildLibraries():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
589 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
590 Build our dependencies into $WORKDIR/libraries/usr/local
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
591 """
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
592 print ""
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
593 print "Building required libraries"
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
594 print ""
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
595 universal = os.path.join(WORKDIR, 'libraries')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
596 os.mkdir(universal)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
597 os.makedirs(os.path.join(universal, 'usr', 'local', 'lib'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
598 os.makedirs(os.path.join(universal, 'usr', 'local', 'include'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
599
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
600 for recipe in library_recipes():
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
601 buildRecipe(recipe, universal, ARCHLIST)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
602
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
603
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
604
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
605 def buildPythonDocs():
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
606 # This stores the documentation as Resources/English.lproj/Documentation
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
607 # inside the framwork. pydoc and IDLE will pick it up there.
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
608 print "Install python documentation"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
609 rootDir = os.path.join(WORKDIR, '_root')
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
610 buildDir = os.path.join('../../Doc')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
611 docdir = os.path.join(rootDir, 'pydocs')
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
612 curDir = os.getcwd()
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
613 os.chdir(buildDir)
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
614 runCommand('make update')
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
615 runCommand('make html')
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
616 os.chdir(curDir)
54202
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
617 if os.path.exists(docdir):
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
618 os.rmdir(docdir)
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
619 os.rename(os.path.join(buildDir, 'build', 'html'), docdir)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
620
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
621
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
622 def buildPython():
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
623 print "Building a universal python for %s architectures" % UNIVERSALARCHS
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
624
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
625 buildDir = os.path.join(WORKDIR, '_bld', 'python')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
626 rootDir = os.path.join(WORKDIR, '_root')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
627
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
628 if os.path.exists(buildDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
629 shutil.rmtree(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
630 if os.path.exists(rootDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
631 shutil.rmtree(rootDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
632 os.mkdir(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
633 os.mkdir(rootDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
634 os.mkdir(os.path.join(rootDir, 'empty-dir'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
635 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
636 os.chdir(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
637
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
638 # Not sure if this is still needed, the original build script
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
639 # claims that parts of the install assume python.exe exists.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
640 os.symlink('python', os.path.join(buildDir, 'python.exe'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
641
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
642 # Extract the version from the configure file, needed to calculate
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
643 # several paths.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
644 version = getVersion()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
645
52470
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
646 # Since the extra libs are not in their installed framework location
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
647 # during the build, augment the library path so that the interpreter
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
648 # will find them during its extension import sanity checks.
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
649 os.environ['DYLD_LIBRARY_PATH'] = os.path.join(WORKDIR,
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
650 'libraries', 'usr', 'local', 'lib')
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
651 print "Running configure..."
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
652 runCommand("%s -C --enable-framework --enable-universalsdk=%s "
52645
19190e058d59 Fix typo in configure line that caused the build installer
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52515
diff changeset
653 "--with-universal-archs=%s --with-computed-gotos "
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
654 "LDFLAGS='-g -L%s/libraries/usr/local/lib' "
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
655 "OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
656 shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
657 UNIVERSALARCHS,
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
658 shellQuote(WORKDIR)[1:-1],
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
659 shellQuote(WORKDIR)[1:-1]))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
660
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
661 print "Running make"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
662 runCommand("make")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
663
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
664 print "Running make frameworkinstall"
54202
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
665 runCommand("make install DESTDIR=%s"%(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
666 shellQuote(rootDir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
667
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
668 print "Running make frameworkinstallextras"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
669 runCommand("make frameworkinstallextras DESTDIR=%s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
670 shellQuote(rootDir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
671
52470
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
672 del os.environ['DYLD_LIBRARY_PATH']
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
673 print "Copying required shared libraries"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
674 if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
675 runCommand("mv %s/* %s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
676 shellQuote(os.path.join(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
677 WORKDIR, 'libraries', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
678 'Python.framework', 'Versions', getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
679 'lib')),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
680 shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
681 'Python.framework', 'Versions', getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
682 'lib'))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
683
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
684 print "Fix file modes"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
685 frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
686 gid = grp.getgrnam('admin').gr_gid
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
687
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
688
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
689
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
690 for dirpath, dirnames, filenames in os.walk(frmDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
691 for dn in dirnames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
692 os.chmod(os.path.join(dirpath, dn), 0775)
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
693 os.chown(os.path.join(dirpath, dn), -1, gid)
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
694
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
695
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
696 for fn in filenames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
697 if os.path.islink(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
698 continue
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
699
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
700 # "chmod g+w $fn"
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
701 p = os.path.join(dirpath, fn)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
702 st = os.stat(p)
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
703 os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP)
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
704 os.chown(p, -1, gid)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
705
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
706 # We added some directories to the search path during the configure
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
707 # phase. Remove those because those directories won't be there on
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
708 # the end-users system.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
709 path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
710 'Versions', version, 'lib', 'python%s'%(version,),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
711 'config', 'Makefile')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
712 fp = open(path, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
713 data = fp.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
714 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
715
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
716 data = data.replace('-L%s/libraries/usr/local/lib'%(WORKDIR,), '')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
717 data = data.replace('-I%s/libraries/usr/local/include'%(WORKDIR,), '')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
718 fp = open(path, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
719 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
720 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
721
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
722 # Add symlinks in /usr/local/bin, using relative links
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
723 usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
724 to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
725 'Python.framework', 'Versions', version, 'bin')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
726 if os.path.exists(usr_local_bin):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
727 shutil.rmtree(usr_local_bin)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
728 os.makedirs(usr_local_bin)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
729 for fn in os.listdir(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
730 os.path.join(frmDir, 'Versions', version, 'bin')):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
731 os.symlink(os.path.join(to_framework, fn),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
732 os.path.join(usr_local_bin, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
733
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
734 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
735
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
736 # Remove the 'Current' link, that way we don't accidently mess with an already installed
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
737 # version of python
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
738 os.unlink(os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 'Versions', 'Current'))
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
739
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
740
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
741
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
742
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
743 def patchFile(inPath, outPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
744 data = fileContents(inPath)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
745 data = data.replace('$FULL_VERSION', getFullVersion())
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
746 data = data.replace('$VERSION', getVersion())
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
747 data = data.replace('$MACOSX_DEPLOYMENT_TARGET', ''.join((DEPTARGET, ' or later')))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
748 data = data.replace('$ARCHITECTURES', "i386, ppc")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
749 data = data.replace('$INSTALL_SIZE', installSize())
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
750
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
751 # This one is not handy as a template variable
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
752 data = data.replace('$PYTHONFRAMEWORKINSTALLDIR', '/Library/Frameworks/Python.framework')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
753 fp = open(outPath, 'wb')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
754 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
755 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
756
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
757 def patchScript(inPath, outPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
758 data = fileContents(inPath)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
759 data = data.replace('@PYVER@', getVersion())
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
760 fp = open(outPath, 'wb')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
761 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
762 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
763 os.chmod(outPath, 0755)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
764
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
765
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
766
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
767 def packageFromRecipe(targetDir, recipe):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
768 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
769 try:
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
770 # The major version (such as 2.5) is included in the package name
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
771 # because having two version of python installed at the same time is
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
772 # common.
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
773 pkgname = '%s-%s'%(recipe['name'], getVersion())
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
774 srcdir = recipe.get('source')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
775 pkgroot = recipe.get('topdir', srcdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
776 postflight = recipe.get('postflight')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
777 readme = textwrap.dedent(recipe['readme'])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
778 isRequired = recipe.get('required', True)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
779
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
780 print "- building package %s"%(pkgname,)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
781
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
782 # Substitute some variables
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
783 textvars = dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
784 VER=getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
785 FULLVER=getFullVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
786 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
787 readme = readme % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
788
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
789 if pkgroot is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
790 pkgroot = pkgroot % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
791 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
792 pkgroot = '/'
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
793
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
794 if srcdir is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
795 srcdir = os.path.join(WORKDIR, '_root', srcdir[1:])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
796 srcdir = srcdir % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
797
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
798 if postflight is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
799 postflight = os.path.abspath(postflight)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
800
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
801 packageContents = os.path.join(targetDir, pkgname + '.pkg', 'Contents')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
802 os.makedirs(packageContents)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
803
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
804 if srcdir is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
805 os.chdir(srcdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
806 runCommand("pax -wf %s . 2>&1"%(shellQuote(os.path.join(packageContents, 'Archive.pax')),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
807 runCommand("gzip -9 %s 2>&1"%(shellQuote(os.path.join(packageContents, 'Archive.pax')),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
808 runCommand("mkbom . %s 2>&1"%(shellQuote(os.path.join(packageContents, 'Archive.bom')),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
809
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
810 fn = os.path.join(packageContents, 'PkgInfo')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
811 fp = open(fn, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
812 fp.write('pmkrpkg1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
813 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
814
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
815 rsrcDir = os.path.join(packageContents, "Resources")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
816 os.mkdir(rsrcDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
817 fp = open(os.path.join(rsrcDir, 'ReadMe.txt'), 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
818 fp.write(readme)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
819 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
820
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
821 if postflight is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
822 patchScript(postflight, os.path.join(rsrcDir, 'postflight'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
823
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
824 vers = getFullVersion()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
825 major, minor = map(int, getVersion().split('.', 2))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
826 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
827 CFBundleGetInfoString="Python.%s %s"%(pkgname, vers,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
828 CFBundleIdentifier='org.python.Python.%s'%(pkgname,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
829 CFBundleName='Python.%s'%(pkgname,),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
830 CFBundleShortVersionString=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
831 IFMajorVersion=major,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
832 IFMinorVersion=minor,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
833 IFPkgFormatVersion=0.10000000149011612,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
834 IFPkgFlagAllowBackRev=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
835 IFPkgFlagAuthorizationAction="RootAuthorization",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
836 IFPkgFlagDefaultLocation=pkgroot,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
837 IFPkgFlagFollowLinks=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
838 IFPkgFlagInstallFat=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
839 IFPkgFlagIsRequired=isRequired,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
840 IFPkgFlagOverwritePermissions=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
841 IFPkgFlagRelocatable=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
842 IFPkgFlagRestartAction="NoRestart",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
843 IFPkgFlagRootVolumeOnly=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
844 IFPkgFlagUpdateInstalledLangauges=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
845 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
846 writePlist(pl, os.path.join(packageContents, 'Info.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
847
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
848 pl = Plist(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
849 IFPkgDescriptionDescription=readme,
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
850 IFPkgDescriptionTitle=recipe.get('long_name', "Python.%s"%(pkgname,)),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
851 IFPkgDescriptionVersion=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
852 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
853 writePlist(pl, os.path.join(packageContents, 'Resources', 'Description.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
854
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
855 finally:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
856 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
857
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
858
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
859 def makeMpkgPlist(path):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
860
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
861 vers = getFullVersion()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
862 major, minor = map(int, getVersion().split('.', 2))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
863
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
864 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
865 CFBundleGetInfoString="Python %s"%(vers,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
866 CFBundleIdentifier='org.python.Python',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
867 CFBundleName='Python',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
868 CFBundleShortVersionString=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
869 IFMajorVersion=major,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
870 IFMinorVersion=minor,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
871 IFPkgFlagComponentDirectory="Contents/Packages",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
872 IFPkgFlagPackageList=[
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
873 dict(
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
874 IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()),
50377
afab319252e7 Py3k: update OSX installer-generator
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50246
diff changeset
875 IFPkgFlagPackageSelection=item['selected'],
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
876 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
877 for item in PKG_RECIPES
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
878 ],
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
879 IFPkgFormatVersion=0.10000000149011612,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
880 IFPkgFlagBackgroundScaling="proportional",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
881 IFPkgFlagBackgroundAlignment="left",
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
882 IFPkgFlagAuthorizationAction="RootAuthorization",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
883 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
884
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
885 writePlist(pl, path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
886
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
887
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
888 def buildInstaller():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
889
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
890 # Zap all compiled files
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
891 for dirpath, _, filenames in os.walk(os.path.join(WORKDIR, '_root')):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
892 for fn in filenames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
893 if fn.endswith('.pyc') or fn.endswith('.pyo'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
894 os.unlink(os.path.join(dirpath, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
895
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
896 outdir = os.path.join(WORKDIR, 'installer')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
897 if os.path.exists(outdir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
898 shutil.rmtree(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
899 os.mkdir(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
900
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
901 pkgroot = os.path.join(outdir, 'Python.mpkg', 'Contents')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
902 pkgcontents = os.path.join(pkgroot, 'Packages')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
903 os.makedirs(pkgcontents)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
904 for recipe in PKG_RECIPES:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
905 packageFromRecipe(pkgcontents, recipe)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
906
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
907 rsrcDir = os.path.join(pkgroot, 'Resources')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
908
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
909 fn = os.path.join(pkgroot, 'PkgInfo')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
910 fp = open(fn, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
911 fp.write('pmkrpkg1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
912 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
913
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
914 os.mkdir(rsrcDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
915
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
916 makeMpkgPlist(os.path.join(pkgroot, 'Info.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
917 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
918 IFPkgDescriptionTitle="Python",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
919 IFPkgDescriptionVersion=getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
920 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
921
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
922 writePlist(pl, os.path.join(pkgroot, 'Resources', 'Description.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
923 for fn in os.listdir('resources'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
924 if fn == '.svn': continue
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
925 if fn.endswith('.jpg'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
926 shutil.copy(os.path.join('resources', fn), os.path.join(rsrcDir, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
927 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
928 patchFile(os.path.join('resources', fn), os.path.join(rsrcDir, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
929
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
930 shutil.copy("../../LICENSE", os.path.join(rsrcDir, 'License.txt'))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
931
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
932
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
933 def installSize(clear=False, _saved=[]):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
934 if clear:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
935 del _saved[:]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
936 if not _saved:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
937 data = captureCommand("du -ks %s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
938 shellQuote(os.path.join(WORKDIR, '_root'))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
939 _saved.append("%d"%((0.5 + (int(data.split()[0]) / 1024.0)),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
940 return _saved[0]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
941
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
942
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
943 def buildDMG():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
944 """
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
945 Create DMG containing the rootDir.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
946 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
947 outdir = os.path.join(WORKDIR, 'diskimage')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
948 if os.path.exists(outdir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
949 shutil.rmtree(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
950
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
951 imagepath = os.path.join(outdir,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
952 'python-%s-macosx'%(getFullVersion(),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
953 if INCLUDE_TIMESTAMP:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
954 imagepath = imagepath + '%04d-%02d-%02d'%(time.localtime()[:3])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
955 imagepath = imagepath + '.dmg'
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
956
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
957 os.mkdir(outdir)
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
958 volname='Python %s'%(getFullVersion())
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
959 runCommand("hdiutil create -format UDRW -volname %s -srcfolder %s %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
960 shellQuote(volname),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
961 shellQuote(os.path.join(WORKDIR, 'installer')),
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
962 shellQuote(imagepath + ".tmp.dmg" )))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
963
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
964
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
965 if not os.path.exists(os.path.join(WORKDIR, "mnt")):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
966 os.mkdir(os.path.join(WORKDIR, "mnt"))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
967 runCommand("hdiutil attach %s -mountroot %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
968 shellQuote(imagepath + ".tmp.dmg"), shellQuote(os.path.join(WORKDIR, "mnt"))))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
969
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
970 # Custom icon for the DMG, shown when the DMG is mounted.
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
971 shutil.copy("../Icons/Disk Image.icns",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
972 os.path.join(WORKDIR, "mnt", volname, ".VolumeIcon.icns"))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
973 runCommand("/Developer/Tools/SetFile -a C %s/"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
974 shellQuote(os.path.join(WORKDIR, "mnt", volname)),))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
975
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
976 runCommand("hdiutil detach %s"%(shellQuote(os.path.join(WORKDIR, "mnt", volname))))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
977
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
978 setIcon(imagepath + ".tmp.dmg", "../Icons/Disk Image.icns")
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
979 runCommand("hdiutil convert %s -format UDZO -o %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
980 shellQuote(imagepath + ".tmp.dmg"), shellQuote(imagepath)))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
981 setIcon(imagepath, "../Icons/Disk Image.icns")
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
982
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
983 os.unlink(imagepath + ".tmp.dmg")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
984
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
985 return imagepath
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
986
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
987
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
988 def setIcon(filePath, icnsPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
989 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
990 Set the custom icon for the specified file or directory.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
991 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
992
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
993 toolPath = os.path.join(os.path.dirname(__file__), "seticon.app/Contents/MacOS/seticon")
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
994 dirPath = os.path.dirname(__file__)
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
995 if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').st_mtime:
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
996 # NOTE: The tool is created inside an .app bundle, otherwise it won't work due
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
997 # to connections to the window server.
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
998 if not os.path.exists('seticon.app/Contents/MacOS'):
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
999 os.makedirs('seticon.app/Contents/MacOS')
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1000 runCommand("cc -o %s %s/seticon.m -framework Cocoa"%(
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1001 shellQuote(toolPath), shellQuote(dirPath)))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1002
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1003 runCommand("%s %s %s"%(shellQuote(os.path.abspath(toolPath)), shellQuote(icnsPath),
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1004 shellQuote(filePath)))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1005
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1006 def main():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1007 # First parse options and check if we can perform our work
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1008 parseOptions()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1009 checkEnvironment()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1010
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1011 os.environ['MACOSX_DEPLOYMENT_TARGET'] = DEPTARGET
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1012
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1013 if os.path.exists(WORKDIR):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1014 shutil.rmtree(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1015 os.mkdir(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1016
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1017 # Then build third-party libraries such as sleepycat DB4.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1018 buildLibraries()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1019
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1020 # Now build python itself
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1021 buildPython()
52515
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1022
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1023 # And then build the documentation
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1024 # Remove the Deployment Target from the shell
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1025 # environment, it's no longer needed and
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1026 # an unexpected build target can cause problems
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1027 # when Sphinx and its dependencies need to
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1028 # be (re-)installed.
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1029 del os.environ['MACOSX_DEPLOYMENT_TARGET']
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1030 buildPythonDocs()
52515
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1031
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1032
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1033 # Prepare the applications folder
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1034 fn = os.path.join(WORKDIR, "_root", "Applications",
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 48356
diff changeset
1035 "Python %s"%(getVersion(),), "Update Shell Profile.command")
51563
971bb47ff70b Fix for issue5224 ("Update Shell Profile.command" contains wrong Python version on OSX)
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 50377
diff changeset
1036 patchScript("scripts/postflight.patch-profile", fn)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1037
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 48356
diff changeset
1038 folder = os.path.join(WORKDIR, "_root", "Applications", "Python %s"%(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1039 getVersion(),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1040 os.chmod(folder, 0755)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1041 setIcon(folder, "../Icons/Python Folder.icns")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1042
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1043 # Create the installer
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1044 buildInstaller()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1045
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1046 # And copy the readme into the directory containing the installer
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1047 patchFile('resources/ReadMe.txt', os.path.join(WORKDIR, 'installer', 'ReadMe.txt'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1048
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1049 # Ditto for the license file.
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1050 shutil.copy('../../LICENSE', os.path.join(WORKDIR, 'installer', 'License.txt'))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1051
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1052 fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w')
50244
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
1053 print >> fp, "# BUILD INFO"
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
1054 print >> fp, "# Date:", time.ctime()
a7b357f9e8a4 unpy3kize this; it require 2.x only Mac modules
Benjamin Peterson <benjamin@python.org>
parents: 49493
diff changeset
1055 print >> fp, "# By:", pwd.getpwuid(os.getuid()).pw_gecos
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1056 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1057
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1058
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1059
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1060 # And copy it to a DMG
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1061 buildDMG()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1062
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1063
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1064 if __name__ == "__main__":
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1065 main()