self.set_executable(key, args[key])
def set_executable(self, key, value):
- if isinstance(value, str):
+ if isinstance(value, basestring):
setattr(self, key, split_quoted(value))
else:
setattr(self, key, value)
class CCompilerTestCase(support.EnvironGuard, unittest.TestCase):
+ def test_set_executables(self):
+ class MyCCompiler(CCompiler):
+ executables = {'compiler': '', 'compiler_cxx': '', 'linker': ''}
+
+ compiler = MyCCompiler()
+
+ # set executable as list
+ compiler.set_executables(compiler=['env', 'OMPI_MPICC=clang', 'mpicc'])
+ self.assertEqual(compiler.compiler, ['env',
+ 'OMPI_MPICC=clang',
+ 'mpicc'])
+
+ # set executable as string
+ compiler.set_executables(compiler_cxx='env OMPI_MPICXX=clang++ mpicxx')
+ self.assertEqual(compiler.compiler_cxx, ['env',
+ 'OMPI_MPICXX=clang++',
+ 'mpicxx'])
+
+ # set executable as unicode string
+ compiler.set_executables(linker=u'env OMPI_MPICXX=clang++ mpiCC')
+ self.assertEqual(compiler.linker, [u'env',
+ u'OMPI_MPICXX=clang++',
+ u'mpiCC'])
+
def test_gen_lib_options(self):
compiler = FakeCompiler()
libdirs = ['lib1', 'lib2']