diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-06-07 14:35:28 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-08-13 20:34:40 +0200 |
commit | 2f616834be2e6e104c9cd108e08030b2b4be68da (patch) | |
tree | 72ee3b8f1ef9117b5b6c52fb4adee1a5d4e861dd /version.py | |
parent | f190cf2e44a0aa6666b6b3b6d7bb5fc0d758f823 (diff) | |
download | hostinfo-maintainer-debian/0.1.5.tar.gz hostinfo-maintainer-debian/0.1.5.tar.bz2 hostinfo-maintainer-debian/0.1.5.zip |
debian: debianizationdebian/0.1.5
Diffstat (limited to 'version.py')
-rw-r--r-- | version.py | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/version.py b/version.py deleted file mode 100644 index 498ce51..0000000 --- a/version.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# To use this script, simply import it your setup.py file, and use the -# results of get_git_version() as your package version: -# -# from version import * -# -# setup( -# version=get_git_version(), -# . -# . -# . -# ) - -__all__ = ["get_git_version"] - -import os -import re -from subprocess import Popen, PIPE - -OWN_DIR = os.path.dirname(os.path.abspath(os.path.realpath(__file__))) - -def call_git_describe(abbrev=4): - try: - p = Popen(['git', 'describe', '--abbrev=%d' % abbrev, - '--tags', '--dirty'], - cwd=OWN_DIR, stdout=PIPE, stderr=PIPE) - p.stderr.close() - line = p.stdout.readlines()[0] - return line.strip() - - except: - return None - -def get_git_version(abbrev=4): - version = call_git_describe(abbrev) - if version is None: - raise ValueError("Cannot find the version number!") - - return re.sub('^debian/', '', version) - -if __name__ == "__main__": - print get_git_version() |