blob: 964f07449ec8f69876131cb744673ca70136770f [file] [log] [blame]
Jack Jansen8f2d8021996-08-05 15:34:45 +00001<HTML>
2<HEAD>
3<TITLE>Building Mac Python from source</TITLE>
4</HEAD>
5<BODY>
6<H1>Building Mac Python from source</H1>
7<HR>
Jack Jansen8f2d8021996-08-05 15:34:45 +00008
Jack Jansen4c1e56c1996-08-06 16:16:20 +00009This document explains how to build MacPython from source. This is
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000010necessary if you want to make modifications to the Python core. Building
11Python is not something to be undertaken lightly, you need a reasonable
12working knowledge of the CodeWarrior development environment, a good net
Jack Jansen4c1e56c1996-08-06 16:16:20 +000013connection and probably quite some time too. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +000014
Jack Jansene0b1e6a2002-01-08 23:03:45 +000015Note that if you only want to build new extension modules you don't need to
16build Python from source, see the <a href="#extending">note on extending Python</a>.<p>
17
Jack Jansen4c1e56c1996-08-06 16:16:20 +000018The information density in this file is high, so you should probably
19print it and read it at your leasure. Most things are explained only
20once (and probably in the wrong place:-). <p>
21
Jack Jansen90cf4912000-02-11 23:14:46 +000022<blockquote>
23First a warning: this information may become outdated if a new CodeWarrior is
24released after MacPython. The
25<a href="http://www.cwi.nl/~jack/macpython.html">MacPython homepage</a> will
Jack Jansene0b1e6a2002-01-08 23:03:45 +000026hopefully have updated instructions in that case. These instructions are for CW7.
Jack Jansen90cf4912000-02-11 23:14:46 +000027</blockquote>
28
Jack Jansenc256ece1999-02-03 13:09:27 +000029I am very interested in feedback on this document, send your
Jack Jansen4c1e56c1996-08-06 16:16:20 +000030comments to the <A
31HREF="http://www.python.org/sigs/pythonmac-sig/">Mac Python Special
32Interest Group</A>.
Jack Jansen8f2d8021996-08-05 15:34:45 +000033
34<H2>What you need.</H2>
35
36The following things you definitely need:
37
38<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +000039
Jack Jansen4c1e56c1996-08-06 16:16:20 +000040<LI> You need a MacPython source distribution, of course. You can
Jack Jansen16904092001-08-16 14:10:56 +000041obtain one via <A HREF="http://www.cwi.nl/~jack/macpython.html">
42http://www.cwi.nl/~jack/macpython.html</A> (which has up-to-date links
Jack Jansen95375861999-03-10 15:51:56 +000043to the other packages needed too) and possibly also from the standard
44<A HREF="ftp://ftp.python.org/pub/python/mac">python.org ftp
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000045site</A>. <BR>
Jack Jansenc256ece1999-02-03 13:09:27 +000046
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000047A better alternative is to check the sources straight out of the CVS
Jack Jansen95375861999-03-10 15:51:56 +000048repository, see below. Most of the packages mentioned here are also
49available through CVS. Check the section on <a href="#cvs">CVS
50repository use</a> below.
Jack Jansen8f2d8021996-08-05 15:34:45 +000051
Jack Jansen4c1e56c1996-08-06 16:16:20 +000052<LI> You need MetroWerks CodeWarrior. The current distribution has
Jack Jansene0b1e6a2002-01-08 23:03:45 +000053been built with CodeWarrior Pro 7.1. Ordering information is
Jack Jansen4c1e56c1996-08-06 16:16:20 +000054available on the <A HREF="http://www.metrowerks.com/">MetroWerks
Jack Jansen16904092001-08-16 14:10:56 +000055homepage</A>. Building Python with MPW, Think/Symantec C or the OSX
56developer tools is impossible without major surgery.
Jack Jansen4c1e56c1996-08-06 16:16:20 +000057
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000058<LI> You need GUSI version 2, the Grand Unified Socket Interface, by
59Matthias Neeracher. The original GUSI is obtainable from <A
Jack Jansen5f884c02000-12-12 22:14:14 +000060HREF="ftp://gusi.sourceforge.net/pub/gusi/">
61ftp://gusi.sourceforge.net/pub/gusi/</A>. At
Jack Jansene0b1e6a2002-01-08 23:03:45 +000062the moment Python is built with a modified version of GUSI
63with Carbon adaptations, so it may be better to check the <A
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000064HREF="http://www.cwi.nl/~jack/macpython.html">MacPython homepage</A>
65for a GUSI that is most easily used for building Python.
Jack Jansena598bc41999-02-10 23:08:24 +000066
Jack Jansen8f2d8021996-08-05 15:34:45 +000067</UL>
68
Jack Jansen4c1e56c1996-08-06 16:16:20 +000069<A NAME="optional">The MacPython project files are configured to
70include a plethora of optional modules</A>, and these modules need a
Jack Jansena2139fe1998-02-25 15:40:35 +000071number of extra packages. To use the project files as-is you have to
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000072download these packages too. Python has all such modules as
Jack Jansen4c1e56c1996-08-06 16:16:20 +000073dynamically loaded modules, so if you don't need a certain package it
Jack Jansen8a6cdcc2000-09-10 12:02:28 +000074suffices to just refrain from builing the extension module.
75Here are the locations for the various things
Jack Jansen4c1e56c1996-08-06 16:16:20 +000076you need:
Jack Jansen8f2d8021996-08-05 15:34:45 +000077
78<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +000079
Jack Jansene0b1e6a2002-01-08 23:03:45 +000080<LI> Tcl and Tk are somewhat less supported on the Mac than on Unix
81or Windows.
Jack Jansen8b41d532000-05-07 22:08:42 +000082See the section on <A HREF="#tcltk">building Tcl/Tk Python</A>
83below.
Jack Jansen8f2d8021996-08-05 15:34:45 +000084
Jack Jansen4c1e56c1996-08-06 16:16:20 +000085<LI> Waste, a TextEdit replacement written by Marco Piovanelli, <A
86HREF="mailto:piovanel@kagi.com">&lt;piovanel@kagi.com&gt;</A>. Python
Jack Jansenc1218bc2001-04-25 22:11:24 +000087was built using version 2.0, which is included in the CodeWarrior
88package. You can also obtain it from <A
Jack Jansen16904092001-08-16 14:10:56 +000089HREF="http://www.merzwaren.com/waste">&lt;http://www.merzwaren.com/waste&gt;</A>
Jack Jansen4c1e56c1996-08-06 16:16:20 +000090and various other places.
Jack Jansen8f2d8021996-08-05 15:34:45 +000091
Jack Jansen1473af71997-05-07 15:43:38 +000092<LI> Gdbm library for the Mac. Available from Jack's Mac software page at
93<A HREF="http://www.cwi.nl/~jack/macsoftware.html">
94http://www.cwi.nl/~jack/macsoftware.html</A> and <A HREF="ftp://ftp.cwi.nl/pub/jack/mac">
Jack Jansen16904092001-08-16 14:10:56 +000095ftp://ftp.cwi.nl/pub/jack/mac</A>.
Jack Jansen1473af71997-05-07 15:43:38 +000096
97<LI> JPEG library by the Independent JPEG Group. A version including
98Mac projects can be found at Jack's page mentioned above.
99The most recent JPEG library can always be obtained from <A
Jack Jansen16904092001-08-16 14:10:56 +0000100HREF="ftp://ftp.uu.net/graphics/jpeg/">ftp://ftp.uu.net/graphics/jpeg/</A>.
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000101
Jack Jansen1473af71997-05-07 15:43:38 +0000102<LI> The netpbm/pbmplus, libtiff, zlib and png libraries. The netpbm distribution
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000103(which includes libtiff) is generally available on Internet ftp
104servers. For Python pbmplus, an older incarnation of netpbm, is
105functionally identical to netpbm, since Python only uses the library
106and not the complete applications. A distribution with correct
Jack Jansen1473af71997-05-07 15:43:38 +0000107projects and library source only is available from, you guessed it, Jack's Mac software
Jack Jansen16904092001-08-16 14:10:56 +0000108page mentioned above.
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000109
Jack Jansen8f2d8021996-08-05 15:34:45 +0000110</UL>
111
112<H2>Setting Up</H2>
113
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000114Now that you have collected everything you should start with building
Jack Jansen1473af71997-05-07 15:43:38 +0000115the various parts. If you don't want to fix
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000116access paths try to set things up as follows:
117
Jack Jansen8f2d8021996-08-05 15:34:45 +0000118<PRE>
119Top-level-folder:
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000120 GUSI2
Jack Jansen8f2d8021996-08-05 15:34:45 +0000121 imglibs
Jack Jansende570301998-08-27 13:39:01 +0000122 jpeg
123 netpbm
124 libtiff
Jack Jansen1473af71997-05-07 15:43:38 +0000125 zlib
Jack Jansende570301998-08-27 13:39:01 +0000126 png
Jack Jansen1473af71997-05-07 15:43:38 +0000127 gdbm
Jack Jansen8f2d8021996-08-05 15:34:45 +0000128 Python
Jack Jansen90cf4912000-02-11 23:14:46 +0000129 Modules
130 ...
131 Mac
132 Modules
133 Build
134 ...
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000135 Tcl/Tk Folder 8.3.4
Jack Jansen8f2d8021996-08-05 15:34:45 +0000136</PRE>
137
Jack Jansende570301998-08-27 13:39:01 +0000138If your setup of the libraries is exactly the same as mine (which is
139not very likely, unless you happen to work from the same CVS
140repository) you can use the project <code>buildlibs.prj</code> in the
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000141<code>:Mac:Build</code> folder to build all needed libraries in one
Jack Jansende570301998-08-27 13:39:01 +0000142fell swoop, otherwise you will have to build the libraries one by
143one. <p>
144
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000145First build GUSI, both the normal one and the Carbon variant.
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000146 <p>
Jack Jansen95375861999-03-10 15:51:56 +0000147
Jack Jansen16e99c01996-09-07 17:11:26 +0000148Next, in
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000149<code>libjpeg</code>, <code>pbmplus</code>,
Jack Jansen1473af71997-05-07 15:43:38 +0000150<code>zlib</code>, <code>libpng</code>, <code>gdbm</code>,
Jack Jansena2139fe1998-02-25 15:40:35 +0000151and<code>libtiff</code> you build all projects. Usually the projects are in "mac"
Jack Jansen1473af71997-05-07 15:43:38 +0000152subfolders, sometimes they are in the main folder. Tcl/tk is a special
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000153case, see below.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000154
155<H2><A NAME="tcltk">Building Tcl/Tk</H2>
156
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000157Tkinter has been built with Tcl/Tk 8.3.4. Load the Mac source distribution
158from the tcl sourceforge site and build it. Build with CW7, but you will
159need CW6 to build the MDEF resource (or copy it from a binary
160installation). As of this writing the projects are CW6, so they need
161massaging to build with CW7, but this is a lot less work than applying
162all the workarounds for CW6 that the build instructions give. <P>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000163
Jack Jansen8b41d532000-05-07 22:08:42 +0000164Note that if you use a different release of Tcl and Tk than the ones
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000165I have used you may have to adapt the Python <code>tkresources.rsrc</code> file.
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000166This is easiest done by building <code>Tk8.3.shlb</code> and copying the TEXT, ICON
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000167and CRSR resources from it to <code>tkresources.rsrc</code>. This allows
168the <code>_tkinter</code> module to work without an installed Tk/Tcl on your
Jack Jansen8b41d532000-05-07 22:08:42 +0000169machine. <P>
170
171Also note that the <code>_tkinter.ppc.slb</code> that is normally distributed
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000172in the <code>lib-dynload</code> folder is the one from the Imaging extension,
Jack Jansen8b41d532000-05-07 22:08:42 +0000173which has some extra features needed by PIL (and which features should not
174hinder normal operation).
Jack Jansen27b10ec1996-08-23 15:44:18 +0000175
Jack Jansen8f2d8021996-08-05 15:34:45 +0000176</UL>
177
Jack Jansenf3dd5aa1996-12-23 17:29:51 +0000178Build first the Tcl library, then
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000179SimpleTcl (test it by typing <code>ls -l</code> in the window you get)
180then the Tk library, then SimpleTk (which can again be tested with
181<code>ls -l</code>). If this all worked you are all set to try
Jack Jansen8f2d8021996-08-05 15:34:45 +0000182building Python.
183
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000184<H2>Building Waste</H2>
185
186You do not need to build the Waste libraries, as Python includes the
Jack Jansena2139fe1998-02-25 15:40:35 +0000187source modules themselves.
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000188
Jack Jansen8f2d8021996-08-05 15:34:45 +0000189<H2>The organization of the Python source tree</H2>
190
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000191Time for a short break, while we have a look at the organization of
192the Python source tree. At the top level, we find the following
193folders:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000194
195<DL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000196<DT> Demo
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000197<DD> Demo programs that are not Mac-specific. Some of these may not
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000198work.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000199
200<DT> Extensions
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000201<DD> Extensions to the interpreter that are not Mac-specific. Contains
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000202the <code>img</code>, <code>Imaging</code> and <code>Numerical</code> extensions
203in this distribution.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000204
205<DT> Grammar
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000206<DD> The Python grammar. Included for reference only, you cannot build
207the parser on a Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000208
209<DT> Include
210<DD> Machine-independent header files.
211
212<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000213<DD> Machine-independent optional modules. Not all of these will work
214on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000215
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000216<DT> Lib
217<DD> Machine-independent modules in Python.
218
219<DT> Lib:lib-dynload
220<DD> This is where the Classic and Carbon dynamically-loaded plugin modules live.
221
Jack Jansen8f2d8021996-08-05 15:34:45 +0000222<DT> Objects
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000223<DD> Machine-independent code for various object types. Most of these are
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000224not really optional: the interpreter will not function without them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000225
226<DT> Parser
227<DD> The Python parser (machine-independent).
228
Jack Jansen8f2d8021996-08-05 15:34:45 +0000229<DT> Python
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000230<DD> The core interpreter. Most files are machine-independent, some
231are unix-specific and not used on the Mac.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000232
233<DT> Tools
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000234<DD> Tools for python developers. Contains <code>modulator</code> which
235builds skeleton C extension modules, <code>bgen</code> which generates
236complete interface modules from information in C header files and
237<code>freeze</code> which is used to turn Python scripts into real
238applications (used by MacFreeze and BuildApplication) There are some
239readme files, but more documentation is sorely needed.
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000240
Jack Jansen8f2d8021996-08-05 15:34:45 +0000241</DL>
242
243All the mac-specific stuff lives in the <code>Mac</code> folder:
244<DL>
Jack Jansenc256ece1999-02-03 13:09:27 +0000245<DT> Build
246<DD> This is where the project files live and where you build the
247libraries, shared libraries, executables and plugin modules. All the
248resulting binaries, except for intermedeate results, are deposited in
Jack Jansena598bc41999-02-10 23:08:24 +0000249the toplevel folder or the Mac:PlugIns folder (for plugin modules).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000250
251<DT> Compat
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000252<DD> Unix-compatability routines. Most of these are not used anymore,
253since GUSI provides a rather complete emulation, but you may need
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000254these if you are trying to build a non-GUSI python.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000255
256<DT> Demo
257<DD> Mac-specific demo programs, some of them annotated.
258
259<DT> Include
260<DD> Mac-specific but compiler-independent include files.
261
262<DT> Lib
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000263<DD> Mac-specific standard modules. The <code>Carbon</code> package
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000264contains modules specifically needed with various MacOS toolbox
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000265interface modules, both for Carbon and classic PPC, despite the name.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000266
267<DT> Modules
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000268<DD> Mac-specific builtin modules. Theoretically these are all
269optional, but some are rather essential (like
Jack Jansen16904092001-08-16 14:10:56 +0000270<code>macosmodule</code>). A lot of these modules are generated with
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000271<code>bgen</code>, in which case the bgen input files are included so
272you can attempt to regenerate them or extend them.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000273
274<DT> MPW
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000275<DD> MPW-specific files. These have not been used or kept up-to-date
276for a long time, so use at your own risk.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000277
278<DT> mwerks
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000279<DD> Mwerks-specific sources and headers. Contains glue code for
280Pythons shared-library architecture, a replacement for
281<code>malloc</code> and a directory with various projects for building
282variations on the Python interpreter. The <code>mwerks_*.h</code>
283files here are the option-setting files for the various interpreters
284and such, comparable to the unix command-line <code>-D</code> options
285to the compiler. Each project uses the correct option file as its
286"prefix file" in the "C/C++ language" settings. Disabling optional
287modules (for the 68K interpreter), building non-GUSI interpreters and
288various other things are accomplished by modifying these files (and
289possibly changing the list of files included in the project window, of
290course).
Jack Jansen8f2d8021996-08-05 15:34:45 +0000291
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000292<DT> OSX
293<DD> Specific to unix-Python (also known as MachoPython) on OSX, not used
294by MacPython.
295
296<DT> OSXResources
297<DD> Specific to unix-Python (also known as MachoPython) on OSX, not used
298by MacPython.
Jack Jansenc256ece1999-02-03 13:09:27 +0000299
Jack Jansen8f2d8021996-08-05 15:34:45 +0000300<DT> Python
301<DD> Mac-specific parts of the core interpreter.
302
303<DT> Resources
304<DD> Resource files needed to build the interpreter.
305
306<DT> Scripts
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000307<DD> A collection of various mac-specific Python scripts. Some are
308essential, some are useful but few are documented, so you will have to
309use your imagination to work them out.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000310
Jack Jansenc256ece1999-02-03 13:09:27 +0000311<DT> Tools
312<DD> A collection of tools, usually bigger than those in the scripts
313folder. The important ones here are the IDE and macfreeze. The IDE is built
314with the buildIDE.py script, which puts the resulting applet in the toplevel
315folder. Macfreeze is usually invoked through the BuildApplication script,
316but for more control over the freezing process you can run the main script here.
317
318
Jack Jansen8f2d8021996-08-05 15:34:45 +0000319<DT> Unsupported
320<DD> Modules that are not supported any longer but may still work with a little effort.
321</DL>
322
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000323<H2>Building the PPC interpreter</H2>
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000324<em>This is different since 2.1. You are best off using the fullbuild.py
Jack Jansen16904092001-08-16 14:10:56 +0000325script, see <a href="#fullbuild">below</a>. </em><p>
326
Jack Jansenc256ece1999-02-03 13:09:27 +0000327First you optionally build the external libraries with buildlibs.prj. Next,
328the projects for
Jack Jansen16904092001-08-16 14:10:56 +0000329interpreter and core library are linked together, so
330building the PythonInterpreterClassic and/or PythonInterpreterCarbon target
331in <code>PythonInterpreter.prj</code>
332will result in everything being built. The result, however, is an "Application
333template", (filetype Atmp). If you don't use fullbuild you can manually
334turn either of these into an interpreter by copying it to PythonInterpreter
335and setting the filetype to APPL (with ResEdit or some such). <p>
336
337Fullbuild does this for you, and the Atmp files is also how ConfigurePythonCarbon
338and ConfigurePythonClassic work their magic. <p>
Jack Jansenc256ece1999-02-03 13:09:27 +0000339
340For completeness sake here is a breakdown of the projects:
Jack Jansen8f2d8021996-08-05 15:34:45 +0000341
342<DL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000343
Jack Jansen16904092001-08-16 14:10:56 +0000344<DT> PythonCore
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000345<DD> The shared library that contains the bulk of the interpreter and
Jack Jansen16904092001-08-16 14:10:56 +0000346its resources. It has targets for PythonCore and PythonCoreCarbon.
347It is a good idea to immedeately put an alias to this
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000348shared library in the <code>Extensions</code> folder of your system
349folder. Do exactly that: put an <em>alias</em> there, copying or
Jack Jansen3412c5d1997-08-27 14:08:22 +0000350moving the file will cause you grief later if you rebuild the library and
Jack Jansen16904092001-08-16 14:10:56 +0000351forget to copy it to the extensions folder again. The ConfigurePythonXXX applets
352will also do this. <br>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000353
Jack Jansen3b805261999-02-14 23:12:06 +0000354<DT> PythonInterpeter
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000355<DD> The interpreter. This is basically a routine to call out to the
Jack Jansen3b805261999-02-14 23:12:06 +0000356shared library. Unlike in previous releases the same program is used for
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000357creating applets (for which formerly PythonApplet was used). There are 4 targets
358in here: two for the classic and carbon templates (which are normally used, and
359converted to PythonInterpreter by the ConfigurePython* applets) and two
360for PythonInterpreter in it's classic and carbon version.<p>
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000361
Jack Jansenc256ece1999-02-03 13:09:27 +0000362<DT> Plugin projects
Jack Jansen16904092001-08-16 14:10:56 +0000363<DD> Each plugin module has a separate project, and these can be rebuilt on
364the fly. Fullbuild (or actually it's little helper genpluginprojects) takes
365care of this.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000366</DL>
367
Jack Jansen3412c5d1997-08-27 14:08:22 +0000368After creating the alias to <code>PythonCore</code> you remove any old
Jack Jansen16904092001-08-16 14:10:56 +0000369<code>Python XXXX Preferences</code> file from the <code>Preferences</code> folder
Jack Jansen061ac501996-10-22 15:27:56 +0000370(if you had python installed on your system before) and run the interpreter once
Jack Jansen3412c5d1997-08-27 14:08:22 +0000371to create the correct preferences file. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000372
Jack Jansenc256ece1999-02-03 13:09:27 +0000373Next, you have to build the extension modules.
Jack Jansen16904092001-08-16 14:10:56 +0000374If you don't use fullbuild simply open each project and build it.
Jack Jansena598bc41999-02-10 23:08:24 +0000375<p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000376
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000377Finally, you must build the standard applets:
Jack Jansen16904092001-08-16 14:10:56 +0000378<code>EditPythonPrefs</code>, <code>BuildApplet</code>, etc. For the N-th time:
379fullbuild does this for you, but you can also manually drag/drop them onto
380BuildApplet. <p>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000381
382<BLOCKQUOTE>
Jack Jansen16904092001-08-16 14:10:56 +0000383<a name="fullbuild"></a>
384The <code>fullbuild</code> script can be used to build
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000385everything, but you need a fully-functional interpreter before you can
386use it (and one that isn't rebuilt in the process: you cannot rebuild
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000387a running program). You could copy the interpreter to a different
388place and use that to run fullbuild. The <code>PythonStandSmall.prj</code>
389project builds an interpreter that is suited to this, and it can also come
390in handy if you need to debug things (which is easier in a static program). <p>
Jack Jansene66b8c81997-05-29 14:57:07 +0000391
Jack Jansen8f2d8021996-08-05 15:34:45 +0000392</BLOCKQUOTE>
393
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000394You are all set now, and should read the release notes and
Jack Jansen3412c5d1997-08-27 14:08:22 +0000395<code>ReadMe</code> file from the <code>Mac</code> folder.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000396
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000397Rebuilding .exp files is no longer needed since CodeWarrior 7.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000398
Jack Jansen95375861999-03-10 15:51:56 +0000399<H2><a name="cvs">Using the CVS source archive</a></H2>
Jack Jansenc256ece1999-02-03 13:09:27 +0000400
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000401It is possible (and probably best) to access the Python sources through remote CVS. The
Jack Jansen65f685b1999-04-12 09:25:23 +0000402advantage of this is that you get the very latest sources, so any bug
403fixed or new features will be immedeately available. This is also the
404disadvantage, of course: as this is the same tree as is used for
405development it may sometimes be a little less stable. <p>
Jack Jansenc256ece1999-02-03 13:09:27 +0000406
407The CVS client of choice is Alexandre Parenteau's MacCVS. It can be
Jack Jansen65f685b1999-04-12 09:25:23 +0000408obtained through the <a href="http://www.wincvs.org">WinCVS
409homepage</a>. MacCVS uses Internet Config to set file types correctly
410based on the filename extension. In the maccvs preferences you should
411also set (in the "binary files" section) "use mac encoding:
412applesingle" and (in the "text files" section) "use ISO latin 1
Jack Jansenc256ece1999-02-03 13:09:27 +0000413conversion". <p>
414
Jack Jansen16904092001-08-16 14:10:56 +0000415<blockquote>
416There is one group of people for whom MacCVS is not the best choice: people with
417checkin rights to the Python repository. You will have to use MacCVS Pro
418(completely unrelated) from www.maccvs.org, because it has working SSH support.
419</blockquote>
420
421It is a good idea to disable Quicktime Exchange in the Quicktime
Jack Jansen8b41d532000-05-07 22:08:42 +0000422control panel. Quicktime Exchange will magically map some extensions to
423filetypes, and this can seriously hinder you if, for instance, <code>.bmp</code>
424is not a Windows bitmap file. <p>
425
Jack Jansen16904092001-08-16 14:10:56 +0000426The Python sources are checked out from the main
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000427Python CVS archive on sourceforge.net, see the <a
Jack Jansen65f685b1999-04-12 09:25:23 +0000428href="http://www.python.org/download/cvs.html">Source access via
429CVS</a> page for details. When you check the sources out you will get
Jack Jansen95375861999-03-10 15:51:56 +0000430something like <code>Python:dist:src</code>, and under that the
Jack Jansen16904092001-08-16 14:10:56 +0000431<code>Modules</code>, <code>Lib</code>, <code>Mac</code> etc hierarchy. The
432<code>src</code> folder can be renamed to <code>Python</code>, and
Jack Jansen95375861999-03-10 15:51:56 +0000433is what this document refers to as the "toplevel Python folder". <P>
Jack Jansenc256ece1999-02-03 13:09:27 +0000434
Jack Jansen16904092001-08-16 14:10:56 +0000435The CVS repository does not contain all the projects for the plugin modules,
436these are built with <code>fullbuild.py</code> normally. For this reason
437it is probably a good idea to first build <code>PythonStandSmall.prj</code>,
438which builds a fairly minimal interpreter, and then follow the
439<a href="#fullbuild">fullbuild instructions</a>.
Jack Jansendae108c2000-02-11 23:17:14 +0000440
Jack Jansen8f2d8021996-08-05 15:34:45 +0000441<H2>Odds and ends</H2>
442
443Some remarks that I could not fit in elsewhere:
444
445<UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000446
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000447<LI> It may be possible to use the <code>PythonCore</code> shared
448library to embed Python in another program, if your program can live
Jack Jansen1473af71997-05-07 15:43:38 +0000449with using GUSI for I/O. Use PythonCore in stead of your MSL C library
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000450(or, at the very least, link it before the normal C library).
Jack Jansen4c1e56c1996-08-06 16:16:20 +0000451
Jack Jansene0b1e6a2002-01-08 23:03:45 +0000452<LI> <a name="extending"></a>It is possible to build PPC extension
453modules without building a complete Python. The binary distribution
454installer can optionally install all the needed folders (the develop
455option). A template for a dynamic module can be found in
Jack Jansen3412c5d1997-08-27 14:08:22 +0000456<code>xx.prj</code>.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000457
458<LI> The Python shared library architecture is a variant of the architecture
459described as "application with shared libraries and dropins" in the MetroWerks
460"Targeting MacOS" documentation. The Python Application and applet-template use
Jack Jansen1473af71997-05-07 15:43:38 +0000461the <code>MSL AppRuntime.Lib</code> runtime library (with properly set CFM
462initialization and termination routines). PythonCore uses <code>MSL Runtime.Lib</code>,
463which is really intended for standalone programs but which we fool into working by
464providing a dummy main program.
Jack Jansen27b10ec1996-08-23 15:44:18 +0000465It is linked statically into PythonCore (and exported to the applications and plugins)
466so we do not have to distribute yet another shared library. Plugin modules use
Jack Jansen1473af71997-05-07 15:43:38 +0000467<code>MSL ShlibRuntime.Lib</code> (not the dropin runtime: modules are never unloaded)
468and obtain the rest from PythonCore. PythonCore uses a
Jack Jansen27b10ec1996-08-23 15:44:18 +0000469non-standard initialization entry point, <code>__initialize_with_resources</code>, to
Jack Jansen1473af71997-05-07 15:43:38 +0000470be able to obtain resources from the library file later on. Plugins can do the same
471(_tkinter does) or use the standard <code>__initialize</code> entry point.
Jack Jansen8f2d8021996-08-05 15:34:45 +0000472
473
Jack Jansen6ad8d131997-01-15 16:53:37 +0000474</UL>
Jack Jansen8f2d8021996-08-05 15:34:45 +0000475</BODY>
476</HTML>