Optimized install and deinstall with Makefile

This commit is contained in:
Kevin Veen-Birkenbach
2025-03-13 22:44:54 +01:00
parent 40c232f4a3
commit 22a2643a26
4 changed files with 8 additions and 8 deletions

View File

@@ -10,7 +10,7 @@
## Features 🚀 ## Features 🚀
- **Installation & Setup:** - **Installation & Setup:**
Create executable wrappers with auto-detected commands (e.g. `main.sh` or `main.py`) and optional setup/teardown commands. Create executable wrappers with auto-detected commands (e.g. `main.sh` or `main.py`).
- **Git Operations:** - **Git Operations:**
Easily perform `git pull`, `push`, `status`, `commit`, `diff`, `add`, `show`, and `checkout` with extra parameters passed through. Easily perform `git pull`, `push`, `status`, `commit`, `diff`, `add`, `show`, and `checkout` with extra parameters passed through.

View File

@@ -16,7 +16,8 @@ def deinstall_repos(selected_repos, repositories_base_dir, bin_dir, all_repos, p
print(f"Removed link for {repo_identifier}.") print(f"Removed link for {repo_identifier}.")
else: else:
print(f"No link found for {repo_identifier} in {bin_dir}.") print(f"No link found for {repo_identifier} in {bin_dir}.")
teardown_cmd = repo.get("teardown") # Check if a Makefile exists and run make.
repo_dir = get_repo_dir(repositories_base_dir,repo) makefile_path = os.path.join(repo_dir, "Makefile")
if teardown_cmd and os.path.exists(repo_dir): if os.path.exists(makefile_path):
run_command(teardown_cmd, cwd=repo_dir, preview=preview) print(f"Makefile found in {repo_identifier}, running 'make deinstall'...")
run_command("make deinstall", cwd=repo_dir, preview=preview)

View File

@@ -78,5 +78,5 @@ def install_repos(selected_repos, repositories_base_dir, bin_dir, all_repos, no_
# Check if a Makefile exists and run make. # Check if a Makefile exists and run make.
makefile_path = os.path.join(repo_dir, "Makefile") makefile_path = os.path.join(repo_dir, "Makefile")
if os.path.exists(makefile_path): if os.path.exists(makefile_path):
print(f"Makefile found in {repo_identifier}, running 'make'...") print(f"Makefile found in {repo_identifier}, running 'make install'...")
run_command("make", cwd=repo_dir, preview=preview) run_command("make install", cwd=repo_dir, preview=preview)

View File

@@ -11,7 +11,6 @@ def interactive_add(config,USER_CONFIG_PATH:str):
new_entry["command"] = input("Command (optional, leave blank to auto-detect): ").strip() new_entry["command"] = input("Command (optional, leave blank to auto-detect): ").strip()
new_entry["description"] = input("Description (optional): ").strip() new_entry["description"] = input("Description (optional): ").strip()
new_entry["replacement"] = input("Replacement (optional): ").strip() new_entry["replacement"] = input("Replacement (optional): ").strip()
new_entry["teardown"] = input("Teardown command (optional): ").strip()
new_entry["alias"] = input("Alias (optional): ").strip() new_entry["alias"] = input("Alias (optional): ").strip()
# Allow the user to mark this entry as ignored. # Allow the user to mark this entry as ignored.
ignore_val = input("Ignore this entry? (y/N): ").strip().lower() ignore_val = input("Ignore this entry? (y/N): ").strip().lower()