Changeset 388 for python/vendor/current/Mac/BuildScript
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- Location:
- python/vendor/current/Mac/BuildScript
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Mac/BuildScript/README.txt
r2 r388 1 Building a MacPythondistribution2 ================================= 1 Building a Python Mac OS X distribution 2 ======================================= 3 3 4 The ``build-install.py`` script creates MacPython distributions, including5 sleepycat db4, sqlite3 and readline support. It builds a complete4 The ``build-install.py`` script creates Python distributions, including 5 certain third-party libraries as necessary. It builds a complete 6 6 framework-based Python out-of-tree, installs it in a funny place with 7 7 $DESTROOT, massages that installation to remove .pyc files and such, creates … … 9 9 and ``scripts`` and placed that on a ``.dmg`` disk image. 10 10 11 Prerequisites12 ------------- 11 For Python 2.7.x and 3.2.x, PSF practice is to build two installer variants 12 for each release. 13 13 14 * A MacOS X 10.4 (or later) 14 1. 32-bit-only, i386 and PPC universal, capable on running on all machines 15 supported by Mac OS X 10.3.9 through (at least) 10.8:: 15 16 16 * XCode 2.2 (or later), with the universal SDK 17 /usr/bin/python build-installer.py \ 18 --sdk-path=/Developer/SDKs/MacOSX10.4u.sdk \ 19 --universal-archs=32-bit \ 20 --dep-target=10.3 17 21 18 * No Fink (in ``/sw``) or DarwinPorts (in ``/opt/local``), those could 22 - builds the following third-party libraries 23 24 * Bzip2 25 * NCurses 26 * GNU Readline (GPL) 27 * SQLite 3.7.13 28 * Zlib 1.2.3 29 * Oracle Sleepycat DB 4.8 (Python 2.x only) 30 31 - requires ActiveState ``Tcl/Tk 8.4`` (currently 8.4.19) to be installed for building 32 33 - recommended build environment: 34 35 * Mac OS X 10.5.8 PPC or Intel 36 * Xcode 3.1.4 37 * ``MacOSX10.4u`` SDK (later SDKs do not support PPC G3 processors) 38 * ``MACOSX_DEPLOYMENT_TARGET=10.3`` 39 * Apple ``gcc-4.0`` 40 * system Python 2.5 for documentation build with Sphinx 41 42 - alternate build environments: 43 44 * Mac OS X 10.6.8 with Xcode 3.2.6 45 - need to change ``/System/Library/Frameworks/{Tcl,Tk}.framework/Version/Current`` to ``8.4`` 46 * Note Xcode 4.* does not support building for PPC so cannot be used for this build 47 48 49 2. 64-bit / 32-bit, x86_64 and i386 universal, for OS X 10.6 (and later):: 50 51 /usr/bin/python build-installer.py \ 52 --sdk-path=/Developer/SDKs/MacOSX10.6.sdk \ 53 --universal-archs=intel \ 54 --dep-target=10.6 55 56 - builds the following third-party libraries 57 58 * NCurses 5.9 (http://bugs.python.org/issue15037) 59 * SQLite 3.7.13 60 61 - uses system-supplied versions of third-party libraries 62 63 * readline module links with Apple BSD editline (libedit) 64 * builds Oracle Sleepycat DB 4.8 (Python 2.x only) 65 66 - requires ActiveState Tcl/Tk 8.5.9 (or later) to be installed for building 67 68 - recommended build environment: 69 70 * Mac OS X 10.6.8 (or later) 71 * Xcode 3.2.6 72 * ``MacOSX10.6`` SDK 73 * ``MACOSX_DEPLOYMENT_TARGET=10.6`` 74 * Apple ``gcc-4.2`` 75 * system Python 2.6 for documentation build with Sphinx 76 77 - alternate build environments: 78 79 * none. Xcode 4.x currently supplies two C compilers. 80 ``llvm-gcc-4.2.1`` has been found to miscompile Python 3.3.x and 81 produce a non-functional Python executable. As it appears to be 82 considered a migration aid by Apple and is not likely to be fixed, 83 its use should be avoided. The other compiler, ``clang``, has been 84 undergoing rapid development. While it appears to have become 85 production-ready in the most recent Xcode 4 releases (Xcode 4.5.x 86 as of this writing), there are still some open issues when 87 building Python and there has not yet been the level of exposure in 88 production environments that the Xcode 3 gcc-4.2 compiler has had. 89 90 91 General Prerequisites 92 --------------------- 93 94 * No Fink (in ``/sw``) or MacPorts (in ``/opt/local``) or other local 95 libraries or utilities (in ``/usr/local``) as they could 19 96 interfere with the build. 20 97 21 * The documentation for the release must be available on python.org98 * The documentation for the release is built using Sphinx 22 99 because it is included in the installer. 100 101 * It is safest to start each variant build with an empty source directory 102 populated with a fresh copy of the untarred source. 103 104 * It is recommended that you remove any existing installed version of the 105 Python being built:: 106 107 sudo rm -rf /Library/Frameworks/Python.framework/Versions/n.n 23 108 24 109 … … 26 111 ---------- 27 112 28 Here are the steps you need to follow to build a MacPython installer:113 Here are the steps you need to follow to build a Python installer: 29 114 30 * Run ``./build-installer.py``. Optionally you can pass a number of arguments31 115 * Run ``build-installer.py``. Optionally you can pass a number of arguments 116 to specify locations of various files. Please see the top of 32 117 ``build-installer.py`` for its usage. 33 118 34 Running this script takes some time, Iwill not only build Python itself119 Running this script takes some time, it will not only build Python itself 35 120 but also some 3th-party libraries that are needed for extensions. 36 121 … … 38 123 somewhere in ``/tmp/_py``). 39 124 40 Building a 4-way universal installer41 ................................... .125 Building other universal installers 126 ................................... 42 127 43 128 It is also possible to build a 4-way universal installer that runs on 44 OS XLeopard or later::129 OS X 10.5 Leopard or later:: 45 130 46 $ ./build-installer.py --dep-target=10.5 --universal-archs=all --sdk=/ 131 /usr/bin/python /build-installer.py \ 132 --dep-target=10.5 133 --universal-archs=all 134 --sdk-path=/Developer/SDKs/MacOSX10.5.sdk 47 135 48 This requires that the deployment target is 10.5 (or later), and hence 49 also that your building on at least OSX 10.5. 136 This requires that the deployment target is 10.5, and hence 137 also that you are building on at least OS X 10.5. 4-way includes 138 ``i386``, ``x86_64``, ``ppc``, and ``ppc64`` (G5). ``ppc64`` executable 139 variants can only be run on G5 machines running 10.5. Note that, 140 while OS X 10.6 is only supported on Intel-based machines, it is possible 141 to run ``ppc`` (32-bit) executables unmodified thanks to the Rosetta ppc 142 emulation in OS X 10.5 and 10.6. The 4-way installer variant must be 143 built with Xcode 3. It is not regularly built or tested. 144 145 Other ``--universal-archs`` options are ``64-bit`` (``x86_64``, ``ppc64``), 146 and ``3-way`` (``ppc``, ``i386``, ``x86_64``). None of these options 147 are regularly exercised; use at your own risk. 148 50 149 51 150 Testing 52 151 ------- 53 152 54 The resulting binaries should work on MacOSX 10.3.9 or later. I usually run 55 the installer on a 10.3.9, a 10.4.x PPC and a 10.4.x Intel system and then 56 run the testsuite to make sure. 153 Ideally, the resulting binaries should be installed and the test suite run 154 on all supported OS X releases and architectures. As a practical matter, 155 that is generally not possible. At a minimum, variant 1 should be run on 156 a PPC G4 system with OS X 10.5 and at least one Intel system running OS X 157 10.8, 10.7, 10.6, or 10.5. Variant 2 should be run on 10.8, 10.7, and 10.6 158 systems in both 32-bit and 64-bit modes.:: 57 159 160 /usr/local/bin/pythonn.n -m test -w -u all,-largefile 161 /usr/local/bin/pythonn.n-32 -m test -w -u all 162 163 Certain tests will be skipped and some cause the interpreter to fail 164 which will likely generate ``Python quit unexpectedly`` alert messages 165 to be generated at several points during a test run. These are normal 166 during testing and can be ignored. 58 167 59 Announcements 60 ------------- 168 It is also recommend to launch IDLE and verify that it is at least 169 functional. Double-click on the IDLE app icon in ``/Applications/Pythonn.n``. 170 It should also be tested from the command line:: 61 171 62 (This is mostly of historic interest) 172 /usr/local/bin/idlen.n 63 173 64 When all is done, announcements can be posted to at least the following65 places:66 - pythonmac-sig@python.org67 - python-dev@python.org68 - python-announce@python.org69 - archivist@info-mac.org70 - adcnews@apple.com71 - news@macnn.com72 - http://www.macupdate.com73 - http://guide.apple.com/usindex.lasso74 - http://www.apple.com/downloads/macosx/submit75 - http://www.versiontracker.com/ (userid Jack.Jansen@oratrix.com)76 - http://www.macshareware.net (userid jackjansen)77 78 Also, check out Stephan Deibels http://pythonology.org/market contact list -
python/vendor/current/Mac/BuildScript/build-installer.py
r2 r388 1 #!/usr/bin/ python1 #!/usr/bin/env python 2 2 """ 3 This script is used to build the "official unofficial" universal build on 4 Mac OS X. It requires Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK to do its 5 work. 64-bit or four-way universal builds require at least OS X 10.5 and 6 the 10.5 SDK. 7 8 Please ensure that this script keeps working with Python 2.3, to avoid 9 bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4) 3 This script is used to build "official" universal installers on Mac OS X. 4 It requires at least Mac OS X 10.5, Xcode 3, and the 10.4u SDK for 5 32-bit builds. 64-bit or four-way universal builds require at least 6 OS X 10.5 and the 10.5 SDK. 7 8 Please ensure that this script keeps working with Python 2.5, to avoid 9 bootstrap issues (/usr/bin/python is Python 2.5 on OSX 10.5). Sphinx, 10 which is used to build the documentation, currently requires at least 11 Python 2.4. 12 13 In addition to what is supplied with OS X 10.5+ and Xcode 3+, the script 14 requires an installed version of hg and a third-party version of 15 Tcl/Tk 8.4 (for OS X 10.4 and 10.5 deployment targets) or Tcl/TK 8.5 16 (for 10.6 or later) installed in /Library/Frameworks. When installed, 17 the Python built by this script will attempt to dynamically link first to 18 Tcl and Tk frameworks in /Library/Frameworks if available otherwise fall 19 back to the ones in /System/Library/Framework. For the build, we recommend 20 installing the most recent ActiveTcl 8.4 or 8.5 version. 21 22 32-bit-only installer builds are still possible on OS X 10.4 with Xcode 2.5 23 and the installation of additional components, such as a newer Python 24 (2.5 is needed for Python parser updates), hg, and svn (for the documentation 25 build). 10 26 11 27 Usage: see USAGE variable in the script. 12 28 """ 13 import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd 14 import grp 29 import platform, os, sys, getopt, textwrap, shutil, stat, time, pwd, grp 30 try: 31 import urllib2 as urllib_request 32 except ImportError: 33 import urllib.request as urllib_request 34 35 STAT_0o755 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR 36 | stat.S_IRGRP | stat.S_IXGRP 37 | stat.S_IROTH | stat.S_IXOTH ) 38 39 STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR 40 | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP 41 | stat.S_IROTH | stat.S_IXOTH ) 15 42 16 43 INCLUDE_TIMESTAMP = 1 … … 18 45 19 46 from plistlib import Plist 20 21 import MacOS22 47 23 48 try: … … 41 66 value = ln[len(variable):].strip() 42 67 return value[1:-1] 68 raise RuntimeError("Cannot find variable %s" % variable[:-1]) 69 70 _cache_getVersion = None 43 71 44 72 def getVersion(): 45 return grepValue(os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION') 73 global _cache_getVersion 74 if _cache_getVersion is None: 75 _cache_getVersion = grepValue( 76 os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION') 77 return _cache_getVersion 78 79 def getVersionTuple(): 80 return tuple([int(n) for n in getVersion().split('.')]) 81 82 def getVersionMajorMinor(): 83 return tuple([int(n) for n in getVersion().split('.', 2)]) 84 85 _cache_getFullVersion = None 46 86 47 87 def getFullVersion(): 88 global _cache_getFullVersion 89 if _cache_getFullVersion is not None: 90 return _cache_getFullVersion 48 91 fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h') 49 92 for ln in open(fn): 50 93 if 'PY_VERSION' in ln: 51 returnln.split()[-1][1:-1]52 53 raise RuntimeError , "Cannot find full version??"94 _cache_getFullVersion = ln.split()[-1][1:-1] 95 return _cache_getFullVersion 96 raise RuntimeError("Cannot find full version??") 54 97 55 98 # The directory we'll use to create the build (will be erased and recreated) … … 66 109 ### The resulting binary doesn't work on all platforms that 67 110 ### it should. Always default to the 10.4u SDK until that 68 ### is ue is resolved.111 ### issue is resolved. 69 112 ### 70 113 ##if int(os.uname()[2].split('.')[0]) == 8: … … 96 139 ARCHLIST = universal_opts_map[UNIVERSALARCHS] 97 140 98 # Source directory (as ume we're in Mac/BuildScript)141 # Source directory (assume we're in Mac/BuildScript) 99 142 SRCDIR = os.path.dirname( 100 143 os.path.dirname( … … 107 150 108 151 target_cc_map = { 109 '10.3': 'gcc-4.0', 110 '10.4': 'gcc-4.0', 111 '10.5': 'gcc-4.0', 112 '10.6': 'gcc-4.2', 152 '10.3': ('gcc-4.0', 'g++-4.0'), 153 '10.4': ('gcc-4.0', 'g++-4.0'), 154 '10.5': ('gcc-4.2', 'g++-4.2'), 155 '10.6': ('gcc-4.2', 'g++-4.2'), 156 '10.7': ('clang', 'clang++'), 157 '10.8': ('clang', 'clang++'), 158 '10.9': ('clang', 'clang++'), 113 159 } 114 160 115 CC = target_cc_map[DEPTARGET] 161 CC, CXX = target_cc_map[DEPTARGET] 162 163 PYTHON_3 = getVersionTuple() >= (3, 0) 116 164 117 165 USAGE = textwrap.dedent("""\ … … 129 177 """)% globals() 130 178 179 # Dict of object file names with shared library names to check after building. 180 # This is to ensure that we ended up dynamically linking with the shared 181 # library paths and versions we expected. For example: 182 # EXPECTED_SHARED_LIBS['_tkinter.so'] = [ 183 # '/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl', 184 # '/Library/Frameworks/Tk.framework/Versions/8.5/Tk'] 185 EXPECTED_SHARED_LIBS = {} 131 186 132 187 # Instructions for building libraries that are necessary for building a … … 137 192 result = [] 138 193 194 LT_10_5 = bool(DEPTARGET < '10.5') 195 196 if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)): 197 result.extend([ 198 dict( 199 name="Tcl 8.5.15", 200 url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tcl8.5.15-src.tar.gz", 201 checksum='f3df162f92c69b254079c4d0af7a690f', 202 buildDir="unix", 203 configure_pre=[ 204 '--enable-shared', 205 '--enable-threads', 206 '--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),), 207 ], 208 useLDFlags=False, 209 install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{ 210 "DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')), 211 "TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())), 212 }, 213 ), 214 dict( 215 name="Tk 8.5.15", 216 url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tk8.5.15-src.tar.gz", 217 checksum='55b8e33f903210a4e1c8bce0f820657f', 218 patches=[ 219 "issue19373_tk_8_5_15_source.patch", 220 ], 221 buildDir="unix", 222 configure_pre=[ 223 '--enable-aqua', 224 '--enable-shared', 225 '--enable-threads', 226 '--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib'%(getVersion(),), 227 ], 228 useLDFlags=False, 229 install='make TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s DESTDIR=%(DESTDIR)s'%{ 230 "DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')), 231 "TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())), 232 "TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.5'%(getVersion())), 233 }, 234 ), 235 ]) 236 237 if getVersionTuple() >= (3, 3): 238 result.extend([ 239 dict( 240 name="XZ 5.0.3", 241 url="http://tukaani.org/xz/xz-5.0.3.tar.gz", 242 checksum='fefe52f9ecd521de2a8ce38c21a27574', 243 configure_pre=[ 244 '--disable-dependency-tracking', 245 ] 246 ), 247 ]) 248 249 result.extend([ 250 dict( 251 name="NCurses 5.9", 252 url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz", 253 checksum='8cb9c412e5f2d96bc6f459aa8c6282a1', 254 configure_pre=[ 255 "--enable-widec", 256 "--without-cxx", 257 "--without-cxx-binding", 258 "--without-ada", 259 "--without-curses-h", 260 "--enable-shared", 261 "--with-shared", 262 "--without-debug", 263 "--without-normal", 264 "--without-tests", 265 "--without-manpages", 266 "--datadir=/usr/share", 267 "--sysconfdir=/etc", 268 "--sharedstatedir=/usr/com", 269 "--with-terminfo-dirs=/usr/share/terminfo", 270 "--with-default-terminfo-dir=/usr/share/terminfo", 271 "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),), 272 ], 273 patchscripts=[ 274 ("ftp://invisible-island.net/ncurses//5.9/ncurses-5.9-20120616-patch.sh.bz2", 275 "f54bf02a349f96a7c4f0d00922f3a0d4"), 276 ], 277 useLDFlags=False, 278 install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%( 279 shellQuote(os.path.join(WORKDIR, 'libraries')), 280 shellQuote(os.path.join(WORKDIR, 'libraries')), 281 getVersion(), 282 ), 283 ), 284 dict( 285 name="SQLite 3.7.13", 286 url="http://www.sqlite.org/sqlite-autoconf-3071300.tar.gz", 287 checksum='c97df403e8a3d5b67bb408fcd6aabd8e', 288 extra_cflags=('-Os ' 289 '-DSQLITE_ENABLE_FTS4 ' 290 '-DSQLITE_ENABLE_FTS3_PARENTHESIS ' 291 '-DSQLITE_ENABLE_RTREE ' 292 '-DSQLITE_TCL=0 ' 293 '%s' % ('','-DSQLITE_WITHOUT_ZONEMALLOC ')[LT_10_5]), 294 configure_pre=[ 295 '--enable-threadsafe', 296 '--enable-shared=no', 297 '--enable-static=yes', 298 '--disable-readline', 299 '--disable-dependency-tracking', 300 ] 301 ), 302 ]) 303 139 304 if DEPTARGET < '10.5': 140 305 result.extend([ 141 306 dict( 142 name="Bzip2 1.0. 5",143 url="http:// www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz",144 checksum=' 3c15a0c8d1d3ee1c46a1634d00617b1a',307 name="Bzip2 1.0.6", 308 url="http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz", 309 checksum='00b516f4704d4a7cb50a1d97e6e8e15b', 145 310 configure=None, 146 install='make install CC=%s PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(147 CC, 311 install='make install CC=%s CXX=%s, PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( 312 CC, CXX, 148 313 shellQuote(os.path.join(WORKDIR, 'libraries')), 149 314 ' -arch '.join(ARCHLIST), … … 156 321 checksum='debc62758716a169df9f62e6ab2bc634', 157 322 configure=None, 158 install='make install CC=%s prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(159 CC, 323 install='make install CC=%s CXX=%s, prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( 324 CC, CXX, 160 325 shellQuote(os.path.join(WORKDIR, 'libraries')), 161 326 ' -arch '.join(ARCHLIST), … … 165 330 dict( 166 331 # Note that GNU readline is GPL'd software 167 name="GNU Readline 5.1.4",168 url="http://ftp.gnu.org/pub/gnu/readline/readline- 5.1.tar.gz" ,169 checksum=' 7ee5a692db88b30ca48927a13fd60e46',332 name="GNU Readline 6.1.2", 333 url="http://ftp.gnu.org/pub/gnu/readline/readline-6.1.tar.gz" , 334 checksum='fc2f7e714fe792db1ce6ddc4c9fb4ef3', 170 335 patchlevel='0', 171 336 patches=[ 172 337 # The readline maintainers don't do actual micro releases, but 173 338 # just ship a set of patches. 174 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-001',175 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-002',176 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-003',177 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004',339 ('http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-001', 340 'c642f2e84d820884b0bf9fd176bc6c3f'), 341 ('http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-002', 342 '1a76781a1ea734e831588285db7ec9b1'), 178 343 ] 179 344 ), 345 ]) 346 347 if not PYTHON_3: 348 result.extend([ 180 349 dict( 181 name="SQLite 3.6.11", 182 url="http://www.sqlite.org/sqlite-3.6.11.tar.gz", 183 checksum='7ebb099696ab76cc6ff65dd496d17858', 350 name="Sleepycat DB 4.7.25", 351 url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz", 352 checksum='ec2b87e833779681a0c3a814aa71359e', 353 buildDir="build_unix", 354 configure="../dist/configure", 184 355 configure_pre=[ 185 '--enable-threadsafe', 186 '--enable-tempstore', 187 '--enable-shared=no', 188 '--enable-static=yes', 189 '--disable-tcl', 356 '--includedir=/usr/local/include/db4', 190 357 ] 191 358 ), 192 dict(193 name="NCurses 5.5",194 url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",195 checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',196 configure_pre=[197 "--without-cxx",198 "--without-ada",199 "--without-progs",200 "--without-curses-h",201 "--enable-shared",202 "--with-shared",203 "--datadir=/usr/share",204 "--sysconfdir=/etc",205 "--sharedstatedir=/usr/com",206 "--with-terminfo-dirs=/usr/share/terminfo",207 "--with-default-terminfo-dir=/usr/share/terminfo",208 "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),),209 "--enable-termcap",210 ],211 patches=[212 "ncurses-5.5.patch",213 ],214 useLDFlags=False,215 install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%(216 shellQuote(os.path.join(WORKDIR, 'libraries')),217 shellQuote(os.path.join(WORKDIR, 'libraries')),218 getVersion(),219 ),220 ),221 359 ]) 222 223 result.extend([224 dict(225 name="Sleepycat DB 4.7.25",226 url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",227 checksum='ec2b87e833779681a0c3a814aa71359e',228 buildDir="build_unix",229 configure="../dist/configure",230 configure_pre=[231 '--includedir=/usr/local/include/db4',232 ]233 ),234 ])235 360 236 361 return result … … 239 364 # Instructions for building packages inside the .mpkg. 240 365 def pkg_recipes(): 366 unselected_for_python3 = ('selected', 'unselected')[PYTHON_3] 241 367 result = [ 242 368 dict( … … 250 376 """, 251 377 postflight="scripts/postflight.framework", 378 selected='selected', 252 379 ), 253 380 dict( … … 263 390 """, 264 391 required=False, 392 selected='selected', 265 393 ), 266 394 dict( … … 274 402 """, 275 403 required=False, 404 selected='selected', 276 405 ), 277 406 dict( … … 282 411 readme="""\ 283 412 This package installs the python documentation at a location 284 that is useable for pydoc and IDLE. If you have installed Xcode 285 it will also install a link to the documentation in 286 /Developer/Documentation/Python 413 that is useable for pydoc and IDLE. 287 414 """, 288 415 postflight="scripts/postflight.documentation", 289 416 required=False, 417 selected='selected', 290 418 ), 291 419 dict( … … 305 433 source="/empty-dir", 306 434 required=False, 435 selected=unselected_for_python3, 307 436 ), 308 437 ] 309 438 310 if DEPTARGET < '10.4' :439 if DEPTARGET < '10.4' and not PYTHON_3: 311 440 result.append( 312 441 dict( … … 322 451 source="/empty-dir", 323 452 required=False, 453 selected=unselected_for_python3, 324 454 ) 325 455 ) … … 339 469 Return the contents of the named file 340 470 """ 341 return open(fn, 'r b').read()471 return open(fn, 'r').read() 342 472 343 473 def runCommand(commandline): 344 474 """ 345 Run a command and raise RuntimeError if it fails. Output is su rpressed475 Run a command and raise RuntimeError if it fails. Output is suppressed 346 476 unless the command fails. 347 477 """ … … 351 481 if xit is not None: 352 482 sys.stdout.write(data) 353 raise RuntimeError , "command failed: %s"%(commandline,)483 raise RuntimeError("command failed: %s"%(commandline,)) 354 484 355 485 if VERBOSE: … … 362 492 if xit is not None: 363 493 sys.stdout.write(data) 364 raise RuntimeError , "command failed: %s"%(commandline,)494 raise RuntimeError("command failed: %s"%(commandline,)) 365 495 366 496 return data 367 497 498 def getTclTkVersion(configfile, versionline): 499 """ 500 search Tcl or Tk configuration file for version line 501 """ 502 try: 503 f = open(configfile, "r") 504 except: 505 fatal("Framework configuration file not found: %s" % configfile) 506 507 for l in f: 508 if l.startswith(versionline): 509 f.close() 510 return l 511 512 fatal("Version variable %s not found in framework configuration file: %s" 513 % (versionline, configfile)) 514 368 515 def checkEnvironment(): 369 516 """ 370 517 Check that we're running on a supported system. 371 518 """ 519 520 if sys.version_info[0:2] < (2, 4): 521 fatal("This script must be run with Python 2.4 or later") 372 522 373 523 if platform.system() != 'Darwin': … … 381 531 os.path.basename(SDKPATH[:-4]))) 382 532 533 # Because we only support dynamic load of only one major/minor version of 534 # Tcl/Tk, ensure: 535 # 1. there are no user-installed frameworks of Tcl/Tk with version 536 # higher than the Apple-supplied system version in 537 # SDKROOT/System/Library/Frameworks 538 # 2. there is a user-installed framework (usually ActiveTcl) in (or linked 539 # in) SDKROOT/Library/Frameworks with the same version as the system 540 # version. This allows users to choose to install a newer patch level. 541 542 frameworks = {} 543 for framework in ['Tcl', 'Tk']: 544 fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework 545 sysfw = os.path.join(SDKPATH, 'System', fwpth) 546 libfw = os.path.join(SDKPATH, fwpth) 547 usrfw = os.path.join(os.getenv('HOME'), fwpth) 548 frameworks[framework] = os.readlink(sysfw) 549 if not os.path.exists(libfw): 550 fatal("Please install a link to a current %s %s as %s so " 551 "the user can override the system framework." 552 % (framework, frameworks[framework], libfw)) 553 if os.readlink(libfw) != os.readlink(sysfw): 554 fatal("Version of %s must match %s" % (libfw, sysfw) ) 555 if os.path.exists(usrfw): 556 fatal("Please rename %s to avoid possible dynamic load issues." 557 % usrfw) 558 559 if frameworks['Tcl'] != frameworks['Tk']: 560 fatal("The Tcl and Tk frameworks are not the same version.") 561 562 # add files to check after build 563 EXPECTED_SHARED_LIBS['_tkinter.so'] = [ 564 "/Library/Frameworks/Tcl.framework/Versions/%s/Tcl" 565 % frameworks['Tcl'], 566 "/Library/Frameworks/Tk.framework/Versions/%s/Tk" 567 % frameworks['Tk'], 568 ] 569 570 # For 10.6+ builds, we build two versions of _tkinter: 571 # - the traditional version (renamed to _tkinter_library.so) linked 572 # with /Library/Frameworks/{Tcl,Tk}.framework 573 # - the default version linked with our builtin copies of Tcl and Tk 574 if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)): 575 EXPECTED_SHARED_LIBS['_tkinter_library.so'] = \ 576 EXPECTED_SHARED_LIBS['_tkinter.so'] 577 EXPECTED_SHARED_LIBS['_tkinter.so'] = [ 578 "/Library/Frameworks/Python.framework/Versions/%s/lib/libtcl%s.dylib" 579 % (getVersion(), frameworks['Tcl']), 580 "/Library/Frameworks/Python.framework/Versions/%s/lib/libtk%s.dylib" 581 % (getVersion(), frameworks['Tk']), 582 ] 583 584 # Remove inherited environment variables which might influence build 585 environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_', 586 'LD_', 'LIBRARY_', 'PATH', 'PYTHON'] 587 for ev in list(os.environ): 588 for prefix in environ_var_prefixes: 589 if ev.startswith(prefix) : 590 print("INFO: deleting environment variable %s=%s" % ( 591 ev, os.environ[ev])) 592 del os.environ[ev] 593 594 base_path = '/bin:/sbin:/usr/bin:/usr/sbin' 595 if 'SDK_TOOLS_BIN' in os.environ: 596 base_path = os.environ['SDK_TOOLS_BIN'] + ':' + base_path 597 # Xcode 2.5 on OS X 10.4 does not include SetFile in its usr/bin; 598 # add its fixed location here if it exists 599 OLD_DEVELOPER_TOOLS = '/Developer/Tools' 600 if os.path.isdir(OLD_DEVELOPER_TOOLS): 601 base_path = base_path + ':' + OLD_DEVELOPER_TOOLS 602 os.environ['PATH'] = base_path 603 print("Setting default PATH: %s"%(os.environ['PATH'])) 383 604 384 605 … … 388 609 """ 389 610 global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET 390 global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC 611 global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC, CXX 391 612 392 613 if args is None: … … 397 618 [ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir=', 398 619 'dep-target=', 'universal-archs=', 'help' ]) 399 except getopt. error, msg:400 print msg620 except getopt.GetoptError: 621 print(sys.exc_info()[1]) 401 622 sys.exit(1) 402 623 403 624 if args: 404 print "Additional arguments"625 print("Additional arguments") 405 626 sys.exit(1) 406 627 … … 408 629 for k, v in options: 409 630 if k in ('-h', '-?', '--help'): 410 print USAGE631 print(USAGE) 411 632 sys.exit(0) 412 633 … … 436 657 DEPTARGET = default_target_map.get(v, '10.3') 437 658 else: 438 raise NotImplementedError , v659 raise NotImplementedError(v) 439 660 440 661 else: 441 raise NotImplementedError , k662 raise NotImplementedError(k) 442 663 443 664 SRCDIR=os.path.abspath(SRCDIR) … … 446 667 DEPSRC=os.path.abspath(DEPSRC) 447 668 448 CC=target_cc_map[DEPTARGET] 449 450 print "Settings:" 451 print " * Source directory:", SRCDIR 452 print " * Build directory: ", WORKDIR 453 print " * SDK location: ", SDKPATH 454 print " * Third-party source:", DEPSRC 455 print " * Deployment target:", DEPTARGET 456 print " * Universal architectures:", ARCHLIST 457 print " * C compiler:", CC 458 print "" 669 CC, CXX=target_cc_map[DEPTARGET] 670 671 print("Settings:") 672 print(" * Source directory:", SRCDIR) 673 print(" * Build directory: ", WORKDIR) 674 print(" * SDK location: ", SDKPATH) 675 print(" * Third-party source:", DEPSRC) 676 print(" * Deployment target:", DEPTARGET) 677 print(" * Universal architectures:", ARCHLIST) 678 print(" * C compiler:", CC) 679 print(" * C++ compiler:", CXX) 680 print("") 459 681 460 682 … … 468 690 XXX: This function assumes that archives contain a toplevel directory 469 691 that is has the same name as the basename of the archive. This is 470 save enough for anything we use. 692 safe enough for almost anything we use. Unfortunately, it does not 693 work for current Tcl and Tk source releases where the basename of 694 the archive ends with "-src" but the uncompressed directory does not. 695 For now, just special case Tcl and Tk tar.gz downloads. 471 696 """ 472 697 curdir = os.getcwd() … … 475 700 if archiveName.endswith('.tar.gz'): 476 701 retval = os.path.basename(archiveName[:-7]) 702 if ((retval.startswith('tcl') or retval.startswith('tk')) 703 and retval.endswith('-src')): 704 retval = retval[:-4] 477 705 if os.path.exists(retval): 478 706 shutil.rmtree(retval) … … 501 729 if xit is not None: 502 730 sys.stdout.write(data) 503 raise RuntimeError , "Cannot extract %s"%(archiveName,)731 raise RuntimeError("Cannot extract %s"%(archiveName,)) 504 732 505 733 return os.path.join(builddir, retval) … … 508 736 os.chdir(curdir) 509 737 510 KNOWNSIZES = {511 "http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz": 7952742,512 "http://downloads.sleepycat.com/db-4.4.20.tar.gz": 2030276,513 }514 515 738 def downloadURL(url, fname): 516 739 """ 517 740 Download the contents of the url into the file. 518 741 """ 519 try: 520 size = os.path.getsize(fname) 521 except OSError: 522 pass 523 else: 524 if KNOWNSIZES.get(url) == size: 525 print "Using existing file for", url 526 return 527 fpIn = urllib2.urlopen(url) 742 fpIn = urllib_request.urlopen(url) 528 743 fpOut = open(fname, 'wb') 529 744 block = fpIn.read(10240) … … 540 755 pass 541 756 757 def verifyThirdPartyFile(url, checksum, fname): 758 """ 759 Download file from url to filename fname if it does not already exist. 760 Abort if file contents does not match supplied md5 checksum. 761 """ 762 name = os.path.basename(fname) 763 if os.path.exists(fname): 764 print("Using local copy of %s"%(name,)) 765 else: 766 print("Did not find local copy of %s"%(name,)) 767 print("Downloading %s"%(name,)) 768 downloadURL(url, fname) 769 print("Archive for %s stored as %s"%(name, fname)) 770 if os.system( 771 'MD5=$(openssl md5 %s) ; test "${MD5##*= }" = "%s"' 772 % (shellQuote(fname), checksum) ): 773 fatal('MD5 checksum mismatch for file %s' % fname) 774 542 775 def buildRecipe(recipe, basedir, archList): 543 776 """ … … 560 793 os.mkdir(DEPSRC) 561 794 562 563 if os.path.exists(sourceArchive): 564 print "Using local copy of %s"%(name,) 565 566 else: 567 print "Did not find local copy of %s"%(name,) 568 print "Downloading %s"%(name,) 569 downloadURL(url, sourceArchive) 570 print "Archive for %s stored as %s"%(name, sourceArchive) 571 572 print "Extracting archive for %s"%(name,) 795 verifyThirdPartyFile(url, recipe['checksum'], sourceArchive) 796 print("Extracting archive for %s"%(name,)) 573 797 buildDir=os.path.join(WORKDIR, '_bld') 574 798 if not os.path.exists(buildDir): … … 577 801 workDir = extractArchive(buildDir, sourceArchive) 578 802 os.chdir(workDir) 803 804 for patch in recipe.get('patches', ()): 805 if isinstance(patch, tuple): 806 url, checksum = patch 807 fn = os.path.join(DEPSRC, os.path.basename(url)) 808 verifyThirdPartyFile(url, checksum, fn) 809 else: 810 # patch is a file in the source directory 811 fn = os.path.join(curdir, patch) 812 runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1), 813 shellQuote(fn),)) 814 815 for patchscript in recipe.get('patchscripts', ()): 816 if isinstance(patchscript, tuple): 817 url, checksum = patchscript 818 fn = os.path.join(DEPSRC, os.path.basename(url)) 819 verifyThirdPartyFile(url, checksum, fn) 820 else: 821 # patch is a file in the source directory 822 fn = os.path.join(curdir, patchscript) 823 if fn.endswith('.bz2'): 824 runCommand('bunzip2 -fk %s' % shellQuote(fn)) 825 fn = fn[:-4] 826 runCommand('sh %s' % shellQuote(fn)) 827 os.unlink(fn) 828 579 829 if 'buildDir' in recipe: 580 830 os.chdir(recipe['buildDir']) 581 582 583 for fn in recipe.get('patches', ()):584 if fn.startswith('http://'):585 # Download the patch before applying it.586 path = os.path.join(DEPSRC, os.path.basename(fn))587 downloadURL(fn, path)588 fn = path589 590 fn = os.path.join(curdir, fn)591 runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1),592 shellQuote(fn),))593 831 594 832 if configure is not None: … … 610 848 if recipe.get('useLDFlags', 1): 611 849 configure_args.extend([ 612 "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%( 850 "CFLAGS=%s-mmacosx-version-min=%s -arch %s -isysroot %s " 851 "-I%s/usr/local/include"%( 852 recipe.get('extra_cflags', ''), 853 DEPTARGET, 613 854 ' -arch '.join(archList), 614 855 shellQuote(SDKPATH)[1:-1], 615 856 shellQuote(basedir)[1:-1],), 616 "LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%( 857 "LDFLAGS=-mmacosx-version-min=%s -syslibroot,%s -L%s/usr/local/lib -arch %s"%( 858 DEPTARGET, 617 859 shellQuote(SDKPATH)[1:-1], 618 860 shellQuote(basedir)[1:-1], … … 621 863 else: 622 864 configure_args.extend([ 623 "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%( 865 "CFLAGS=%s-mmacosx-version-min=%s -arch %s -isysroot %s " 866 "-I%s/usr/local/include"%( 867 recipe.get('extra_cflags', ''), 868 DEPTARGET, 624 869 ' -arch '.join(archList), 625 870 shellQuote(SDKPATH)[1:-1], … … 628 873 629 874 if 'configure_post' in recipe: 630 configure_args = configure_args =list(recipe['configure_post'])875 configure_args = configure_args + list(recipe['configure_post']) 631 876 632 877 configure_args.insert(0, configure) 633 878 configure_args = [ shellQuote(a) for a in configure_args ] 634 879 635 print "Running configure for %s"%(name,)880 print("Running configure for %s"%(name,)) 636 881 runCommand(' '.join(configure_args) + ' 2>&1') 637 882 638 print "Running install for %s"%(name,)883 print("Running install for %s"%(name,)) 639 884 runCommand('{ ' + install + ' ;} 2>&1') 640 885 641 print "Done %s"%(name,)642 print ""886 print("Done %s"%(name,)) 887 print("") 643 888 644 889 os.chdir(curdir) … … 648 893 Build our dependencies into $WORKDIR/libraries/usr/local 649 894 """ 650 print ""651 print "Building required libraries"652 print ""895 print("") 896 print("Building required libraries") 897 print("") 653 898 universal = os.path.join(WORKDIR, 'libraries') 654 899 os.mkdir(universal) … … 664 909 # This stores the documentation as Resources/English.lproj/Documentation 665 910 # inside the framwork. pydoc and IDLE will pick it up there. 666 print "Install python documentation"911 print("Install python documentation") 667 912 rootDir = os.path.join(WORKDIR, '_root') 668 913 buildDir = os.path.join('../../Doc') … … 671 916 os.chdir(buildDir) 672 917 runCommand('make update') 673 runCommand( 'make html')918 runCommand("make html PYTHON='%s'" % os.path.abspath(sys.executable)) 674 919 os.chdir(curDir) 675 920 if not os.path.exists(docdir): … … 679 924 680 925 def buildPython(): 681 print "Building a universal python for %s architectures" % UNIVERSALARCHS926 print("Building a universal python for %s architectures" % UNIVERSALARCHS) 682 927 683 928 buildDir = os.path.join(WORKDIR, '_bld', 'python') … … 688 933 if os.path.exists(rootDir): 689 934 shutil.rmtree(rootDir) 690 os.m kdir(buildDir)691 os.m kdir(rootDir)692 os.m kdir(os.path.join(rootDir, 'empty-dir'))935 os.makedirs(buildDir) 936 os.makedirs(rootDir) 937 os.makedirs(os.path.join(rootDir, 'empty-dir')) 693 938 curdir = os.getcwd() 694 939 os.chdir(buildDir) … … 707 952 os.environ['DYLD_LIBRARY_PATH'] = os.path.join(WORKDIR, 708 953 'libraries', 'usr', 'local', 'lib') 709 print "Running configure..."954 print("Running configure...") 710 955 runCommand("%s -C --enable-framework --enable-universalsdk=%s " 711 956 "--with-universal-archs=%s " 957 "%s " 712 958 "LDFLAGS='-g -L%s/libraries/usr/local/lib' " 713 " OPT='-g -O3-I%s/libraries/usr/local/include' 2>&1"%(959 "CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%( 714 960 shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH), 715 961 UNIVERSALARCHS, 962 (' ', '--with-computed-gotos ')[PYTHON_3], 716 963 shellQuote(WORKDIR)[1:-1], 717 964 shellQuote(WORKDIR)[1:-1])) 718 965 719 print "Running make"966 print("Running make") 720 967 runCommand("make") 721 968 722 print "Running make frameworkinstall" 723 runCommand("make frameworkinstall DESTDIR=%s"%( 969 # For deployment targets of 10.6 and higher, we build our own version 970 # of Tcl and Cocoa Aqua Tk libs because the Apple-supplied Tk 8.5 is 971 # out-of-date and has critical bugs. Save the _tkinter.so that was 972 # linked with /Library/Frameworks/{Tck,Tk}.framework and build 973 # another _tkinter.so linked with our builtin Tcl and Tk libs. 974 if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)): 975 runCommand("find build -name '_tkinter.so' " 976 " -execdir mv '{}' _tkinter_library.so \;") 977 print("Running make to build builtin _tkinter") 978 runCommand("make TCLTK_INCLUDES='-I%s/libraries/usr/local/include' " 979 "TCLTK_LIBS='-L%s/libraries/usr/local/lib -ltcl8.5 -ltk8.5'"%( 980 shellQuote(WORKDIR)[1:-1], 981 shellQuote(WORKDIR)[1:-1])) 982 # make a copy which will be moved to lib-tkinter later 983 runCommand("find build -name '_tkinter.so' " 984 " -execdir cp -p '{}' _tkinter_builtin.so \;") 985 986 print("Running make install") 987 runCommand("make install DESTDIR=%s"%( 724 988 shellQuote(rootDir))) 725 989 726 print "Running make frameworkinstallextras"990 print("Running make frameworkinstallextras") 727 991 runCommand("make frameworkinstallextras DESTDIR=%s"%( 728 992 shellQuote(rootDir))) 729 993 730 994 del os.environ['DYLD_LIBRARY_PATH'] 731 print "Copying required shared libraries"995 print("Copying required shared libraries") 732 996 if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')): 733 997 runCommand("mv %s/* %s"%( … … 740 1004 'lib')))) 741 1005 742 print "Fix file modes" 1006 path_to_lib = os.path.join(rootDir, 'Library', 'Frameworks', 1007 'Python.framework', 'Versions', 1008 version, 'lib', 'python%s'%(version,)) 1009 1010 # If we made multiple versions of _tkinter, move them to 1011 # their own directories under python lib. This allows 1012 # users to select which to import by manipulating sys.path 1013 # directly or with PYTHONPATH. 1014 1015 if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)): 1016 TKINTERS = ['builtin', 'library'] 1017 tkinter_moves = [('_tkinter_' + tkn + '.so', 1018 os.path.join(path_to_lib, 'lib-tkinter', tkn)) 1019 for tkn in TKINTERS] 1020 # Create the destination directories under lib-tkinter. 1021 # The permissions and uid/gid will be fixed up next. 1022 for tkm in tkinter_moves: 1023 os.makedirs(tkm[1]) 1024 1025 print("Fix file modes") 743 1026 frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') 744 1027 gid = grp.getgrnam('admin').gr_gid 745 1028 1029 shared_lib_error = False 1030 moves_list = [] 746 1031 for dirpath, dirnames, filenames in os.walk(frmDir): 747 1032 for dn in dirnames: 748 os.chmod(os.path.join(dirpath, dn), 0775)1033 os.chmod(os.path.join(dirpath, dn), STAT_0o775) 749 1034 os.chown(os.path.join(dirpath, dn), -1, gid) 750 751 1035 752 1036 for fn in filenames: … … 760 1044 os.chown(p, -1, gid) 761 1045 1046 if fn in EXPECTED_SHARED_LIBS: 1047 # check to see that this file was linked with the 1048 # expected library path and version 1049 data = captureCommand("otool -L %s" % shellQuote(p)) 1050 for sl in EXPECTED_SHARED_LIBS[fn]: 1051 if ("\t%s " % sl) not in data: 1052 print("Expected shared lib %s was not linked with %s" 1053 % (sl, p)) 1054 shared_lib_error = True 1055 1056 # If this is a _tkinter variant, move it to its own directory 1057 # now that we have fixed its permissions and checked that it 1058 # was linked properly. The directory was created earlier. 1059 # The files are moved after the entire tree has been walked 1060 # since the shared library checking depends on the files 1061 # having unique names. 1062 if (DEPTARGET > '10.5') and (getVersionTuple() >= (3, 4)): 1063 for tkm in tkinter_moves: 1064 if fn == tkm[0]: 1065 moves_list.append( 1066 (p, os.path.join(tkm[1], '_tkinter.so'))) 1067 1068 if shared_lib_error: 1069 fatal("Unexpected shared library errors.") 1070 1071 # Now do the moves. 1072 for ml in moves_list: 1073 shutil.move(ml[0], ml[1]) 1074 1075 if PYTHON_3: 1076 LDVERSION=None 1077 VERSION=None 1078 ABIFLAGS=None 1079 1080 fp = open(os.path.join(buildDir, 'Makefile'), 'r') 1081 for ln in fp: 1082 if ln.startswith('VERSION='): 1083 VERSION=ln.split()[1] 1084 if ln.startswith('ABIFLAGS='): 1085 ABIFLAGS=ln.split()[1] 1086 if ln.startswith('LDVERSION='): 1087 LDVERSION=ln.split()[1] 1088 fp.close() 1089 1090 LDVERSION = LDVERSION.replace('$(VERSION)', VERSION) 1091 LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS) 1092 config_suffix = '-' + LDVERSION 1093 else: 1094 config_suffix = '' # Python 2.x 1095 762 1096 # We added some directories to the search path during the configure 763 1097 # phase. Remove those because those directories won't be there on 764 # the end-users system. 765 path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 766 'Versions', version, 'lib', 'python%s'%(version,), 767 'config', 'Makefile') 1098 # the end-users system. Also remove the directories from _sysconfigdata.py 1099 # (added in 3.3) if it exists. 1100 1101 include_path = '-I%s/libraries/usr/local/include' % (WORKDIR,) 1102 lib_path = '-L%s/libraries/usr/local/lib' % (WORKDIR,) 1103 1104 # fix Makefile 1105 path = os.path.join(path_to_lib, 'config' + config_suffix, 'Makefile') 768 1106 fp = open(path, 'r') 769 1107 data = fp.read() 770 1108 fp.close() 771 1109 772 data = data.replace('-L%s/libraries/usr/local/lib'%(WORKDIR,), '') 773 data = data.replace('-I%s/libraries/usr/local/include'%(WORKDIR,), '') 1110 for p in (include_path, lib_path): 1111 data = data.replace(" " + p, '') 1112 data = data.replace(p + " ", '') 1113 774 1114 fp = open(path, 'w') 775 1115 fp.write(data) 776 1116 fp.close() 1117 1118 # fix _sysconfigdata if it exists 1119 # 1120 # TODO: make this more robust! test_sysconfig_module of 1121 # distutils.tests.test_sysconfig.SysconfigTestCase tests that 1122 # the output from get_config_var in both sysconfig and 1123 # distutils.sysconfig is exactly the same for both CFLAGS and 1124 # LDFLAGS. The fixing up is now complicated by the pretty 1125 # printing in _sysconfigdata.py. Also, we are using the 1126 # pprint from the Python running the installer build which 1127 # may not cosmetically format the same as the pprint in the Python 1128 # being built (and which is used to originally generate 1129 # _sysconfigdata.py). 1130 1131 import pprint 1132 path = os.path.join(path_to_lib, '_sysconfigdata.py') 1133 if os.path.exists(path): 1134 fp = open(path, 'r') 1135 data = fp.read() 1136 fp.close() 1137 # create build_time_vars dict 1138 exec(data) 1139 vars = {} 1140 for k, v in build_time_vars.items(): 1141 if type(v) == type(''): 1142 for p in (include_path, lib_path): 1143 v = v.replace(' ' + p, '') 1144 v = v.replace(p + ' ', '') 1145 vars[k] = v 1146 1147 fp = open(path, 'w') 1148 # duplicated from sysconfig._generate_posix_vars() 1149 fp.write('# system configuration generated and used by' 1150 ' the sysconfig module\n') 1151 fp.write('build_time_vars = ') 1152 pprint.pprint(vars, stream=fp) 1153 fp.close() 777 1154 778 1155 # Add symlinks in /usr/local/bin, using relative links … … 790 1167 os.chdir(curdir) 791 1168 792 1169 if PYTHON_3: 1170 # Remove the 'Current' link, that way we don't accidentally mess 1171 # with an already installed version of python 2 1172 os.unlink(os.path.join(rootDir, 'Library', 'Frameworks', 1173 'Python.framework', 'Versions', 'Current')) 793 1174 794 1175 def patchFile(inPath, outPath): … … 797 1178 data = data.replace('$VERSION', getVersion()) 798 1179 data = data.replace('$MACOSX_DEPLOYMENT_TARGET', ''.join((DEPTARGET, ' or later'))) 799 data = data.replace('$ARCHITECTURES', " i386, ppc")1180 data = data.replace('$ARCHITECTURES', ", ".join(universal_opts_map[UNIVERSALARCHS])) 800 1181 data = data.replace('$INSTALL_SIZE', installSize()) 801 1182 802 1183 # This one is not handy as a template variable 803 1184 data = data.replace('$PYTHONFRAMEWORKINSTALLDIR', '/Library/Frameworks/Python.framework') 804 fp = open(outPath, 'w b')1185 fp = open(outPath, 'w') 805 1186 fp.write(data) 806 1187 fp.close() … … 809 1190 data = fileContents(inPath) 810 1191 data = data.replace('@PYVER@', getVersion()) 811 fp = open(outPath, 'w b')1192 fp = open(outPath, 'w') 812 1193 fp.write(data) 813 1194 fp.close() 814 os.chmod(outPath, 0755)1195 os.chmod(outPath, STAT_0o755) 815 1196 816 1197 … … 829 1210 isRequired = recipe.get('required', True) 830 1211 831 print "- building package %s"%(pkgname,)1212 print("- building package %s"%(pkgname,)) 832 1213 833 1214 # Substitute some variables … … 874 1255 875 1256 vers = getFullVersion() 876 major, minor = map(int, getVersion().split('.', 2))1257 major, minor = getVersionMajorMinor() 877 1258 pl = Plist( 878 1259 CFBundleGetInfoString="Python.%s %s"%(pkgname, vers,), … … 911 1292 912 1293 vers = getFullVersion() 913 major, minor = map(int, getVersion().split('.', 2))1294 major, minor = getVersionMajorMinor() 914 1295 915 1296 pl = Plist( … … 924 1305 dict( 925 1306 IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()), 926 IFPkgFlagPackageSelection= 'selected'1307 IFPkgFlagPackageSelection=item.get('selected', 'selected'), 927 1308 ) 928 1309 for item in pkg_recipes() … … 1022 1403 shutil.copy("../Icons/Disk Image.icns", 1023 1404 os.path.join(WORKDIR, "mnt", volname, ".VolumeIcon.icns")) 1024 runCommand(" /Developer/Tools/SetFile -a C %s/"%(1405 runCommand("SetFile -a C %s/"%( 1025 1406 shellQuote(os.path.join(WORKDIR, "mnt", volname)),)) 1026 1407 … … 1042 1423 """ 1043 1424 1044 toolPath = os.path.join(os.path.dirname(__file__), "seticon.app/Contents/MacOS/seticon")1045 dirPath = os.path.dirname(__file__)1425 dirPath = os.path.normpath(os.path.dirname(__file__)) 1426 toolPath = os.path.join(dirPath, "seticon.app/Contents/MacOS/seticon") 1046 1427 if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').st_mtime: 1047 1428 # NOTE: The tool is created inside an .app bundle, otherwise it won't work due 1048 1429 # to connections to the window server. 1049 if not os.path.exists('seticon.app/Contents/MacOS'): 1050 os.makedirs('seticon.app/Contents/MacOS') 1430 appPath = os.path.join(dirPath, "seticon.app/Contents/MacOS") 1431 if not os.path.exists(appPath): 1432 os.makedirs(appPath) 1051 1433 runCommand("cc -o %s %s/seticon.m -framework Cocoa"%( 1052 1434 shellQuote(toolPath), shellQuote(dirPath))) … … 1062 1444 os.environ['MACOSX_DEPLOYMENT_TARGET'] = DEPTARGET 1063 1445 os.environ['CC'] = CC 1446 os.environ['CXX'] = CXX 1064 1447 1065 1448 if os.path.exists(WORKDIR): 1066 1449 shutil.rmtree(WORKDIR) 1067 1450 os.mkdir(WORKDIR) 1451 1452 os.environ['LC_ALL'] = 'C' 1068 1453 1069 1454 # Then build third-party libraries such as sleepycat DB4. … … 1090 1475 folder = os.path.join(WORKDIR, "_root", "Applications", "Python %s"%( 1091 1476 getVersion(),)) 1092 os.chmod(folder, 0755)1477 os.chmod(folder, STAT_0o755) 1093 1478 setIcon(folder, "../Icons/Python Folder.icns") 1094 1479 … … 1103 1488 1104 1489 fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w') 1105 print >> fp, "# BUILD INFO"1106 print >> fp, "# Date:", time.ctime()1107 print >> fp, "# By:", pwd.getpwuid(os.getuid()).pw_gecos1490 fp.write("# BUILD INFO\n") 1491 fp.write("# Date: %s\n" % time.ctime()) 1492 fp.write("# By: %s\n" % pwd.getpwuid(os.getuid()).pw_gecos) 1108 1493 fp.close() 1109 1494 -
python/vendor/current/Mac/BuildScript/resources/ReadMe.txt
r2 r388 1 This package will install MacPython $FULL_VERSION for Mac OS X2 $MACOSX_DEPLOYMENT_TARGET for the following 3 architecture(s):$ARCHITECTURES.1 This package will install Python $FULL_VERSION for Mac OS X 2 $MACOSX_DEPLOYMENT_TARGET for the following architecture(s): 3 $ARCHITECTURES. 4 4 5 Separate installers are available for older versions 6 of Mac OS X, see the homepage, below. 5 **** IMPORTANT **** 7 6 8 Install ation requires approximately $INSTALL_SIZE MB of disk9 space, ignore the message that it will take zero bytes. 7 Installing on OS X 10.8 (Mountain Lion) or later systems 8 ======================================================== 10 9 11 You must install onto your current boot disk, even 12 though the installer does not enforce this, otherwise 13 things will not work. 10 If you are attempting to install on an OS X 10.8+ system, you may 11 see a message that Python can't be installed because it is from an 12 unidentified developer. This is because this Python installer 13 package is not yet compatible with the Gatekeeper security feature 14 introduced in OS X 10.8. To allow Python to be installed, you 15 can override the Gatekeeper policy for this install. In the Finder, 16 instead of double-clicking, control-click or right click the "Python" 17 installer package icon. Then select "Open using ... Installer" from 18 the contextual menu that appears. 14 19 15 MacPython consists of the Python programming language 16 interpreter, plus a set of programs to allow easy 17 access to it for Mac users including an integrated development 18 environment, IDLE, plus a set of pre-built extension modules 19 that open up specific Macintosh technologies to Python programs. 20 **** IMPORTANT **** 20 21 21 The installer puts the applications in "Python $VERSION" 22 in your Applications folder, command-line tools in 23 /usr/local/bin and the underlying machinery in 24 $PYTHONFRAMEWORKINSTALLDIR. 22 Update your version of Tcl/Tk to use IDLE or other Tk applications 23 ================================================================== 25 24 26 More information on MacPython can be found at 27 http://www.python.org/download/mac/. 25 To use IDLE or other programs that use the Tkinter graphical user 26 interface toolkit, you may need to install a newer third-party version 27 of the Tcl/Tk frameworks. Visit http://www.python.org/download/mac/tcltk/ 28 for current information about supported and recommended versions of 29 Tcl/Tk for this version of Python and of Mac OS X. 30 31 32 Using this version of Python on OS X 33 ==================================== 34 35 Python consists of the Python programming language interpreter, plus 36 a set of programs to allow easy access to it for Mac users including 37 an integrated development environment, IDLE, plus a set of pre-built 38 extension modules that open up specific Macintosh technologies to 39 Python programs. 40 41 The installer puts applications, an "Update Shell Profile" command, 42 and a link to the optionally installed Python Documentation into the 43 "Python $VERSION" subfolder of the system Applications folder, 44 and puts the underlying machinery into the folder 45 $PYTHONFRAMEWORKINSTALLDIR. It can 46 optionally place links to the command-line tools in /usr/local/bin as 47 well. Double-click on the "Update Shell Profile" command to add the 48 "bin" directory inside the framework to your shell's search path. 49 50 You must install onto your current boot disk, even though the 51 installer may not enforce this, otherwise things will not work. 52 53 You can verify the integrity of the disk image file containing the 54 installer package and this ReadMe file by comparing its md5 checksum 55 and size with the values published on the release page linked at 56 http://www.python.org/download/ 57 58 Installation requires approximately $INSTALL_SIZE MB of disk space, 59 ignore the message that it will take zero bytes. 28 60 29 61 More information on Python in general can be found at -
python/vendor/current/Mac/BuildScript/scripts/postflight.documentation
r2 r388 2 2 3 3 PYVER="@PYVER@" 4 FWK="/Library/Frameworks/Python.framework/Versions/${PYVER}" 5 FWK_DOCDIR_SUBPATH="Resources/English.lproj/Documentation" 6 FWK_DOCDIR="${FWK}/${FWK_DOCDIR_SUBPATH}" 7 APPDIR="/Applications/Python ${PYVER}" 8 SHARE_DIR="${FWK}/share" 9 SHARE_DOCDIR="${SHARE_DIR}/doc/python${PYVER}" 10 SHARE_DOCDIR_TO_FWK="../../.." 4 11 5 if [ -d /Developer/Documentation ]; then 6 if [ ! -d /Developer/Documentation/Python]; then7 mkdir -p /Developer/Documentation/Python 8 12 # make link in /Applications/Python m.n/ for Finder users 13 if [ -d "${APPDIR}" ]; then 14 ln -fhs "${FWK_DOCDIR}/index.html" "${APPDIR}/Python Documentation.html" 15 fi 9 16 10 ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation @PYVER@" 17 # make share/doc link in framework for command line users 18 if [ -d "${SHARE_DIR}" ]; then 19 mkdir -m 775 -p "${SHARE_DOCDIR}" 20 # make relative link to html doc directory 21 ln -fhs "${SHARE_DOCDIR_TO_FWK}/${FWK_DOCDIR_SUBPATH}" "${SHARE_DOCDIR}/html" 11 22 fi 23 -
python/vendor/current/Mac/BuildScript/scripts/postflight.framework
r2 r388 9 9 "${FWK}/bin/python@PYVER@" -Wi -tt \ 10 10 "${FWK}/lib/python${PYVER}/compileall.py" \ 11 - x badsyntax -x site-packages\11 -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 12 12 "${FWK}/lib/python${PYVER}" 13 13 14 14 "${FWK}/bin/python@PYVER@" -Wi -tt -O \ 15 15 "${FWK}/lib/python${PYVER}/compileall.py" \ 16 - x badsyntax -x site-packages\16 -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ 17 17 "${FWK}/lib/python${PYVER}" 18 19 "${FWK}/bin/python@PYVER@" -Wi \ 20 "${FWK}/lib/python${PYVER}/compileall.py" \ 21 -f -x badsyntax \ 22 "${FWK}/lib/python${PYVER}/site-packages" 23 24 "${FWK}/bin/python@PYVER@" -Wi -O \ 25 "${FWK}/lib/python${PYVER}/compileall.py" \ 26 -f -x badsyntax \ 27 "${FWK}/lib/python${PYVER}/site-packages" 18 28 19 29 chgrp -R admin "${FWK}" -
python/vendor/current/Mac/BuildScript/scripts/postflight.patch-profile
r2 r388 21 21 BSH="`basename "${theShell}"`" 22 22 case "${BSH}" in 23 bash|ksh|sh|*csh )23 bash|ksh|sh|*csh|zsh) 24 24 if [ `id -ur` = 0 ]; then 25 25 P=`su - ${USER} -c 'echo A-X-4-X@@$PATH@@X-4-X-A' | grep 'A-X-4-X@@.*@@X-4-X-A' | sed -e 's/^A-X-4-X@@//g' -e 's/@@X-4-X-A$//g'` … … 58 58 fi 59 59 echo "" >> "${RC}" 60 echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}"60 echo "# Setting PATH for Python ${PYVER}" >> "${RC}" 61 61 echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}" 62 62 echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}" … … 77 77 fi 78 78 ;; 79 zsh) 80 PR="${HOME}/.zprofile" 81 ;; 79 82 *sh) 80 83 PR="${HOME}/.profile" … … 87 90 fi 88 91 echo "" >> "${PR}" 89 echo "# Setting PATH for MacPython ${PYVER}" >> "${PR}"92 echo "# Setting PATH for Python ${PYVER}" >> "${PR}" 90 93 echo "# The orginal version is saved in `basename ${PR}`.pysave" >> "${PR}" 91 94 echo 'PATH="'"${PYTHON_ROOT}/bin"':${PATH}"' >> "${PR}"
Note:
See TracChangeset
for help on using the changeset viewer.