building matplotlib without X-server connection

Hello,

currently the GTK backends for matplotlib won't build without
an X-server connection. The following patch fixes this:

···

======================================================================
--- setup.py 4 Nov 2004 15:58:57 -0000 1.108
+++ setup.py 11 Nov 2004 09:54:24 -0000
@@ -122,11 +122,16 @@
build_transforms(ext_modules, packages, NUMERIX)
     
if BUILD_GTKAGG:
- try: import gtk
- except ImportError: print 'GTKAgg requires pygtk'
- else:
- BUILD_AGG = 1
- build_gtkagg(ext_modules, packages)
+ try:
+ import gtk
+ except ImportError:
+ print 'GTKAgg requires pygtk'
+ BUILD_GTKAGG=0
+ except RuntimeError:
+ print 'pygtk present but import failed'
+if BUILD_GTKAGG:
+ BUILD_AGG = 1
+ build_gtkagg(ext_modules, packages)

if BUILD_TKAGG:
     try: import Tkinter

It makes use of the fact the the import of gtk fails with an
RuntimeError instead of an ImportError when the module is present
but not X-server is there. Do you think that this is safe to
commit? Or will it have unwanted side-effects?

I hope this helps,
Jochen
--
http://seehuhn.de/