Commits

Maciej Fijalkowski committed d8d1c8b

Remove caching.

  • Participants
  • Parent commits 5fb0a2b

Comments (0)

Files changed (3)

ctypes_configure/cbuild.py

 
 import os, sys, inspect, re, imp, py
 from ctypes_configure import stdoutcapture
+import distutils
 
 debug = 0
 
         opt += '/Op'
     gcv['OPT'] = opt
 
+
+def try_compile(c_files, eci):
+    try:
+        build_executable(c_files, eci)
+        result = True
+    except (distutils.errors.CompileError,
+            distutils.errors.LinkError):
+        result = False
+    return result
+
 def compile_c_module(cfiles, modbasename, eci, tmpdir=None):
     #try:
     #    from distutils.log import set_threshold
 
 def log_spawned_cmd(spawn):
     def spawn_and_log(cmd, *args, **kwds):
-        log.execute(' '.join(cmd))
+        if debug:
+            log.execute(' '.join(cmd))
         return spawn(cmd, *args, **kwds)
     return spawn_and_log
 

ctypes_configure/configure.py

 
 import os, py, sys
 import ctypes
-from ctypes_configure.cbuild import build_executable, configdir
+from ctypes_configure.cbuild import build_executable, configdir, try_compile
 from ctypes_configure.cbuild import ExternalCompilationInfo
-from ctypes_configure.gcc_cache import build_executable_cache, try_compile_cache
 import distutils
 
 # ____________________________________________________________
         self.f.write(question + "\n")
         self.close()
         eci = self.config._compilation_info_
-        return try_compile_cache([self.path], eci)
+        return try_compile([self.path], eci)
 
         
 def configure(CConfig):

ctypes_configure/gcc_cache.py

-
-from ctypes_configure.cbuild import build_executable, ExternalCompilationInfo
-import md5
-import py
-import distutils
-import distutils.errors
-
-cache_dir_root = py.magic.autopath().join('..', '_cache').ensure(dir=1)
-
-def cache_file_path(c_files, eci, cachename):
-    cache_dir = cache_dir_root.join(cachename).ensure(dir=1)
-    filecontents = [c_file.read() for c_file in c_files]
-    key = repr((filecontents, eci))
-    hash = md5.md5(key).hexdigest()
-    return cache_dir.join(hash)
-
-def build_executable_cache(c_files, eci):
-    path = cache_file_path(c_files, eci, 'build_executable_cache')
-    try:
-        return path.read()
-    except py.error.Error:
-        result = py.process.cmdexec(build_executable(c_files, eci))
-        path.write(result)
-        return result
-
-def try_compile_cache(c_files, eci):
-    path = cache_file_path(c_files, eci, 'try_compile_cache')
-    try:
-        return eval(path.read())
-    except py.error.Error:
-        try:
-            build_executable(c_files, eci)
-            result = True
-        except (distutils.errors.CompileError,
-                distutils.errors.LinkError):
-            result = False
-        path.write(repr(result))
-        return result