mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
add git version printing where available.
This commit is contained in:
parent
a273f9687f
commit
1a96e190e5
1 changed files with 9 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import shutil
|
||||
import lib.configobj
|
||||
from subprocess import check_output, CalledProcessError
|
||||
from lib.configobj import ConfigObj
|
||||
from itertools import chain
|
||||
|
||||
|
@ -41,6 +42,14 @@ class config(original_ConfigObj):
|
|||
LOG_CONFIG = os.path.join(PROGRAM_DIR, "logging.cfg")
|
||||
SAMPLE_LOG_CONFIG = os.path.join(PROGRAM_DIR, "logging.cfg.sample")
|
||||
|
||||
try:
|
||||
repo = check_output(["git", "config", "--get", "remote.origin.url"]).splitlines()[0]
|
||||
branch = check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).splitlines()[0]
|
||||
hash = check_output(["git", "rev-parse", "--short", "HEAD"]).splitlines()[0]
|
||||
NZBTOMEDIA_VERSION = 'repo:' + repo + ' branch:' + branch + ' hash: ' + hash
|
||||
except CalledProcessError:
|
||||
pass
|
||||
|
||||
def __init__(self, *args, **kw):
|
||||
if len(args) == 0:
|
||||
args = (self.CONFIG_FILE,)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue