From 82645ba9d8b2281c321069ba65c941de47d2bd8a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 9 Jul 2025 04:21:57 +0200 Subject: [PATCH] Added ErrorCatching for missing make install --- pkgmgr/deinstall_repos.py | 9 +++++++-- pkgmgr/install_repos.py | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgmgr/deinstall_repos.py b/pkgmgr/deinstall_repos.py index a5067c2..8635c63 100644 --- a/pkgmgr/deinstall_repos.py +++ b/pkgmgr/deinstall_repos.py @@ -1,4 +1,5 @@ import os +import sys from pkgmgr.get_repo_identifier import get_repo_identifier from pkgmgr.get_repo_dir import get_repo_dir @@ -6,6 +7,7 @@ def deinstall_repos(selected_repos, repositories_base_dir, bin_dir, all_repos, p for repo in selected_repos: repo_identifier = get_repo_identifier(repo, all_repos) alias_path = os.path.join(bin_dir, repo_identifier) + if os.path.exists(alias_path): confirm = input(f"Are you sure you want to delete link '{alias_path}' for {repo_identifier}? [y/N]: ").strip().lower() if confirm == "y": @@ -16,8 +18,11 @@ def deinstall_repos(selected_repos, repositories_base_dir, bin_dir, all_repos, p print(f"Removed link for {repo_identifier}.") else: print(f"No link found for {repo_identifier} in {bin_dir}.") - # Check if a Makefile exists and run make. + makefile_path = os.path.join(repo_dir, "Makefile") if os.path.exists(makefile_path): print(f"Makefile found in {repo_identifier}, running 'make deinstall'...") - run_command("make deinstall", cwd=repo_dir, preview=preview) \ No newline at end of file + try: + run_command("make deinstall", cwd=repo_dir, preview=preview) + except SystemExit as e: + print(f"[Warning] Failed to run 'make deinstall' for {repo_identifier}: {e}") diff --git a/pkgmgr/install_repos.py b/pkgmgr/install_repos.py index 250cc97..4da2fb3 100644 --- a/pkgmgr/install_repos.py +++ b/pkgmgr/install_repos.py @@ -143,5 +143,8 @@ def install_repos( # Check if a Makefile exists and run make. makefile_path = os.path.join(repo_dir, "Makefile") if os.path.exists(makefile_path): - print(f"Makefile found in {repo_identifier}, running 'make install'...") - run_command("make install", cwd=repo_dir, preview=preview) + cmd = "make install" + try: + run_command(cmd, cwd=repo_dir, preview=preview) + except SystemExit as e: + print(f"[Warning] Failed to run '{cmd}' for {repo_identifier}: {e}")