#!/usr/bin/env python

import os
from scipy_distutils.misc_util import get_path, default_config_dict, dot_join
from scipy_distutils.core import Extension
from scipy_distutils.x11_info import get_x11_info

def configuration(parent_package=''):
    """
       gist only works with an X-windows server
       This will install *.gs and *.gp files to
       '%spython%s/site-packages/scipy/xplt' % (sys.prefix,sys.version[:3])
    """
    x11_info = get_x11_info()
    if not x11_info:
        return

    config = default_config_dict('xplt',parent_package)
    local_path = get_path(__name__)
    
    sources = ['gistCmodule.c']
    sources = [os.path.join(local_path,x) for x in sources]
                                               
    ext = Extension(dot_join(parent_package,'xplt.gistC'),
                    sources,
                    include_dirs = x11_info.get('include_dirs',[]),
                    library_dirs = x11_info.get('library_dirs',[]),
                    libraries = x11_info.get('libraries',[]) + ['m'])
    config['ext_modules'].append(ext)
        
    from glob import glob
    gist = glob(os.path.join(local_path,'gist','*.c'))
    # libraries are C static libraries
    config['libraries'].append(('gist',{'sources':gist,
                                        'macros':[('STDC_HEADERS',1)]}))
                                   
    file_ext = ['*.gs','*.gp', '*.ps', '*.help']
    xplt_files = [glob(os.path.join(local_path,x)) for x in file_ext]
    xplt_files = reduce(lambda x,y:x+y,xplt_files,[])
    xplt_path = os.path.join(local_path,'xplt')
    config['data_files'].extend( [(xplt_path,xplt_files)])
    
    return config

if __name__ == '__main__':    
    from scipy_distutils.core import setup
    setup(**configuration())

@@ -104,16 +104,66 @@
 ot_join%0A
+from scipy_distutils.misc_util import dict_append%0A
 from sci
@@ -197,16 +197,17 @@
 tension%0A
+#
 from sci
@@ -248,16 +248,66 @@
 11_info%0A
+from scipy_distutils.system_info import x11_info%0A%0A
 %0Adef con
@@ -536,23 +536,25 @@
  x11
-_info = get_x11
+ = x11_info().get
 _inf
@@ -571,21 +571,16 @@
  not x11
-_info
 :%0A      
@@ -782,76 +782,31 @@
 es%5D%0A
-                                               %0A    ext = Extension(
+%0A    ext_arg = %7B'name':
 dot_
@@ -859,226 +859,129 @@
     
-    
- 
+'
 sources
-,%0A                    include_dirs = x11_info.get('include_dirs',%5B%5D),%0A                    library_dirs = x11_info.get('library_dirs',%5B
+':sources%7D%0A    dict_append(ext_arg,**x11)%0A    dict_append(ext_arg,libraries=%5B'm'
 %5D)
-,
 %0A    
-                libraries = x11_info.get('libraries',%5B%5D) + %5B'm'%5D
+ext = Extension (**ext_arg
 )%0A  

Impl. system_info and x11_info