diff --git a/llvm/test_llvmpy.py b/llvm/test_llvmpy.py index c96f471..8df32b8 100644 --- a/llvm/test_llvmpy.py +++ b/llvm/test_llvmpy.py @@ -9,6 +9,7 @@ import unittest import subprocess import tempfile import contextlib +from distutils.spawn import find_executable is_py3k = sys.version_info[0] >= 3 BITS = tuple.__itemsize__ * 8 @@ -31,7 +32,6 @@ import llvmpy tests = [] - # --------------------------------------------------------------------------- if sys.version_info[:2] <= (2, 6): @@ -674,6 +674,7 @@ tests.append(TestTargetMachines) # --------------------------------------------------------------------------- class TestNative(TestCase): + def setUp(self): self.tmpdir = tempfile.mkdtemp() @@ -694,8 +695,12 @@ class TestNative(TestCase): return m def _compile(self, src): + cc = find_executable('cc') + if not cc: + return + dst = os.path.join(self.tmpdir, 'llvmobj.out') - s = subprocess.call(['cc', '-o', dst, src]) + s = subprocess.call([cc, '-o', dst, src]) if s != 0: raise Exception("Cannot compile")