add indicator to debug output when using a standalone executable

This commit is contained in:
Mike Fährmann
2021-12-10 03:18:02 +01:00
parent 64978b5d37
commit 45ca1693d8

View File

@@ -142,20 +142,23 @@ def main():
import os.path import os.path
import requests import requests
head = "" extra = ""
try: if getattr(sys, "frozen", False):
out, err = subprocess.Popen( extra = " - Executable"
("git", "rev-parse", "--short", "HEAD"), else:
stdout=subprocess.PIPE, try:
stderr=subprocess.PIPE, out, err = subprocess.Popen(
cwd=os.path.dirname(os.path.abspath(__file__)), ("git", "rev-parse", "--short", "HEAD"),
).communicate() stdout=subprocess.PIPE,
if out and not err: stderr=subprocess.PIPE,
head = " - Git HEAD: " + out.decode().rstrip() cwd=os.path.dirname(os.path.abspath(__file__)),
except (OSError, subprocess.SubprocessError): ).communicate()
pass if out and not err:
extra = " - Git HEAD: " + out.decode().rstrip()
except (OSError, subprocess.SubprocessError):
pass
log.debug("Version %s%s", __version__, head) log.debug("Version %s%s", __version__, extra)
log.debug("Python %s - %s", log.debug("Python %s - %s",
platform.python_version(), platform.platform()) platform.python_version(), platform.platform())
try: try: