From 50bef3ee5c113a193b4acd30890fe815fa38185e Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 9 Mar 2012 22:54:21 +0000 Subject: [PATCH] Fixed an environment issue with Python subprocesses --- SConstruct | 4 ++++ src/python/SConscript | 11 +++++++---- test/python/runTests.py | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 6aba2c265..834ca984a 100644 --- a/SConstruct +++ b/SConstruct @@ -116,6 +116,10 @@ env = Environment(tools=toolchain+['textfile', 'subst', 'recursiveInstall', 'wix if os.name == 'nt' and 'TMP' in os.environ: env['ENV']['TMP'] = os.environ['TMP'] +# Fixes issues with Python subprocesses. See http://bugs.python.org/issue13524 +if os.name == 'nt': + env['ENV']['SystemRoot'] = os.environ['SystemRoot'] + # Fix an issue with Unicode sneaking into the environment on Windows if os.name == 'nt': for key,val in env['ENV'].iteritems(): diff --git a/src/python/SConscript b/src/python/SConscript index 1d802bd93..c89bc28f3 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -32,13 +32,16 @@ if localenv['python_package'] == 'full': cantera_libname = 'cantera_shared' if os.name=='nt' else 'cantera' pylinklibs = [cantera_libname] - # On Windows, we need to link against the Python "import" library. - # With MSVC, this is automatically handled by a "#pragma comment - # directive in the Python headers, but for MinGW we need to do - # it manually. if localenv['toolchain'] == 'mingw': + # On Windows, we need to link against the Python "import" library. + # With MSVC, this is automatically handled by a "#pragma comment + # directive in the Python headers, but for MinGW we need to do + # it manually. pylinklibs.append('python%s' % gcv('VERSION')) + # Link statically so we don't have to include a copy of libstdc++ + localenv.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++']) + # OS X requires library dependencies to be specified at link time if localenv['OS'] == 'Darwin': pylinklibs.append('python%s' % gcv('VERSION')) diff --git a/test/python/runTests.py b/test/python/runTests.py index 5da3e8f81..a01b9b1cd 100644 --- a/test/python/runTests.py +++ b/test/python/runTests.py @@ -4,6 +4,7 @@ Unit tests for the Cantera Python module. This script gathers all the tests defined in all of the test.py files, runs them, and prints a report. """ +import sys import unittest import Cantera @@ -11,6 +12,7 @@ import Cantera if __name__ == '__main__': print '\n* INFO: using Cantera module found at this location:' print '* ', repr(Cantera.__file__), '\n' + sys.stdout.flush() loader = unittest.TestLoader() runner = unittest.TextTestRunner(verbosity=2)