show version in app
This commit is contained in:
parent
d37441dc4b
commit
36a9228ad8
3 changed files with 31 additions and 1 deletions
6
build.sh
6
build.sh
|
|
@ -37,8 +37,14 @@ echo "Cleaning previous build artifacts..."
|
||||||
rm -rf build/ dist/
|
rm -rf build/ dist/
|
||||||
|
|
||||||
echo "Starting PyInstaller build..."
|
echo "Starting PyInstaller build..."
|
||||||
|
GIT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "Unknown")
|
||||||
|
echo "__version__ = \"$GIT_VERSION\"" > src/core/_baked_version.py
|
||||||
|
|
||||||
pyinstaller --clean disco-reaper.spec
|
pyinstaller --clean disco-reaper.spec
|
||||||
|
|
||||||
|
echo "Cleaning up baked version file..."
|
||||||
|
rm -f src/core/_baked_version.py
|
||||||
|
|
||||||
echo "Generating Launch-Reaper.sh launcher..."
|
echo "Generating Launch-Reaper.sh launcher..."
|
||||||
cat << 'EOF' > dist/Launch-Reaper.sh
|
cat << 'EOF' > dist/Launch-Reaper.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
|
||||||
|
|
@ -67,3 +67,25 @@ def resolve_discord_links(content: str, state: MigrationState, platform: str, ta
|
||||||
if result != content:
|
if result != content:
|
||||||
logger.debug(f"resolve_discord_links: Content resolved to (len {len(result)}): {result[:100]!r}")
|
logger.debug(f"resolve_discord_links: Content resolved to (len {len(result)}): {result[:100]!r}")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
def get_app_version() -> str:
|
||||||
|
"""Gets the dynamic app version from baked file or git."""
|
||||||
|
try:
|
||||||
|
from src.core._baked_version import __version__
|
||||||
|
return f"Reaper-{__version__}"
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
version = subprocess.check_output(
|
||||||
|
["git", "describe", "--tags", "--always"],
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
universal_newlines=True
|
||||||
|
).strip()
|
||||||
|
if not version:
|
||||||
|
return "Reaper-Unknown"
|
||||||
|
return f"Reaper-{version}"
|
||||||
|
except Exception:
|
||||||
|
return "Reaper-Unknown-git"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ from src.core.configuration import (
|
||||||
get_available_configs, create_new_config, load_config, save_config,
|
get_available_configs, create_new_config, load_config, save_config,
|
||||||
)
|
)
|
||||||
from src.ui.widgets import RamDisplay, Footnote
|
from src.ui.widgets import RamDisplay, Footnote
|
||||||
|
from src.core.utils import get_app_version
|
||||||
|
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
@ -94,7 +95,7 @@ class ConfigSelectionScreen(Screen):
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
with Container(id="config_sel_container"):
|
with Container(id="config_sel_container"):
|
||||||
yield Label("Disco Reaper — Select Configuration", id="config_sel_title")
|
yield Label(f"{get_app_version()} — Select Configuration", id="config_sel_title")
|
||||||
with VerticalScroll(id="config_list_container"):
|
with VerticalScroll(id="config_list_container"):
|
||||||
yield ListView(id="config_list")
|
yield ListView(id="config_list")
|
||||||
with Horizontal(id="config_sel_actions"):
|
with Horizontal(id="config_sel_actions"):
|
||||||
|
|
@ -476,6 +477,7 @@ class ConfigScreen(Screen):
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
class ReaperApp(App):
|
class ReaperApp(App):
|
||||||
|
TITLE = get_app_version()
|
||||||
SCREENS = {
|
SCREENS = {
|
||||||
"config_selection": ConfigSelectionScreen,
|
"config_selection": ConfigSelectionScreen,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue