annotate Mac/BuildScript/build-installer.py @ 86127:a3d09c19bb93

merge with 3.3
author Georg Brandl <georg@python.org>
date Sun, 06 Oct 2013 19:24:00 +0200
parents 985384cd6365
children 286a0e47bdb8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
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.
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
4 It requires at least Mac OS X 10.5, Xcode 3, and the 10.4u SDK for
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
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
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
13 In addition to what is supplied with OS X 10.5+ and Xcode 3+, the script
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
14 requires an installed version of hg and a third-party version of
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
15 Tcl/Tk 8.4 (for OS X 10.4 and 10.5 deployment targets) or Tcl/TK 8.5
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
16 (for 10.6 or later) installed in /Library/Frameworks. When installed,
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
17 the Python built by this script will attempt to dynamically link first to
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
18 Tcl and Tk frameworks in /Library/Frameworks if available otherwise fall
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
19 back to the ones in /System/Library/Framework. For the build, we recommend
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
20 installing the most recent ActiveTcl 8.4 or 8.5 version.
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
21
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
22 32-bit-only installer builds are still possible on OS X 10.4 with Xcode 2.5
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
23 and the installation of additional components, such as a newer Python
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
24 (2.5 is needed for Python parser updates), hg, and svn (for the documentation
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
25 build).
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
26
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
27 Usage: see USAGE variable in the script.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
28 """
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
29 import platform, os, sys, getopt, textwrap, shutil, stat, time, pwd, grp
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
30 try:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
31 import urllib2 as urllib_request
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
32 except ImportError:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
33 import urllib.request as urllib_request
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
34
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
35 STAT_0o755 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
36 | stat.S_IRGRP | stat.S_IXGRP
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
37 | stat.S_IROTH | stat.S_IXOTH )
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
38
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
39 STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
40 | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
41 | stat.S_IROTH | stat.S_IXOTH )
38673
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 INCLUDE_TIMESTAMP = 1
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
44 VERBOSE = 1
38673
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 from plistlib import Plist
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 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
49 from plistlib import writePlist
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
50 except ImportError:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
51 # We're run using python2.3
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
52 def writePlist(plist, path):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
53 plist.write(path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
54
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
55 def shellQuote(value):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
56 """
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
57 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
58 a shell command.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
59 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
60 return "'%s'"%(value.replace("'", "'\"'\"'"))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
61
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
62 def grepValue(fn, variable):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
63 variable = variable + '='
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
64 for ln in open(fn, 'r'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
65 if ln.startswith(variable):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
66 value = ln[len(variable):].strip()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
67 return value[1:-1]
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
68 raise RuntimeError("Cannot find variable %s" % variable[:-1])
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
69
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
70 _cache_getVersion = None
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
71
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
72 def getVersion():
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
73 global _cache_getVersion
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
74 if _cache_getVersion is None:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
75 _cache_getVersion = grepValue(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
76 os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION')
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
77 return _cache_getVersion
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
78
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
79 def getVersionTuple():
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
80 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
81
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
82 def getVersionMajorMinor():
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
83 return tuple([int(n) for n in getVersion().split('.', 2)])
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
84
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
85 _cache_getFullVersion = None
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
86
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
87 def getFullVersion():
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
88 global _cache_getFullVersion
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
89 if _cache_getFullVersion is not None:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
90 return _cache_getFullVersion
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
91 fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
92 for ln in open(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
93 if 'PY_VERSION' in ln:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
94 _cache_getFullVersion = ln.split()[-1][1:-1]
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
95 return _cache_getFullVersion
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
96 raise RuntimeError("Cannot find full version??")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
97
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
98 # 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
99 WORKDIR = "/tmp/_py"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
100
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
101 # 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
102 # 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
103 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
104 DEPSRC = os.path.expanduser('~/Universal/other-sources')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
105
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
106 # Location of the preferred SDK
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
107
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
108 ### 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
109 ### 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
110 ### it should. Always default to the 10.4u SDK until that
85406
c57d99a8fc42 #18803: fix more typos. Patch by Févry Thibault.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 81801
diff changeset
111 ### issue is resolved.
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
112 ###
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
113 ##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
114 ## # 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
115 ## # 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
116 ## # useable for a universal build
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
117 ## SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
118 ##else:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
119 ## SDKPATH = "/"
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
120
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
121 SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
122
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
123 universal_opts_map = { '32-bit': ('i386', 'ppc',),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
124 '64-bit': ('x86_64', 'ppc64',),
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
125 'intel': ('i386', 'x86_64'),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
126 '3-way': ('ppc', 'i386', 'x86_64'),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
127 'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
128 default_target_map = {
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
129 '64-bit': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
130 '3-way': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
131 'intel': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
132 'all': '10.5',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
133 }
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
134
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
135 UNIVERSALOPTS = tuple(universal_opts_map.keys())
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
136
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
137 UNIVERSALARCHS = '32-bit'
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
138
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
139 ARCHLIST = universal_opts_map[UNIVERSALARCHS]
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
140
68488
0991b40e895d #11515: fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 61121
diff changeset
141 # 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
142 SRCDIR = os.path.dirname(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
143 os.path.dirname(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
144 os.path.dirname(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
145 os.path.abspath(__file__
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
146 ))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
147
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
148 # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
149 DEPTARGET = '10.3'
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
150
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
151 target_cc_map = {
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
152 '10.3': ('gcc-4.0', 'g++-4.0'),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
153 '10.4': ('gcc-4.0', 'g++-4.0'),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
154 '10.5': ('gcc-4.2', 'g++-4.2'),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
155 '10.6': ('gcc-4.2', 'g++-4.2'),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
156 '10.7': ('clang', 'clang++'),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
157 '10.8': ('clang', 'clang++'),
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
158 }
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
159
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
160 CC, CXX = target_cc_map[DEPTARGET]
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
161
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
162 PYTHON_3 = getVersionTuple() >= (3, 0)
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
163
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
164 USAGE = textwrap.dedent("""\
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
165 Usage: build_python [options]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
166
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
167 Options:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
168 -? or -h: Show this message
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
169 -b DIR
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
170 --build-dir=DIR: Create build here (default: %(WORKDIR)r)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
171 --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
172 --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
173 --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
174 --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
175 --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
176 """)% globals()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
177
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
178 # Dict of object file names with shared library names to check after building.
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
179 # This is to ensure that we ended up dynamically linking with the shared
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
180 # library paths and versions we expected. For example:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
181 # EXPECTED_SHARED_LIBS['_tkinter.so'] = [
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
182 # '/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
183 # '/Library/Frameworks/Tk.framework/Versions/8.5/Tk']
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
184 EXPECTED_SHARED_LIBS = {}
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
185
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
186 # 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
187 # batteries included python.
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
188 # [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
189 # command line options have been processed.]
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
190 def library_recipes():
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
191 result = []
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
192
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
193 LT_10_5 = bool(DEPTARGET < '10.5')
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
194
85560
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
195 if DEPTARGET > '10.5':
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
196 result.extend([
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
197 dict(
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
198 name="Tcl 8.5.14",
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
199 url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tcl8.5.14-src.tar.gz",
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
200 checksum='44b50e58ab45dd272f6714dce2129123',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
201 buildDir="unix",
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
202 configure_pre=[
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
203 '--enable-shared',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
204 '--enable-threads',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
205 '--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
206 ],
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
207 useLDFlags=False,
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
208 install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
209 "DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
210 "TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
211 },
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
212 ),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
213 dict(
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
214 name="Tk 8.5.14",
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
215 url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tk8.5.14-src.tar.gz",
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
216 checksum='a9c48921b3688020470cd3a6dd4e867d',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
217 buildDir="unix",
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
218 configure_pre=[
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
219 '--enable-aqua',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
220 '--enable-shared',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
221 '--enable-threads',
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
222 '--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
223 ],
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
224 useLDFlags=False,
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
225 install='make TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
226 "DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
227 "TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
228 "TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.5'%(getVersion())),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
229 },
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
230 ),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
231 ])
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
232
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
233 if getVersionTuple() >= (3, 3):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
234 result.extend([
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
235 dict(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
236 name="XZ 5.0.3",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
237 url="http://tukaani.org/xz/xz-5.0.3.tar.gz",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
238 checksum='fefe52f9ecd521de2a8ce38c21a27574',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
239 configure_pre=[
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
240 '--disable-dependency-tracking',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
241 ]
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
242 ),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
243 ])
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
244
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
245 result.extend([
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
246 dict(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
247 name="NCurses 5.9",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
248 url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
249 checksum='8cb9c412e5f2d96bc6f459aa8c6282a1',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
250 configure_pre=[
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
251 "--enable-widec",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
252 "--without-cxx",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
253 "--without-cxx-binding",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
254 "--without-ada",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
255 "--without-curses-h",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
256 "--enable-shared",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
257 "--with-shared",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
258 "--without-debug",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
259 "--without-normal",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
260 "--without-tests",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
261 "--without-manpages",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
262 "--datadir=/usr/share",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
263 "--sysconfdir=/etc",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
264 "--sharedstatedir=/usr/com",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
265 "--with-terminfo-dirs=/usr/share/terminfo",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
266 "--with-default-terminfo-dir=/usr/share/terminfo",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
267 "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
268 ],
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
269 patchscripts=[
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
270 ("ftp://invisible-island.net/ncurses//5.9/ncurses-5.9-20120616-patch.sh.bz2",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
271 "f54bf02a349f96a7c4f0d00922f3a0d4"),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
272 ],
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
273 useLDFlags=False,
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
274 install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
275 shellQuote(os.path.join(WORKDIR, 'libraries')),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
276 shellQuote(os.path.join(WORKDIR, 'libraries')),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
277 getVersion(),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
278 ),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
279 ),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
280 dict(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
281 name="SQLite 3.7.13",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
282 url="http://www.sqlite.org/sqlite-autoconf-3071300.tar.gz",
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
283 checksum='c97df403e8a3d5b67bb408fcd6aabd8e',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
284 extra_cflags=('-Os '
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
285 '-DSQLITE_ENABLE_FTS4 '
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
286 '-DSQLITE_ENABLE_FTS3_PARENTHESIS '
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
287 '-DSQLITE_ENABLE_RTREE '
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
288 '-DSQLITE_TCL=0 '
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
289 '%s' % ('','-DSQLITE_WITHOUT_ZONEMALLOC ')[LT_10_5]),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
290 configure_pre=[
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
291 '--enable-threadsafe',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
292 '--enable-shared=no',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
293 '--enable-static=yes',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
294 '--disable-readline',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
295 '--disable-dependency-tracking',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
296 ]
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
297 ),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
298 ])
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
299
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
300 if DEPTARGET < '10.5':
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
301 result.extend([
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
302 dict(
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
303 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
304 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
305 checksum='00b516f4704d4a7cb50a1d97e6e8e15b',
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
306 configure=None,
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
307 install='make install CC=%s CXX=%s, PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
308 CC, CXX,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
309 shellQuote(os.path.join(WORKDIR, 'libraries')),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
310 ' -arch '.join(ARCHLIST),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
311 SDKPATH,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
312 ),
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 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
315 name="ZLib 1.2.3",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
316 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
317 checksum='debc62758716a169df9f62e6ab2bc634',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
318 configure=None,
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
319 install='make install CC=%s CXX=%s, prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
320 CC, CXX,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
321 shellQuote(os.path.join(WORKDIR, 'libraries')),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
322 ' -arch '.join(ARCHLIST),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
323 SDKPATH,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
324 ),
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 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
327 # 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
328 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
329 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
330 checksum='fc2f7e714fe792db1ce6ddc4c9fb4ef3',
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
331 patchlevel='0',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
332 patches=[
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
333 # 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
334 # just ship a set of patches.
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
335 ('http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-001',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
336 'c642f2e84d820884b0bf9fd176bc6c3f'),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
337 ('http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-002',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
338 '1a76781a1ea734e831588285db7ec9b1'),
59741
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 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
341 ])
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
342
67598
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
343 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
344 result.extend([
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
345 dict(
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
346 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
347 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
348 checksum='ec2b87e833779681a0c3a814aa71359e',
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
349 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
350 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
351 configure_pre=[
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
352 '--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
353 ]
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
354 ),
48454765d8e0 #10843: Update third-party library versions used in OS X 32-bit
Ned Deily <nad@acm.org>
parents: 66780
diff changeset
355 ])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
356
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
357 return result
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
358
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
359
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
360 # 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
361 def pkg_recipes():
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
362 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
363 result = [
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
364 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
365 name="PythonFramework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
366 long_name="Python Framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
367 source="/Library/Frameworks/Python.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
368 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
369 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
370 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
371 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
372 """,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
373 postflight="scripts/postflight.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
374 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
375 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
376 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
377 name="PythonApplications",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
378 long_name="GUI Applications",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
379 source="/Applications/Python %(VER)s",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
380 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
381 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
382 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
383 from python scripts).
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
384
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
385 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
386 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
387 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
388 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
389 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
390 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
391 name="PythonUnixTools",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
392 long_name="UNIX command-line tools",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
393 source="/usr/local/bin",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
394 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
395 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
396 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
397 is not necessary to use Python.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
398 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
399 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
400 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
401 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
402 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
403 name="PythonDocumentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
404 long_name="Python Documentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
405 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
406 source="/pydocs",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
407 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
408 This package installs the python documentation at a location
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
409 that is useable for pydoc and IDLE.
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
410 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
411 postflight="scripts/postflight.documentation",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
412 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
413 selected='selected',
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
414 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
415 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
416 name="PythonProfileChanges",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
417 long_name="Shell profile updater",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
418 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
419 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
420 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
421 the system provided Python tools.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
422
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
423 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
424 "/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
425 to your PATH by hand.
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
426 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
427 postflight="scripts/postflight.patch-profile",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
428 topdir="/Library/Frameworks/Python.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
429 source="/empty-dir",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
430 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
431 selected=unselected_for_python3,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
432 ),
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
433 ]
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
434
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
435 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
436 result.append(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
437 dict(
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
438 name="PythonSystemFixes",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
439 long_name="Fix system Python",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
440 readme="""\
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
441 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
442 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
443 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
444 """,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
445 postflight="../Tools/fixapplepython23.py",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
446 topdir="/Library/Frameworks/Python.framework",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
447 source="/empty-dir",
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
448 required=False,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
449 selected=unselected_for_python3,
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
450 )
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
451 )
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
452 return result
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 def fatal(msg):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
455 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
456 A fatal error, bail out.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
457 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
458 sys.stderr.write('FATAL: ')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
459 sys.stderr.write(msg)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
460 sys.stderr.write('\n')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
461 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
462
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
463 def fileContents(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
464 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
465 Return the contents of the named file
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
466 """
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
467 return open(fn, 'r').read()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
468
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
469 def runCommand(commandline):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
470 """
68585
bf94b6a73fc8 #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68488
diff changeset
471 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
472 unless the command fails.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
473 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
474 fd = os.popen(commandline, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
475 data = fd.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
476 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
477 if xit is not None:
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
478 sys.stdout.write(data)
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
479 raise RuntimeError("command failed: %s"%(commandline,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
480
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
481 if VERBOSE:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
482 sys.stdout.write(data); sys.stdout.flush()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
483
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
484 def captureCommand(commandline):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
485 fd = os.popen(commandline, 'r')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
486 data = fd.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
487 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
488 if xit is not None:
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
489 sys.stdout.write(data)
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
490 raise RuntimeError("command failed: %s"%(commandline,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
491
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
492 return data
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
493
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
494 def getTclTkVersion(configfile, versionline):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
495 """
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
496 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
497 """
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
498 try:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
499 f = open(configfile, "r")
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
500 except:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
501 fatal("Framework configuration file not found: %s" % configfile)
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
502
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
503 for l in f:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
504 if l.startswith(versionline):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
505 f.close()
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
506 return l
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
507
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
508 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
509 % (versionline, configfile))
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
510
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
511 def checkEnvironment():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
512 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
513 Check that we're running on a supported system.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
514 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
515
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
516 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
517 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
518
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
519 if platform.system() != 'Darwin':
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
520 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
521
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
522 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
523 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
524
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
525 if not os.path.exists(SDKPATH):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
526 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
527 os.path.basename(SDKPATH[:-4])))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
528
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
529 # 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
530 # Tcl/Tk, ensure:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
531 # 1. there are no user-installed frameworks of Tcl/Tk with version
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
532 # higher than the Apple-supplied system version in
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
533 # SDKROOT/System/Library/Frameworks
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
534 # 2. there is a user-installed framework (usually ActiveTcl) in (or linked
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
535 # in) SDKROOT/Library/Frameworks with the same version as the system
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
536 # version. This allows users to choose to install a newer patch level.
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
537
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
538 frameworks = {}
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
539 for framework in ['Tcl', 'Tk']:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
540 fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
541 sysfw = os.path.join(SDKPATH, 'System', fwpth)
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
542 libfw = os.path.join(SDKPATH, fwpth)
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
543 usrfw = os.path.join(os.getenv('HOME'), fwpth)
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
544 frameworks[framework] = os.readlink(sysfw)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
545 if not os.path.exists(libfw):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
546 fatal("Please install a link to a current %s %s as %s so "
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
547 "the user can override the system framework."
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
548 % (framework, frameworks[framework], libfw))
66780
50de9f1a6d54 Two small changes to adjust framework builds to the new stable ABI
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 65555
diff changeset
549 if os.readlink(libfw) != os.readlink(sysfw):
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
550 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
551 if os.path.exists(usrfw):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
552 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
553 % usrfw)
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
554
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
555 if frameworks['Tcl'] != frameworks['Tk']:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
556 fatal("The Tcl and Tk frameworks are not the same version.")
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
557
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
558 # add files to check after build
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
559 EXPECTED_SHARED_LIBS['_tkinter.so'] = [
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
560 "/Library/Frameworks/Tcl.framework/Versions/%s/Tcl"
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
561 % frameworks['Tcl'],
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
562 "/Library/Frameworks/Tk.framework/Versions/%s/Tk"
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
563 % frameworks['Tk'],
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
564 ]
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
565
85560
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
566 # For 10.6+ builds, we build two versions of _tkinter:
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
567 # - the traditional version (renamed to _tkinter.so.framework) linked
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
568 # with /Library/Frameworks/{Tcl,Tk}.framework
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
569 # - the default version linked with our private copies of Tcl and Tk
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
570 if DEPTARGET > '10.5':
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
571 EXPECTED_SHARED_LIBS['_tkinter.so.framework'] = \
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
572 EXPECTED_SHARED_LIBS['_tkinter.so']
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
573 EXPECTED_SHARED_LIBS['_tkinter.so'] = [
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
574 "/Library/Frameworks/Python.framework/Versions/%s/lib/libtcl%s.dylib"
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
575 % (getVersion(), frameworks['Tcl']),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
576 "/Library/Frameworks/Python.framework/Versions/%s/lib/libtk%s.dylib"
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
577 % (getVersion(), frameworks['Tk']),
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
578 ]
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
579
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
580 # Remove inherited environment variables which might influence build
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
581 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
582 'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
583 for ev in list(os.environ):
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
584 for prefix in environ_var_prefixes:
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
585 if ev.startswith(prefix) :
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
586 print("INFO: deleting environment variable %s=%s" % (
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
587 ev, os.environ[ev]))
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
588 del os.environ[ev]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
589
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
590 base_path = '/bin:/sbin:/usr/bin:/usr/sbin'
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
591 if 'SDK_TOOLS_BIN' in os.environ:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
592 base_path = os.environ['SDK_TOOLS_BIN'] + ':' + base_path
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
593 # Xcode 2.5 on OS X 10.4 does not include SetFile in its usr/bin;
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
594 # add its fixed location here if it exists
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
595 OLD_DEVELOPER_TOOLS = '/Developer/Tools'
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
596 if os.path.isdir(OLD_DEVELOPER_TOOLS):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
597 base_path = base_path + ':' + OLD_DEVELOPER_TOOLS
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
598 os.environ['PATH'] = base_path
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
599 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
600
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
601
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
602 def parseOptions(args=None):
38673
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 Parse arguments and update global settings.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
605 """
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
606 global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
607 global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC, CXX
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
608
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
609 if args is None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
610 args = sys.argv[1:]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
611
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
612 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
613 options, args = getopt.getopt(args, '?hb',
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
614 [ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir=',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
615 'dep-target=', 'universal-archs=', 'help' ])
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
616 except getopt.GetoptError:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
617 print(sys.exc_info()[1])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
618 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
619
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
620 if args:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
621 print("Additional arguments")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
622 sys.exit(1)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
623
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
624 deptarget = None
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
625 for k, v in options:
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
626 if k in ('-h', '-?', '--help'):
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
627 print(USAGE)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
628 sys.exit(0)
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 elif k in ('-d', '--build-dir'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
631 WORKDIR=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
632
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
633 elif k in ('--third-party',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
634 DEPSRC=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
635
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
636 elif k in ('--sdk-path',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
637 SDKPATH=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
638
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
639 elif k in ('--src-dir',):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
640 SRCDIR=v
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
641
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
642 elif k in ('--dep-target', ):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
643 DEPTARGET=v
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
644 deptarget=v
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
645
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
646 elif k in ('--universal-archs', ):
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
647 if v in UNIVERSALOPTS:
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
648 UNIVERSALARCHS = v
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
649 ARCHLIST = universal_opts_map[UNIVERSALARCHS]
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
650 if deptarget is None:
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
651 # Select alternate default deployment
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
652 # target
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
653 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
654 else:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
655 raise NotImplementedError(v)
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
656
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
657 else:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
658 raise NotImplementedError(k)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
659
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
660 SRCDIR=os.path.abspath(SRCDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
661 WORKDIR=os.path.abspath(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
662 SDKPATH=os.path.abspath(SDKPATH)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
663 DEPSRC=os.path.abspath(DEPSRC)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
664
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
665 CC, CXX=target_cc_map[DEPTARGET]
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
666
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
667 print("Settings:")
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
668 print(" * Source directory:", SRCDIR)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
669 print(" * Build directory: ", WORKDIR)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
670 print(" * SDK location: ", SDKPATH)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
671 print(" * Third-party source:", DEPSRC)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
672 print(" * Deployment target:", DEPTARGET)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
673 print(" * Universal architectures:", ARCHLIST)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
674 print(" * C compiler:", CC)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
675 print(" * C++ compiler:", CXX)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
676 print("")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
677
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
678
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
679
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
680
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
681 def extractArchive(builddir, archiveName):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
682 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
683 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
684 extracted archive.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
685
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
686 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
687 that is has the same name as the basename of the archive. This is
85560
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
688 safe enough for almost anything we use. Unfortunately, it does not
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
689 work for current Tcl and Tk source releases where the basename of
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
690 the archive ends with "-src" but the uncompressed directory does not.
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
691 For now, just special case Tcl and Tk tar.gz downloads.
38673
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 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
694 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
695 os.chdir(builddir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
696 if archiveName.endswith('.tar.gz'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
697 retval = os.path.basename(archiveName[:-7])
85560
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
698 if ((retval.startswith('tcl') or retval.startswith('tk'))
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
699 and retval.endswith('-src')):
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
700 retval = retval[:-4]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
701 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
702 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
703 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
704
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
705 elif archiveName.endswith('.tar.bz2'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
706 retval = os.path.basename(archiveName[:-8])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
707 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
708 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
709 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
710
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
711 elif archiveName.endswith('.tar'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
712 retval = os.path.basename(archiveName[:-4])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
713 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
714 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
715 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
716
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
717 elif archiveName.endswith('.zip'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
718 retval = os.path.basename(archiveName[:-4])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
719 if os.path.exists(retval):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
720 shutil.rmtree(retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
721 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
722
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
723 data = fp.read()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
724 xit = fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
725 if xit is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
726 sys.stdout.write(data)
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
727 raise RuntimeError("Cannot extract %s"%(archiveName,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
728
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
729 return os.path.join(builddir, retval)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
730
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
731 finally:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
732 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
733
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
734 def downloadURL(url, fname):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
735 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
736 Download the contents of the url into the file.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
737 """
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
738 fpIn = urllib_request.urlopen(url)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
739 fpOut = open(fname, 'wb')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
740 block = fpIn.read(10240)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
741 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
742 while block:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
743 fpOut.write(block)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
744 block = fpIn.read(10240)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
745 fpIn.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
746 fpOut.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
747 except:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
748 try:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
749 os.unlink(fname)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
750 except:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
751 pass
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
752
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
753 def verifyThirdPartyFile(url, checksum, fname):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
754 """
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
755 Download file from url to filename fname if it does not already exist.
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
756 Abort if file contents does not match supplied md5 checksum.
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
757 """
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
758 name = os.path.basename(fname)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
759 if os.path.exists(fname):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
760 print("Using local copy of %s"%(name,))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
761 else:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
762 print("Did not find local copy of %s"%(name,))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
763 print("Downloading %s"%(name,))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
764 downloadURL(url, fname)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
765 print("Archive for %s stored as %s"%(name, fname))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
766 if os.system(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
767 'MD5=$(openssl md5 %s) ; test "${MD5##*= }" = "%s"'
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
768 % (shellQuote(fname), checksum) ):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
769 fatal('MD5 checksum mismatch for file %s' % fname)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
770
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
771 def buildRecipe(recipe, basedir, archList):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
772 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
773 Build software using a recipe. This function does the
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
774 '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
775 to customize this process, basically a poor-mans DarwinPorts.
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 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
778
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
779 name = recipe['name']
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
780 url = recipe['url']
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
781 configure = recipe.get('configure', './configure')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
782 install = recipe.get('install', 'make && make install DESTDIR=%s'%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
783 shellQuote(basedir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
784
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
785 archiveName = os.path.split(url)[-1]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
786 sourceArchive = os.path.join(DEPSRC, archiveName)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
787
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
788 if not os.path.exists(DEPSRC):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
789 os.mkdir(DEPSRC)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
790
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
791 verifyThirdPartyFile(url, recipe['checksum'], sourceArchive)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
792 print("Extracting archive for %s"%(name,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
793 buildDir=os.path.join(WORKDIR, '_bld')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
794 if not os.path.exists(buildDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
795 os.mkdir(buildDir)
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 workDir = extractArchive(buildDir, sourceArchive)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
798 os.chdir(workDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
799 if 'buildDir' in recipe:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
800 os.chdir(recipe['buildDir'])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
801
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
802 for patch in recipe.get('patches', ()):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
803 if isinstance(patch, tuple):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
804 url, checksum = patch
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
805 fn = os.path.join(DEPSRC, os.path.basename(url))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
806 verifyThirdPartyFile(url, checksum, fn)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
807 else:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
808 # patch is a file in the source directory
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
809 fn = os.path.join(curdir, patch)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
810 runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
811 shellQuote(fn),))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
812
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
813 for patchscript in recipe.get('patchscripts', ()):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
814 if isinstance(patchscript, tuple):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
815 url, checksum = patchscript
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
816 fn = os.path.join(DEPSRC, os.path.basename(url))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
817 verifyThirdPartyFile(url, checksum, fn)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
818 else:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
819 # patch is a file in the source directory
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
820 fn = os.path.join(curdir, patchscript)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
821 if fn.endswith('.bz2'):
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
822 runCommand('bunzip2 -fk %s' % shellQuote(fn))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
823 fn = fn[:-4]
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
824 runCommand('sh %s' % shellQuote(fn))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
825 os.unlink(fn)
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
826
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
827 if configure is not None:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
828 configure_args = [
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
829 "--prefix=/usr/local",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
830 "--enable-static",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
831 "--disable-shared",
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
832 #"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
833 ]
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
834
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
835 if 'configure_pre' in recipe:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
836 args = list(recipe['configure_pre'])
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
837 if '--disable-static' in args:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
838 configure_args.remove('--enable-static')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
839 if '--enable-shared' in args:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
840 configure_args.remove('--disable-shared')
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
841 configure_args.extend(args)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
842
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
843 if recipe.get('useLDFlags', 1):
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
844 configure_args.extend([
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
845 "CFLAGS=%s-mmacosx-version-min=%s -arch %s -isysroot %s "
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
846 "-I%s/usr/local/include"%(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
847 recipe.get('extra_cflags', ''),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
848 DEPTARGET,
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
849 ' -arch '.join(archList),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
850 shellQuote(SDKPATH)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
851 shellQuote(basedir)[1:-1],),
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
852 "LDFLAGS=-mmacosx-version-min=%s -syslibroot,%s -L%s/usr/local/lib -arch %s"%(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
853 DEPTARGET,
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
854 shellQuote(SDKPATH)[1:-1],
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
855 shellQuote(basedir)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
856 ' -arch '.join(archList)),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
857 ])
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
858 else:
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
859 configure_args.extend([
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
860 "CFLAGS=%s-mmacosx-version-min=%s -arch %s -isysroot %s "
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
861 "-I%s/usr/local/include"%(
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
862 recipe.get('extra_cflags', ''),
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
863 DEPTARGET,
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
864 ' -arch '.join(archList),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
865 shellQuote(SDKPATH)[1:-1],
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
866 shellQuote(basedir)[1:-1],),
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
867 ])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
868
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
869 if 'configure_post' in recipe:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
870 configure_args = configure_args + list(recipe['configure_post'])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
871
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
872 configure_args.insert(0, configure)
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
873 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
874
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
875 print("Running configure for %s"%(name,))
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
876 runCommand(' '.join(configure_args) + ' 2>&1')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
877
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
878 print("Running install for %s"%(name,))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
879 runCommand('{ ' + install + ' ;} 2>&1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
880
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
881 print("Done %s"%(name,))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
882 print("")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
883
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
884 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
885
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
886 def buildLibraries():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
887 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
888 Build our dependencies into $WORKDIR/libraries/usr/local
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
889 """
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
890 print("")
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
891 print("Building required libraries")
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
892 print("")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
893 universal = os.path.join(WORKDIR, 'libraries')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
894 os.mkdir(universal)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
895 os.makedirs(os.path.join(universal, 'usr', 'local', 'lib'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
896 os.makedirs(os.path.join(universal, 'usr', 'local', 'include'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
897
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
898 for recipe in library_recipes():
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
899 buildRecipe(recipe, universal, ARCHLIST)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
900
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
901
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
902
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
903 def buildPythonDocs():
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
904 # 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
905 # inside the framwork. pydoc and IDLE will pick it up there.
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
906 print("Install python documentation")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
907 rootDir = os.path.join(WORKDIR, '_root')
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
908 buildDir = os.path.join('../../Doc')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
909 docdir = os.path.join(rootDir, 'pydocs')
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
910 curDir = os.getcwd()
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
911 os.chdir(buildDir)
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
912 runCommand('make update')
60861
3a8a6184f40a Merged revisions 80355 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents: 60740
diff changeset
913 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
914 os.chdir(curDir)
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
915 if not os.path.exists(docdir):
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
916 os.mkdir(docdir)
54202
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
917 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
918
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
919
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
920 def buildPython():
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
921 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
922
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
923 buildDir = os.path.join(WORKDIR, '_bld', 'python')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
924 rootDir = os.path.join(WORKDIR, '_root')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
925
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
926 if os.path.exists(buildDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
927 shutil.rmtree(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
928 if os.path.exists(rootDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
929 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
930 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
931 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
932 os.makedirs(os.path.join(rootDir, 'empty-dir'))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
933 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
934 os.chdir(buildDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
935
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
936 # 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
937 # 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
938 os.symlink('python', os.path.join(buildDir, 'python.exe'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
939
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
940 # 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
941 # several paths.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
942 version = getVersion()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
943
52470
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
944 # 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
945 # 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
946 # 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
947 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
948 'libraries', 'usr', 'local', 'lib')
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
949 print("Running configure...")
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
950 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
951 "--with-universal-archs=%s "
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
952 "%s "
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
953 "LDFLAGS='-g -L%s/libraries/usr/local/lib' "
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
954 "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
955 shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
956 UNIVERSALARCHS,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
957 (' ', '--with-computed-gotos ')[PYTHON_3],
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
958 shellQuote(WORKDIR)[1:-1],
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
959 shellQuote(WORKDIR)[1:-1]))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
960
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
961 print("Running make")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
962 runCommand("make")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
963
85560
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
964 # For deployment targets of 10.6 and higher, we build our own version
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
965 # of Tcl and Cocoa Aqua Tk libs because the Apple-supplied Tk 8.5 is
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
966 # out-of-date and has critical bugs. Save the _tkinter.so that was
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
967 # linked with /Library/Frameworks/{Tck,Tk}.framework and build
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
968 # another _tkinter.so linked with our private Tcl and Tk libs.
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
969 if DEPTARGET > '10.5':
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
970 runCommand("find build -name '_tkinter.so' "
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
971 " -execdir mv '{}' '{}'.framework \;")
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
972 print("Running make to rebuild _tkinter")
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
973 runCommand("make TCLTK_INCLUDES='-I%s/libraries/usr/local/include' "
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
974 "TCLTK_LIBS='-L%s/libraries/usr/local/lib -ltcl8.5 -ltk8.5'"%(
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
975 shellQuote(WORKDIR)[1:-1],
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
976 shellQuote(WORKDIR)[1:-1]))
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
977 # make a backup copy, just in case
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
978 runCommand("find build -name '_tkinter.so' "
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
979 " -execdir cp -p '{}' '{}'.private \;")
985384cd6365 Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+
Ned Deily <nad@acm.org>
parents: 85407
diff changeset
980
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
981 print("Running make install")
54202
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52645
diff changeset
982 runCommand("make install DESTDIR=%s"%(
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
983 shellQuote(rootDir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
984
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
985 print("Running make frameworkinstallextras")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
986 runCommand("make frameworkinstallextras DESTDIR=%s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
987 shellQuote(rootDir)))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
988
52470
52c36e450a48 Merged revisions 70746 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52462
diff changeset
989 del os.environ['DYLD_LIBRARY_PATH']
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
990 print("Copying required shared libraries")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
991 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
992 runCommand("mv %s/* %s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
993 shellQuote(os.path.join(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
994 WORKDIR, 'libraries', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
995 'Python.framework', 'Versions', getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
996 'lib')),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
997 shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
998 'Python.framework', 'Versions', getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
999 'lib'))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1000
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1001 print("Fix file modes")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1002 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
1003 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
1004
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1005 shared_lib_error = False
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1006 for dirpath, dirnames, filenames in os.walk(frmDir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1007 for dn in dirnames:
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1008 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
1009 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
1010
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1011 for fn in filenames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1012 if os.path.islink(fn):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1013 continue
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1014
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1015 # "chmod g+w $fn"
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1016 p = os.path.join(dirpath, fn)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1017 st = os.stat(p)
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
1018 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
1019 os.chown(p, -1, gid)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1020
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1021 if fn in EXPECTED_SHARED_LIBS:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1022 # check to see that this file was linked with the
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1023 # expected library path and version
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1024 data = captureCommand("otool -L %s" % shellQuote(p))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1025 for sl in EXPECTED_SHARED_LIBS[fn]:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1026 if ("\t%s " % sl) not in data:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1027 print("Expected shared lib %s was not linked with %s"
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1028 % (sl, p))
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1029 shared_lib_error = True
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1030
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1031 if shared_lib_error:
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1032 fatal("Unexpected shared library errors.")
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1033
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
1034 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
1035 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
1036 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
1037 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
1038
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
1039 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
1040 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
1041 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
1042 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
1043 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
1044 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
1045 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
1046 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
1047 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
1048
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
1049 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
1050 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
1051 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
1052 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
1053 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
1054
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1055 # 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
1056 # phase. Remove those because those directories won't be there on
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1057 # the end-users system. Also remove the directories from _sysconfigdata.py
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1058 # (added in 3.3) if it exists.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1059
84963
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1060 include_path = '-I%s/libraries/usr/local/include' % (WORKDIR,)
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1061 lib_path = '-L%s/libraries/usr/local/lib' % (WORKDIR,)
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1062
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1063 path_to_lib = os.path.join(rootDir, 'Library', 'Frameworks',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1064 'Python.framework', 'Versions',
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1065 version, 'lib', 'python%s'%(version,))
84963
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1066
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1067 # fix Makefile
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1068 path = os.path.join(path_to_lib, 'config' + config_suffix, 'Makefile')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1069 fp = open(path, 'r')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1070 data = fp.read()
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1071 fp.close()
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1072
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1073 for p in (include_path, lib_path):
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1074 data = data.replace(" " + p, '')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1075 data = data.replace(p + " ", '')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1076
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1077 fp = open(path, 'w')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1078 fp.write(data)
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1079 fp.close()
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1080
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1081 # fix _sysconfigdata if it exists
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1082 #
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1083 # TODO: make this more robust! test_sysconfig_module of
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1084 # distutils.tests.test_sysconfig.SysconfigTestCase tests that
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1085 # the output from get_config_var in both sysconfig and
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1086 # distutils.sysconfig is exactly the same for both CFLAGS and
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1087 # LDFLAGS. The fixing up is now complicated by the pretty
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1088 # printing in _sysconfigdata.py. Also, we are using the
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1089 # pprint from the Python running the installer build which
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1090 # may not cosmetically format the same as the pprint in the Python
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1091 # being built (and which is used to originally generate
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1092 # _sysconfigdata.py).
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1093
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1094 import pprint
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1095 path = os.path.join(path_to_lib, '_sysconfigdata.py')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1096 if os.path.exists(path):
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1097 fp = open(path, 'r')
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1098 data = fp.read()
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1099 fp.close()
84963
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1100 # create build_time_vars dict
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1101 exec(data)
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1102 vars = {}
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1103 for k, v in build_time_vars.items():
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1104 if type(v) == type(''):
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1105 for p in (include_path, lib_path):
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1106 v = v.replace(' ' + p, '')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1107 v = v.replace(p + ' ', '')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1108 vars[k] = v
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1109
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1110 fp = open(path, 'w')
84963
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1111 # duplicated from sysconfig._generate_posix_vars()
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1112 fp.write('# system configuration generated and used by'
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1113 ' the sysconfig module\n')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1114 fp.write('build_time_vars = ')
3ffd9a270e14 Fix OS X installer build script to handle the pretty-printed _sysconfigdata.py
Ned Deily <nad@acm.org>
parents: 81801
diff changeset
1115 pprint.pprint(vars, stream=fp)
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1116 fp.close()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1117
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1118 # Add symlinks in /usr/local/bin, using relative links
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1119 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
1120 to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks',
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1121 'Python.framework', 'Versions', version, 'bin')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1122 if os.path.exists(usr_local_bin):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1123 shutil.rmtree(usr_local_bin)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1124 os.makedirs(usr_local_bin)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1125 for fn in os.listdir(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1126 os.path.join(frmDir, 'Versions', version, 'bin')):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1127 os.symlink(os.path.join(to_framework, fn),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1128 os.path.join(usr_local_bin, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1129
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1130 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1131
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1132 if PYTHON_3:
85406
c57d99a8fc42 #18803: fix more typos. Patch by Févry Thibault.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 81801
diff changeset
1133 # Remove the 'Current' link, that way we don't accidentally mess
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1134 # 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
1135 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
1136 'Python.framework', 'Versions', 'Current'))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1137
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1138 def patchFile(inPath, outPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1139 data = fileContents(inPath)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1140 data = data.replace('$FULL_VERSION', getFullVersion())
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1141 data = data.replace('$VERSION', getVersion())
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1142 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
1143 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
1144 data = data.replace('$INSTALL_SIZE', installSize())
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1145
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1146 # 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
1147 data = data.replace('$PYTHONFRAMEWORKINSTALLDIR', '/Library/Frameworks/Python.framework')
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1148 fp = open(outPath, 'w')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1149 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1150 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1151
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1152 def patchScript(inPath, outPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1153 data = fileContents(inPath)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1154 data = data.replace('@PYVER@', getVersion())
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1155 fp = open(outPath, 'w')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1156 fp.write(data)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1157 fp.close()
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1158 os.chmod(outPath, STAT_0o755)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1159
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1160
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1161
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1162 def packageFromRecipe(targetDir, recipe):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1163 curdir = os.getcwd()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1164 try:
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
1165 # 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
1166 # 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
1167 # common.
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1168 pkgname = '%s-%s'%(recipe['name'], getVersion())
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1169 srcdir = recipe.get('source')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1170 pkgroot = recipe.get('topdir', srcdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1171 postflight = recipe.get('postflight')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1172 readme = textwrap.dedent(recipe['readme'])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1173 isRequired = recipe.get('required', True)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1174
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1175 print("- building package %s"%(pkgname,))
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 # Substitute some variables
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1178 textvars = dict(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1179 VER=getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1180 FULLVER=getFullVersion(),
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 readme = readme % textvars
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 if pkgroot is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1185 pkgroot = pkgroot % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1186 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1187 pkgroot = '/'
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1188
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1189 if srcdir is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1190 srcdir = os.path.join(WORKDIR, '_root', srcdir[1:])
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1191 srcdir = srcdir % textvars
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1192
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1193 if postflight is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1194 postflight = os.path.abspath(postflight)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1195
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1196 packageContents = os.path.join(targetDir, pkgname + '.pkg', 'Contents')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1197 os.makedirs(packageContents)
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 if srcdir is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1200 os.chdir(srcdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1201 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
1202 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
1203 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
1204
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1205 fn = os.path.join(packageContents, 'PkgInfo')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1206 fp = open(fn, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1207 fp.write('pmkrpkg1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1208 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1209
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1210 rsrcDir = os.path.join(packageContents, "Resources")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1211 os.mkdir(rsrcDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1212 fp = open(os.path.join(rsrcDir, 'ReadMe.txt'), 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1213 fp.write(readme)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1214 fp.close()
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 if postflight is not None:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1217 patchScript(postflight, os.path.join(rsrcDir, 'postflight'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1218
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1219 vers = getFullVersion()
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1220 major, minor = getVersionMajorMinor()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1221 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1222 CFBundleGetInfoString="Python.%s %s"%(pkgname, vers,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1223 CFBundleIdentifier='org.python.Python.%s'%(pkgname,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1224 CFBundleName='Python.%s'%(pkgname,),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1225 CFBundleShortVersionString=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1226 IFMajorVersion=major,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1227 IFMinorVersion=minor,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1228 IFPkgFormatVersion=0.10000000149011612,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1229 IFPkgFlagAllowBackRev=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1230 IFPkgFlagAuthorizationAction="RootAuthorization",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1231 IFPkgFlagDefaultLocation=pkgroot,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1232 IFPkgFlagFollowLinks=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1233 IFPkgFlagInstallFat=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1234 IFPkgFlagIsRequired=isRequired,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1235 IFPkgFlagOverwritePermissions=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1236 IFPkgFlagRelocatable=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1237 IFPkgFlagRestartAction="NoRestart",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1238 IFPkgFlagRootVolumeOnly=True,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1239 IFPkgFlagUpdateInstalledLangauges=False,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1240 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1241 writePlist(pl, os.path.join(packageContents, 'Info.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1242
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1243 pl = Plist(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1244 IFPkgDescriptionDescription=readme,
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1245 IFPkgDescriptionTitle=recipe.get('long_name', "Python.%s"%(pkgname,)),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1246 IFPkgDescriptionVersion=vers,
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 writePlist(pl, os.path.join(packageContents, 'Resources', 'Description.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1249
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1250 finally:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1251 os.chdir(curdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1252
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 def makeMpkgPlist(path):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1255
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1256 vers = getFullVersion()
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1257 major, minor = getVersionMajorMinor()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1258
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1259 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1260 CFBundleGetInfoString="Python %s"%(vers,),
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1261 CFBundleIdentifier='org.python.Python',
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1262 CFBundleName='Python',
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1263 CFBundleShortVersionString=vers,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1264 IFMajorVersion=major,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1265 IFMinorVersion=minor,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1266 IFPkgFlagComponentDirectory="Contents/Packages",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1267 IFPkgFlagPackageList=[
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1268 dict(
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1269 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
1270 IFPkgFlagPackageSelection=item.get('selected', 'selected'),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1271 )
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1272 for item in pkg_recipes()
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1273 ],
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1274 IFPkgFormatVersion=0.10000000149011612,
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1275 IFPkgFlagBackgroundScaling="proportional",
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1276 IFPkgFlagBackgroundAlignment="left",
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1277 IFPkgFlagAuthorizationAction="RootAuthorization",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1278 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1279
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1280 writePlist(pl, path)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1281
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1282
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1283 def buildInstaller():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1284
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1285 # Zap all compiled files
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1286 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
1287 for fn in filenames:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1288 if fn.endswith('.pyc') or fn.endswith('.pyo'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1289 os.unlink(os.path.join(dirpath, fn))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1290
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1291 outdir = os.path.join(WORKDIR, 'installer')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1292 if os.path.exists(outdir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1293 shutil.rmtree(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1294 os.mkdir(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1295
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1296 pkgroot = os.path.join(outdir, 'Python.mpkg', 'Contents')
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1297 pkgcontents = os.path.join(pkgroot, 'Packages')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1298 os.makedirs(pkgcontents)
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1299 for recipe in pkg_recipes():
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1300 packageFromRecipe(pkgcontents, recipe)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1301
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1302 rsrcDir = os.path.join(pkgroot, 'Resources')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1303
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1304 fn = os.path.join(pkgroot, 'PkgInfo')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1305 fp = open(fn, 'w')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1306 fp.write('pmkrpkg1')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1307 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1308
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1309 os.mkdir(rsrcDir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1310
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1311 makeMpkgPlist(os.path.join(pkgroot, 'Info.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1312 pl = Plist(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1313 IFPkgDescriptionTitle="Python",
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1314 IFPkgDescriptionVersion=getVersion(),
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1315 )
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1316
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1317 writePlist(pl, os.path.join(pkgroot, 'Resources', 'Description.plist'))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1318 for fn in os.listdir('resources'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1319 if fn == '.svn': continue
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1320 if fn.endswith('.jpg'):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1321 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
1322 else:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1323 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
1324
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1325 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
1326
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1327
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1328 def installSize(clear=False, _saved=[]):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1329 if clear:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1330 del _saved[:]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1331 if not _saved:
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1332 data = captureCommand("du -ks %s"%(
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1333 shellQuote(os.path.join(WORKDIR, '_root'))))
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1334 _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
1335 return _saved[0]
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1336
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1337
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1338 def buildDMG():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1339 """
40450
cc992d75d5b3 Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents: 39442
diff changeset
1340 Create DMG containing the rootDir.
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1341 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1342 outdir = os.path.join(WORKDIR, 'diskimage')
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1343 if os.path.exists(outdir):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1344 shutil.rmtree(outdir)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1345
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1346 imagepath = os.path.join(outdir,
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1347 'python-%s-macosx%s'%(getFullVersion(),DEPTARGET))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1348 if INCLUDE_TIMESTAMP:
59741
acc3e3583fac update mac installer script from the trunk #8068
Benjamin Peterson <benjamin@python.org>
parents: 54359
diff changeset
1349 imagepath = imagepath + '-%04d-%02d-%02d'%(time.localtime()[:3])
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1350 imagepath = imagepath + '.dmg'
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1351
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1352 os.mkdir(outdir)
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1353 volname='Python %s'%(getFullVersion())
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1354 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
1355 shellQuote(volname),
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1356 shellQuote(os.path.join(WORKDIR, 'installer')),
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1357 shellQuote(imagepath + ".tmp.dmg" )))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1358
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1359
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1360 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
1361 os.mkdir(os.path.join(WORKDIR, "mnt"))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1362 runCommand("hdiutil attach %s -mountroot %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1363 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
1364
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1365 # 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
1366 shutil.copy("../Icons/Disk Image.icns",
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1367 os.path.join(WORKDIR, "mnt", volname, ".VolumeIcon.icns"))
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1368 runCommand("SetFile -a C %s/"%(
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1369 shellQuote(os.path.join(WORKDIR, "mnt", volname)),))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1370
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1371 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
1372
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1373 setIcon(imagepath + ".tmp.dmg", "../Icons/Disk Image.icns")
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1374 runCommand("hdiutil convert %s -format UDZO -o %s"%(
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1375 shellQuote(imagepath + ".tmp.dmg"), shellQuote(imagepath)))
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1376 setIcon(imagepath, "../Icons/Disk Image.icns")
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1377
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1378 os.unlink(imagepath + ".tmp.dmg")
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1379
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1380 return imagepath
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1381
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1382
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1383 def setIcon(filePath, icnsPath):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1384 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1385 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
1386 """
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1387
61121
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1388 dirPath = os.path.normpath(os.path.dirname(__file__))
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1389 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
1390 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
1391 # 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
1392 # to connections to the window server.
61121
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1393 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
1394 if not os.path.exists(appPath):
e47aea86f714 Merged revisions 80653 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 60861
diff changeset
1395 os.makedirs(appPath)
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1396 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
1397 shellQuote(toolPath), shellQuote(dirPath)))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1398
52452
08bf31848a42 Merged revisions 70727 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 51563
diff changeset
1399 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
1400 shellQuote(filePath)))
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1401
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1402 def main():
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1403 # 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
1404 parseOptions()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1405 checkEnvironment()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1406
52461
857be5d95120 Merged revisions 70737 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52452
diff changeset
1407 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
1408 os.environ['CC'] = CC
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1409 os.environ['CXX'] = CXX
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1410
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1411 if os.path.exists(WORKDIR):
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1412 shutil.rmtree(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1413 os.mkdir(WORKDIR)
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1414
60692
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
1415 os.environ['LC_ALL'] = 'C'
bedd6ee03e60 Merged revisions 80179 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 59741
diff changeset
1416
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1417 # Then build third-party libraries such as sleepycat DB4.
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1418 buildLibraries()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1419
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1420 # Now build python itself
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1421 buildPython()
52515
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1422
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1423 # And then build the documentation
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1424 # Remove the Deployment Target from the shell
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1425 # environment, it's no longer needed and
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1426 # an unexpected build target can cause problems
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1427 # when Sphinx and its dependencies need to
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1428 # be (re-)installed.
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1429 del os.environ['MACOSX_DEPLOYMENT_TARGET']
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1430 buildPythonDocs()
52515
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1431
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1432
e4778ea8e4b2 Merged revisions 70802 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 52470
diff changeset
1433 # Prepare the applications folder
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1434 fn = os.path.join(WORKDIR, "_root", "Applications",
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 48356
diff changeset
1435 "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
1436 patchScript("scripts/postflight.patch-profile", fn)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1437
49493
bdf4da5d04ad merge from trunk
Benjamin Peterson <benjamin@python.org>
parents: 48356
diff changeset
1438 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
1439 getVersion(),))
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1440 os.chmod(folder, STAT_0o755)
38673
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1441 setIcon(folder, "../Icons/Python Folder.icns")
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1442
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1443 # Create the installer
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1444 buildInstaller()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1445
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1446 # 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
1447 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
1448
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1449 # Ditto for the license file.
39442
654c380cf8b9 Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents: 38673
diff changeset
1450 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
1451
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1452 fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w')
81800
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1453 fp.write("# BUILD INFO\n")
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1454 fp.write("# Date: %s\n" % time.ctime())
d54330c8daaa Issue #14018: Backport OS X installer updates from 3.3.
Ned Deily <nad@acm.org>
parents: 68586
diff changeset
1455 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
1456 fp.close()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1457
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1458 # And copy it to a DMG
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1459 buildDMG()
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1460
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1461 if __name__ == "__main__":
a19c20c5e5c7 Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1462 main()