[pypy-svn] r32255 - pypy/dist/pypy/jit/codegen
arigo at codespeak.net
arigo at codespeak.net
Wed Sep 13 12:38:58 CEST 2006
Author: arigo
Date: Wed Sep 13 12:38:56 2006
New Revision: 32255
Modified:
pypy/dist/pypy/jit/codegen/detect_cpu.py
Log:
Use the 'platform' module, new in 2.3, which I didn't know about.
Modified: pypy/dist/pypy/jit/codegen/detect_cpu.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/detect_cpu.py (original)
+++ pypy/dist/pypy/jit/codegen/detect_cpu.py Wed Sep 13 12:38:56 2006
@@ -8,13 +8,17 @@
pass
def autodetect():
- platform = sys.platform.lower()
- if platform.startswith('win'): # assume an Intel Windows
- return 'i386'
- # assume we have 'uname'
- mach = os.popen('uname -m', 'r').read().strip()
- if not mach:
- raise ProcessorAutodetectError, "cannot run 'uname -m'"
+ try:
+ import platform
+ mach = platform.machine()
+ except ImportError:
+ platform = sys.platform.lower()
+ if platform.startswith('win'): # assume an Intel Windows
+ return 'i386'
+ # assume we have 'uname'
+ mach = os.popen('uname -m', 'r').read().strip()
+ if not mach:
+ raise ProcessorAutodetectError, "cannot run 'uname -m'"
try:
return {'i386': 'i386',
'i486': 'i386',
More information about the Pypy-commit
mailing list