From 9cf0468c0ba363d43e50ba9cfd89ec876b7dceb4 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Fri, 12 Feb 2021 22:41:37 +0000 Subject: [PATCH] add win_inet_pton for py27 --- requirements.txt | 3 ++- setup.py | 6 ++---- steam/utils/__init__.py | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index d5e0306..a3416a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ vdf>=3.3 gevent>=1.3.0 protobuf>=3.0.0 gevent-eventemitter~=2.1 -enum34==1.1.2; python_version < '3.4' PyYAML==5.1 cachetools>=3.0.0 +enum34==1.1.2; python_version < '3.4' +win-inet-pton; python_version == '2.7' and platform_system == 'Windows' diff --git a/setup.py b/setup.py index 1c093d5..20f3ee7 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,6 @@ from setuptools import setup, find_packages from codecs import open from os import path -import sys here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: @@ -20,6 +19,8 @@ install_requires = [ 'requests>=2.9.1', 'vdf>=3.3', 'cachetools>=3.0.0', + "win-inet-pton; python_version == '2.7' and platform_system == 'Windows'", + "enum34==1.1.2; python_version < '3.4'", ] install_extras = { @@ -30,9 +31,6 @@ install_extras = { ], } -if sys.version_info < (3, 4): - install_requires.append('enum34>=1.0.4') - setup( name='steam', version=__version__, diff --git a/steam/utils/__init__.py b/steam/utils/__init__.py index c59a552..b9d647a 100644 --- a/steam/utils/__init__.py +++ b/steam/utils/__init__.py @@ -1,10 +1,15 @@ """Utility package with various useful functions """ +import six +from six.moves import xrange as _range + +if sys.PY2: + import win_inet_pton + import weakref import struct import socket import sys -from six.moves import xrange as _range def ip4_from_int(ip):