[pypy-svn] r59025 - in pypy/branch/cbuild-refactor/pypy/translator: c/test platform platform/test

pedronis at codespeak.net pedronis at codespeak.net
Sun Oct 12 14:34:30 CEST 2008


Author: pedronis
Date: Sun Oct 12 14:34:29 2008
New Revision: 59025

Modified:
   pypy/branch/cbuild-refactor/pypy/translator/c/test/test_standalone.py
   pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py
   pypy/branch/cbuild-refactor/pypy/translator/platform/test/test_posix.py
Log:
let's execute makefile objects directly



Modified: pypy/branch/cbuild-refactor/pypy/translator/c/test/test_standalone.py
==============================================================================
--- pypy/branch/cbuild-refactor/pypy/translator/c/test/test_standalone.py	(original)
+++ pypy/branch/cbuild-refactor/pypy/translator/c/test/test_standalone.py	Sun Oct 12 14:34:29 2008
@@ -189,7 +189,6 @@
     assert data.strip() == "OK"
 
 def test_separate_files():
-    py.test.skip("Skip for now")
     # One file in translator/c/src
     fname = py.path.local(pypydir).join(
         'translator', 'c', 'src', 'll_strtod.h')

Modified: pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py
==============================================================================
--- pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py	(original)
+++ pypy/branch/cbuild-refactor/pypy/translator/platform/linux.py	Sun Oct 12 14:34:29 2008
@@ -71,13 +71,13 @@
     def __init__(self, path=None):
         self.defs = {}
         self.lines = []
-        self._path = py.path.local(path)
+        self.makefile_dir = py.path.local(path)
         
     def pathrel(self, fpath):
-        if fpath.dirpath() == self._path:
+        if fpath.dirpath() == self.makefile_dir:
             return fpath.basename
-        elif fpath.dirpath().dirpath() == self._path.dirpath():
-            return '../' + fpath.relto(self._path.dirpath())
+        elif fpath.dirpath().dirpath() == self.makefile_dir.dirpath():
+            return '../' + fpath.relto(self.makefile_dir.dirpath())
         else:
             return str(fpath)
 
@@ -98,7 +98,7 @@
 
     def write(self, out=None):
         if out is None:
-            f = self._path.join('Makefile').open('w')
+            f = self.makefile_dir.join('Makefile').open('w')
         else:
             f = out
         for line in self.lines:
@@ -245,7 +245,11 @@
 
         return m
 
-    def execute_makefile(self, path):
+    def execute_makefile(self, path_to_makefile):
+        if isinstance(path_to_makefile, GnuMakefile):
+            path = path_to_makefile.makefile_dir
+        else:
+            path = path_to_makefile
         log.execute('make in %s' % (path,))
         returncode, stdout, stderr = _run_subprocess('make', ['-C', str(path)])
         if returncode != 0:

Modified: pypy/branch/cbuild-refactor/pypy/translator/platform/test/test_posix.py
==============================================================================
--- pypy/branch/cbuild-refactor/pypy/translator/platform/test/test_posix.py	(original)
+++ pypy/branch/cbuild-refactor/pypy/translator/platform/test/test_posix.py	Sun Oct 12 14:34:29 2008
@@ -24,7 +24,7 @@
     mk = host.gen_makefile([cfile], ExternalCompilationInfo(),
                            path=tmpdir)
     mk.write()
-    host.execute_makefile(tmpdir)
+    host.execute_makefile(mk)
     res = host.execute(tmpdir.join('test_simple_enough'))
     assert res.out == '42\n'
     assert res.err == ''



More information about the Pypy-commit mailing list