blob: dc9783c3e1becf9891fd96382684dde4fa08aba6 [file] [log] [blame]
Jack Jansenf7e57142001-09-08 21:38:26 +00001How to install Python 2.2a3 on your Macintosh
Jack Jansencbed91b2001-08-03 13:31:36 +00002---------------------------------------------
Jack Jansen2f9a9e32001-02-17 22:03:42 +00003
Jack Jansenc1218bc2001-04-25 22:11:24 +00004This is a MacPython that can run on classic MacOS (from 8.1
Jack Jansencbe7b1c2001-03-06 22:42:12 +00005onwards) and natively on MacOSX. The installer tries to work out whether you can
Jack Jansencbed91b2001-08-03 13:31:36 +00006use the Carbon version or not.
Jack Jansen2f9a9e32001-02-17 22:03:42 +00007
Jack Jansen028f2d52001-08-29 22:04:08 +00008You should definitely read the Relnotes file too, and the section below about
9toolbox module reorganization.
Jack Jansen2f9a9e32001-02-17 22:03:42 +000010
Jack Jansenc1218bc2001-04-25 22:11:24 +000011A special note about the active installer: do not background it, it may hang
Jack Jansen2b73fe92001-03-27 21:38:55 +000012your machine. This is a general problem with Vise active installers, MindVision
13are working on it.
Jack Jansen8ef786e2001-03-15 14:27:09 +000014
Jack Jansenf7e57142001-09-08 21:38:26 +000015Aside from the general new Python 2.2a3 listed in the general relnotes file
Jack Jansen028f2d52001-08-29 22:04:08 +000016there is some other new machine-independent stuff in this release as well, as
Jack Jansenf7e57142001-09-08 21:38:26 +000017it was built from newer sources than unix/windows 2.2a3.
Jack Jansen2f9a9e32001-02-17 22:03:42 +000018------
Jack Jansen83cab721997-08-26 13:25:06 +000019
20If this is your first encounter with Python: you definitely need the
21common user documentation (common to all platforms). You can find this
Jack Jansen538bd132000-10-19 21:58:27 +000022(in various forms) on www.pythonlabs.com, www.python.org and
23ftp.python.org. Through there, or via
24http://www.cwi.nl/~jack/macpython.html you can also find the most recent
25MacPython distribution.
Jack Jansen83cab721997-08-26 13:25:06 +000026
27Mac-specific documentation is included in this distribution in folder
28Mac:Demo. The documentation is sparse, but it will have to serve for
29now. The documentation is in HTML format, start with index.html.
30
Jack Jansencbe7b1c2001-03-06 22:42:12 +000031This installer installs MacPython for classic PPC MacOS, MacPython for Carbon
32(OS X, OS 9 or OS8 with CarbonLib installed) or both, depending on your
33configuration. By selecting custom install you can bypass these tests and
34install what you want.
Jack Jansenecbc1cc1998-01-06 12:13:16 +000035
Jack Jansen2b73fe92001-03-27 21:38:55 +000036If you want 68k support you will have to stay with MacPython 1.5.2.
Jack Jansen965226b2000-09-14 20:58:24 +000037
Jack Jansen028f2d52001-08-29 22:04:08 +000038Toolbox module reorganization and more
39--------------------------------------
40
41You can safely skip this section if this is your first encounter with MacPython.
42
43I am working on a new organization of the mac-specific modules, and in
44general bringing the MacPython folder structure more in line with
45unix-Python. This is not only a good idea, it will also immensely
46facilitate moving MacPython functionality to an OSX Python that is based
47on Mach-O and the unix-Python distribution. But don't worry: MacPython
48is definitely not dead yet, and the hope is that the transition will be
49as seamless as possible.
50
51First a change that should not cause too much concern: :Mac:Plugins has
52gone, and most of the dynamically loaded modules have moved to
53:Lib:lib-dynload.
54
55Second, and more important: the toolbox modules, such as Res and
56Resource, have moved to a Carbon package. So, in stead of "import Res"
57you should now say "from Carbon import Res" and in stead of "from Res
58import *" you should use "from Carbon.Res import *". For the lifetime of
59MacPython 2.2 there is a folder :Mac:Lib:lib-compat on sys.path that
60contains modules with the old names which imports the new names after
61issuing a warning.
62
63Note that although the package is called Carbon the modules work fine under
64classic PPC, and they are normal classic modules. Also note that some
65modules you may think of as toolbox modules (such as Waste) really are not,
66and they are not in the Carbon package.
67
68Some open issues I would like to discuss on the PythonMac-SIG, please join
69in if you have views on the matter:
70- Is this all a good idea?
71- Some modules are not in the Carbon package (icglue, for instance, or
72 supporting module such as aetools and aepack) and maybe they should be,
73 some are (ControlAccessors) which arguably should not. Opinions are welcome.
74- I'm tempted to put Qt and QuickTime into their own package, especially
75 since I'm also working on porting it to Windows. It would also be in line
76 with Apple's organization. Opinions?
77- Should we get rid of the Res/Resource dichotomy, where the first is the
78 extension module and the second is the Python module with the constants?
79 We could simply import the extension module functionality into the Python
80 module, at the expense of a rather large namespace.
81- Should we have a Carbon.Carbon module that simply imports the whole world,
82 so that "from Carbon.Carbon import *" is pretty much equivalent to the C
83 #include <Carbon/Carbon.h>?
84- Should we put all the other Mac modules into a Mac package? This will make
85 MacPython programs a lot more verbose, but that is a good thing too if people
86 try to port Mac Python scripts to other platforms.
87 Should the Carbon package then be a sub-package of the Mac package?
88
89Another change related to the OSX growth path is that there is a new module
90macresource that you can use to easily open a resource file accompanying your
91script. Use "macresource.need("DLOG", MY_DIALOG_ID, "name.rsrc") and if the
92given resource is not available (it _is_ available if your script has been
93turned into an applet) the given resource file will be opened. This method will
94eventually also contain the magic needed to open the resource file on
95OSX MachO Python.
96
97... and more
98------------
99
100A feature that I am not sure about (so: feedback!) is that if you open a textfile
101for reading MacPython will now accept either unix linefeeds (LF, '\n') or
102Macintosh linefeeds (CR, '\r') and present both of them as '\n'. This is done on
103a low level, so it works for files opened by scripts as well as for your scripts
Jack Jansenf7e57142001-09-08 21:38:26 +0000104and modules itself. This can be turned off with a preference/startup option.
Jack Jansen028f2d52001-08-29 22:04:08 +0000105
106But:
107- this works only for input, and there's no way to find out what the original
108 linefeed convention of the file was.
Jack Jansen028f2d52001-08-29 22:04:08 +0000109- Windows \r\n linefeeds are not supported and get turned into \n\n.
110
Jack Jansen83cab721997-08-26 13:25:06 +0000111What to install
112---------------
113
Jack Jansen12a37b72000-05-06 23:01:07 +0000114The optional parts in this distribution are
115- TK+PIL: Tkinter and support modules, plus Imaging, the Python image manipulation
116 package (allows you to read, write and display images and do lots of operations on them).
Jack Jansencbe7b1c2001-03-06 22:42:12 +0000117 For Carbon MacPython you only get PIL: there is no Tcl/Tk for Carbon yet.
Jack Jansen2b73fe92001-03-27 21:38:55 +0000118 This is the reason Classic MacPython is also installed on MacOSX: it allows you
Jack Jansen028f2d52001-08-29 22:04:08 +0000119 to run Tkinter applications, albeit in the Classic box.
Jack Jansen12a37b72000-05-06 23:01:07 +0000120- img: another imaging package. Has more file format support and is faster
121 than imaging, but has only limited operations on images. There is a bridge
122 between the packages.
123- Numeric: the LLNL Numeric Python extension. All sorts of nifty operations
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000124 on matrices and such. This is the most recent version from the sourceforge archive.
Jack Jansencbe7b1c2001-03-06 22:42:12 +0000125 Numeric has moved from Extensions to :Lib:site-python, by the way, see the release
126 notes.
Jack Jansen12a37b72000-05-06 23:01:07 +0000127- Developers kit: all header files and some tools and sample projects to get you started on
128 writing Python extensions if you have CodeWarrior.
129All these except the DevKit are installed with Easy Install.
Jack Jansen83cab721997-08-26 13:25:06 +0000130
Jack Jansencbe7b1c2001-03-06 22:42:12 +0000131After the installer finishes it automatically launches the appropriate
Jack Jansen2b73fe92001-03-27 21:38:55 +0000132ConfigurePython applet, to finish configuration of your Python. If you run MacOS9 or later
Jack Jansencbe7b1c2001-03-06 22:42:12 +0000133(or 8 with CarbonLib installed) you can switch back and forth between the classic and
134Carbon versions of Python by running either ConfigurePythonClassic or ConfigurePythonCarbon.
Jack Jansen83cab721997-08-26 13:25:06 +0000135
Jack Jansen2e42bdd2000-11-14 20:37:37 +0000136Moving your Python installation after installing is generally not a good idea.
137If you have to do this anyway you should remove your preference file, run
Jack Jansen2f9a9e32001-02-17 22:03:42 +0000138ConfigurePython and remove all .pyc files. (there's a script zappyc.py that does
139the latter).
Jack Jansen2e42bdd2000-11-14 20:37:37 +0000140
Jack Jansen83cab721997-08-26 13:25:06 +0000141If you don't have enough memory: the sizes choosen are somewhat
Jack Jansen9080e9b2001-01-23 21:03:52 +0000142arbitrary, and they are as high as they are so that test.autotest runs with fewer
143problems. An average Python program can make do with much less memory.
144Try lowering the application sizes in the finder "get info"
145window, and seeing whether the resulting python is still usable.
Jack Jansen83cab721997-08-26 13:25:06 +0000146
Jack Jansen83cab721997-08-26 13:25:06 +0000147After installing
148----------------
149
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000150It is probably a good idea to run the automatic tests. Start
Jack Jansenf7e57142001-09-08 21:38:26 +0000151Python and "import test.regrtest ; test.regrtest.main()".
Jack Jansende519092000-10-12 21:21:43 +0000152
Jack Jansenf7e57142001-09-08 21:38:26 +0000153test_time will fail because MacPython accepts bogus values for mktime(), this
154will be fixed later.
155
156test_descrtut will fail because of a problem with the test itself.
157
158Three tests will fail on MacOS9 with MemoryErrors:
Jack Jansencbed91b2001-08-03 13:31:36 +0000159test_longexp, test_sha and test_zlib (on MacOSX nothing should fail).
Jack Jansen2b73fe92001-03-27 21:38:55 +0000160
Jack Jansen2f9a9e32001-02-17 22:03:42 +0000161If you increase the PythonInterpreter memory
Jack Jansen2b73fe92001-03-27 21:38:55 +0000162partition size they will pass (but for longexp you have to increase it by an
Jack Jansen99e607a2001-05-10 12:20:30 +0000163incredible amount, 400MB is rumoured). It will, however, print some messages
Jack Jansen2e42bdd2000-11-14 20:37:37 +0000164about optional features not supported. You should not worry about these,
165they are modules that are supported by Python on other platforms. Also,
166if you didn't run compileall before autotesting you may run out of
167memory the first time you run the tests. test_socket may also fail if
168you have no internet connection. Please also read the Relnotes file for
169other minor problems with this distribution.
Jack Jansen83cab721997-08-26 13:25:06 +0000170
Jack Jansen12a37b72000-05-06 23:01:07 +0000171Using Python is most easily done from the IDE, which has a builtin editor,
172debugger and other goodies. The alternative is to use PythonInterpreter,
173which is the lowlevel interpreter with a console-window only (similar to Unix
174Python).
Jack Jansen83cab721997-08-26 13:25:06 +0000175
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000176If your program uses Tkinter you MUST run it under PythonInterpreter, Tkinter
177and IDE are incompatible and your program will fail in strange ways.
178
Jack Jansen0b726951997-10-08 15:34:42 +0000179Uninstalling
180------------
181
182Two items are installed in the system folder: the interpreter shared
Jack Jansen2f9a9e32001-02-17 22:03:42 +0000183libraries PythonCore and PythonCoreCarbon lives in the Extensions folder and the
Jack Jansenf7e57142001-09-08 21:38:26 +0000184"Python 2.2a3 Preferences" file in the Python subfolder in the
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000185Preferences folder. All the rest of Python lives in the folder you
186installed in.
Jack Jansen0b726951997-10-08 15:34:42 +0000187
Jack Jansenc1218bc2001-04-25 22:11:24 +0000188On OSX the libraries are installed in /Library/CFMSupport. There is a nasty bug
189in OSX that is triggered by Python: if any orphaned aliases are left in
190/Library/CFMSupport your machine will start to behave very badly. 2.1
191beta installers triggered this problem if you simply threw away your Python folder,
192so if you installed a 2.1beta you should clean out the aliases in /Library/CFMSupport
Jack Jansen028f2d52001-08-29 22:04:08 +0000193too. The final 2.1 and 2.1.1 installers always copied the shared libraries on OSX, so it does
Jack Jansenc1218bc2001-04-25 22:11:24 +0000194not have the problem anymore.
195
Jack Jansen83cab721997-08-26 13:25:06 +0000196Things to see
197-------------
198
Jack Jansen12a37b72000-05-06 23:01:07 +0000199Start off at Mac:Demo:index.html. Read at least the first few sections.
200
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000201There are also some interesting files in the "Relnotes" folder that may
Jack Jansen83cab721997-08-26 13:25:06 +0000202contain useful information. There is also a first stab at documentation
203(plus examples) in the Mac:Demo folder. The toplevel Demo folder has
Jack Jansen12a37b72000-05-06 23:01:07 +0000204machine-independent demos.
205The Mac:Lib:test folder also has some programs that show simple
Jack Jansen83cab721997-08-26 13:25:06 +0000206capabilities of various modules.
207
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000208The ":Mac:scripts" folder has some sample scripts. Some are useful, some are
Jack Jansen83cab721997-08-26 13:25:06 +0000209just interesting to look at to see how various things work. The MkDistr,
210mkapplet and fullbuild scripts (plus the ones mentioned above) may help
211you to understand how to use AppleEvents and various other toolboxes
212from python.
213
Jack Jansen8a6cdcc2000-09-10 12:02:28 +0000214Other mac-specific goodies can be found in :Mac:Tools, of which the IDE sources
215and a CGI framework deserve special mention.
216
Jack Jansen83cab721997-08-26 13:25:06 +0000217The 'img' group of modules, which handles I/O of many different image
Jack Jansend0ddb661998-04-27 15:14:36 +0000218formats is included, but without documentation. You can find docs at
219ftp://ftp.cwi.nl/pub/jack/python/img (or somewhere around there).
220
221Finally there is a Mac:Contrib folder which contains some contributed
Jack Jansen12a37b72000-05-06 23:01:07 +0000222software.
Jack Jansen83cab721997-08-26 13:25:06 +0000223
224Upgrading from older Python releases
225------------------------------------
226
Jack Jansen2f9a9e32001-02-17 22:03:42 +0000227Python releases are independent of each other, with
Jack Jansen83cab721997-08-26 13:25:06 +0000228separate Preferences files, shared library names, etc. The good news is
229that this means you can keep your older version around if you are unsure
230whether to upgrade. The bad news is that your old preference settings
231are lost and you have to set them again.
232
Jack Jansenf7e57142001-09-08 21:38:26 +0000233After you are satisfied that 2.2a3 works as expected you can trash
Jack Jansen83cab721997-08-26 13:25:06 +0000234anything in the system folder that has "python" in the name and not
Jack Jansenf7e57142001-09-08 21:38:26 +0000235"2.2a3".
Jack Jansen83cab721997-08-26 13:25:06 +0000236
Jack Jansen028f2d52001-08-29 22:04:08 +0000237The ConfigurePython... applets will try to detect incompatible preferences
Jack Jansen2b73fe92001-03-27 21:38:55 +0000238files and offer to remove them. This means that re-running ConfigurePython after
239a second install of the same MacPython version (or after moving the Python folder)
240should fix things up correctly.
241
Jack Jansen83cab721997-08-26 13:25:06 +0000242The installer
243-------------
244
Jack Jansen12a37b72000-05-06 23:01:07 +0000245The installer for this product was created using Installer VISE
246from MindVision Software. For more information on Installer VISE,
Jack Jansen83cab721997-08-26 13:25:06 +0000247contact:
248MindVision Software
2497201 North 7th Street
250Lincoln, NE 68521-8913
251Voice: 402-477-3269
252Fax: 402-477-1395
253Internet: mindvision@mindvision.com
254http://www.mindvision.com
255
Jack Jansen12a37b72000-05-06 23:01:07 +0000256Just van Rossum <just@letterror.nl> created the initial version of the
257installer (with Installer Vise Lite), and Jack worked from there.
Jack Jansen83cab721997-08-26 13:25:06 +0000258
Jack Jansen01ae9eb2000-04-22 22:57:25 +0000259Thanks!
260-------
261
Jack Jansen965226b2000-09-14 20:58:24 +0000262Thanks go to the whole Python community with Guido in the lead, of
263course. Mac-specific thanks go to the pythonmac-sig, Just van Rossum,
264Corran Webster, Tony Ingraldi, Erik van Blokland, Bill Bedford, Chris
265Stern, Gordon Worley, Oliver Steele, M. Papillon, Steven Majewski, David
Jack Jansen538bd132000-10-19 21:58:27 +0000266Goodger, Chris Barker, Luc Lefebvre, Tattoo Mabonzo K., Russell Finn,
Jack Jansenf7e57142001-09-08 21:38:26 +0000267Tom Bridgman, Russel Owen, Pascal Oberndoerfer, Dean Draayer,
268Alexandre Parenteau,
Jack Jansende1d4952001-08-27 15:30:48 +0000269and all the other people who provided feedback, code or both!
Jack Jansen01ae9eb2000-04-22 22:57:25 +0000270
Jack Jansende519092000-10-12 21:21:43 +0000271MacPython includes waste, a TextEdit replacement which is (c) 1998 Marco Piovanelli.
272
Jack Jansen9080e9b2001-01-23 21:03:52 +0000273A special mention is deserved by Matthias Neeracher, who has written the brilliant
274unix-compatible GUSI I/O library, without which MacPython would not have sockets
275or select, and to Alexandre Parenteau, who has ported this library to Carbon.
276
Jack Jansen83cab721997-08-26 13:25:06 +0000277Feedback
278--------
279
280Send bug reports, suggestions, contributions and fanmail to
Jack Jansenecbc1cc1998-01-06 12:13:16 +0000281<jack@cwi.nl>. However, a better way to discuss MacPython is to join the
Jack Jansen83cab721997-08-26 13:25:06 +0000282<pythonmac-sig@python.org> mailing list, which is explicitly meant for
283this purpose.
284
Jack Jansenb25ec912001-03-05 15:44:55 +0000285
Jack Jansen83cab721997-08-26 13:25:06 +0000286Jack Jansen
Jack Jansen12a37b72000-05-06 23:01:07 +0000287Oratrix Development BV
288Valeriusplein 30
289Amsterdam
Jack Jansen83cab721997-08-26 13:25:06 +0000290the Netherlands
291
292<jack@cwi.nl>, http://www.cwi.nl/~jack