Commits

Armin Rigo committed ab75804

Avoid calling os.uname() at runtime. Not completely sure this plays
nice with cross-compilation. How can I check?...

Also, a fix for builds on linux3 on some Python versions.

  • Participants
  • Parent commits 27e883f

Comments (0)

Files changed (1)

rpython/memory/gc/env.py

 
 # ---------- Linux2 ----------
 
+try:
+    ARCH = os.uname()[4]  # machine
+except (OSError, AttributeError):
+    ARCH = ''
+
 def get_L2cache_linux2():
-    arch = os.uname()[4]  # machine
+    arch = ARCH      # precomputed; the call to os.uname() is not translated
     if arch.endswith('86') or arch == 'x86_64':
         return get_L2cache_linux2_cpuinfo()
     if arch in ('alpha', 'ppc', 'ppc64'):
         return get_L2cache_linux2_sparc()
     return -1
 
+get_L2cache_linux3 = get_L2cache_linux2
+
 
 def get_L2cache_linux2_cpuinfo(filename="/proc/cpuinfo", label='cache size'):
     debug_start("gc-hardware")