From 3f5189f8c3c0230bc10fc1c90349c5c340fe808a Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Mon, 31 Oct 2016 09:56:15 +0100 Subject: better version handling --- setup.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 70a85c2..9804422 100755 --- a/setup.py +++ b/setup.py @@ -3,19 +3,25 @@ from setuptools import setup, find_packages from codecs import open from os import path -import numpy from setuptools.extension import Extension from Cython.Build import cythonize - +import numpy +import re +import os here = path.abspath(path.dirname(__file__)) -import os + #import glob -version='0.1.5' +# dirty but working +__version__ = re.search( + r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too + open('ot/__init__.py').read()).group(1) +# The beautiful part is, I don't even need to check exceptions here. +# If something messes up, let the build process fail noisy, BEFORE my release! ROOT = os.path.abspath(os.path.dirname(__file__)) @@ -29,7 +35,7 @@ except (IOError, ImportError): setup(name='POT', - version=version, + version=__version__, description='Python Optimal Transport Library', long_description=README, author=u'Remi Flamary, Nicolas Courty', @@ -43,7 +49,7 @@ setup(name='POT', language="c++", # generate and compile C++ code, include_dirs=[numpy.get_include(),os.path.join(ROOT,'ot/lp')])), platforms=['linux','macosx','windows'], - download_url='https://github.com/rflamary/POT/archive/V{}.tar.gz'.format(version), + download_url='https://github.com/rflamary/POT/archive/V{}.tar.gz'.format(__version__), license = 'MIT', scripts=[], data_files=[], -- cgit v1.2.3