mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
56 lines
1 KiB
Python
56 lines
1 KiB
Python
|
#!/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_install_latest(script_dir):
|
||
|
poetry_bin = local_bin / "poetry"
|
||
|
run(f"{poetry_bin} install", cwd=script_dir / "..")
|
||
|
|
||
|
|
||
|
def spaced_hl():
|
||
|
print("\n\n___________________\n\n")
|