Skip to content

Commit ac64f06

Browse files
prculleyNick-Hall
authored andcommitted
make; some fixes
1 parent 61fd7de commit ac64f06

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

make.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def strip_header(po_file):
275275
out_file = ""
276276
if not os.path.isfile(po_file):
277277
return out_file
278-
with open(po_file, "r") as in_file:
278+
with open(po_file, "r", encoding="utf-8") as in_file:
279279
for line in in_file:
280280
if not header:
281281
out_file += line
@@ -289,8 +289,8 @@ def aggregate_pot():
289289
Aggregate the template files for all addons into a single file without
290290
strings that are already present in core Gramps.
291291
"""
292-
args = ["touch", "po/template.pot"]
293-
call(args)
292+
f = open("po/template.pot", "w")
293+
f.close()
294294

295295
args = ["xgettext", "-j", "-o", "po/template.pot"]
296296
args.extend(glob.glob("*/po/template.pot"))
@@ -514,7 +514,9 @@ def register(ptype, **kwargs):
514514
f'"{addon}/po/{locale}-local.po" '
515515
)
516516
# Get all of the addon strings out of the catalog:
517-
system(f"touch {addon}/po/{locale}-temp.po")
517+
f = open(f"{addon}/po/{locale}-temp.po", "w")
518+
f.close()
519+
518520
system(
519521
f"msggrep --location={addon}/* "
520522
f'"{addon}/po/{locale}-global.po" '
@@ -574,9 +576,14 @@ def register(ptype, **kwargs):
574576

575577
languages = get_all_languages()
576578
listings = {lang: [] for lang in languages}
577-
dirs = [
578-
file for file in glob.glob("*") if os.path.isdir(file) and file != "__pycache__"
579-
]
579+
if len(sys.argv) == 3 or addon == "all":
580+
dirs = [
581+
file
582+
for file in glob.glob("*")
583+
if os.path.isdir(file) and file != "__pycache__"
584+
]
585+
else:
586+
dirs = [addon]
580587
for addon in sorted(dirs):
581588
todo = False
582589
for po in glob.glob(f"{addon}/po/*-local.po"):

0 commit comments

Comments
 (0)