Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 5 additions & 35 deletions building/compile_po.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
import polib
import pathlib

libRoot = pathlib.Path(__file__).absolute().parent.parent
root = libRoot / "src"
print(f"compiling .po files in {root.absolute()}")

def compilePoFiles(root=root, errIfEmpty=True):
"""Looks for all paths matching **/*.po and compiles to a .mo file using
python polib

:param: root
raise Exception(
"""

po_files = list(pathlib.Path(root).glob('**/*.po'))

for popath in po_files:
mopath = popath.with_suffix(".mo")
po = polib.pofile(popath)
po.save_as_mofile(mopath)

if len(po_files) < 1:
if root.exists():
raise FileNotFoundError(
f"Found no po files to compile to mo. Was this the right folder to search? \n"
f" {root}"
)
else:
# if app folder doesn't exist, there's nothing to translate
print("No .po files to compile as this is a library-only installation.")
else:
print(f"compiled {len(po_files)} .po files to .mo in {root.absolute()}")
return len(po_files)

if __name__ == "__main__":
n_files = compilePoFiles(root)
The psychopy_app.compile_po has been removed.
Please use psychopy_translations.generate instead.
https://github.com/psychopy/psychopy-translations/blob/dev/psychopy_translations/generate.py
""")
2 changes: 0 additions & 2 deletions setupApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import py2app # noqa: needed to build app bundle, even though not explicitly used here
from ctypes import util
import importlib
from building import compile_po
from building import semanticVersion
from pathlib import Path
import psychopy
Expand All @@ -23,7 +22,6 @@ def glob_to_list(path, glob_pattern='*'):
"""Convert a glob pattern to a list of files."""
return [str(p.absolute()) for p in Path(path).glob(glob_pattern)]

compile_po.compilePoFiles()
# semanticVersion.updateVersionFile()
# semanticVersion.updateGitShaFile()

Expand Down
Loading