Derive variant display names from upstream data

This commit is contained in:
2026-04-24 10:50:55 +08:00
parent 89b89d4f19
commit 3fe6876ef0
6 changed files with 17961 additions and 17152 deletions
-50
View File
@@ -23,41 +23,6 @@ SYNC_PATHS = [
"LICENSE.txt",
]
LOCAL_TEXT_REPLACEMENTS = {
"brands/oneplus.md": [
(
"""**一加 Ace 3 / 一加 12R (`aston`) / 一加 Ace 3 原神刻晴定制机 / 一加 12R Genshin Impact Edition (`martin`):**
`PJE110`: 一加 Ace 3 国行版 / 原神刻晴定制机
`CPH2585`: 一加 12R 印度版 / 原神刻晴定制机""",
"""**一加 Ace 3 (`aston`):**
`PJE110`: 一加 Ace 3 国行版 / 原神刻晴定制机
**一加 12R (`aston`):**
`CPH2585`: 一加 12R 印度版 / 原神刻晴定制机""",
),
],
"brands/oneplus_en.md": [
(
"""**OnePlus Ace 3 / OnePlus 12R (`aston`) / OnePlus Ace 3 Genshin Impact Edition / OnePlus 12R Genshin Impact Edition (`martin`):**
`PJE110`: OnePlus Ace 3 China / Genshin Impact Edition
`CPH2585`: OnePlus 12R India / Genshin Impact Edition""",
"""**OnePlus Ace 3 (`aston`):**
`PJE110`: OnePlus Ace 3 China / Genshin Impact Edition
**OnePlus 12R (`aston`):**
`CPH2585`: OnePlus 12R India / Genshin Impact Edition""",
),
],
}
def run(cmd: list[str], cwd: Path | None = None) -> None:
subprocess.run(cmd, cwd=cwd or PROJECT_ROOT, check=True)
@@ -97,21 +62,6 @@ def sync_selected_paths(upstream_root: Path) -> None:
raise FileNotFoundError(f"Missing upstream path: {relative_path}")
sync_path(src, dst)
apply_local_corrections()
def apply_local_corrections() -> None:
for relative_path, replacements in LOCAL_TEXT_REPLACEMENTS.items():
path = WORKSPACE_ROOT / relative_path
if not path.exists():
continue
text = path.read_text(encoding="utf-8")
updated = text
for old, new in replacements:
updated = updated.replace(old, new)
if updated != text:
path.write_text(updated, encoding="utf-8")
def build_index(output_path: str) -> None:
run(