daylinbox/tasks.py

19 lines
615 B
Python
Raw Permalink Normal View History

2024-10-22 12:30:44 -05:00
#!/usr/bin/env python3
if not (
(_i := __import__)("importlib.util").util.find_spec("swydd")
or (_src := _i("pathlib").Path(__file__).parent / "swydd/__init__.py").is_file()
): # noqa | https://github.com/daylinmorgan/swydd?tab=readme-ov-file#automagic-snippet
_r = _i("urllib.request").request.urlopen("https://swydd.dayl.in/swydd.py")
_src.parent.mkdir(exist_ok=True)
_src.write_text(_r.read().decode())
2024-10-22 13:25:53 -05:00
from swydd import task, sub, cli, ctx
2024-10-22 12:30:44 -05:00
@task
2024-10-22 13:25:53 -05:00
def build():
"""build the image (forwards positioanl args)"""
sub("podman build . -t daylinbox " + " ".join(ctx.rest))
2024-10-22 12:30:44 -05:00
2024-10-22 13:25:53 -05:00
cli("build")