#!/usr/bin/env python3 import subprocess from getpass import getpass from pathlib import Path local_bin = Path("/home/admin/.local/bin/") def run(command, **kwargs): return subprocess.run(command, shell=True, **kwargs) def box(message, context=None): text_line = "| " if context is not None: text_line += context + ": " text_line += message + " |" separator = "=" * len(text_line) print() print(separator) print(text_line) print(separator) print() def step(message): continue_message = "-> Press ENTER to continue or Ctrl+C to interrupt the script <-" upper_separator = "_" * len(continue_message) print() print(upper_separator) box(message, "Next step") print(continue_message) getpass("") print() def install_latest_pipx(): run("pip install --user --upgrade pipx") def poetry_update(script_dir): poetry_bin = local_bin / "poetry" run(f"{poetry_bin} update", cwd=script_dir / "..") def spaced_hl(): print("\n\n___________________\n\n")