We currently duplicate the project version number in bmaptool and setup.py
files. Let's get rid of the duplication and have setup.py parse the bmaptool
file and fetch the version number.
Change-Id: I06ee68ca29b16fac2cbfa53cd9a61329b8606409
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Current TODO list, any help with these is appreciated.
-3. In setup.py, fetch the version from 'bmaptool' file.
4. Teach the 'make_a_release.sh' script to update the version and the
changelog.
6. Write in the man page, docs, and may be --help that it is very important
#!/usr/bin/env python
+import re
from setuptools import setup, find_packages
+def get_version():
+ """Fetch the project version number from the 'bmaptool' file."""
+
+ with open("bmaptool", "r") as fobj:
+ for line in fobj:
+ matchobj = re.match(r'^VERSION = "(\d+.\d+)"$', line)
+ if matchobj:
+ return matchobj.group(1)
+
+ return None
+
setup(
name="bmap-tools",
description="Bmap tools",
author="Artem Bityutskiy",
author_email="artem.bityutskiy@linux.intel.com",
- version="2.6",
+ version=get_version(),
scripts=['bmaptool'],
packages=find_packages(exclude=["test*"]),
license='GPLv2',