Files
grott-home-assistant-add-on/dodo.py
T
2023-08-15 00:39:53 +10:00

33 lines
968 B
Python

# use pydoit to run the pipeline
# url: http://pydoit.org/
# install pydoit: pip install doit (or pipx)
import os
import glob
BUILDS = [
"grott",
"grott-current",
]
TRANSLATIONS_FOLDER = "translations"
def task_copy_translations():
"""Copy translations from the source to the translations folder."""
translations = glob.glob(f"{TRANSLATIONS_FOLDER}/*.yaml")
for build in BUILDS:
for translation in translations:
# get the file basename
translation = os.path.basename(translation)
yield {
"name": f"copy {translation} to {build}",
"actions": [
f"mkdir -p {build}/translations",
f"cp {TRANSLATIONS_FOLDER}/{translation} {build}/translations/{translation}",
],
"file_dep": [f"{TRANSLATIONS_FOLDER}/{translation}"],
"targets": [f"{build}/translations/{translation}"],
}