Commits

Armin Rigo  committed 987f44a

Fix this to not depend on the cpumodel.

  • Participants
  • Parent commits ca87dba

Comments (0)

Files changed (2)

File lib_pypy/ctypes_config_cache/dumpcache.py

-import os
+import sys, os
 from ctypes_configure import dumpcache
-from rpython.jit.backend import detect_cpu
 
 def dumpcache2(basename, config):
-    model = detect_cpu.autodetect_main_model_and_size()
-    filename = '_%s_%s_.py' % (basename, model)
+    size = 32 if sys.maxint <= 2**32 else 64
+    filename = '_%s_%s_.py' % (basename, size)
     dumpcache.dumpcache(__file__, filename, config)
     #
     filename = os.path.join(os.path.dirname(__file__),
                             '_%s_cache.py' % (basename,))
     g = open(filename, 'w')
     print >> g, '''\
-try:
-    from __pypy__ import cpumodel
-except ImportError:
-    from rpython.jit.backend import detect_cpu
-    cpumodel = detect_cpu.autodetect_main_model_and_size()
+import sys
+_size = 32 if sys.maxint <= 2**32 else 64
 # XXX relative import, should be removed together with
 # XXX the relative imports done e.g. by lib_pypy/pypy_test/test_hashlib
-mod = __import__("_%s_%%s_" %% (cpumodel,),
-                 globals(), locals(), ["*"])
-globals().update(mod.__dict__)\
+_mod = __import__("_%s_%%s_" %% (_size,),
+                  globals(), locals(), ["*"])
+globals().update(_mod.__dict__)\
 ''' % (basename,)
     g.close()

File lib_pypy/ctypes_config_cache/rebuild.py

         sys.path[:] = path
 
 def try_rebuild():
-    from rpython.jit.backend import detect_cpu
-    model = detect_cpu.autodetect_main_model_and_size()
-    # remove the files '_*_model_.py'
+    size = 32 if sys.maxint <= 2**32 else 64
+    # remove the files '_*_size_.py'
     left = {}
     for p in os.listdir(_dirpath):
-        if p.startswith('_') and (p.endswith('_%s_.py' % model) or
-                                  p.endswith('_%s_.pyc' % model)):
+        if p.startswith('_') and (p.endswith('_%s_.py' % size) or
+                                  p.endswith('_%s_.pyc' % size)):
             os.unlink(os.path.join(_dirpath, p))
         elif p.startswith('_') and (p.endswith('_.py') or
                                     p.endswith('_.pyc')):