Change setup.py so that it reads the version from version.py

This commit is contained in:
Arash Ghoreyshi
2013-07-01 13:47:40 -05:00
parent d58235bb12
commit 122ce67728
2 changed files with 16 additions and 2 deletions

View File

@@ -17,5 +17,5 @@
Cloudkeep's Barbican Client version
"""
__version__ = '0.2.1'
__version__ = '0.2.1dev'
__version_info__ = tuple(__version__.split('.'))

View File

@@ -24,9 +24,23 @@ name = 'python-barbicanclient'
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def get_version():
PKG = "barbicanclient"
VERSIONFILE = os.path.join(PKG, "version.py")
version = "unknown"
try:
version_file = open(VERSIONFILE, "r")
for line in version_file:
if '__version__' in line:
version = line.split("'")[1]
break
except EnvironmentError:
pass # Okay, there is no version file.
return version
setuptools.setup(
name=name,
version="0.2.1dev",
version=get_version(),
description='Client Library for OpenStack Barbican Key Management API',
long_description=read('README.md'),
keywords="openstack encryption key-management secret",