Jack Jansen | d8d7bbe | 2002-11-20 14:07:57 +0000 | [diff] [blame] | 1 | Building a MacPython-OSX on top of Jaguar's /usr/bin/python |
| 2 | ----------------------------------------------------------- |
| 3 | |
| 4 | One way of getting MacPython functionality is to use the Python that Apple |
| 5 | supplies since MacOSX 10.2, and extend this with the missing bits. |
| 6 | |
| 7 | (Another way is building a framework python, see Mac/OSX/README for |
| 8 | details on that). |
| 9 | |
| 10 | Preparation |
| 11 | ----------- |
| 12 | |
| 13 | First of all you have to fix two things in the python distributed |
| 14 | by Apple. This paragraph is valid for 10.2 through 10.2.2, so if you |
| 15 | have a later version of Jaguar your mileage may vary. |
| 16 | |
| 17 | 1. /usr/lib/python2.2/config/Makefile has an erronuous reference to |
| 18 | building for intel processors. Edit the file with sudo, and change |
| 19 | the line |
| 20 | LDFLAGS= -arch i386 -arch ppc |
| 21 | to |
| 22 | LDFLAGS= -arch ppc |
| 23 | 2. /usr/lib/python2.2/site-packages is not writeable except by root. |
| 24 | Make it writeable by administrators by doing |
| 25 | sudo chgrp admin /usr/lib/python2.2/site-packages |
| 26 | sudo chmod g+w /usr/lib/python2.2/site-packages |
| 27 | Alternatively you can do the make's below as superuser, but I |
| 28 | would advise against this. |
| 29 | |
| 30 | Building |
| 31 | -------- |
| 32 | |
| 33 | Typing "make -f Makefile.jaguar" will build and install almost everything you need. |
| 34 | If you also want the "pythonw" unix program, which allows you to run GUI scripts from |
| 35 | a Terminal window, you should also do "sudo make -f Makefile.jaguar install_pythonw". |
| 36 | |
| 37 | What do you get |
| 38 | --------------- |
| 39 | |
| 40 | After the make you will have a folder /Applications/MacPython-OSX that contains the |
| 41 | IDE and BuildApplet applications. Also, you will find a folder "python-additions" there |
| 42 | that contains the MacPython-specific additions to your installed Python. The only thing |
| 43 | that is installed outside the /Applications/MacPython-OSX folder is |
| 44 | /usr/lib/python2.2/site-packages/MacPython.pth, which is the magic file that will make |
| 45 | python find the new modules. |
| 46 | |
| 47 | Uninstalling |
| 48 | ------------ |
| 49 | 1. Remove /Applications/MacPython-OSX |
| 50 | 2. Remove /usr/lib/python2.2/site-packages/MacPython.pth |
| 51 | |
| 52 | How does it work? |
| 53 | ----------------- |
| 54 | |
| 55 | Makefile.jaguar does most of the work by calling on Makefile (which is normally used |
| 56 | to build the Mac extensions for a framework-based python) after setting various |
| 57 | variables such that everything is built for /usr/bin/python. Some extension modules |
| 58 | (that are included in framework python 2.3a0, but missing from static python 2.2) |
| 59 | are built with setup.py. And some Carbon modules are built to replace their 2.2 |
| 60 | versions, which lack required functionality. The stubs in Mac/Lib/Carbon know about |
| 61 | this overriding. |
| 62 | |