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
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

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