only fetch commit hash if in running from git repo

This commit is contained in:
Izalia Mae 2022-11-16 10:41:00 -05:00
parent 8fd712c849
commit ef5d4bc579
2 changed files with 11 additions and 6 deletions

View file

@ -1,4 +1,4 @@
from .manage import main
from relay.manage import main
if __name__ == '__main__':

View file

@ -2,6 +2,8 @@ import logging
import subprocess
import traceback
from pathlib import Path
from . import __version__, misc
from .http_debug import STATS
from .misc import Message, Response, WKNodeinfo
@ -9,13 +11,16 @@ from .processors import run_processor
routes = []
version = __version__
try:
commit_label = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode('ascii')
version = f'{__version__} {commit_label}'
except:
version = __version__
if Path(__file__).parent.parent.joinpath('.git').exists():
try:
commit_label = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode('ascii')
version = f'{__version__} {commit_label}'
except:
pass
def register_route(method, path):