Commit 331f837b authored by Stefan Behnel's avatar Stefan Behnel

change working directory when running C compiler to make it work with relative path names

parent 10dd4816
...@@ -121,21 +121,26 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -121,21 +121,26 @@ class CythonCompileTestCase(unittest.TestCase):
full_module_name=module) full_module_name=module)
def run_distutils(self, module, workdir, incdir): def run_distutils(self, module, workdir, incdir):
build_extension = build_ext(distutils_distro) cwd = os.getcwd()
build_extension.include_dirs = INCLUDE_DIRS[:] os.chdir(workdir)
if incdir: try:
build_extension.include_dirs.append(incdir) build_extension = build_ext(distutils_distro)
build_extension.finalize_options() build_extension.include_dirs = INCLUDE_DIRS[:]
if incdir:
extension = Extension( build_extension.include_dirs.append(incdir)
module, build_extension.finalize_options()
sources = [os.path.join(workdir, module + '.c')],
extra_compile_args = CFLAGS, extension = Extension(
) module,
build_extension.extensions = [extension] sources = [module + '.c'],
build_extension.build_temp = workdir extra_compile_args = CFLAGS,
build_extension.build_lib = workdir )
build_extension.run() build_extension.extensions = [extension]
build_extension.build_temp = workdir
build_extension.build_lib = workdir
build_extension.run()
finally:
os.chdir(cwd)
def compile(self, directory, module, workdir, incdir, expect_errors): def compile(self, directory, module, workdir, incdir, expect_errors):
expected_errors = errors = () expected_errors = errors = ()
...@@ -165,9 +170,6 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -165,9 +170,6 @@ class CythonCompileTestCase(unittest.TestCase):
self.run_distutils(module, workdir, incdir) self.run_distutils(module, workdir, incdir)
class CythonRunTestCase(CythonCompileTestCase): class CythonRunTestCase(CythonCompileTestCase):
def shortDescription(self):
return "compiling and running " + self.module
def runTest(self): def runTest(self):
self.run() self.run()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment