[pypy-svn] r46340 - pypy/dist/pypy/rpython/lltypesystem

xoraxax at codespeak.net xoraxax at codespeak.net
Wed Sep 5 13:49:24 CEST 2007


Author: xoraxax
Date: Wed Sep  5 13:49:22 2007
New Revision: 46340

Modified:
   pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
Do not bail out on missing ctypes (ignore the importerror), now pypy doesnt depend on ctypes for easy targets.

Modified: pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py	Wed Sep  5 13:49:22 2007
@@ -1,6 +1,11 @@
 import sys
-import ctypes
-import ctypes.util
+
+try:
+    import ctypes
+    import ctypes.util
+except ImportError:
+    ctypes = None
+
 import os
 from pypy.rpython.lltypesystem import lltype, llmemory
 from pypy.rpython.extfunc import ExtRegistryEntry
@@ -417,16 +422,17 @@
 
 # __________ the standard C library __________
 
-if sys.platform == 'win32':
-    # trying to guess the correct libc... only a few tests fail if there
-    # is a mismatch between the one used by python2x.dll and the one
-    # loaded here
-    if sys.version_info < (2, 4):
-        standard_c_lib = ctypes.cdll.LoadLibrary('msvcrt.dll')
+if ctypes:
+    if sys.platform == 'win32':
+        # trying to guess the correct libc... only a few tests fail if there
+        # is a mismatch between the one used by python2x.dll and the one
+        # loaded here
+        if sys.version_info < (2, 4):
+            standard_c_lib = ctypes.cdll.LoadLibrary('msvcrt.dll')
+        else:
+            standard_c_lib = ctypes.cdll.LoadLibrary('msvcr71.dll')
     else:
-        standard_c_lib = ctypes.cdll.LoadLibrary('msvcr71.dll')
-else:
-    standard_c_lib = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
+        standard_c_lib = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
 
 # ____________________________________________
 



More information about the Pypy-commit mailing list