annotate Mac/BuildScript/build-installer.py @ 58765:2ba7677bfa95 legacy-trunk

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