From 3c04441eb6638b739b475b68e5682c208cd8f755 Mon Sep 17 00:00:00 2001 From: nibrag Date: Sat, 7 May 2016 13:58:46 +0300 Subject: [PATCH] Automatic version determination and check python version --- setup.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 434bfa5..1eb4086 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,34 @@ #!/usr/bin/env python +import codecs +import os +import re +import sys + try: from setuptools import setup except ImportError: from distutils.core import setup + +with codecs.open(os.path.join(os.path.abspath(os.path.dirname( + __file__)), 'aiosocks', '__init__.py'), 'r', 'latin1') as fp: + try: + version = re.findall(r"^__version__ = '([^']+)'\r?$", + fp.read(), re.M)[0] + except IndexError: + raise RuntimeError('Unable to determine version.') + + +if sys.version_info < (3, 5, 1): + raise RuntimeError("aiosocks requires Python 3.5.1+") + + setup( name='aiosocks', author='Nail Ibragimov', - version='0.1.1', - license='LICENSE.txt', + author_email='ibragwork@gmail.com', + version=version, + license='Apache 2', url='https://github.com/nibrag/aiosocks', description='SOCKS proxy client for asyncio and aiohttp',