""" Support routines for subprocess and multiprocess module. Currently, this extension module is only required when using the modules on Windows. """ import sys if sys.platform != 'win32': raise ImportError("The '_winapi' module is only available on Windows") # Declare external Win32 functions from _pypy_winbase_cffi import ffi as _ffi _kernel32 = _ffi.dlopen('kernel32') GetVersion = _kernel32.GetVersion NULL = _ffi.NULL # Now the _subprocess module implementation def _WinError(): code, message = _ffi.getwinerror() raise WindowsError(code, message) def _int2handle(val): return _ffi.cast("HANDLE", val) def _handle2int(handle): return int(_ffi.cast("intptr_t", handle)) _INVALID_HANDLE_VALUE = _int2handle(-1)
Library, providing access to those non-portable, but still useful routines. """ # XXX incomplete: implemented only functions needed by subprocess.py # PAC: 2010/08 added MS locking for Whoosh # 07/2016: rewrote in CFFI import sys if sys.platform != 'win32': raise ImportError("The 'msvcrt' module is only available on Windows") import _rawffi from _pypy_winbase_cffi import ffi as _ffi _lib = _ffi.dlopen(_rawffi.get_libc().name) _kernel32 = _ffi.dlopen('kernel32') import errno try: from __pypy__ import builtinify, validate_fd except ImportError: builtinify = validate_fd = lambda f: f def _ioerr(): e = _ffi.errno raise IOError(e, errno.errorcode[e])
""" Support routines for subprocess module. Currently, this extension module is only required when using the subprocess module on Windows. """ import sys if sys.platform != 'win32': raise ImportError("The '_subprocess' module is only available on Windows") # Declare external Win32 functions from _pypy_winbase_cffi import ffi as _ffi _kernel32 = _ffi.dlopen('kernel32') GetVersion = _kernel32.GetVersion # Now the _subprocess module implementation def _WinError(): code, message = _ffi.getwinerror() raise WindowsError(code, message) def _int2handle(val): return _ffi.cast("HANDLE", val) _INVALID_HANDLE_VALUE = _int2handle(-1) class _handle(object): def __init__(self, c_handle):
Library, providing access to those non-portable, but still useful routines. """ # XXX incomplete: implemented only functions needed by subprocess.py # PAC: 2010/08 added MS locking for Whoosh # 07/2016: rewrote in CFFI import sys if sys.platform != 'win32': raise ImportError("The 'msvcrt' module is only available on Windows") import _rawffi from _pypy_winbase_cffi import ffi as _ffi _lib = _ffi.dlopen(_rawffi.get_libc().name) import errno try: from __pypy__ import builtinify, validate_fd except ImportError: builtinify = validate_fd = lambda f: f def _ioerr(): e = _ffi.errno raise IOError(e, errno.errorcode[e]) @builtinify
Library, providing access to those non-portable, but still useful routines. """ # XXX incomplete: implemented only functions needed by subprocess.py # PAC: 2010/08 added MS locking for Whoosh # 07/2016: rewrote in CFFI import sys if sys.platform != 'win32': raise ImportError("The 'msvcrt' module is only available on Windows") import _rawffi from _pypy_winbase_cffi import ffi as _ffi _lib = _ffi.dlopen(_rawffi.get_libc().name) import errno try: from __pypy__ import builtinify, validate_fd except ImportError: builtinify = validate_fd = lambda f: f def _ioerr(): e = _ffi.errno raise IOError(e, errno.errorcode[e]) @builtinify def open_osfhandle(fd, flags): """"open_osfhandle(handle, flags) -> file descriptor
""" Support routines for overlapping io. Currently, this extension module is only required when using the modules on Windows. """ import sys if sys.platform != 'win32': raise ImportError("The '_overlapped' module is only available on Windows") # Declare external Win32 functions from _pypy_winbase_cffi import ffi as _ffi _kernel32 = _ffi.dlopen('kernel32') _winsock2 = _ffi.dlopen('Ws2_32') _mswsock = _ffi.dlopen('Mswsock') GetVersion = _kernel32.GetVersion NULL = _ffi.NULL from _winapi import INVALID_HANDLE_VALUE, _MAX_PATH, _Z, RaiseFromWindowsErr import _winapi # # Error Codes # ERROR_IO_PENDING = 997 ERROR_PIPE_BUSY = 231 ERROR_NETNAME_DELETED = 64