mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-09 10:51:57 +00:00
* Add dashboard widget assets
* Add ipywidgets and ipyflex to project
* Add currencies dashboard notebook
* Update docs and docstrings
* Add pyinstaller to project deps
* Add pyinstaller artifacts to gitignore
* Fix linter errors in terminal.py
* Update cspell hook and action with a pyinstaller specific word
* Add pyinstaller specfile and artifacts
* Add splashscreen image
* Add app icon
* adding splash screen support to terminal.spec and terminal.py
* Restore the conda env build files
* Sync deps
* Add border to the splashscreen image
* Clean up terminal launcher
* Add support for default feature flags in packages apps
* Fix types and linting
* Add splashscreen management to app bootup
* Check prediction feature flag when entering crypto/pred
* Update pyinstaller spec file
* fix .spec file to work for splash and icon - removed the ".."
* Allows to export when using installer (#1568)
* fix export for packaged apps
* fix filename
* Git : replace commit_hash when it is set in config_terminal
* Add update of the git commit hash in gtff default during build
* Add packaged app name and feature flag to logs
* Add platform specific icon assignment
* Add macOS build assets
* Add tensorflow to hidden imports
* Move LOGGING_COMMIT_HASH to gtff
* Adding files/folders needed to .spec and pyinstaller folder. This will make certain commands work again.
* Linting
* Workflow : ignore ./build/pyinstaller from codespell
* Workflow : exclude ./build/pyinstaller from flake8
* Poetry + Workflow : add types-six
* Pyinstaller : remove property_cached, user_agent and vaderSentiment
* Revert "Pyinstaller : remove property_cached, user_agent and vaderSentiment"
This reverts commit dbb3e2b810.
* Clean up local paths in specfile
* Validate deps have correct Jinja version (they do)
* Fix logging commit hash to be set correctly for the logger to see it
Co-authored-by: Andrew <andrew.kenreich@gmail.com>
Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
148 lines
3.7 KiB
Python
Vendored
148 lines
3.7 KiB
Python
Vendored
# -*- 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 = (
|
|
os.getenv("GT_BUILD_TYPE") if bool(os.getenv("GT_BUILD_TYPE")) else "folder"
|
|
)
|
|
|
|
# Local python environment packages folder
|
|
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["GTFF_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"),
|
|
(os.path.join(os.getcwd(), "routines"), "routines"),
|
|
(os.path.join(os.getcwd(), "styles"), "styles"),
|
|
("property_cached", "property_cached"),
|
|
("user_agent", "user_agent"),
|
|
("vaderSentiment", "vaderSentiment"),
|
|
(
|
|
os.path.join("frozendict", "VERSION"),
|
|
"frozendict",
|
|
),
|
|
("GTFF_DEFAULTS.json", "gamestonk_terminal"),
|
|
]
|
|
|
|
# Python libraries that are explicitly pulled into the bundle
|
|
hidden_imports = [
|
|
"sklearn.utils._cython_blas",
|
|
"sklearn.utils._typedefs",
|
|
"sklearn.neighbors.quad_tree",
|
|
"sklearn.tree._utils",
|
|
"sklearn.neighbors._partition_nodes",
|
|
"squarify",
|
|
"linearmodels",
|
|
"user_agent",
|
|
"vaderSentiment",
|
|
"frozendict",
|
|
"boto3",
|
|
"textwrap3",
|
|
"pyEX",
|
|
"tensorflow",
|
|
]
|
|
|
|
analysis_kwargs = dict(
|
|
scripts=[os.path.join(os.getcwd(), "terminal.py")],
|
|
pathex=[pathex, "."],
|
|
binaries=[],
|
|
datas=added_files,
|
|
hiddenimports=hidden_imports,
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[],
|
|
win_no_prefer_redirects=False,
|
|
win_private_assemblies=False,
|
|
cipher=None,
|
|
noarchive=False,
|
|
)
|
|
|
|
a = Analysis(**analysis_kwargs)
|
|
pyz = PYZ(a.pure, a.zipped_data, cipher=analysis_kwargs["cipher"])
|
|
|
|
exe_args = [
|
|
pyz,
|
|
a.scripts,
|
|
[],
|
|
]
|
|
|
|
exe_kwargs = dict(
|
|
name=NAME,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=False,
|
|
upx_exclude=[],
|
|
console=True,
|
|
disable_windowed_traceback=False,
|
|
target_arch="x86_64",
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
)
|
|
|
|
# Packaging settings
|
|
if build_type == "onefile":
|
|
exe_args += [a.binaries, a.zipfiles, a.datas]
|
|
exe_kwargs["runtime_tmpdir"] = None
|
|
elif build_type == "folder":
|
|
exe_kwargs["exclude_binaries"] = True
|
|
collect_args = [
|
|
a.binaries,
|
|
a.zipfiles,
|
|
a.datas,
|
|
]
|
|
collect_kwargs = dict(
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
name=NAME,
|
|
)
|
|
|
|
|
|
# Platform specific settings
|
|
if is_win:
|
|
splash = Splash(
|
|
os.path.join(os.getcwd(), "images", "splashscreen.png"),
|
|
binaries=a.binaries,
|
|
datas=a.datas,
|
|
text_pos=(200, 400),
|
|
text_size=12,
|
|
text_color="white",
|
|
)
|
|
exe_args += [splash, splash.binaries]
|
|
exe_kwargs["icon"] = (os.path.join(os.getcwd(), "images", "gst_app.ico"),)
|
|
|
|
if is_darwin:
|
|
exe_kwargs["icon"] = (
|
|
os.path.join(os.getcwd(), "images", "GamestonkTerminal.icns"),
|
|
)
|
|
|
|
exe = EXE(*exe_args, **exe_kwargs)
|
|
|
|
if build_type == "folder":
|
|
coll = COLLECT(*([exe] + collect_args), **collect_kwargs)
|