Git : replace commit_hash when it is set in config_terminal

This commit is contained in:
Chavithra PARANA
2022-03-28 18:26:25 +02:00
parent 938e9bed87
commit 15bde4e238
4 changed files with 10 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
{
"GTFF_PACKAGED_APPLICATION": "True",
"GT_LOGGING_COMMIT_HASH": "938e9be",
"GTFF_ENABLE_PREDICT": "False",
"GTFF_ENABLE_CHECK_API": "True",
"GTFF_ENABLE_THOUGHTS_DAY": "False",

View File

@@ -26,6 +26,7 @@ PAPERMILL_NOTEBOOK_REPORT_PORT = (
# USE IN LOG LINES + FOR FOLDER NAME INSIDE S3 BUCKET
LOGGING_APP_NAME = os.getenv("GT_LOGGING_APP_NAME") or "gst"
LOGGING_COMMIT_HASH = os.getenv("GT_LOGGING_COMMIT_HASH") or "REPLACE_ME"
# D | H | M | S
LOGGING_FREQUENCY = os.getenv("GT_LOGGING_FREQUENCY") or "H"
# stdout,stderr,noop,file

View File

@@ -46,6 +46,9 @@ def get_app_id() -> str:
def get_commit_hash() -> str:
"""Get Commit Short Hash"""
if cfg.LOGGING_COMMIT_HASH != "REPLACE_ME":
return cfg.LOGGING_COMMIT_HASH
file_path = Path(__file__)
git_dir = file_path.parent.parent.absolute().joinpath(".git")

View File

@@ -13,6 +13,7 @@ from typing import List
import ascii_magic
import matplotlib.pyplot as plt
import gamestonk_terminal.config_terminal as cfg
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal import thought_of_the_day as thought
from gamestonk_terminal.rich_config import console
@@ -66,6 +67,10 @@ def sha256sum(filename):
def update_terminal():
"""Updates the terminal by running git pull in the directory. Runs poetry install if needed"""
if cfg.LOGGING_COMMIT_HASH != "REPLACE_ME":
return cfg.LOGGING_COMMIT_HASH
poetry_hash = sha256sum("poetry.lock")
completed_process = subprocess.run("git pull", shell=True, check=False) # nosec