From ff8ef366151bdd2376bcde24cdc1067a861edc01 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Mon, 9 May 2022 18:03:25 +0200 Subject: [PATCH] ADD REPO_DIR constant --- advlabdb/scripts/maintain/user_update.py | 9 ++++++++- advlabdb/scripts/setup/shared.py | 5 ++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/advlabdb/scripts/maintain/user_update.py b/advlabdb/scripts/maintain/user_update.py index 6ff8d56..fba0887 100644 --- a/advlabdb/scripts/maintain/user_update.py +++ b/advlabdb/scripts/maintain/user_update.py @@ -1,4 +1,4 @@ -from ..setup.shared import LOCAL_BIN, install_latest_pipx, poetry_update +from ..setup.shared import LOCAL_BIN, REPO_DIR, install_latest_pipx, poetry_update from ..terminal_utils import box, run from .shared import show_update_datetime @@ -13,8 +13,15 @@ def main(): pipx_bin = LOCAL_BIN / "pipx" run(f"{pipx_bin} upgrade-all --include-injected") + box("Backup database") # TODO: Backup + box("Pull updates from the git repository") + run("git pull", cwd=REPO_DIR) + + box("Update user docs") + # TODO: Update docs + box("Install latest Poetry packages") poetry_update() diff --git a/advlabdb/scripts/setup/shared.py b/advlabdb/scripts/setup/shared.py index e6e0d69..6d2e46c 100644 --- a/advlabdb/scripts/setup/shared.py +++ b/advlabdb/scripts/setup/shared.py @@ -1,10 +1,10 @@ from pathlib import Path -from ... import __file__ as advlabdb_init_path # Points to __init__.py from ..terminal_utils import run LOCAL_BIN = Path("/home/admin/.local/bin/") LOGS_DIR = Path("/var/log/advlabdb") +REPO_DIR = Path("/home/admin/advlabdb") def install_latest_pipx(): @@ -13,5 +13,4 @@ def install_latest_pipx(): def poetry_update(): poetry_bin = LOCAL_BIN / "poetry" - advlabdb_root_dir = Path(advlabdb_init_path).parents[1] - run(f"{poetry_bin} update", cwd=advlabdb_root_dir) + run(f"{poetry_bin} update", cwd=REPO_DIR)