Tweak ftl:sync paths
This commit is contained in:
parent
89bce6d829
commit
91cc311f74
14
ftl/sync.py
14
ftl/sync.py
@ -17,31 +17,31 @@ import requests
|
|||||||
|
|
||||||
root = os.environ["BUILD_WORKSPACE_DIRECTORY"]
|
root = os.environ["BUILD_WORKSPACE_DIRECTORY"]
|
||||||
repos_bzl = os.path.join(root, "repos.bzl")
|
repos_bzl = os.path.join(root, "repos.bzl")
|
||||||
working_folder = os.path.join(root, "..", "anki-i18n")
|
working_folder = os.path.join(root, "..")
|
||||||
|
|
||||||
if not os.path.exists(working_folder):
|
|
||||||
os.mkdir(working_folder)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Module:
|
class Module:
|
||||||
name: str
|
name: str
|
||||||
|
folder_name: str
|
||||||
repo: str
|
repo: str
|
||||||
# (source ftl folder, i18n templates folder)
|
# (source ftl folder, i18n templates folder)
|
||||||
ftl: Optional[Tuple[str, str]] = None
|
ftl: Optional[Tuple[str, str]] = None
|
||||||
|
|
||||||
def folder(self) -> str:
|
def folder(self) -> str:
|
||||||
return os.path.join(working_folder, self.name)
|
return os.path.join(working_folder, self.folder_name)
|
||||||
|
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
Module(
|
Module(
|
||||||
name="core",
|
name="core",
|
||||||
|
folder_name="ftl-core",
|
||||||
repo="git@github.com:ankitects/anki-core-i18n",
|
repo="git@github.com:ankitects/anki-core-i18n",
|
||||||
ftl=(os.path.join(root, "ftl", "core"), "core/templates"),
|
ftl=(os.path.join(root, "ftl", "core"), "core/templates"),
|
||||||
),
|
),
|
||||||
Module(
|
Module(
|
||||||
name="qtftl",
|
name="qtftl",
|
||||||
|
folder_name="ftl-qt",
|
||||||
repo="git@github.com:ankitects/anki-desktop-ftl",
|
repo="git@github.com:ankitects/anki-desktop-ftl",
|
||||||
ftl=(os.path.join(root, "ftl", "qt"), "desktop/templates"),
|
ftl=(os.path.join(root, "ftl", "qt"), "desktop/templates"),
|
||||||
),
|
),
|
||||||
@ -54,7 +54,7 @@ def update_repo(module: Module):
|
|||||||
|
|
||||||
def clone_repo(module: Module):
|
def clone_repo(module: Module):
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["git", "clone", module.repo, module.name], cwd=working_folder, check=True
|
["git", "clone", module.repo, module.folder_name], cwd=working_folder, check=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ def commit_if_changed(folder: str, update_label: str):
|
|||||||
# no changes
|
# no changes
|
||||||
return
|
return
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["git", "commit", "-a", "-m", "update " + update_label], cwd=folder, check=True
|
["git", "commit", "-a", "-m", "Update " + update_label], cwd=folder, check=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user