From 41eb6f64bd84c62b68a41bf53feb756097d22864 Mon Sep 17 00:00:00 2001 From: George Kraft Date: Tue, 12 Nov 2013 03:12:48 -0600 Subject: CXMAN-254: Move version definition from setup.py to __init__.py This makes the pyipmi version accessible via the pyipmi.__version__ variable, so we no longer have to use pkg_resources to find it. --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 1fadda7..20bfe0f 100644 --- a/setup.py +++ b/setup.py @@ -30,9 +30,17 @@ from setuptools import setup +def get_version(): + """ Parse __init__.py to find the package version """ + for line in open("pyipmi/__init__.py"): + key, delim, value = line.partition("=") + if key.strip() == "__version__" and delim == "=": + return value.strip().strip("'\"") + raise Exception("Failed to parse pyipmi package version from __init__.py") + setup( name='pyipmi', - version='0.9.0', + version=get_version(), packages=['pyipmi', 'pyipmi.commands', 'pyipmi.tools'], -- cgit v1.2.1