From e95b0e0c6c6a996768ec03cba614410244507dea Mon Sep 17 00:00:00 2001 From: lvmin Date: Thu, 10 Aug 2023 03:23:49 -0700 Subject: [PATCH] i --- launch.py | 7 +++++++ modules/launch_util.py | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 modules/launch_util.py diff --git a/launch.py b/launch.py index 67de65a3..c32c7228 100644 --- a/launch.py +++ b/launch.py @@ -1,6 +1,8 @@ import os import sys +from modules.launch_util import commit_hash, fooocus_tag + def prepare_environment(): torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu118") @@ -12,7 +14,12 @@ def prepare_environment(): comfy_repo = os.environ.get('COMFY_REPO', "https://github.com/comfyanonymous/ComfyUI.git") comfy_commit_hash = os.environ.get('COMFY_COMMIT_HASH', "5ac96897e9782805cd5e8fe85bd98ad03eae2b6f") + commit = commit_hash() + tag = fooocus_tag + print(f"Python {sys.version}") + print(f"Version: {tag}") + print(f"Commit hash: {commit}") prepare_environment() diff --git a/modules/launch_util.py b/modules/launch_util.py new file mode 100644 index 00000000..2806ba0c --- /dev/null +++ b/modules/launch_util.py @@ -0,0 +1,17 @@ +import os + +import subprocess +from functools import lru_cache + + +git = os.environ.get('GIT', "git") +fooocus_tag = '1.0.0' + + +@lru_cache() +def commit_hash(): + try: + return subprocess.check_output([git, "rev-parse", "HEAD"], shell=False, encoding='utf8').strip() + except Exception: + return "" +