#!/usr/bin/env python3
import os
import pathlib
import sys
args = sys.argv[1:]
args_string = " ".join(args)
def install():
os.system("./.venv/bin/python -m pip install -e .")
def build():
os.system("./.venv/bin/python -m pip install build")
os.system("rm -r dist")
os.system("./.venv/bin/python -m build .")
os.system("./.venv/bin/python -m pip install black")
os.system("./.venv/bin/python -m black .")
if not pathlib.Path(".venv").exists():
os.system("python3 -m venv .venv")
install()
if "install" in args:
install()
if "build" in sys.argv:
build()
if "publish" in sys.argv:
build()
os.system("./.venv/bin/python -m pip install twine")
os.system("./.venv/bin/python -m twine upload --repository gitea dist/*")
if "run" in sys.argv:
os.system("./.venv/bin/yura " + args_string)