From: <mk...@pr...> - 2004-01-31 06:25:48
|
Update of /cvsroot/csp/APPLICATIONS/SimData In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990 Modified Files: CHANGES.current Makefile setup.py Log Message: Index: CHANGES.current =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/CHANGES.current,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** CHANGES.current 1 Jan 2004 16:17:32 -0000 1.94 --- CHANGES.current 31 Jan 2004 06:24:07 -0000 1.95 *************** *** 1,4 **** --- 1,32 ---- Version 0.4.0 (in progress) =========================== + 2003-01-30: onsight + * Starting with version 1.3.20 of SWIG, the python runtime + library support has changed. The swigpy library is no + longer distributed with SWIG, and must be built locally + if needed. SimData relies on having a single runtime + library library loaded, that is shared by all client + modules. As a first attempt at solving this problem, + SimData will directly incorporate the python runtime + code. This may or may not work under Windows, depending + on how the associated symbols are resolved when linking + modules that depend on SimData. + + * Added 'swigopts' and 'ldopts' options to setup.py to dump + swig and linker options to stdout. The Makefile now gets + these options from setup.py. The options strings are now + dependent on the installed version of SWIG, to account for + the renaming of the '-c' command line option and optional + linking with an external python runtime library. The + setup.py script also deals with this change in SWIG + behavior when building under distutils. + + ==> NOTE: These changes have not been tested under Windows, + and no changes have been made to the VC project file + yet. If you are using Windows and would like to help + improve support for new versions of SWIG, please post + a message to the developers forum at + http://csp.sourceforge.net/forum + 2003-12-30: delta * Added an environment variable to the project in lieu of Index: Makefile =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Makefile,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile 24 Oct 2003 15:45:43 -0000 1.22 --- Makefile 31 Jan 2004 06:24:07 -0000 1.23 *************** *** 2,10 **** export PYTHON_INCLUDE := $(shell python setup.py python_include_path) export GDEBUGF = -g -W -Wall -pedantic -Wmissing-prototypes -Wconversion -Wshadow #-DSIMDATA_NOLOADCHECK ! export GCFLAGS = -fPIC -O2 # -march=athlon-tbird ! export GLDOPTS = -shared -lswigpy -ldl ! export GSWOPTS = -c -c++ -python -noexcept export CXX = g++ export SWIG = swig --- 2,10 ---- export PYTHON_INCLUDE := $(shell python setup.py python_include_path) + export GSWOPTS = $(shell python setup.py swigopts) + export GLDOPTS = $(shell python setup.py ldopts) export GDEBUGF = -g -W -Wall -pedantic -Wmissing-prototypes -Wconversion -Wshadow #-DSIMDATA_NOLOADCHECK ! export GCFLAGS = -fPIC -O2 export CXX = g++ export SWIG = swig Index: setup.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/setup.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** setup.py 24 Oct 2003 06:44:13 -0000 1.32 --- setup.py 31 Jan 2004 06:24:07 -0000 1.33 *************** *** 26,31 **** - - import sys --- 26,29 ---- *************** *** 47,55 **** from distutils.command.build_ext import build_ext from distutils import sysconfig, dir_util ! import os, os.path, string # REMEMBER TO 'touch Version.cpp' OR REBUILD ALL VERSION = "0.3.4" def copy_dir(src, dst, files, verbose=0): from distutils.file_util import copy_file --- 45,81 ---- from distutils.command.build_ext import build_ext from distutils import sysconfig, dir_util ! import os, os.path, string, re # REMEMBER TO 'touch Version.cpp' OR REBUILD ALL VERSION = "0.3.4" + + SWIG_VERSION = None + + def getSwigVersion(): + global SWIG_VERSION + if SWIG_VERSION is None: + (cout, cin, cerr) = os.popen3('swig -version') + versiontext = ' '.join(cerr.readlines()) + match = re.search(r'\s(1)\.(\d)\.(\d+)\s', versiontext) + if match is None: + print >>sys.stderr, 'swig -version failed. Check that SWIG is installed correctly.' + sys.exit(1) + SWIG_VERSION = map(int, match.groups()) + return SWIG_VERSION + + def checkSwigVersion(): + major, minor, rev = getSwigVersion() + if major < 1 or minor < 3 or rev < 16: + print >>sys.stderr, 'SWIG version 1.3.16 or greater required; older versions are not supported.' + sys.exit(1) + if rev == 18 or rev == 19: + print >>sys.stderr, 'SWIG versions 1.3.18 and 1.3.19 are not supported, please upgrade to a newer version.' + sys.exit(1) + + def isOldSwigRuntime(): + major, minor, rev = getSwigVersion() + return major == 1 and minor == 3 and rev < 20 + def copy_dir(src, dst, files, verbose=0): from distutils.file_util import copy_file *************** *** 140,144 **** class build_swig_ext(build_ext): ! swig_options = '' def build_extension(self, ext): --- 166,170 ---- class build_swig_ext(build_ext): ! options = [] def build_extension(self, ext): *************** *** 183,187 **** swig = self.find_swig() ! swig_cmd = [swig, "-python", "-c++"] + build_swig_ext.options.split() if 1 or self.inplace: --- 209,213 ---- swig = self.find_swig() ! swig_cmd = [swig] + build_swig_ext.options if 1 or self.inplace: *************** *** 347,356 **** headers_fullpath = fullpath("Include/SimData/", "", headers) - build_swig_ext.options = "-IInclude -noexcept" includes = ["Include"] defines = [("SIMDATA_VERSION", '"%s"' % VERSION)] ! libraries = ["swigpy", "dl"] cflags = [] if len(sys.argv)>=2: --- 373,388 ---- headers_fullpath = fullpath("Include/SimData/", "", headers) includes = ["Include"] defines = [("SIMDATA_VERSION", '"%s"' % VERSION)] ! libraries = ["dl"] cflags = [] + checkSwigVersion() + swigopts = ["-python", "-c++", "-noexcept"] + if isOldSwigRuntime(): + libraries.append('swigpy') + else: + swigopts.append("-runtime") + build_swig_ext.options = swigopts + ["-IInclude"] if len(sys.argv)>=2: *************** *** 361,364 **** --- 393,402 ---- print sysconfig.get_python_inc() sys.exit(0) + if command == "ldopts": + print '-shared', ' '.join(map(lambda x: '-l%s' % x, libraries)) + sys.exit(0) + if command == "swigopts": + print ' '.join(swigopts) + sys.exit(0) cSimData = Extension("SimData._cSimData", |