[pypy-commit] pypy default: merged upstream

alex_gaynor noreply at buildbot.pypy.org
Sat Apr 27 22:13:09 CEST 2013


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r63705:1d8dd0055879
Date: 2013-04-27 13:12 -0700
http://bitbucket.org/pypy/pypy/changeset/1d8dd0055879/

Log:	merged upstream

diff --git a/rpython/translator/platform/__init__.py b/rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py
+++ b/rpython/translator/platform/__init__.py
@@ -4,6 +4,7 @@
 
 from rpython.tool.runsubprocess import run_subprocess as _run_subprocess
 from rpython.tool.udir import udir
+from rpython.tool.version import rpythonroot
 
 log = py.log.Producer("platform")
 
@@ -163,6 +164,15 @@
                 break
         return response_file
 
+    def _make_o_file(self, cfile, ext):
+        """Create an object file name under the udir for a .c file"""
+        ofile = cfile.new(ext=ext)
+        if ofile.relto(udir):
+            return ofile
+        ofile = udir.join(ofile.relto(rpythonroot))
+        ofile.dirpath().ensure(dir=True)
+        return ofile
+
     def preprocess_include_dirs(self, include_dirs):
         if 'PYPY_LOCALBASE' in os.environ:
             dirs = list(self._preprocess_include_dirs(include_dirs))
diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -31,7 +31,7 @@
         return list(link_files)
 
     def _compile_c_file(self, cc, cfile, compile_args):
-        oname = cfile.new(ext='o')
+        oname = self._make_o_file(cfile, ext='o')
         args = ['-c'] + compile_args + [str(cfile), '-o', str(oname)]
         self._execute_c_compiler(cc, args, oname,
                                  cwd=str(cfile.dirpath()))
diff --git a/rpython/translator/platform/windows.py b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -197,7 +197,7 @@
         return ["@%s" % (response_file,)]
 
     def _compile_c_file(self, cc, cfile, compile_args):
-        oname = cfile.new(ext='obj')
+        oname = self._make_o_file(cfile, ext='obj')
         # notabene: (tismer)
         # This function may be called for .c but also .asm files.
         # The c compiler accepts any order of arguments, while


More information about the pypy-commit mailing list