Migrate translations_develop script (#33933)

* Migrate translations_develop script

* Fix lint
This commit is contained in:
Paulus Schoutsen 2020-04-10 14:17:09 -07:00 committed by GitHub
parent 294a2d2460
commit 8e6e8dfbe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 68 deletions

View file

@ -49,13 +49,8 @@ def run_upload_docker():
raise ExitApp("Failed to download translations")
def run(args):
"""Run the script."""
if get_current_branch() != "dev" and os.environ.get("AZURE_BRANCH") != "dev":
raise ExitApp(
"Please only run the translations upload script from a clean checkout of dev."
)
def generate_upload_data():
"""Generate the data for uploading."""
translations = {"component": {}}
for path in INTEGRATIONS_DIR.glob(f"*{os.sep}strings*.json"):
@ -71,7 +66,19 @@ def run(args):
parent.update(json.loads(path.read_text()))
return translations
def run():
"""Run the script."""
if get_current_branch() != "dev" and os.environ.get("AZURE_BRANCH") != "dev":
raise ExitApp(
"Please only run the translations upload script from a clean checkout of dev."
)
translations = generate_upload_data()
LOCAL_FILE.parent.mkdir(parents=True, exist_ok=True)
LOCAL_FILE.write_text(json.dumps(translations, indent=4, sort_keys=True))
# run_upload_docker()
run_upload_docker()