diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/env python3 import os -import b4 +import re from setuptools import setup # Utility function to read the README file. @@ -14,10 +14,18 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() +def find_version(source): + version_file = read(source) + version_match = re.search(r"^__VERSION__ = ['\"]([^'\"]*)['\"]", version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + NAME = 'b4' setup( - version=b4.VERSION, + version=find_version('b4/__init__.py'), url='https://git.kernel.org/pub/scm/utils/b4/b4.git', name=NAME, description='A tool to work with public-inbox and patch archives', |