Add update of the git commit hash in gtff default during build

This commit is contained in:
Theodore Aptekarev
2022-03-28 19:59:07 +03:00
parent 15bde4e238
commit 6df1284e94
2 changed files with 16 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"GTFF_PACKAGED_APPLICATION": "True",
"GT_LOGGING_COMMIT_HASH": "938e9be",
"GT_LOGGING_COMMIT_HASH": "sha:15bde4e2",
"GTFF_ENABLE_PREDICT": "False",
"GTFF_ENABLE_CHECK_API": "True",
"GTFF_ENABLE_THOUGHTS_DAY": "False",
@@ -27,4 +27,4 @@
"GTFF_OPEN_REPORT_AS_HTML": "True",
"GTFF_ENABLE_QUICK_EXIT": "False",
"GTFF_ENABLE_EXIT_AUTO_HELP": "False"
}
}

View File

@@ -1,12 +1,15 @@
# -*- mode: python ; coding: utf-8 -*-
import os
import sys
import json
from PyInstaller.compat import is_darwin, is_win
from PyInstaller.building.api import PYZ, EXE, COLLECT
from PyInstaller.building.splash import Splash
from PyInstaller.building.build_main import Analysis
from gamestonk_terminal.loggers import get_commit_hash
NAME = "GamestonkTerminal"
build_type = (
@@ -18,6 +21,17 @@ pathex = os.path.join(
os.path.dirname(sys.executable), "..", "lib", "python3.8", "site-packages"
)
# Get latest commit
commit_hash = get_commit_hash()
build_assets_folder = os.path.join(os.getcwd(), "build", "pyinstaller")
default_feature_flags_path = os.path.join(build_assets_folder, "GTFF_DEFAULTS.json")
with open(default_feature_flags_path, "r") as f:
default_gtff = json.load(f)
default_gtff["GT_LOGGING_COMMIT_HASH"] = commit_hash
with open(default_feature_flags_path, "w") as f:
json.dump(default_gtff, f, indent=4)
# Files that are explicitly pulled into the bundle
added_files = [
(os.path.join(os.getcwd(), "gamestonk_terminal"), "gamestonk_terminal"),