diff options
Diffstat (limited to 'release')
11 files changed, 71 insertions, 27 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/check_po.py b/release/scripts/modules/bl_i18n_utils/check_po.py index a688d38df88..b669a9ddff2 100755 --- a/release/scripts/modules/bl_i18n_utils/check_po.py +++ b/release/scripts/modules/bl_i18n_utils/check_po.py @@ -26,8 +26,11 @@ import os import sys from codecs import open -import settings -import utils +try: + import settings + import utils +except: + from . import (settings, utils) TRUNK_PO_DIR = settings.TRUNK_PO_DIR BRANCHES_DIR = settings.BRANCHES_DIR diff --git a/release/scripts/modules/bl_i18n_utils/clean_po.py b/release/scripts/modules/bl_i18n_utils/clean_po.py index 7e91b41065c..f0b8dd6b1d2 100755 --- a/release/scripts/modules/bl_i18n_utils/clean_po.py +++ b/release/scripts/modules/bl_i18n_utils/clean_po.py @@ -25,10 +25,13 @@ import os import sys import collections -from codecs import open -import settings -import utils +try: + import settings + import utils +except: + from . import (settings, utils) + TRUNK_PO_DIR = settings.TRUNK_PO_DIR BRANCHES_DIR = settings.BRANCHES_DIR diff --git a/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py b/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py index 4739a98920f..cbbef17b37d 100755 --- a/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py +++ b/release/scripts/modules/bl_i18n_utils/import_po_from_branches.py @@ -28,9 +28,12 @@ import sys import subprocess from codecs import open -import settings -import utils -import rtl_preprocess +try: + import settings + import utils + import rtl_preprocess +except: + from . import (settings, utils, rtl_preprocess) TRUNK_PO_DIR = settings.TRUNK_PO_DIR diff --git a/release/scripts/modules/bl_i18n_utils/merge_po.py b/release/scripts/modules/bl_i18n_utils/merge_po.py index 1a55cd670b0..b09e4daefbc 100755 --- a/release/scripts/modules/bl_i18n_utils/merge_po.py +++ b/release/scripts/modules/bl_i18n_utils/merge_po.py @@ -29,9 +29,11 @@ # never merged from sources. import sys -from codecs import open -import utils +try: + import utils +except: + from . import utils def main(): diff --git a/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py b/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py index c6fc5fc787e..9b2ee983952 100755 --- a/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py +++ b/release/scripts/modules/bl_i18n_utils/rtl_preprocess.py @@ -35,8 +35,12 @@ import sys import ctypes -import settings -import utils +try: + import settings + import utils +except: + from . import (settings, utils) + FRIBIDI_LIB = settings.FRIBIDI_LIB diff --git a/release/scripts/modules/bl_i18n_utils/update_branches.py b/release/scripts/modules/bl_i18n_utils/update_branches.py index 1a856b14944..6626fa937a6 100755 --- a/release/scripts/modules/bl_i18n_utils/update_branches.py +++ b/release/scripts/modules/bl_i18n_utils/update_branches.py @@ -30,7 +30,11 @@ import os import sys import tempfile -import settings +try: + import settings +except: + from . import settings + PY3 = settings.PYTHON3_EXEC diff --git a/release/scripts/modules/bl_i18n_utils/update_mo.py b/release/scripts/modules/bl_i18n_utils/update_mo.py index 9804eb8ce34..1b415e7bd7c 100755 --- a/release/scripts/modules/bl_i18n_utils/update_mo.py +++ b/release/scripts/modules/bl_i18n_utils/update_mo.py @@ -26,8 +26,11 @@ import subprocess import os import sys -import settings -import utils +try: + import settings + import utils +except: + from . import (settings, utils) GETTEXT_MSGFMT_EXECUTABLE = settings.GETTEXT_MSGFMT_EXECUTABLE @@ -39,17 +42,19 @@ TRUNK_PO_DIR = settings.TRUNK_PO_DIR DOMAIN = settings.DOMAIN -def process_po(po, lang): - mo_dir = os.path.join(TRUNK_MO_DIR, lang, "LC_MESSAGES") +def process_po(po, lang, mo=None): + if not mo: + mo_dir = os.path.join(TRUNK_MO_DIR, lang, "LC_MESSAGES") + # Create dirs if not existing! + if not os.path.isdir(mo_dir): + os.makedirs(mo_dir, exist_ok = True) - # Create dirs if not existing! - os.makedirs(mo_dir, exist_ok = True) # show stats cmd = (GETTEXT_MSGFMT_EXECUTABLE, "--statistics", po, "-o", - os.path.join(mo_dir, ".".join((DOMAIN, "mo"))), + mo or os.path.join(mo_dir, ".".join((DOMAIN, "mo"))), ) print("Running ", " ".join(cmd)) @@ -64,11 +69,18 @@ def main(): "under {}.".format(TRUNK_MO_DIR)) parser.add_argument('langs', metavar='ISO_code', nargs='*', help="Restrict processed languages to those.") + parser.add_argument('po', help="Only process that po file (implies --mo).") + parser.add_argument('mo', help="Mo file to generate (implies --po).") args = parser.parse_args() ret = 0 - if args.langs: + if args.po and args.mo: + if os.path.exists(args.po): + t = process_po(args.po, None, args.mo) + if t: + ret = t + elif args.langs: for lang in args.langs: po = os.path.join(TRUNK_PO_DIR, ".".join((lang, "po"))) if os.path.exists(po): diff --git a/release/scripts/modules/bl_i18n_utils/update_msg.py b/release/scripts/modules/bl_i18n_utils/update_msg.py index e5154632cfe..c1b0d636655 100755 --- a/release/scripts/modules/bl_i18n_utils/update_msg.py +++ b/release/scripts/modules/bl_i18n_utils/update_msg.py @@ -26,7 +26,10 @@ import os import sys import subprocess -import settings +try: + import settings +except: + from . import settings BLENDER_ARGS = [ diff --git a/release/scripts/modules/bl_i18n_utils/update_po.py b/release/scripts/modules/bl_i18n_utils/update_po.py index c4e980aad2a..d098b50e907 100755 --- a/release/scripts/modules/bl_i18n_utils/update_po.py +++ b/release/scripts/modules/bl_i18n_utils/update_po.py @@ -28,8 +28,12 @@ import sys from codecs import open import shutil -import settings -import utils +try: + import settings + import utils +except: + from . import (settings, utils) + GETTEXT_MSGMERGE_EXECUTABLE = settings.GETTEXT_MSGMERGE_EXECUTABLE BRANCHES_DIR = settings.BRANCHES_DIR diff --git a/release/scripts/modules/bl_i18n_utils/update_pot.py b/release/scripts/modules/bl_i18n_utils/update_pot.py index 58c924cade4..ca5d156be9b 100755 --- a/release/scripts/modules/bl_i18n_utils/update_pot.py +++ b/release/scripts/modules/bl_i18n_utils/update_pot.py @@ -31,8 +31,11 @@ import argparse import time import pickle -import settings -import utils +try: + import settings + import utils +except: + from . import (settings, utils) COMMENT_PREFIX = settings.COMMENT_PREFIX diff --git a/release/scripts/modules/bl_i18n_utils/update_trunk.py b/release/scripts/modules/bl_i18n_utils/update_trunk.py index f4a2e0b3f8f..5e0ceab387c 100755 --- a/release/scripts/modules/bl_i18n_utils/update_trunk.py +++ b/release/scripts/modules/bl_i18n_utils/update_trunk.py @@ -33,7 +33,10 @@ import os import sys import shutil -import settings +try: + import settings +except: + from . import settings TRUNK_PO_DIR = settings.TRUNK_PO_DIR TRUNK_MO_DIR = settings.TRUNK_MO_DIR |