euscan: use python-git for __version__

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-07-24 08:33:19 +02:00
parent 9d905166be
commit 46c2ea6f70

View File

@ -5,21 +5,26 @@ Distributed under the terms of the GNU General Public License v2
""" """
from __future__ import print_function from __future__ import print_function
import os
# Meta # Meta
__author__ = "Corentin Chary (iksaif)" __author__ = "Corentin Chary (iksaif)"
__email__ = "corentin.chary@gmail.com" __email__ = "corentin.chary@gmail.com"
__version__ = "git"
__productname__ = "euscan" __productname__ = "euscan"
__description__ = "A tool to detect new upstream releases." __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 # Imports
import sys import sys
import os
import getopt import getopt
from errno import EINTR, EINVAL from errno import EINTR, EINVAL
from httplib import HTTPConnection from httplib import HTTPConnection