feat: remove WSL-specific aliases and 1Password agent bridge script; add dependency checks and installation for Python packages
Some checks failed
Nix Format Check / check-format (push) Failing after 38s

This commit is contained in:
2025-03-10 15:59:28 +01:00
parent 62954eb986
commit 6c095843ba
5 changed files with 44 additions and 39 deletions

View File

@ -95,3 +95,43 @@ def run_command(command, shell=False):
return True, result.stdout.strip()
except subprocess.CalledProcessError as e:
return False, e.stderr.strip()
def ensure_dependencies():
"""Check and install required dependencies for the dotfiles system"""
required_packages = [
'pyfiglet', # For ASCII art generation
]
missing_packages = []
for package in required_packages:
try:
__import__(package)
except ImportError:
missing_packages.append(package)
if missing_packages:
printfe("yellow", f"Missing dependencies: {', '.join(missing_packages)}")
install = input("Would you like to install them now? (y/n): ").lower()
if install == 'y' or install == 'yes':
printfe("cyan", "Installing missing dependencies...")
for package in missing_packages:
printfe("blue", f"Installing {package}...")
success, output = run_command(['pip', 'install', '--user', package])
if success:
printfe("green", f"Successfully installed {package}")
# Attempt to import the newly installed package
if package == 'pyfiglet':
try:
global pyfiglet
import pyfiglet
except ImportError:
printfe("red", f"Failed to import {package} after installation")
else:
printfe("red", f"Failed to install {package}: {output}")
printfe("green", "All dependencies have been processed")
return True
else:
printfe("yellow", "Skipping dependency installation")
return False
return True