|
From: <fli...@li...> - 2026-05-01 08:49:49
|
unknown user pushed a commit to branch release/2024.1
in repository fgmeta.
The following commit(s) were added to refs/heads/release/2024.1 by this push:
new df993de create_shared_models_manifest.py: raise an exception when non-ASCII chars are found
df993de is described below
SF URL: http://sourceforge.net/p/flightgear/fgmeta/ci/df993de18c39c2459483e439b2c3409a49f2b7a7/
Commit: df993de18c39c2459483e439b2c3409a49f2b7a7
Author: Florent Rougon
Committer: Florent Rougon
AuthorDate: Fri Apr 24 15:48:13 2026 +0200
create_shared_models_manifest.py: raise an exception when non-ASCII chars are found
The previous code wanted to do this but didn't, because of the default
ensure_ascii=True for json.dump().
---
release_builder/create_shared_models_manifest.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/release_builder/create_shared_models_manifest.py b/release_builder/create_shared_models_manifest.py
index 6b82e9a..416d9fb 100755
--- a/release_builder/create_shared_models_manifest.py
+++ b/release_builder/create_shared_models_manifest.py
@@ -95,10 +95,12 @@ def main():
output_path = os.path.join(fgdata_dir, "SharedModelsManifest.json")
with open(output_path, "w", encoding="ascii") as f:
- # Note we keep the default value (True) of ensure_ascii.
- # File names in FGData and TerraSync should be ASCII only,
- # no extended UTF-8 characters, for now.
- json.dump(manifest, f, indent=2)
+ # File names in FGData and TerraSync should be ASCII only, no
+ # extended UTF-8 characters, for now. With ensure_ascii=False,
+ # json.dump() won't escape non-ASCII chars, therefore any such
+ # char in a path will cause an exception to be raised since the
+ # JSON file has been opened with encoding="ascii".
+ json.dump(manifest, f, indent=2, ensure_ascii=False)
f.write("\n")
print(f"Wrote {len(files)} file entries to {output_path!r}")
|