2022-05-03 17:02:39 +00:00
|
|
|
#!/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")
|
|
|
|
|
|
|
|
|
2022-05-07 15:01:05 +00:00
|
|
|
def poetry_update(script_dir):
|
2022-05-03 17:02:39 +00:00
|
|
|
poetry_bin = local_bin / "poetry"
|
2022-05-07 14:56:54 +00:00
|
|
|
run(f"{poetry_bin} update", cwd=script_dir / "..")
|
2022-05-03 17:02:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
def spaced_hl():
|
|
|
|
print("\n\n___________________\n\n")
|