Experimenting with reinteract on OS X

73 views
Skip to first unread message

Owen Taylor

unread,
Aug 28, 2008, 9:37:46 PM8/28/08
to reint...@googlegroups.com
I had a chance to spend a few hours to see if I could get reinteract
going on OS X 10.5 (Leopard). It went pretty smoothly, so I thought
I'd write up the steps here and add a few thoughts about future work.
Note that these were my first hours doing anything on a Mac since
about 1994, so don't take this as any sort of "best practices"

Steps:

Note: This is all from the from the command line. I've written <tab>
to indicate tab completion to something that is long and hopefully
unique.

1. Install the developer tools from the second OS DVD. I just
installed the default set of pretty much everything, though I'm sure
you could prune things down if you were short on disk space.

2. Follow the steps from:

http://developer.imendio.com/projects/gtk-macosx/

to build GTK+ in your home directory. However, *don't* do the
'jhbuild bootstrap' step, since that will build Python 2.4 overriding
the system 2.5, and I'm not sure reinteract works any more with 2.4.
Instead, just bootstrap the modules you actually need with:

jhbuild -m bootstrap buildone automake-1.7 gettext libtool pkg-config

(I may be forgetting one above .. if the build breaks, it
hopefully will be obvious what you need and you can go back and do a
jhbuild buildone for that.)

3. Built pygobject

jhbuild buildone pygobject

This unexpectedly installs the result into
/Library/Python/2.5/site-packages instead of nicely encapsulated under
~/gtk but the installed packages have a hardcoded path to the GTK+
libraries in your home dir, so it's good enough.

4. Build pycairo; pycairo needs a patch for the matplotlib integration
to work properly

jhbuild updateone pycairo
cd ~/gtk/source/pycairo-<tab>
patch -p0 < [filename of the patch I've attached below ]
jhbuild buildone pycairo

5. Build pygtk

jhbuild buildone pygtk

Note: the following steps have a bunch of manual source control
checkouts, you probably want check them out into some directory, I've
omitted changing to that directory for each checkout

6. Build numpy from svn. svn matplotlib wants a newer numpy than the
system version; if we just run 'python setup.py install' the system
one will be first in the path, so as a workaround we'll build an egg
and install that, which adjusts sys.path, and things work out better

jhbuild shell # run in the jhbuild environment
svn co http://scipy.org/svn/numpy/trunk numpy
cd numpy
python setupegg.py bdist_egg
sudo easy_install dist/numpy<tab>

7. Build matplotlib from svn

# Still in the jhbuild shell
svn co http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib
cd matplotlib
python setupegg.py bdist_egg
sudo easy_install dist/matplotlib<tab>

8. Download and build git:

# Still in the jhbuild shell
curl -O http://kernel.org/pub/software/scm/git/git-1.6.0.1.tar.bz2
tar xvfz git-<tab>
cd git-<tab>
./configure --prefix=$HOME/gtk/inst
make
make install

9. [Optional] Checkout and build gtk-quartz-engine to get a more
native look and feel

# Still in the jhbuild shell
svn co http://svn.gnome.org/svn/gtk-quartz-engine/trunk gtk-quartz-engine
cd gtk-quartz-engine
./configure --prefix=$HOME/gtk/inst
make
make install
echo 'gtk-theme-name="Quartz"' >> ~/.gtkrc-2.0

10. Checkout reinteract and try it out

# Still in the jhbuild shell
git clone git://git.fishsoup.net/reinteract
cd reinteract
bin/uninst.py
# experiment or try the examples in the examples/ directory)

Thoughts:

- Most of the stuff probably applies to 10.4 and 10.3 as well. On
older versions, you would need to install the Python package from
python.org to get 2.5 and some details about installing the python
modules might be different.

- I've avoided prebuilt stuff above, though prebuilt versions for
most of this stuff is available, to avoid worrying about the giant
matrix of Operating System/architecture/Python version/etc.
compatibility.

- The eventual goal would be to have an installer that bundled most
of this stuff together ... probably include gtk/gtk
deps/pygtk/numpy/matplotlib but not Python .. you want to use the
system Python so that people can access their own locally installed
modules.

- The reinteract user interface out of the box sticks out like a
thumb on OS X. My goal in my current "notebook user interface" rewrite
is to have a pretty flexible set of user interface components that can
be glued together in different configurations ... tabbed notebook,
single worksheet window, maemo mini-version, etc. OS X would be
another version that combined a native menu bar with standard GTK+
components used in individual windows.

- It looks like the way you replace the "Python" menu bar with a
native menu bar and fix the app icon is to create a thin objective C
wrapper that embeds python. At least that's what Xcode does for a
Python project.

I'm impressed by the work that was done on the Quartz port of GTK+ ...
except for the small pycairo patch above, everything really did work
out of the box. Continuing the work here to do an all-in-one installer
and a better user interface isn't a priority for me ... my reinteract
backlog is big enough as it is ... so it's definitely a place where
someone could get involved and contribute.

- Owen

pycairo-unknown-surface-pattern.patch
Reply all
Reply to author
Forward
0 new messages