aboutsummaryrefslogtreecommitdiff
path: root/launch.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-01-05 11:57:01 +0300
committerAUTOMATIC <16777216c@gmail.com>2023-01-05 11:57:14 +0300
commit997461d3dd86f51c06ea0c2eff17ce8b8b48c0af (patch)
treeb402765a18b49e66e37d90c99bf56ce0f6e0dc0f /launch.py
parent01a1fee874e12eb68d849a31bbf177c69ff4cc22 (diff)
add footer with versions
Diffstat (limited to 'launch.py')
-rw-r--r--launch.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/launch.py b/launch.py
index af0d418b..49b91b1f 100644
--- a/launch.py
+++ b/launch.py
@@ -13,6 +13,21 @@ dir_extensions = "extensions"
python = sys.executable
git = os.environ.get('GIT', "git")
index_url = os.environ.get('INDEX_URL', "")
+stored_commit_hash = None
+
+
+def commit_hash():
+ global stored_commit_hash
+
+ if stored_commit_hash is not None:
+ return stored_commit_hash
+
+ try:
+ stored_commit_hash = run(f"{git} rev-parse HEAD").strip()
+ except Exception:
+ stored_commit_hash = "<none>"
+
+ return stored_commit_hash
def extract_arg(args, name):
@@ -194,10 +209,7 @@ def prepare_environment():
xformers = '--xformers' in sys.argv
ngrok = '--ngrok' in sys.argv
- try:
- commit = run(f"{git} rev-parse HEAD").strip()
- except Exception:
- commit = "<none>"
+ commit = commit_hash()
print(f"Python {sys.version}")
print(f"Commit hash: {commit}")