From e81b13a83211ae00b83dd10a123eea27f9347688 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Sun, 10 Aug 2014 18:18:02 -0700 Subject: [PATCH] Set module version in separate VERSION file --- MANIFEST.in | 2 ++ VERSION | 1 + kafka/__init__.py | 4 +++- setup.py | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 MANIFEST.in create mode 100644 VERSION diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..68bd7939c --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include VERSION +recursive-include kafka *.py diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..ac39a106c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.9.0 diff --git a/kafka/__init__.py b/kafka/__init__.py index e446f58f1..41dc25a39 100644 --- a/kafka/__init__.py +++ b/kafka/__init__.py @@ -1,5 +1,7 @@ __title__ = 'kafka' -__version__ = '0.9.0' +# Use setuptools to get version from setup.py +import pkg_resources +__version__ = pkg_resources.require('kafka-python')[0].version __author__ = 'David Arthur' __license__ = 'Apache License 2.0' __copyright__ = 'Copyright 2012, David Arthur under Apache License, v2.0' diff --git a/setup.py b/setup.py index 6e2c50901..d719bf421 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,8 @@ from setuptools import setup, Command -from kafka import __version__ +with open('VERSION', 'r') as v: + __version__ = v.read().rstrip() class Tox(Command):