# # author: Achim Gaedke # created: May 2001 # file: pygsl/gsl_extension.py # $Id: gsl_Extension.py,v 1.17 2005/06/07 06:14:01 schnizer Exp $ # # module for gsl extensions compilation from distutils.core import setup, Extension from distutils.errors import DistutilsModuleError, DistutilsExecError import os import os.path import re import string import types import imp from sys import argv,version_info import gsl_numobj # steel --gsl-prefix from option list gsl_prefix_option=None gsl_prefix_option_pattern=re.compile("--gsl-prefix=(.+)") pos=0 while posthis_version[pos]: return 0 elif this_type == types.IntType: if required_version[pos]>int(this_version[pos]): return 0 else: raise DistutilsExecError,"incorrect version specification" # problematic: 0.9 < 0.9.0, but assures that 0.9.1 > 0.9 if len(required_version)>len(this_version): return 0 return 1 def check_gsl_version(self, version_array): return self.check_version(version_array,self.get_gsl_version()) def check_python_version(self, version_array): return self.check_version(version_array,version_info) # get gsl-prefix option def get_gsl_info(self, arguments): """ executes gsl-config with given arguments """ gsl_command=os.popen(self.gsl_config_tool+' '+arguments) gsl_output=gsl_command.readline() gsl_command.close() if not gsl_output: raise DistutilsExecError,"could not start %s"%self.gsl_config_tool return gsl_output def get_gsl_prefix(self,): return gsl_Location.get_gsl_prefix() def get_gsl_cflags(self): return gsl_Location.get_gsl_cflags() def get_gsl_libs(self): return gsl_Location.get_gsl_libs() def get_gsl_version(self): return gsl_Location.get_gsl_version()