[pypy-svn] r75408 - in pypy/trunk/pypy: module/cpyext/include tool

afa at codespeak.net afa at codespeak.net
Tue Jun 15 18:04:21 CEST 2010


Author: afa
Date: Tue Jun 15 18:04:20 2010
New Revision: 75408

Modified:
   pypy/trunk/pypy/module/cpyext/include/Python.h
   pypy/trunk/pypy/tool/gcc_cache.py
Log:
- Import the "platform" on every compilation attempt: an option may have changed the compiler
- fix cpyext when compiled with --cc=mingw32.


Modified: pypy/trunk/pypy/module/cpyext/include/Python.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/Python.h	(original)
+++ pypy/trunk/pypy/module/cpyext/include/Python.h	Tue Jun 15 18:04:20 2010
@@ -15,7 +15,9 @@
 #else
 # define MS_WIN32 1
 # define MS_WINDOWS 1
-# include <crtdefs.h>
+# ifdef _MSC_VER
+#  include <crtdefs.h>
+# endif
 # include <io.h>
 # define Py_DEPRECATED(VERSION_UNUSED)
 # ifdef Py_BUILD_CORE

Modified: pypy/trunk/pypy/tool/gcc_cache.py
==============================================================================
--- pypy/trunk/pypy/tool/gcc_cache.py	(original)
+++ pypy/trunk/pypy/tool/gcc_cache.py	Tue Jun 15 18:04:20 2010
@@ -1,6 +1,5 @@
-
 from pypy.tool.autopath import pypydir
-from pypy.translator.platform import platform, CompilationError
+from pypy.translator.platform import CompilationError
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.tool.compat import md5
 import py
@@ -8,6 +7,9 @@
 cache_dir_root = py.path.local(pypydir).join('_cache').ensure(dir=1)
 
 def cache_file_path(c_files, eci, cachename):
+    "Builds a filename to cache compilation data"
+    # Import 'platform' every time, the compiler may have been changed
+    from pypy.translator.platform import platform
     cache_dir = cache_dir_root.join(cachename).ensure(dir=1)
     filecontents = [c_file.read() for c_file in c_files]
     key = repr((filecontents, eci, platform.key()))
@@ -15,6 +17,9 @@
     return cache_dir.join(hash)
 
 def build_executable_cache(c_files, eci):
+    "Builds and run a program; caches the result"
+    # Import 'platform' every time, the compiler may have been changed
+    from pypy.translator.platform import platform
     path = cache_file_path(c_files, eci, 'build_executable_cache')
     try:
         return path.read()
@@ -24,6 +29,9 @@
         return result.out
 
 def try_compile_cache(c_files, eci):
+    "Try to compile a program; caches the result (starts with 'True' or 'FAIL')"
+    # Import 'platform' every time, the compiler may have been changed
+    from pypy.translator.platform import platform
     path = cache_file_path(c_files, eci, 'try_compile_cache')
     try:
         data = path.read()



More information about the Pypy-commit mailing list