Commits

Armin Rigo committed 06948d8

Test and (bah) fix.

Comments (0)

Files changed (2)

pypy/translator/platform/posix.py

         m.cfiles = rel_cfiles
 
         rel_includedirs = [pypyrel(incldir) for incldir in
-                           self._preprocess_include_dirs(eci.include_dirs)]
+                           self.preprocess_include_dirs(eci.include_dirs)]
         rel_libdirs = [pypyrel(libdir) for libdir in
-                       self._preprocess_library_dirs(eci.library_dirs)]
+                       self.preprocess_library_dirs(eci.library_dirs)]
 
         m.comment('automatically generated makefile')
         definitions = [

pypy/translator/platform/test/test_posix.py

 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.tool.udir import udir
 from StringIO import StringIO
-import sys
+import sys, os
 
 def test_echo():
     res = host.execute('echo', '42 24')
         mk.write()
         assert 'LINKFILES = /foo/bar.a' in tmpdir.join('Makefile').read()
 
+    def test_preprocess_localbase(self):
+        tmpdir = udir.join('test_preprocess_localbase').ensure(dir=1)
+        eci = ExternalCompilationInfo()
+        os.environ['PYPY_LOCALBASE'] = '/foo/baz'
+        try:
+            mk = self.platform.gen_makefile(['blip.c'], eci, path=tmpdir)
+            mk.write()
+        finally:
+            del os.environ['PYPY_LOCALBASE']
+        Makefile = tmpdir.join('Makefile').read()
+        assert 'INCLUDEDIRS = -I/foo/baz/include' in Makefile
+        assert 'LIBDIRS = -L/foo/baz/lib' in Makefile
+
 class TestMaemo(TestMakefile):
     strict_on_stderr = False