Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r63877:987f44a927f7
Date: 2013-05-06 14:40 +0200
http://bitbucket.org/pypy/pypy/changeset/987f44a927f7/

Log:    Fix this to not depend on the cpumodel.

diff --git a/lib_pypy/ctypes_config_cache/dumpcache.py 
b/lib_pypy/ctypes_config_cache/dumpcache.py
--- a/lib_pypy/ctypes_config_cache/dumpcache.py
+++ b/lib_pypy/ctypes_config_cache/dumpcache.py
@@ -1,25 +1,21 @@
-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()
diff --git a/lib_pypy/ctypes_config_cache/rebuild.py 
b/lib_pypy/ctypes_config_cache/rebuild.py
--- a/lib_pypy/ctypes_config_cache/rebuild.py
+++ b/lib_pypy/ctypes_config_cache/rebuild.py
@@ -25,13 +25,12 @@
         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')):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to