From 46c2ea6f70758c4df56c1bc9cb28e0a0d3637c9d Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Tue, 24 Jul 2012 08:33:19 +0200 Subject: [PATCH] euscan: use python-git for __version__ Signed-off-by: Corentin Chary --- bin/euscan | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/euscan b/bin/euscan index 8696848..42d63e8 100755 --- a/bin/euscan +++ b/bin/euscan @@ -5,21 +5,26 @@ Distributed under the terms of the GNU General Public License v2 """ from __future__ import print_function - +import os # Meta __author__ = "Corentin Chary (iksaif)" __email__ = "corentin.chary@gmail.com" -__version__ = "git" __productname__ = "euscan" __description__ = "A tool to detect new upstream releases." +if os.path.exists(os.path.join(os.path.dirname(__file__), "..", ".git")): + import git + repo = git.Repo(os.path.join(os.path.dirname(__file__))) + __version__ = "git-%s" % repo.head.commit +else: + __version__ = "git" + # Imports import sys -import os import getopt from errno import EINTR, EINVAL from httplib import HTTPConnection