From cfa2f34a4c049a68b021bc82704416e7d517f183 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 21 2019 11:16:39 +0000 Subject: Get the version by reading the file rather than importing it Signed-off-by: Pierre-Yves Chibon --- diff --git a/setup.py b/setup.py index 1821fe5..8836c03 100644 --- a/setup.py +++ b/setup.py @@ -4,13 +4,19 @@ Setup script """ -# These two lines are needed to run on EL6 -__requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4'] -import pkg_resources +import os +import re +from setuptools import setup -from fedora_elections import __version__ +versionfile = os.path.join( + os.path.dirname(__file__), 'fedora_elections', '__init__.py') -from setuptools import setup +# Thanks to SQLAlchemy: +# https://github.com/zzzeek/sqlalchemy/blob/master/setup.py#L104 +with open(versionfile) as stream: + __version__ = re.compile( + r".*__version__ = '(.*?)'", re.S + ).match(stream.read()).group(1) setup( name='fedora-elections',