# HG changeset patch # User Chaiwat Suttipongsakul # Date 1531673940 -25200 # Sun Jul 15 23:59:00 2018 +0700 # Node ID a5d588a2813c391029324b06f137efb7fea8131c # Parent a00d833c3c1ba4bcbcdfb91894601e31cb541607 add experimental support for Windows diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -21,7 +21,6 @@ description='Asynchronous I/O HTTP and HTTPS Proxy on Python 3.5', long_description=readme(), keywords='wormhole asynchronous web proxy', - platforms='POSIX', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -29,10 +28,14 @@ 'Intended Audience :: System Administrators', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Internet :: Proxy Servers', ], + install_requires=[ + 'pywin32;platform_system=="Windows"', + ], packages=['wormhole'], include_package_data=True, entry_points={'console_scripts': ['wormhole = wormhole.proxy:main']}, diff --git a/wormhole/proxy.py b/wormhole/proxy.py --- a/wormhole/proxy.py +++ b/wormhole/proxy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -VERSION = "v2.0.2" +VERSION = "v2.0.3" import sys if sys.version_info < (3, 5): diff --git a/wormhole/server.py b/wormhole/server.py --- a/wormhole/server.py +++ b/wormhole/server.py @@ -1,6 +1,6 @@ import asyncio import functools -import resource +import sys from time import time from wormhole.authentication import get_ident from wormhole.authentication import verify @@ -11,7 +11,12 @@ MAX_RETRY = 3 -MAX_TASKS = resource.getrlimit(resource.RLIMIT_NOFILE)[0] +if sys.platform == 'win32': + import win32file + MAX_TASKS = win32file._getmaxstdio() +else: + import resource + MAX_TASKS = resource.getrlimit(resource.RLIMIT_NOFILE)[0] wormhole_semaphore = None