2022-07-22 13:21:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
from pathlib import Path
|
2022-07-22 12:31:52 +02:00
|
|
|
from pathlib import Path
|
|
|
|
from os import chdir
|
2022-07-22 13:21:30 +02:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
def run(cmd, cwd=Path.cwd()):
|
|
|
|
result = subprocess.run(cmd, shell=True, cwd=cwd)
|
|
|
|
if result.returncode != 0:
|
|
|
|
raise RuntimeError(f"Failed to execute {cmd}")
|
|
|
|
|
2022-07-22 13:35:08 +02:00
|
|
|
|
2022-07-22 12:31:52 +02:00
|
|
|
|
|
|
|
def cd_repo_root_path() -> str:
|
|
|
|
# Make sure the script is always started from the same
|
|
|
|
# ScreenPlay root folder
|
|
|
|
root_path = Path.cwd()
|
|
|
|
if root_path.name == "Tools":
|
|
|
|
root_path = root_path.parent
|
|
|
|
print(f"Change root directory to: {root_path}")
|
|
|
|
chdir(root_path)
|
2022-07-22 13:35:08 +02:00
|
|
|
return root_path
|