summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2013-11-12 03:16:44 -0600
committerGeorge Kraft <george.kraft@calxeda.com>2013-11-12 03:16:44 -0600
commita68b90e5c412d414776177bb6c2fdc01d6223f84 (patch)
tree442cd6ac468b4fb024828bd095d60bdd8ca9dbd8
parent545098d5d051e574297aa71ecf74026095f51dd3 (diff)
downloadcxmanage-a68b90e5c412d414776177bb6c2fdc01d6223f84.tar.gz
CXMAN-254: Move version definition from setup.py to __init__.py
This makes the cxmanage package accessible via the cxmanage_api.__version__ variable.
-rw-r--r--cxmanage_api/__init__.py3
-rw-r--r--setup.py10
2 files changed, 12 insertions, 1 deletions
diff --git a/cxmanage_api/__init__.py b/cxmanage_api/__init__.py
index 9cff494..6c2a52e 100644
--- a/cxmanage_api/__init__.py
+++ b/cxmanage_api/__init__.py
@@ -38,6 +38,9 @@ import shutil
import tempfile
+__version__ = "0.10.1"
+
+
WORK_DIR = tempfile.mkdtemp(prefix="cxmanage_api-")
atexit.register(lambda: shutil.rmtree(WORK_DIR))
diff --git a/setup.py b/setup.py
index f1414a8..060f8fe 100644
--- a/setup.py
+++ b/setup.py
@@ -34,9 +34,17 @@
from setuptools import setup
+def get_version():
+ """ Parse __init__.py to find the package version """
+ for line in open("cxmanage_api/__init__.py"):
+ key, delim, value = line.partition("=")
+ if key.strip() == "__version__" and delim == "=":
+ return value.strip().strip("'\"")
+ raise Exception("Failed to parse cxmanage package version from __init__.py")
+
setup(
name='cxmanage',
- version='0.10.1',
+ version=get_version(),
packages=[
'cxmanage_api',
'cxmanage_api.cli',