spcd/pidd/cmd.py
Marc Beninca 8c1ca67ef8
Some checks failed
/ job (push) Failing after 11m45s
imports
2024-06-25 11:41:40 +02:00

65 lines
1.2 KiB
Python

import os
from pathlib import Path
from rwx import ps, split
from rwx.log import log
from pidd import browse, project, projects
def pidd_browse_workspace() -> None:
browse(project.root)
def pidd_build_project() -> None:
for extension in ["py", "sh"]:
path = Path(project.root) / f"build.{extension}"
if path.exists():
ps.run(path)
break
else:
pass
def pidd_clone_branch() -> None:
log.info(projects)
split()
log.info(project)
split()
log.info(f"""\
{project.url}
""")
ps.run(
"git",
"clone",
"--branch",
project.branch,
"--",
project.url,
project.root,
)
def pidd_list_environment() -> None:
for variable, value in sorted(projects.environment.items()):
log.info(f"{variable} = {value}")
def pidd_synchronize() -> None:
host = "rwx.work"
source = "out"
user = "cd"
#
root = Path(os.sep) / user / project.branch / projects.group / project.name
#
target = f"{user}@{host}:{root}"
ps.run(
"rsync",
"--archive",
"--delete-before",
"--verbose",
f"{source}/",
f"{target}/",
"--dry-run",
)