-
Install the Tk library.
Go to the Mac
OS X Downloads section of the Apple web
site and search for "Tk" (without the quotes). Download
the latest version of Tk Aqua (8.4.2.0 as of this
writing) and install it (the "easy install" option is
fine). As this installation involves libraries, you'll
need the system administrator password, but you won't
need to reboot. Among other things, this install will
create a /usr/local/
directory that will be
used in later steps.
I can't fathom why Tk isn't installed along with Tcl
by default on Mac OS X. While you're waiting for the
install to complete, why not drop Apple a line at http://www.apple.com/macosx/feedback/
and let them know that Aqua Tk is a reasonable default
install in an environment that has Tcl, Python, and Perl
(all of which can make good use of Tk) already
preinstalled, and make the Tk library available to
them.
-
Build and install optional libraries.
This step is completely optional, but since Python
will have to be built from source anyway in the next step
it's not too much extra work and can make for a more
capable Python installation. The library I most strongly
recommend is the readline library; basic editing commands
in the Python shell are sorely missed without it.
In any case, building readline is not too hard.
Download the latest (4.3 as of this writing) from http://www.gnu.org/directory/readline.html
and unpack it (probably StuffIt
Expander will do so for you auto- matically). Enter
its directory from within a terminal window (via a
command like
cd readline-4.3
and type the following two commands:
./configure --disable-shared
and
make
This will build the readline library (the current
version seems to have problems building a shared library;
I haven't really spent the time to investigate further as
it's not really needed anyhow). Typing the command
sudo make install
will install it.
I strongly feel that this library ought to be already
linked into the Python that Apple has preinstalled on Mac
OS X. If you do likewise, why not drop them a feedback
note at the address mentioned above while you're waiting
for readline to build?
Other optional libraries like
gdbm
can be installed in a similar manner if desired.
-
Build Python from source and install it.
Go to http://www.python.org/
and find and download the latest Python tarball
(Python-2.3a2.tgz as of this writing) and unpack it
(probably StuffIt Expander will do so for you
automatically). Note that it is quite possibly an alpha
release -- there are some significant Mac OS X
improvements between the 2.2 and 2.3 series, so it makes
sense to get the 2.3 version even if it's only an alpha.
In particular, I have not been able to get the 2.2
release to work with the binary Tk release mentioned
above (although I was able to the 2.2 release work with
Tcl/Tk built completely from source by playing around
with the Setup file -- if you want to take this route, it
is doable, just less direct).
Open a terminal window (if you've installed readline
as suggested above you've already got one) and navigate
within it to the Python source directory that you've just
unpacked. Type
./configure --enable-framework
and wait a bit.
Type
make
and wait a bit longer (in fact, on this G4 there's
time to go get a cup of tea -- if you haven't sent any
feedback to Apple yet about how if Tk, readline, Open
SSL, and Python were all preinstalled in a friendly
manner you wouldn't need to be wasting this time right
now, now's a good time to consider doing so).
Finally, type
sudo make frameworkinstall
There will be a bit more of a wait afterwards, but
Python with Tkinter (and readline if you built it) will
have been installed when it completes.
-
Install the Zope
External Editor Helper Application (UNIX Version)
Copy zopeedit.py
into
/usr/local/bin
either via the finder (you'll
have to use the "Go to Folder" menu item as
/usr/local/bin
is normally invisible and you
may have to play with permissions) or via a command like
sudo cp zopeedit.py /usr/local/bin
in the
terminal (assuming that zopeedit.py
is in
the current directory). Modify the first line of it to
read
#!/usr/bin/env pythonw
and you may just as well add the line
macosx = sys.platform == 'darwin'
under the
win32 = sys.platform == 'win32'
while you're in there (if it's not already present).
-
Install the ZopeEdit AppleScript
This AppleScript can be put in
/usr/local/bin
and is used to call the
zopeedit.py
file (Mozilla does not recognize
zopeedit.py
as a valid helper application,
but it will recognize an AppleScript). Note that
currently this script is actually configured to call
zopeedit.pyc
, the compiled form of
zopeedit.py
. Either zopeedit.py
can be compiled (via importing it from the Python command
line) or the script can be modified to call
zopeedit.py
directly to make it work
properly.
-
Configure your favorite browser
This is done mostly as described in the UNIX
documentation, but it may be necessary to have the
browser reference the AppleScript instead of the
zopeedit.py
file.
I have only personally gotten this working with
Mozilla (and have
been using it with Mozilla since version 1.1 if I recall
correctly); neither
Camino
nor Safari seem to allow
setting helper applications based on
MIME type, so neither of these browsers will currently
work with Zope External Editor (if you know of a way to
make either of these work, in particular Camino, please
let me know). I have not tried MSIE, Opera, iCab,
OmniWeb, etc.
-
Edit your ~/.zope-external-edit file
Configure this as per the main documentation. I've
been using it reliably with both
BBEdit and
OpenOffice.
(See also my tip for BBEdit.)