[pypy-svn] r42649 - in pypy/dist/pypy: module/select rlib

afa at codespeak.net afa at codespeak.net
Thu May 3 23:17:35 CEST 2007


Author: afa
Date: Thu May  3 23:17:33 2007
New Revision: 42649

Removed:
   pypy/dist/pypy/module/select/ctypes_select.py
Modified:
   pypy/dist/pypy/module/select/__init__.py
   pypy/dist/pypy/module/select/interp_select.py
   pypy/dist/pypy/rlib/_rsocket_ctypes.py
Log:
Remove ctypes_select in favor of _rsocket_ctypes.
Most of select structs and functions were actually already used by rsocket,
and it will be easier to port to win32.

Next step: work on Windows to write a poll() replacement.


Modified: pypy/dist/pypy/module/select/__init__.py
==============================================================================
--- pypy/dist/pypy/module/select/__init__.py	(original)
+++ pypy/dist/pypy/module/select/__init__.py	Thu May  3 23:17:33 2007
@@ -13,9 +13,15 @@
     }
 
     def buildloaders(cls):
-        from pypy.module.select import ctypes_select as _c 
-        for constant, value in _c.constants.iteritems():
-            Module.interpleveldefs[constant] = "space.wrap(%r)" % value
+        constantnames = '''
+            POLLIN POLLPRI POLLOUT POLLERR POLLHUP POLLNVAL
+            POLLRDNORM POLLRDBAND POLLWRNORM POLLWEBAND POLLMSG'''.split()
+
+        from pypy.rlib._rsocket_ctypes import constants
+        for name in constantnames:
+            if name in constants:
+                value = constants[name]
+                Module.interpleveldefs[name] = "space.wrap(%r)" % value
         super(Module, cls).buildloaders()
     buildloaders = classmethod(buildloaders)
 

Modified: pypy/dist/pypy/module/select/interp_select.py
==============================================================================
--- pypy/dist/pypy/module/select/interp_select.py	(original)
+++ pypy/dist/pypy/module/select/interp_select.py	Thu May  3 23:17:33 2007
@@ -1,7 +1,7 @@
 from pypy.interpreter.typedef import TypeDef
 from pypy.interpreter.baseobjspace import Wrappable
 from pypy.interpreter.gateway import W_Root, ObjSpace, interp2app
-from pypy.module.select import ctypes_select as _c
+from pypy.rlib import _rsocket_ctypes as _c
 from pypy.rpython.rctypes.aerrno import geterrno
 from pypy.interpreter.error import OperationError
 

Modified: pypy/dist/pypy/rlib/_rsocket_ctypes.py
==============================================================================
--- pypy/dist/pypy/rlib/_rsocket_ctypes.py	(original)
+++ pypy/dist/pypy/rlib/_rsocket_ctypes.py	Thu May  3 23:17:33 2007
@@ -22,6 +22,7 @@
                 'sys/socket.h',
                 'sys/un.h',
                 'sys/poll.h',
+                'sys/select.h',
                 'netinet/in.h',
                 'netinet/tcp.h',
                 'unistd.h',
@@ -64,8 +65,6 @@
     INVALID_SOCKET = ctypes_platform.DefinedConstantInteger('INVALID_SOCKET')
     INET_ADDRSTRLEN = ctypes_platform.DefinedConstantInteger('INET_ADDRSTRLEN')
     INET6_ADDRSTRLEN= ctypes_platform.DefinedConstantInteger('INET6_ADDRSTRLEN')
-    POLLIN = ctypes_platform.DefinedConstantInteger('POLLIN')
-    POLLOUT = ctypes_platform.DefinedConstantInteger('POLLOUT')
     EINPROGRESS = ctypes_platform.DefinedConstantInteger('EINPROGRESS')
     WSAEINPROGRESS = ctypes_platform.DefinedConstantInteger('WSAEINPROGRESS')
     EWOULDBLOCK = ctypes_platform.DefinedConstantInteger('EWOULDBLOCK')
@@ -134,6 +133,9 @@
 TCP_LINGER2 TCP_MAXSEG TCP_NODELAY TCP_QUICKACK TCP_SYNCNT TCP_WINDOW_CLAMP
 
 IPX_TYPE
+
+POLLIN POLLPRI POLLOUT POLLERR POLLHUP POLLNVAL
+POLLRDNORM POLLRDBAND POLLWRNORM POLLWEBAND POLLMSG
 '''.split()
 
 for name in constant_names:
@@ -313,8 +315,6 @@
 FIONBIO = cConfig.FIONBIO
 INET_ADDRSTRLEN = cConfig.INET_ADDRSTRLEN
 INET6_ADDRSTRLEN = cConfig.INET6_ADDRSTRLEN
-POLLIN = cConfig.POLLIN
-POLLOUT = cConfig.POLLOUT
 EINPROGRESS = cConfig.EINPROGRESS or cConfig.WSAEINPROGRESS
 EWOULDBLOCK = cConfig.EWOULDBLOCK or cConfig.WSAEWOULDBLOCK
 EAFNOSUPPORT = cConfig.EAFNOSUPPORT or cConfig.WSAEAFNOSUPPORT


More information about the pypy-svn mailing list