[pypy-svn] r22606 - pypy/dist/pypy/rpython/rctypes
gromit at codespeak.net
gromit at codespeak.net
Tue Jan 24 17:50:41 CET 2006
Author: gromit
Date: Tue Jan 24 17:50:38 2006
New Revision: 22606
Modified:
pypy/dist/pypy/rpython/rctypes/implementation.py
pypy/dist/pypy/rpython/rctypes/interface.py
Log:
FIX: Don't import windows stuff on linux.
Modified: pypy/dist/pypy/rpython/rctypes/implementation.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/implementation.py (original)
+++ pypy/dist/pypy/rpython/rctypes/implementation.py Tue Jan 24 17:50:38 2006
@@ -2,8 +2,11 @@
The rctypes implementaion is contained here.
"""
+import sys
from ctypes import *
-from ctypes import _FUNCFLAG_CDECL, _FUNCFLAG_STDCALL
+from ctypes import _FUNCFLAG_CDECL
+if sys.platform == "win32":
+ from ctypes import _FUNCFLAG_STDCALL
from pypy.annotation.model import SomeInteger
from pypy.rpython.lltypesystem.lltype import Signed
@@ -61,15 +64,16 @@
-class RWinDLL(WinDLL):
- """
- This is the restricted version of ctypes' WINDLL class
- """
-
- class _StdcallFuncPtr(FunctionPointerTranslation, WinDLL._StdcallFuncPtr):
+if sys.platform == "win32":
+ class RWinDLL(WinDLL):
"""
- A simple extension of ctypes function pointers that
- implements a simple interface to the anotator.
+ This is the restricted version of ctypes' WINDLL class
"""
- _flags_ = _FUNCFLAG_STDCALL
+
+ class _StdcallFuncPtr(FunctionPointerTranslation, WinDLL._StdcallFuncPtr):
+ """
+ A simple extension of ctypes function pointers that
+ implements a simple interface to the anotator.
+ """
+ _flags_ = _FUNCFLAG_STDCALL
Modified: pypy/dist/pypy/rpython/rctypes/interface.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/interface.py (original)
+++ pypy/dist/pypy/rpython/rctypes/interface.py Tue Jan 24 17:50:38 2006
@@ -1,8 +1,13 @@
from ctypes import _DLLS
-from implementation import RCDLL as CDLL, RWinDLL as WinDLL, c_int, c_char_p, c_char, POINTER
+from implementation import RCDLL as CDLL, c_int, c_char_p, c_char, POINTER
+try:
+ from implementation import RWinDLL as WinDLL
+except ImportError:
+ WinDLL = None
cdll = _DLLS( CDLL )
-windll = _DLLS( WinDLL )
+if WinDLL:
+ windll = _DLLS( WinDLL )
"""
More information about the Pypy-commit
mailing list