diff --git a/README.rst b/README.rst index 40f4754..4853f1c 100644 --- a/README.rst +++ b/README.rst @@ -32,6 +32,10 @@ want the C extension, set the environment variable ``RADIX_NO_EXT=1``. Tests are in the ``tests/`` directory and can be run with ``python setup.py nosetests``. +Windows +^^^^^^^ +Windows support depends on a third-party library--`win-inet-pton`--to provide `inet_pton` and `inet_ntop` wrappers for the socket library. It is automatically included for installations on the Windows platform. + Usage ----- diff --git a/radix/radix.py b/radix/radix.py index 15b1048..142590a 100644 --- a/radix/radix.py +++ b/radix/radix.py @@ -1,3 +1,6 @@ +import sys +if sys.platform.startswith('win'): + import win_inet_pton from socket import (getaddrinfo, gaierror, inet_pton, inet_ntop, AF_INET, AF_INET6, SOCK_RAW, AI_NUMERICHOST) diff --git a/setup.py b/setup.py index 0759445..b425b5a 100755 --- a/setup.py +++ b/setup.py @@ -56,6 +56,9 @@ ], tests_require=tests_require, packages=find_packages(exclude=['tests', 'tests.*']), + install_requires=[ + 'win-inet-pton >= 1.0.1;platform_system=="Windows"', + ], test_suite='nose.collector', **extra_kwargs )