[Pythonmac-SIG] First Carbon version of MacPython checked into CVS

Jack Jansen jack@oratrix.nl
Sat, 03 Jun 2000 00:39:24 +0200


I've just done a flurry of checkins to the CVS repository that should
allow people to build a carbonized Python. I've only tested it
on MacOS9, and I think there's a funny resource I need for it to run
on X, but my X machine is at so that'll have to wait.

This is a rather quick-and-dirty approach, I've slashed all
functionality for which wasn't immedeately clear how to solve it:
- No command-. I'm not sure yet how to solve this without moving
  completely to the Carbon Event Manager. Any ideas are appreciated.
- No time given to background processes from within the mainloop. I
  used to call SystemTask for this, but it is gone. Again, any ideas
  are welcome. Preferrably cheap ideas, calling WaitNextEvent with a 0 
  timeout is not something I would like to have in the interpreter
  mainloop (unless it has gotten very cheap).
- No argc/argv processing. ProcessHighLevelEvent is gone, and I
  haven't yet found out what the current way is to have your
  AppleEvents handled. Again, tips are welcome (and always, code is
  even more welcome:-).
- No GUSI. This means that threads, sockets and select are gone, and that the
  age-old Compat library is used for things like getwd() and
  listdir().
- Only the core toolbox modules (AE, Evt, Ctl, Dlg, Menu, Qd, Win)
  have been ported, and this has mainly been done quick-and-dirty.

There's a design issue with the toolbox modules I'd like feedback on,
the issue of backward compatibility. Since all the structure access
has gone (for C programmers) there are now accessor functions for all
interesting members of the Window, Menu, Dialog,
etc. structures. Python has so far taken a half-hearted approach: some 
modules provide accessors, some provide nothing, some provide python
attribute access (Win, for instance). I could code the attribute
access to use the new accessor functions, which would give backward
compatbility of Python source, or I could force people to use the new
accessor functions. I'm tempted to do the latter as the MacOS docs
will move to that too so it should be easier on newcomers,
eventually. It'll also be less work in the long run (as the accessor
functions are bgen-generated and the attribute access is hand-coded),
but it'll mean conversion of lots of Python code in the short
run. Opinions, please.

A second issue is the GrafPort structure and SetPort method. In
pre-carbon windows and dialogs could also be passed where GrafPorts
were expected, but in Carbon this is no longer true. I could
relatively easily do the conversion automatically, or I could let
people convert their code to SetPort(mywindow.GetWindowPort()).

A third issue is the as_XXX() methods. MacOS now has a naming
convention for these: to cast an object to a less specific object you
do "win = dlg.GetDialogWindow()", to cast it to a more specific object 
you do "dlg = Dlg.GetDialogFromWindow(win)". I think I'd like to
follow this convention and do away with all the as_XXX() methods and
functions, but again that will mean people have to convert their code.

And finally what everyone has been waiting for: instructions on how to 
try this. First you have to wait for a few bits and pieces to be
checked in to the main Python repository: new versions of import.c,
parsetok.c, fileobject.c and a few others.

Next you need to get the beta release of CodeWarrior that can generate 
Carbon-compatible binaries. MPTP-member have this, and apparently it
was made available at WWDC too so it might be possible to find it on
the Metrowerks site.

Now you're all set to build Python:Mac:Build:PythonStandCarbon.prj and 
give it a try.

Let me end with a plea: I could really use some help on this. Getting
this far has already been a serious effort (for which I didn't really
have the time in the first place:-), but I think that if we can get a
carbonized MacPython out there quickly it may be a tremendous boost to 
Python's visibility in the Mac community.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | ++++ see http://www.xs4all.nl/~tank/ ++++