annotate Mac/BuildScript/build-installer.py @ 77670:8beffdfa29cd

Remove obsolete fixapplepython23 script and PythonSystemFixes installer package from the OS X Makefile for Python 3. It has never worked on Python 3 and is not needed there as pre-10.3.9 installs are no longer supported.
author Ned Deily <nad@acm.org>
date Sun, 24 Jun 2012 00:19:31 -0700
parents 8ea0fdda6a62
children d1c93a2ee324
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1 #!/usr/bin/env python
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
2 """
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
3 This script is used to build "official" universal installers on Mac OS X.
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
4 It requires at least Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK for
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
5 32-bit builds. 64-bit or four-way universal builds require at least
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
6 OS X 10.5 and the 10.5 SDK.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
7
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
8 Please ensure that this script keeps working with Python 2.5, to avoid
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
9 bootstrap issues (/usr/bin/python is Python 2.5 on OSX 10.5). Sphinx,
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
10 which is used to build the documentation, currently requires at least
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
11 Python 2.4.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
12
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
13 Usage: see USAGE variable in the script.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
14 """
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
15 import platform, os, sys, getopt, textwrap, shutil, stat, time, pwd, grp
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
16 try:
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
17 import urllib2 as urllib_request
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
18 except ImportError:
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
19 import urllib.request as urllib_request
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
20
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
21 STAT_0o755 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
22 | stat.S_IRGRP | stat.S_IXGRP
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
23 | stat.S_IROTH | stat.S_IXOTH )
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
24
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
25 STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
26 | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
27 | stat.S_IROTH | stat.S_IXOTH )
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
28
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
29 INCLUDE_TIMESTAMP = 1
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
30 VERBOSE = 1
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
31
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
32 from plistlib import Plist
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
33
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
34 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
35 from plistlib import writePlist
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
36 except ImportError:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
37 # We're run using python2.3
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
38 def writePlist(plist, path):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
39 plist.write(path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
40
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
41 def shellQuote(value):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
42 """
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
43 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
44 a shell command.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
45 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
46 return "'%s'"%(value.replace("'", "'\"'\"'"))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
47
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
48 def grepValue(fn, variable):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
49 variable = variable + '='
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
50 for ln in open(fn, 'r'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
51 if ln.startswith(variable):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
52 value = ln[len(variable):].strip()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
53 return value[1:-1]
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
54 raise RuntimeError("Cannot find variable %s" % variable[:-1])
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
55
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
56 _cache_getVersion = None
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
57
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
58 def getVersion():
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
59 global _cache_getVersion
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
60 if _cache_getVersion is None:
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
61 _cache_getVersion = grepValue(
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
62 os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION')
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
63 return _cache_getVersion
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
64
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
65 def getVersionTuple():
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
66 return tuple([int(n) for n in getVersion().split('.')])
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
67
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
68 def getVersionMajorMinor():
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
69 return tuple([int(n) for n in getVersion().split('.', 2)])
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
70
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
71 _cache_getFullVersion = None
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
72
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
73 def getFullVersion():
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
74 global _cache_getFullVersion
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
75 if _cache_getFullVersion is not None:
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
76 return _cache_getFullVersion
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
77 fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
78 for ln in open(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
79 if 'PY_VERSION' in ln:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
80 _cache_getFullVersion = ln.split()[-1][1:-1]
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
81 return _cache_getFullVersion
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
82 raise RuntimeError("Cannot find full version??")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
83
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
84 # 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
85 WORKDIR = "/tmp/_py"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
86
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
87 # 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
88 # 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
89 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
90 DEPSRC = os.path.expanduser('~/Universal/other-sources')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
91
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
92 # Location of the preferred SDK
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
93
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
94 ### There are some issues with the SDK selection below here,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
95 ### The resulting binary doesn't work on all platforms that
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
96 ### it should. Always default to the 10.4u SDK until that
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
97 ### isue is resolved.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
98 ###
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
99 ##if int(os.uname()[2].split('.')[0]) == 8:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
100 ## # Explicitly use the 10.4u (universal) SDK when
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
101 ## # building on 10.4, the system headers are not
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
102 ## # useable for a universal build
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
103 ## SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
104 ##else:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
105 ## SDKPATH = "/"
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
106
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
107 SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
108
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
109 universal_opts_map = { '32-bit': ('i386', 'ppc',),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
110 '64-bit': ('x86_64', 'ppc64',),
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
111 'intel': ('i386', 'x86_64'),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
112 '3-way': ('ppc', 'i386', 'x86_64'),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
113 'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
114 default_target_map = {
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
115 '64-bit': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
116 '3-way': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
117 'intel': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
118 'all': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
119 }
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
120
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
121 UNIVERSALOPTS = tuple(universal_opts_map.keys())
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
122
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
123 UNIVERSALARCHS = '32-bit'
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
124
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
125 ARCHLIST = universal_opts_map[UNIVERSALARCHS]
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
126
68488
0991b40e895d #11515: fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 61121
diff changeset
127 # Source directory (assume 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
128 SRCDIR = os.path.dirname(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
129 os.path.dirname(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
130 os.path.dirname(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
131 os.path.abspath(__file__
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
132 ))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
133
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
134 # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
135 DEPTARGET = '10.3'
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
136
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
137 target_cc_map = {
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
138 '10.3': 'gcc-4.0',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
139 '10.4': 'gcc-4.0',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
140 '10.5': 'gcc-4.0',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
141 '10.6': 'gcc-4.2',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
142 }
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
143
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
144 CC = target_cc_map[DEPTARGET]
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
145
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
146 PYTHON_3 = getVersionTuple() >= (3, 0)
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
147
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
148 USAGE = textwrap.dedent("""\
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
149 Usage: build_python [options]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
150
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
151 Options:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
152 -? or -h: Show this message
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
153 -b DIR
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
154 --build-dir=DIR: Create build here (default: %(WORKDIR)r)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
155 --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
156 --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
157 --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
158 --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
159 --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
160 """)% globals()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
161
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
162
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
163 # 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
164 # batteries included python.
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
165 # [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
166 # command line options have been processed.]
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
167 def library_recipes():
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
168 result = []
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
169
76039
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
170 result.extend([
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
171 dict(
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
172 name="XZ 5.0.3",
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
173 url="http://tukaani.org/xz/xz-5.0.3.tar.gz",
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
174 checksum='fefe52f9ecd521de2a8ce38c21a27574',
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
175 configure_pre=[
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
176 '--disable-dependency-tracking',
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
177 ]
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
178 )
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
179 ])
0e1177499762 Issue #13507: OS X installer builds now build liblzma for the new
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
180
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
181 if DEPTARGET < '10.5':
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
182 result.extend([
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
183 dict(
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
184 name="Bzip2 1.0.6",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
185 url="http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
186 checksum='00b516f4704d4a7cb50a1d97e6e8e15b',
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
187 configure=None,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
188 install='make install CC=%s PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
189 CC,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
190 shellQuote(os.path.join(WORKDIR, 'libraries')),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
191 ' -arch '.join(ARCHLIST),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
192 SDKPATH,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
193 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
194 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
195 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
196 name="ZLib 1.2.3",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
197 url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
198 checksum='debc62758716a169df9f62e6ab2bc634',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
199 configure=None,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
200 install='make install CC=%s prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
201 CC,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
202 shellQuote(os.path.join(WORKDIR, 'libraries')),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
203 ' -arch '.join(ARCHLIST),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
204 SDKPATH,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
205 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
206 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
207 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
208 # Note that GNU readline is GPL'd software
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
209 name="GNU Readline 6.1.2",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
210 url="http://ftp.gnu.org/pub/gnu/readline/readline-6.1.tar.gz" ,
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
211 checksum='fc2f7e714fe792db1ce6ddc4c9fb4ef3',
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
212 patchlevel='0',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
213 patches=[
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
214 # The readline maintainers don't do actual micro releases, but
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
215 # just ship a set of patches.
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
216 'http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-001',
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
217 'http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-002',
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
218 ]
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
219 ),
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
220 dict(
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
221 name="SQLite 3.7.4",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
222 url="http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
223 checksum='8f0c690bfb33c3cbbc2471c3d9ba0158',
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
224 configure_env=('CFLAGS="-Os'
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
225 ' -DSQLITE_ENABLE_FTS3'
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
226 ' -DSQLITE_ENABLE_FTS3_PARENTHESIS'
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
227 ' -DSQLITE_ENABLE_RTREE'
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
228 ' -DSQLITE_TCL=0'
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
229 '"'),
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
230 configure_pre=[
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
231 '--enable-threadsafe',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
232 '--enable-shared=no',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
233 '--enable-static=yes',
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
234 '--disable-readline',
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
235 '--disable-dependency-tracking',
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
236 ]
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
237 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
238 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
239 name="NCurses 5.5",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
240 url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
241 checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
242 configure_pre=[
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
243 "--enable-widec",
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
244 "--without-cxx",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
245 "--without-ada",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
246 "--without-progs",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
247 "--without-curses-h",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
248 "--enable-shared",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
249 "--with-shared",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
250 "--datadir=/usr/share",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
251 "--sysconfdir=/etc",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
252 "--sharedstatedir=/usr/com",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
253 "--with-terminfo-dirs=/usr/share/terminfo",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
254 "--with-default-terminfo-dir=/usr/share/terminfo",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
255 "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
256 "--enable-termcap",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
257 ],
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
258 patches=[
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
259 "ncurses-5.5.patch",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
260 ],
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
261 useLDFlags=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
262 install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
263 shellQuote(os.path.join(WORKDIR, 'libraries')),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
264 shellQuote(os.path.join(WORKDIR, 'libraries')),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
265 getVersion(),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
266 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
267 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
268 ])
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
269
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
270 if not PYTHON_3:
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
271 result.extend([
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
272 dict(
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
273 name="Sleepycat DB 4.7.25",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
274 url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
275 checksum='ec2b87e833779681a0c3a814aa71359e',
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
276 buildDir="build_unix",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
277 configure="../dist/configure",
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
278 configure_pre=[
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
279 '--includedir=/usr/local/include/db4',
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
280 ]
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
281 ),
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
282 ])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
283
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
284 return result
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
285
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
286
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
287 # Instructions for building packages inside the .mpkg.
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
288 def pkg_recipes():
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
289 unselected_for_python3 = ('selected', 'unselected')[PYTHON_3]
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
290 result = [
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
291 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
292 name="PythonFramework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
293 long_name="Python Framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
294 source="/Library/Frameworks/Python.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
295 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
296 This package installs Python.framework, that is the python
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
297 interpreter and the standard library. This also includes Python
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
298 wrappers for lots of Mac OS X API's.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
299 """,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
300 postflight="scripts/postflight.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
301 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
302 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
303 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
304 name="PythonApplications",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
305 long_name="GUI Applications",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
306 source="/Applications/Python %(VER)s",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
307 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
308 This package installs IDLE (an interactive Python IDE),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
309 Python Launcher and Build Applet (create application bundles
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
310 from python scripts).
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
311
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
312 It also installs a number of examples and demos.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
313 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
314 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
315 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
316 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
317 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
318 name="PythonUnixTools",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
319 long_name="UNIX command-line tools",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
320 source="/usr/local/bin",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
321 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
322 This package installs the unix tools in /usr/local/bin for
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
323 compatibility with older releases of Python. This package
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
324 is not necessary to use Python.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
325 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
326 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
327 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
328 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
329 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
330 name="PythonDocumentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
331 long_name="Python Documentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
332 topdir="/Library/Frameworks/Python.framework/Versions/%(VER)s/Resources/English.lproj/Documentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
333 source="/pydocs",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
334 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
335 This package installs the python documentation at a location
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
336 that is useable for pydoc and IDLE. If you have installed Xcode
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
337 it will also install a link to the documentation in
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
338 /Developer/Documentation/Python
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
339 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
340 postflight="scripts/postflight.documentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
341 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
342 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
343 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
344 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
345 name="PythonProfileChanges",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
346 long_name="Shell profile updater",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
347 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
348 This packages updates your shell profile to make sure that
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
349 the Python tools are found by your shell in preference of
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
350 the system provided Python tools.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
351
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
352 If you don't install this package you'll have to add
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
353 "/Library/Frameworks/Python.framework/Versions/%(VER)s/bin"
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
354 to your PATH by hand.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
355 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
356 postflight="scripts/postflight.patch-profile",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
357 topdir="/Library/Frameworks/Python.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
358 source="/empty-dir",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
359 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
360 selected=unselected_for_python3,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
361 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
362 ]
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
363
77670
8beffdfa29cd Remove obsolete fixapplepython23 script and PythonSystemFixes
Ned Deily <nad@acm.org>
parents: 77669
diff changeset
364 if DEPTARGET < '10.4' and not PYTHON_3:
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
365 result.append(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
366 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
367 name="PythonSystemFixes",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
368 long_name="Fix system Python",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
369 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
370 This package updates the system python installation on
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
371 Mac OS X 10.3 to ensure that you can build new python extensions
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
372 using that copy of python after installing this version.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
373 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
374 postflight="../Tools/fixapplepython23.py",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
375 topdir="/Library/Frameworks/Python.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
376 source="/empty-dir",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
377 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
378 selected=unselected_for_python3,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
379 )
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
380 )
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
381 return result
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
382
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
383 def fatal(msg):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
384 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
385 A fatal error, bail out.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
386 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
387 sys.stderr.write('FATAL: ')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
388 sys.stderr.write(msg)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
389 sys.stderr.write('\n')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
390 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
391
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
392 def fileContents(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
393 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
394 Return the contents of the named file
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
395 """
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
396 return open(fn, 'r').read()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
397
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
398 def runCommand(commandline):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
399 """
68585
bf94b6a73fc8 #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68488
diff changeset
400 Run a command and raise RuntimeError if it fails. Output is suppressed
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
401 unless the command fails.
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 fd = os.popen(commandline, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
404 data = fd.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
405 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
406 if xit is not None:
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
407 sys.stdout.write(data)
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
408 raise RuntimeError("command failed: %s"%(commandline,))
38673
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 if VERBOSE:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
411 sys.stdout.write(data); sys.stdout.flush()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
412
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
413 def captureCommand(commandline):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
414 fd = os.popen(commandline, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
415 data = fd.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
416 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
417 if xit is not None:
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
418 sys.stdout.write(data)
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
419 raise RuntimeError("command failed: %s"%(commandline,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
420
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
421 return data
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
422
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
423 def getTclTkVersion(configfile, versionline):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
424 """
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
425 search Tcl or Tk configuration file for version line
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
426 """
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
427 try:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
428 f = open(configfile, "r")
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
429 except:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
430 fatal("Framework configuration file not found: %s" % configfile)
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
431
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
432 for l in f:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
433 if l.startswith(versionline):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
434 f.close()
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
435 return l
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
436
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
437 fatal("Version variable %s not found in framework configuration file: %s"
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
438 % (versionline, configfile))
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
439
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
440 def checkEnvironment():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
441 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
442 Check that we're running on a supported system.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
443 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
444
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
445 if sys.version_info[0:2] < (2, 4):
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
446 fatal("This script must be run with Python 2.4 or later")
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
447
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
448 if platform.system() != 'Darwin':
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
449 fatal("This script should be run on a Mac OS X 10.4 (or later) system")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
450
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
451 if int(platform.release().split('.')[0]) < 8:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
452 fatal("This script should be run on a Mac OS X 10.4 (or later) system")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
453
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
454 if not os.path.exists(SDKPATH):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
455 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
456 os.path.basename(SDKPATH[:-4])))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
457
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
458 # Because we only support dynamic load of only one major/minor version of
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
459 # Tcl/Tk, ensure:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
460 # 1. there are no user-installed frameworks of Tcl/Tk with version
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
461 # higher than the Apple-supplied system version
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
462 # 2. there is a user-installed framework in /Library/Frameworks with the
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
463 # same version as the system version. This allows users to choose
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
464 # to install a newer patch level.
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
465
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
466 for framework in ['Tcl', 'Tk']:
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
467 #fw = dict(lower=framework.lower(),
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
468 # upper=framework.upper(),
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
469 # cap=framework.capitalize())
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
470 #fwpth = "Library/Frameworks/%(cap)s.framework/%(lower)sConfig.sh" % fw
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
471 fwpth = 'Library/Frameworks/Tcl.framework/Versions/Current'
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
472 sysfw = os.path.join(SDKPATH, 'System', fwpth)
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
473 libfw = os.path.join('/', fwpth)
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
474 usrfw = os.path.join(os.getenv('HOME'), fwpth)
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
475 #version = "%(upper)s_VERSION" % fw
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
476 if os.readlink(libfw) != os.readlink(sysfw):
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
477 fatal("Version of %s must match %s" % (libfw, sysfw) )
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
478 if os.path.exists(usrfw):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
479 fatal("Please rename %s to avoid possible dynamic load issues."
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
480 % usrfw)
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
481
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
482 # Remove inherited environment variables which might influence build
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
483 environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
484 'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
485 for ev in list(os.environ):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
486 for prefix in environ_var_prefixes:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
487 if ev.startswith(prefix) :
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
488 print("INFO: deleting environment variable %s=%s" % (
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
489 ev, os.environ[ev]))
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
490 del os.environ[ev]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
491
60740
8c9828c15040 Merged revisions 80232 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60692
diff changeset
492 os.environ['PATH'] = '/bin:/sbin:/usr/bin:/usr/sbin'
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
493 print("Setting default PATH: %s"%(os.environ['PATH']))
60740
8c9828c15040 Merged revisions 80232 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60692
diff changeset
494
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
495
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
496 def parseOptions(args=None):
38673
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 Parse arguments and update global settings.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
499 """
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
500 global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
501 global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
502
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
503 if args is None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
504 args = sys.argv[1:]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
505
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
506 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
507 options, args = getopt.getopt(args, '?hb',
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
508 [ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir=',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
509 'dep-target=', 'universal-archs=', 'help' ])
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
510 except getopt.GetoptError:
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
511 print(sys.exc_info()[1])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
512 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
513
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
514 if args:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
515 print("Additional arguments")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
516 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
517
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
518 deptarget = None
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
519 for k, v in options:
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
520 if k in ('-h', '-?', '--help'):
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
521 print(USAGE)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
522 sys.exit(0)
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 elif k in ('-d', '--build-dir'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
525 WORKDIR=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
526
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
527 elif k in ('--third-party',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
528 DEPSRC=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
529
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
530 elif k in ('--sdk-path',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
531 SDKPATH=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
532
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
533 elif k in ('--src-dir',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
534 SRCDIR=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
535
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
536 elif k in ('--dep-target', ):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
537 DEPTARGET=v
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
538 deptarget=v
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
539
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
540 elif k in ('--universal-archs', ):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
541 if v in UNIVERSALOPTS:
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
542 UNIVERSALARCHS = v
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
543 ARCHLIST = universal_opts_map[UNIVERSALARCHS]
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
544 if deptarget is None:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
545 # Select alternate default deployment
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
546 # target
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
547 DEPTARGET = default_target_map.get(v, '10.3')
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
548 else:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
549 raise NotImplementedError(v)
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
550
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
551 else:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
552 raise NotImplementedError(k)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
553
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
554 SRCDIR=os.path.abspath(SRCDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
555 WORKDIR=os.path.abspath(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
556 SDKPATH=os.path.abspath(SDKPATH)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
557 DEPSRC=os.path.abspath(DEPSRC)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
558
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
559 CC=target_cc_map[DEPTARGET]
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
560
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
561 print("Settings:")
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
562 print(" * Source directory:", SRCDIR)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
563 print(" * Build directory: ", WORKDIR)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
564 print(" * SDK location: ", SDKPATH)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
565 print(" * Third-party source:", DEPSRC)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
566 print(" * Deployment target:", DEPTARGET)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
567 print(" * Universal architectures:", ARCHLIST)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
568 print(" * C compiler:", CC)
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
569 print("")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
570
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
571
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
572
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
573
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
574 def extractArchive(builddir, archiveName):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
575 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
576 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
577 extracted archive.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
578
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
579 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
580 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
581 save enough for anything we use.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
582 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
583 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
584 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
585 os.chdir(builddir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
586 if archiveName.endswith('.tar.gz'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
587 retval = os.path.basename(archiveName[:-7])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
588 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
589 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
590 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
591
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
592 elif archiveName.endswith('.tar.bz2'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
593 retval = os.path.basename(archiveName[:-8])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
594 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
595 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
596 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
597
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
598 elif archiveName.endswith('.tar'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
599 retval = os.path.basename(archiveName[:-4])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
600 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
601 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
602 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
603
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
604 elif archiveName.endswith('.zip'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
605 retval = os.path.basename(archiveName[:-4])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
606 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
607 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
608 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
609
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
610 data = fp.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
611 xit = fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
612 if xit is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
613 sys.stdout.write(data)
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
614 raise RuntimeError("Cannot extract %s"%(archiveName,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
615
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
616 return os.path.join(builddir, retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
617
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
618 finally:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
619 os.chdir(curdir)
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 KNOWNSIZES = {
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
622 "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
623 "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
624 }
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
625
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
626 def downloadURL(url, fname):
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 Download the contents of the url into the file.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
629 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
630 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
631 size = os.path.getsize(fname)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
632 except OSError:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
633 pass
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
634 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
635 if KNOWNSIZES.get(url) == size:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
636 print("Using existing file for", url)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
637 return
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
638 fpIn = urllib_request.urlopen(url)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
639 fpOut = open(fname, 'wb')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
640 block = fpIn.read(10240)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
641 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
642 while block:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
643 fpOut.write(block)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
644 block = fpIn.read(10240)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
645 fpIn.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
646 fpOut.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
647 except:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
648 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
649 os.unlink(fname)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
650 except:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
651 pass
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
652
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
653 def buildRecipe(recipe, basedir, archList):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
654 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
655 Build software using a recipe. This function does the
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
656 '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
657 to customize this process, basically a poor-mans DarwinPorts.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
658 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
659 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
660
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
661 name = recipe['name']
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
662 url = recipe['url']
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
663 configure = recipe.get('configure', './configure')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
664 install = recipe.get('install', 'make && make install DESTDIR=%s'%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
665 shellQuote(basedir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
666
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
667 archiveName = os.path.split(url)[-1]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
668 sourceArchive = os.path.join(DEPSRC, archiveName)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
669
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
670 if not os.path.exists(DEPSRC):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
671 os.mkdir(DEPSRC)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
672
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
674 if os.path.exists(sourceArchive):
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
675 print("Using local copy of %s"%(name,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
676
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
677 else:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
678 print("Did not find local copy of %s"%(name,))
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
679 print("Downloading %s"%(name,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
680 downloadURL(url, sourceArchive)
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
681 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
682
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
683 print("Extracting archive for %s"%(name,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
684 buildDir=os.path.join(WORKDIR, '_bld')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
685 if not os.path.exists(buildDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
686 os.mkdir(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
687
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
688 workDir = extractArchive(buildDir, sourceArchive)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
689 os.chdir(workDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
690 if 'buildDir' in recipe:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
691 os.chdir(recipe['buildDir'])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
692
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
693
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
694 for fn in recipe.get('patches', ()):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
695 if fn.startswith('http://'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
696 # Download the patch before applying it.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
697 path = os.path.join(DEPSRC, os.path.basename(fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
698 downloadURL(fn, path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
699 fn = path
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
700
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
701 fn = os.path.join(curdir, fn)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
702 runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
703 shellQuote(fn),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
704
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
705 if configure is not None:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
706 configure_args = [
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
707 "--prefix=/usr/local",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
708 "--enable-static",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
709 "--disable-shared",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
710 #"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
711 ]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
712
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
713 if 'configure_pre' in recipe:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
714 args = list(recipe['configure_pre'])
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
715 if '--disable-static' in args:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
716 configure_args.remove('--enable-static')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
717 if '--enable-shared' in args:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
718 configure_args.remove('--disable-shared')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
719 configure_args.extend(args)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
720
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
721 if recipe.get('useLDFlags', 1):
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
722 configure_args.extend([
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
723 "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
724 ' -arch '.join(archList),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
725 shellQuote(SDKPATH)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
726 shellQuote(basedir)[1:-1],),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
727 "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
728 shellQuote(SDKPATH)[1:-1],
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
729 shellQuote(basedir)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
730 ' -arch '.join(archList)),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
731 ])
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
732 else:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
733 configure_args.extend([
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
734 "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
735 ' -arch '.join(archList),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
736 shellQuote(SDKPATH)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
737 shellQuote(basedir)[1:-1],),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
738 ])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
739
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
740 if 'configure_post' in recipe:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
741 configure_args = configure_args = list(recipe['configure_post'])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
742
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
743 configure_args.insert(0, configure)
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
744 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
745
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
746 if 'configure_env' in recipe:
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
747 configure_args.insert(0, recipe['configure_env'])
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
748
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
749 print("Running configure for %s"%(name,))
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
750 runCommand(' '.join(configure_args) + ' 2>&1')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
751
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
752 print("Running install for %s"%(name,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
753 runCommand('{ ' + install + ' ;} 2>&1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
754
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
755 print("Done %s"%(name,))
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
756 print("")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
757
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
758 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
759
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
760 def buildLibraries():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
761 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
762 Build our dependencies into $WORKDIR/libraries/usr/local
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
763 """
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
764 print("")
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
765 print("Building required libraries")
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
766 print("")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
767 universal = os.path.join(WORKDIR, 'libraries')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
768 os.mkdir(universal)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
769 os.makedirs(os.path.join(universal, 'usr', 'local', 'lib'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
770 os.makedirs(os.path.join(universal, 'usr', 'local', 'include'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
771
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
772 for recipe in library_recipes():
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
773 buildRecipe(recipe, universal, ARCHLIST)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
774
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
775
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
776
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
777 def buildPythonDocs():
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
778 # 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
779 # inside the framwork. pydoc and IDLE will pick it up there.
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
780 print("Install python documentation")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
781 rootDir = os.path.join(WORKDIR, '_root')
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
782 buildDir = os.path.join('../../Doc')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
783 docdir = os.path.join(rootDir, 'pydocs')
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
784 curDir = os.getcwd()
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
785 os.chdir(buildDir)
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
786 runCommand('make update')
60861
3a8a6184f40a Merged revisions 80355 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents: 60740
diff changeset
787 runCommand("make html PYTHON='%s'" % os.path.abspath(sys.executable))
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
788 os.chdir(curDir)
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
789 if not os.path.exists(docdir):
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
790 os.mkdir(docdir)
54202
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
791 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
792
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 def buildPython():
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
795 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
796
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
797 buildDir = os.path.join(WORKDIR, '_bld', 'python')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
798 rootDir = os.path.join(WORKDIR, '_root')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
799
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
800 if os.path.exists(buildDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
801 shutil.rmtree(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
802 if os.path.exists(rootDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
803 shutil.rmtree(rootDir)
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
804 os.makedirs(buildDir)
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
805 os.makedirs(rootDir)
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
806 os.makedirs(os.path.join(rootDir, 'empty-dir'))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
807 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
808 os.chdir(buildDir)
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 # 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
811 # 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
812 os.symlink('python', os.path.join(buildDir, 'python.exe'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
813
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
814 # 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
815 # several paths.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
816 version = getVersion()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
817
52470
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
818 # 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
819 # 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
820 # 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
821 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
822 'libraries', 'usr', 'local', 'lib')
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
823 print("Running configure...")
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
824 runCommand("%s -C --enable-framework --enable-universalsdk=%s "
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
825 "--with-universal-archs=%s "
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
826 "%s "
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
827 "LDFLAGS='-g -L%s/libraries/usr/local/lib' "
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
828 "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
829 shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
830 UNIVERSALARCHS,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
831 (' ', '--with-computed-gotos ')[PYTHON_3],
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
832 shellQuote(WORKDIR)[1:-1],
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
833 shellQuote(WORKDIR)[1:-1]))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
834
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
835 print("Running make")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
836 runCommand("make")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
837
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
838 print("Running make install")
54202
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
839 runCommand("make install DESTDIR=%s"%(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
840 shellQuote(rootDir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
841
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
842 print("Running make frameworkinstallextras")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
843 runCommand("make frameworkinstallextras DESTDIR=%s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
844 shellQuote(rootDir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
845
52470
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
846 del os.environ['DYLD_LIBRARY_PATH']
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
847 print("Copying required shared libraries")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
848 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
849 runCommand("mv %s/* %s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
850 shellQuote(os.path.join(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
851 WORKDIR, 'libraries', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
852 'Python.framework', 'Versions', getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
853 'lib')),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
854 shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
855 'Python.framework', 'Versions', getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
856 'lib'))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
857
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
858 print("Fix file modes")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
859 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
860 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
861
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
862 for dirpath, dirnames, filenames in os.walk(frmDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
863 for dn in dirnames:
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
864 os.chmod(os.path.join(dirpath, dn), STAT_0o775)
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
865 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
866
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
867
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
868 for fn in filenames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
869 if os.path.islink(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
870 continue
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
871
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
872 # "chmod g+w $fn"
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
873 p = os.path.join(dirpath, fn)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
874 st = os.stat(p)
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
875 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
876 os.chown(p, -1, gid)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
877
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
878 if PYTHON_3:
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
879 LDVERSION=None
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
880 VERSION=None
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
881 ABIFLAGS=None
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
882
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
883 fp = open(os.path.join(buildDir, 'Makefile'), 'r')
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
884 for ln in fp:
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
885 if ln.startswith('VERSION='):
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
886 VERSION=ln.split()[1]
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
887 if ln.startswith('ABIFLAGS='):
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
888 ABIFLAGS=ln.split()[1]
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
889 if ln.startswith('LDVERSION='):
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
890 LDVERSION=ln.split()[1]
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
891 fp.close()
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
892
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
893 LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
894 LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
895 config_suffix = '-' + LDVERSION
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
896 else:
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
897 config_suffix = '' # Python 2.x
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
898
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
899 # 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
900 # 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
901 # the end-users system.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
902 path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
903 'Versions', version, 'lib', 'python%s'%(version,),
67799
334812ba5874 Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with
Ned Deily <nad@acm.org>
parents: 67598
diff changeset
904 'config' + config_suffix, 'Makefile')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
905 fp = open(path, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
906 data = fp.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
907 fp.close()
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 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
910 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
911 fp = open(path, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
912 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
913 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
914
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
915 # Add symlinks in /usr/local/bin, using relative links
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
916 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
917 to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
918 'Python.framework', 'Versions', version, 'bin')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
919 if os.path.exists(usr_local_bin):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
920 shutil.rmtree(usr_local_bin)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
921 os.makedirs(usr_local_bin)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
922 for fn in os.listdir(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
923 os.path.join(frmDir, 'Versions', version, 'bin')):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
924 os.symlink(os.path.join(to_framework, fn),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
925 os.path.join(usr_local_bin, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
926
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
927 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
928
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
929 if PYTHON_3:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
930 # Remove the 'Current' link, that way we don't accidently mess
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
931 # with an already installed version of python 2
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
932 os.unlink(os.path.join(rootDir, 'Library', 'Frameworks',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
933 'Python.framework', 'Versions', 'Current'))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
934
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
935 def patchFile(inPath, outPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
936 data = fileContents(inPath)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
937 data = data.replace('$FULL_VERSION', getFullVersion())
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
938 data = data.replace('$VERSION', getVersion())
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
939 data = data.replace('$MACOSX_DEPLOYMENT_TARGET', ''.join((DEPTARGET, ' or later')))
65555
3baecd4e0c12 Don't lie about the supported architectures in the OSX installer
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 61121
diff changeset
940 data = data.replace('$ARCHITECTURES', ", ".join(universal_opts_map[UNIVERSALARCHS]))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
941 data = data.replace('$INSTALL_SIZE', installSize())
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
942
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
943 # 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
944 data = data.replace('$PYTHONFRAMEWORKINSTALLDIR', '/Library/Frameworks/Python.framework')
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
945 fp = open(outPath, 'w')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
946 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
947 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
948
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
949 def patchScript(inPath, outPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
950 data = fileContents(inPath)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
951 data = data.replace('@PYVER@', getVersion())
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
952 fp = open(outPath, 'w')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
953 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
954 fp.close()
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
955 os.chmod(outPath, STAT_0o755)
38673
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
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
958
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
959 def packageFromRecipe(targetDir, recipe):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
960 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
961 try:
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
962 # 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
963 # 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
964 # common.
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
965 pkgname = '%s-%s'%(recipe['name'], getVersion())
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
966 srcdir = recipe.get('source')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
967 pkgroot = recipe.get('topdir', srcdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
968 postflight = recipe.get('postflight')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
969 readme = textwrap.dedent(recipe['readme'])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
970 isRequired = recipe.get('required', True)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
971
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
972 print("- building package %s"%(pkgname,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
973
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
974 # Substitute some variables
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
975 textvars = dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
976 VER=getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
977 FULLVER=getFullVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
978 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
979 readme = readme % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
980
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
981 if pkgroot is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
982 pkgroot = pkgroot % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
983 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
984 pkgroot = '/'
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
985
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
986 if srcdir is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
987 srcdir = os.path.join(WORKDIR, '_root', srcdir[1:])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
988 srcdir = srcdir % textvars
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 if postflight is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
991 postflight = os.path.abspath(postflight)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
992
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
993 packageContents = os.path.join(targetDir, pkgname + '.pkg', 'Contents')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
994 os.makedirs(packageContents)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
995
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
996 if srcdir is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
997 os.chdir(srcdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
998 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
999 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
1000 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
1001
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1002 fn = os.path.join(packageContents, 'PkgInfo')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1003 fp = open(fn, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1004 fp.write('pmkrpkg1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1005 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1006
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1007 rsrcDir = os.path.join(packageContents, "Resources")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1008 os.mkdir(rsrcDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1009 fp = open(os.path.join(rsrcDir, 'ReadMe.txt'), 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1010 fp.write(readme)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1011 fp.close()
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 postflight is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1014 patchScript(postflight, os.path.join(rsrcDir, 'postflight'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1015
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1016 vers = getFullVersion()
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1017 major, minor = getVersionMajorMinor()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1018 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1019 CFBundleGetInfoString="Python.%s %s"%(pkgname, vers,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1020 CFBundleIdentifier='org.python.Python.%s'%(pkgname,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1021 CFBundleName='Python.%s'%(pkgname,),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1022 CFBundleShortVersionString=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1023 IFMajorVersion=major,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1024 IFMinorVersion=minor,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1025 IFPkgFormatVersion=0.10000000149011612,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1026 IFPkgFlagAllowBackRev=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1027 IFPkgFlagAuthorizationAction="RootAuthorization",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1028 IFPkgFlagDefaultLocation=pkgroot,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1029 IFPkgFlagFollowLinks=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1030 IFPkgFlagInstallFat=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1031 IFPkgFlagIsRequired=isRequired,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1032 IFPkgFlagOverwritePermissions=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1033 IFPkgFlagRelocatable=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1034 IFPkgFlagRestartAction="NoRestart",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1035 IFPkgFlagRootVolumeOnly=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1036 IFPkgFlagUpdateInstalledLangauges=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1037 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1038 writePlist(pl, os.path.join(packageContents, 'Info.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1039
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1040 pl = Plist(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1041 IFPkgDescriptionDescription=readme,
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1042 IFPkgDescriptionTitle=recipe.get('long_name', "Python.%s"%(pkgname,)),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1043 IFPkgDescriptionVersion=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1044 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1045 writePlist(pl, os.path.join(packageContents, 'Resources', 'Description.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1046
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1047 finally:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1048 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1049
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1050
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1051 def makeMpkgPlist(path):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1052
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1053 vers = getFullVersion()
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1054 major, minor = getVersionMajorMinor()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1055
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1056 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1057 CFBundleGetInfoString="Python %s"%(vers,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1058 CFBundleIdentifier='org.python.Python',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1059 CFBundleName='Python',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1060 CFBundleShortVersionString=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1061 IFMajorVersion=major,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1062 IFMinorVersion=minor,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1063 IFPkgFlagComponentDirectory="Contents/Packages",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1064 IFPkgFlagPackageList=[
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1065 dict(
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1066 IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()),
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1067 IFPkgFlagPackageSelection=item.get('selected', 'selected'),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1068 )
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1069 for item in pkg_recipes()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1070 ],
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1071 IFPkgFormatVersion=0.10000000149011612,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1072 IFPkgFlagBackgroundScaling="proportional",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1073 IFPkgFlagBackgroundAlignment="left",
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1074 IFPkgFlagAuthorizationAction="RootAuthorization",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1075 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1076
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1077 writePlist(pl, path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1078
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1079
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1080 def buildInstaller():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1081
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1082 # Zap all compiled files
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1083 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
1084 for fn in filenames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1085 if fn.endswith('.pyc') or fn.endswith('.pyo'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1086 os.unlink(os.path.join(dirpath, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1087
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1088 outdir = os.path.join(WORKDIR, 'installer')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1089 if os.path.exists(outdir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1090 shutil.rmtree(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1091 os.mkdir(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1092
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1093 pkgroot = os.path.join(outdir, 'Python.mpkg', 'Contents')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1094 pkgcontents = os.path.join(pkgroot, 'Packages')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1095 os.makedirs(pkgcontents)
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1096 for recipe in pkg_recipes():
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1097 packageFromRecipe(pkgcontents, recipe)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1098
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1099 rsrcDir = os.path.join(pkgroot, 'Resources')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1100
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1101 fn = os.path.join(pkgroot, 'PkgInfo')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1102 fp = open(fn, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1103 fp.write('pmkrpkg1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1104 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1105
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1106 os.mkdir(rsrcDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1107
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1108 makeMpkgPlist(os.path.join(pkgroot, 'Info.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1109 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1110 IFPkgDescriptionTitle="Python",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1111 IFPkgDescriptionVersion=getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1112 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1113
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1114 writePlist(pl, os.path.join(pkgroot, 'Resources', 'Description.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1115 for fn in os.listdir('resources'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1116 if fn == '.svn': continue
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1117 if fn.endswith('.jpg'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1118 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
1119 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1120 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
1121
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1122 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
1123
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1124
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1125 def installSize(clear=False, _saved=[]):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1126 if clear:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1127 del _saved[:]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1128 if not _saved:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1129 data = captureCommand("du -ks %s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1130 shellQuote(os.path.join(WORKDIR, '_root'))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1131 _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
1132 return _saved[0]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1133
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1134
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1135 def buildDMG():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1136 """
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
1137 Create DMG containing the rootDir.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1138 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1139 outdir = os.path.join(WORKDIR, 'diskimage')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1140 if os.path.exists(outdir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1141 shutil.rmtree(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1142
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1143 imagepath = os.path.join(outdir,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1144 'python-%s-macosx%s'%(getFullVersion(),DEPTARGET))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1145 if INCLUDE_TIMESTAMP:
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1146 imagepath = imagepath + '-%04d-%02d-%02d'%(time.localtime()[:3])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1147 imagepath = imagepath + '.dmg'
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1148
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1149 os.mkdir(outdir)
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1150 volname='Python %s'%(getFullVersion())
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1151 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
1152 shellQuote(volname),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1153 shellQuote(os.path.join(WORKDIR, 'installer')),
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1154 shellQuote(imagepath + ".tmp.dmg" )))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1155
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1156
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1157 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
1158 os.mkdir(os.path.join(WORKDIR, "mnt"))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1159 runCommand("hdiutil attach %s -mountroot %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1160 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
1161
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1162 # 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
1163 shutil.copy("../Icons/Disk Image.icns",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1164 os.path.join(WORKDIR, "mnt", volname, ".VolumeIcon.icns"))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1165 runCommand("/Developer/Tools/SetFile -a C %s/"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1166 shellQuote(os.path.join(WORKDIR, "mnt", volname)),))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1167
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1168 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
1169
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1170 setIcon(imagepath + ".tmp.dmg", "../Icons/Disk Image.icns")
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1171 runCommand("hdiutil convert %s -format UDZO -o %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1172 shellQuote(imagepath + ".tmp.dmg"), shellQuote(imagepath)))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1173 setIcon(imagepath, "../Icons/Disk Image.icns")
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1174
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1175 os.unlink(imagepath + ".tmp.dmg")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1176
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1177 return imagepath
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1178
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1179
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1180 def setIcon(filePath, icnsPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1181 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1182 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
1183 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1184
61121
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1185 dirPath = os.path.normpath(os.path.dirname(__file__))
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1186 toolPath = os.path.join(dirPath, "seticon.app/Contents/MacOS/seticon")
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1187 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
1188 # 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
1189 # to connections to the window server.
61121
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1190 appPath = os.path.join(dirPath, "seticon.app/Contents/MacOS")
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1191 if not os.path.exists(appPath):
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1192 os.makedirs(appPath)
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1193 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
1194 shellQuote(toolPath), shellQuote(dirPath)))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1195
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1196 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
1197 shellQuote(filePath)))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1198
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1199 def main():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1200 # 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
1201 parseOptions()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1202 checkEnvironment()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1203
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1204 os.environ['MACOSX_DEPLOYMENT_TARGET'] = DEPTARGET
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1205 os.environ['CC'] = CC
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1206
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1207 if os.path.exists(WORKDIR):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1208 shutil.rmtree(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1209 os.mkdir(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1210
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
1211 os.environ['LC_ALL'] = 'C'
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
1212
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1213 # Then build third-party libraries such as sleepycat DB4.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1214 buildLibraries()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1215
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1216 # Now build python itself
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1217 buildPython()
52515
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1218
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1219 # And then build the documentation
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1220 # Remove the Deployment Target from the shell
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1221 # environment, it's no longer needed and
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1222 # an unexpected build target can cause problems
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1223 # when Sphinx and its dependencies need to
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1224 # be (re-)installed.
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1225 del os.environ['MACOSX_DEPLOYMENT_TARGET']
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1226 buildPythonDocs()
52515
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1227
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1228
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1229 # Prepare the applications folder
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1230 fn = os.path.join(WORKDIR, "_root", "Applications",
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 48356
diff changeset
1231 "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
1232 patchScript("scripts/postflight.patch-profile", fn)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1233
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 48356
diff changeset
1234 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
1235 getVersion(),))
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1236 os.chmod(folder, STAT_0o755)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1237 setIcon(folder, "../Icons/Python Folder.icns")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1238
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1239 # Create the installer
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1240 buildInstaller()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1241
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1242 # 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
1243 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
1244
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1245 # Ditto for the license file.
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1246 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
1247
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1248 fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w')
77669
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1249 fp.write("# BUILD INFO\n")
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1250 fp.write("# Date: %s\n" % time.ctime())
8ea0fdda6a62 Update OS X installer build script to be Python 3 compatible.
Ned Deily <nad@acm.org>
parents: 76039
diff changeset
1251 fp.write("# By: %s\n" % pwd.getpwuid(os.getuid()).pw_gecos)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1252 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1253
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1254 # And copy it to a DMG
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1255 buildDMG()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1256
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1257 if __name__ == "__main__":
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1258 main()