Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7df9c60

Browse files
committed
Steven Majewski's instructions for building the toolbox modules for
incorporating them in a vanilla Python under MacOSX (i.e. in a non-MacPython-Python). Not complete and up-to-date right now, but that'll be fixed shortly.
1 parent 6bfa31c commit 7df9c60

1 file changed

Lines changed: 116 additions & 0 deletions

File tree

Mac/OSX/README.macosx.txt

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
--- README.macosx ---
2+
3+
[1] You need to build Python for macosx. The latest release (2.1b2)
4+
builds out of the box for macosx -- use:
5+
configure --with-dyld --with-suffix=.x
6+
( get the latest version -- you'll have to fix the build process
7+
to get earlier versions to build.)
8+
9+
10+
[2] You need a copy of Apple's Universal Interfaces CIncludes.
11+
12+
The Carbon.framework include files on macosx are not as backwards
13+
compatible as the ones in Universal Interfaces. For example
14+
UI has a Windows.h file that includes MacWindows.h, while
15+
Carbon.framework only has MacWindows.h
16+
( actually, it's: HIToolbox.framework/Headers/MacWindows.h )
17+
18+
Until macpython sources are converted to be more Carbon compliant
19+
you need to get a copy of Universal Interfaces (downloadable from
20+
Apple's web site if you don't have a copy. If you have Metrowerks
21+
Compiler, there is probably a copy on your CD. )
22+
23+
24+
[3] If your are building from patches, you need to download the cvs
25+
distribution and apply the patches. ( The "If" is there because I
26+
may eventually package this up in a separate patched distribution.)
27+
28+
cvs -d:pserver:[email protected]:/hosts/mm/CVSREMOTE login
29+
Password: geheim
30+
31+
cvs -d:pserver:[email protected]:/hosts/mm/CVSREMOTE co python/Mac
32+
33+
The normal macpython distributions have classic-mac line endings.
34+
macosx gnu tools want unix line endings. Getting sources from
35+
the cvs server avoids having to do a bunch of conversions on
36+
the source files.
37+
38+
39+
New files (go in python/Mac/Modules/ directory)
40+
README.macosx (this file)
41+
Makefile (makefile also creates a dummy .h file)
42+
Carbonmodule.c
43+
44+
Patched files:
45+
python/Mac/Python/macglue.c
46+
python/Mac/Modules/Win/Winmodule.c
47+
48+
49+
[4] There are two lines you have to edit in the Makefile to point to
50+
Universal Interfaces CIncludes and the Python source distribution.
51+
(eventually, disutils will be used to find the Python sources.
52+
eventually, macpython sources will use the more modern headers.)
53+
54+
55+
# Point this to the directory with the Universal Interfaces CIncludes:
56+
UINCLUDE= /Local/Carbon/Universal.Interfaces/CIncludes/
57+
58+
# Point this to your python source directory:
59+
PYTHONHOME= /Users/sdm7g/Src/Python-2.1a2/
60+
61+
After changing those lines, you can type "make" .
62+
63+
"-undefined warning" is used rather than "-undefined supress" --
64+
and there are always some undefined symbols that are resolved
65+
in the main python module. If there is something *REALLY*
66+
unresolved (or often the problem is multiple definitions)
67+
you will get an error on importing Carbonmodule.so.
68+
69+
[5] Installation is manual for now.
70+
If you want to run it out of the python/Mac/Modules directory, you
71+
need to copy it to /usr/local/lib/python2.1/site-packages/
72+
( or whatever is the appropriate directory on your machine )
73+
74+
75+
[6] All of the toolbox modules are built into a single container module
76+
named Carbon. All of the other modules are in the Carbon namespace:
77+
i.e. Carbon.Win. You can do a "from Carbon import *", however all
78+
modules get put into sys.modules under their own name, so once
79+
Carbon has been imported, statements like "import Win" will work --
80+
there is no Winmodule.so file, but import will find 'Win' in the
81+
sys.modules cache before it tries to match a filename.
82+
83+
84+
These are the modules currently linked:
85+
86+
Python 2.1a2 (#1, 02/12/01, 19:49:54)
87+
[GCC Apple DevKit-based CPP 5.0] on Darwin1.2
88+
Type "copyright", "credits" or "license" for more information.
89+
>>> import Carbon
90+
>>> dir(Carbon)
91+
['AE', 'App', 'Cm', 'ColorPicker', 'Ctl', 'Dlg', 'Drag', 'Evt', 'Fm', 'HtmlRender', 'Icn', 'List', 'Menu', 'Qd', 'Qdoffs', 'Res', 'Scrap', 'Snd', 'TE', 'Win', '__doc__', '__file__', '__name__', 'macfs']
92+
>>>
93+
94+
A simple test:
95+
96+
>>> import Snd
97+
>>> Snd.SysBeep( 100 )
98+
99+
The main one missing is macosmodule, which has some functions for handling
100+
resource forks of files, file types and creators, and how and whether
101+
MacPython handles events or your script does. Some of these functions
102+
require others in Python/macmain.c, which may drag in other symbols, either
103+
undefined or multiply defined ( because there is a unix-Python implementation
104+
parallel to the macpython one. ) It's likely that we will need (or at least
105+
want) new macosx implementations of some of these functions.
106+
107+
If you're interested in trying to add them, there is an additional target
108+
in the Makefile "make Experimental", which compiles and links with the
109+
$(XXX) modules: currently just macosmodule.c and macmain.c -- you
110+
can add others to try to resolve undefined symbols or edit the files
111+
to remove some symbols or functions.
112+
113+
-- Steve Majewski <[email protected]>
114+
115+
116+

0 commit comments

Comments
 (0)