From 9193ffddf2d22b4e37c6dfaf9727f401971f9231 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Tue, 3 Dec 2019 16:08:53 -0800 Subject: [PATCH] fix problem where if you don't have things installed, it'll fail to install because installing requires things to be installed... Not pretty to parse out the version, but other packages do it.. and better than repeating it multiple times.. --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ae12c5d..401489f 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,15 @@ #!/usr/bin/env python +def getversion(fname): + with open(fname) as fp: + v = [ x for x in fp.readlines() if x.startswith('__version__') ] + if len(v) != 1: + raise ValueError('too many lines start with __version__') + return v[0].split("'")[1] + from setuptools import setup -from ntunnel import __version__ +import os.path +__version__ = getversion(os.path.join('ntunnel', '__init__.py')) # Install requirements for git: # https://stackoverflow.com/questions/18026980/python-setuptools-how-can-i-list-a-private-repository-under-install-requires