From 9d59078489dc834d2afe4242bef30c88b739f14d Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Fri, 30 Mar 2018 20:03:45 -0400 Subject: Read version from __init__ --- immutables/__init__.py | 1 + setup.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/immutables/__init__.py b/immutables/__init__.py index fa060ed..48deb49 100644 --- a/immutables/__init__.py +++ b/immutables/__init__.py @@ -2,3 +2,4 @@ from ._map import Map __all__ = 'Map', +__version__ = '0.1' diff --git a/setup.py b/setup.py index b32ab17..b0cd4c9 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,26 @@ +import os.path import platform import setuptools -VERSION = '0.1' - CFLAGS = ['-O2'] if platform.uname().system != 'Windows': CFLAGS.extend(['-std=c99', '-fsigned-char', '-Wall', '-Wsign-compare', '-Wconversion']) +with open(os.path.join( + os.path.dirname(__file__), 'immutables', '__init__.py')) as f: + for line in f: + if line.startswith('__version__ ='): + _, _, version = line.partition('=') + VERSION = version.strip(" \n'\"") + break + else: + raise RuntimeError( + 'unable to read the version from immutables/__init__.py') + + setuptools.setup( name='immutables', version=VERSION, -- cgit v1.2.3