Skip to content

Commit

Permalink
SConstruct: add custom braille tables section to manifest (actual and…
Browse files Browse the repository at this point in the history
… localized data) if present. Re #38.

After processing root manifest section (actual and localized), process custom braille translation tables section if at least one custom braille table and their attriutes are defined (buildVars.brailleTables is not empty).
  • Loading branch information
josephsl committed May 9, 2024
1 parent 933fd68 commit 4b844ab
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,20 @@ def createAddonBundleFromPath(path, dest):


def generateManifest(source, dest):
# Prepare the root manifest section
addon_info = buildVars.addon_info
with codecs.open(source, "r", "utf-8") as f:
manifest_template = f.read()
manifest = manifest_template.format(**addon_info)
# Add additional manifest sections such as custom braile tables
# Custom braille translation tables
if buildVars.brailleTables:
manifest_brailleTables = ["\n[brailleTables]"]
for table in buildVars.brailleTables.keys():
manifest_brailleTables.append(f"[[{table}]]")
for key, val in buildVars.brailleTables[table].items():
manifest_brailleTables.append(f"{key} = {val}")
manifest += "\n".join(manifest_brailleTables)
with codecs.open(dest, "w", "utf-8") as f:
f.write(manifest)

Expand All @@ -193,6 +203,15 @@ def generateTranslatedManifest(source, language, out):
with codecs.open(source, "r", "utf-8") as f:
manifest_template = f.read()
result = manifest_template.format(**vars)
# Add additional manifest sections such as custom braile tables
# Custom braille translation tables
if buildVars.brailleTables:
result_brailleTables = ["\n[brailleTables]"]
for table in buildVars.brailleTables.keys():
result_brailleTables.append(f"[[{table}]]")
# Fetch display name only.
result_brailleTables.append(f"displayName = {buildVars.brailleTables[table]["displayName"]}")
result += "\n".join(result_brailleTables)
with codecs.open(out, "w", "utf-8") as f:
f.write(result)

Expand Down

0 comments on commit 4b844ab

Please sign in to comment.