Fix rmtree in translation script on MacOS (#129352)

This commit is contained in:
Simone Rescio 2025-01-16 12:39:37 +01:00 committed by GitHub
parent 9db6be11f7
commit 9a1b965c7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,6 @@ import argparse
import json
from pathlib import Path
import re
from shutil import rmtree
import sys
from . import download, upload
@ -83,9 +82,10 @@ def run_single(translations, flattened_translations, integration):
)
if download.DOWNLOAD_DIR.is_dir():
rmtree(str(download.DOWNLOAD_DIR))
download.DOWNLOAD_DIR.mkdir(parents=True)
for lang_file in download.DOWNLOAD_DIR.glob("*.json"):
lang_file.unlink()
else:
download.DOWNLOAD_DIR.mkdir(parents=True)
(download.DOWNLOAD_DIR / "en.json").write_text(
json.dumps({"component": {integration: translations["component"][integration]}})