#+CATEGORY: pmachines
#+TAGS: bug(b) calendar(c) waiting(w)
+* DOING put the builder on my personal pc
+* rename: s/functional tests/system tests/
* magnet, road cone, bucket
* osx support
* (python 3.11) manylinux2014_x86_64
def run(self):
l = LanguageBuilder(
- app_name, 'assets/locale/po/', 'assets/scenes/', 'assets/locale/')
- l.build()
- l = LanguageBuilder(
- 'test', 'tests/assets/locale/po/', 'tests/assets/scenes/', 'tests/assets/locale/')
+ app_name, 'assets/locale/po/', 'assets/scenes/', 'assets/locale/', '.')
l.build()
+ # l = LanguageBuilder(
+ # 'test', 'assets/locale/po/', 'assets/scenes/', 'assets/locale/', 'tests')
+ # l.build()
class BDistAppsCommand(bdist_apps):
def test_l10n_command(self, l_mock):
cmd = L10nCommand(Distribution())
cmd.run()
- assert l_mock.call_count == 2 # 1 - added test building
+ assert l_mock.call_count == 1
build_args = l_mock.call_args_list[0].args
assert isinstance(build_args[0], str)
assert 'locale' in build_args[1]
rmtree('./tests/' + dirname, ignore_errors=True)
def test_lang(self):
- l = LanguageBuilder('test_pmachines', './tests/po/', './tests/po/', './tests/locale/')
+ #l = LanguageBuilder('test_pmachines', './po/', './po/', './locale/', 'tests')
+ l = LanguageBuilder('test', 'assets/locale/po/', 'assets/scenes/', 'assets/locale/', 'tests')
l.build()
- self.assertTrue(exists('./tests/po/test_pmachines.pot'))
- self.assertTrue(exists('./tests/locale/it_IT/LC_MESSAGES/test_pmachines.mo'))
+ self.assertTrue(exists('./tests/assets/locale/po/test.pot'))
+ self.assertTrue(exists('./tests/assets/locale/it_IT/LC_MESSAGES/test.mo'))
'''Tools for l10n.'''
-from os import system, makedirs, remove, listdir
+from os import system, makedirs, remove, listdir, getcwd, chdir
from os.path import exists, isfile, join
from shutil import move, copy
from json import loads
class LanguageBuilder:
'''Tools for building files for l10n.'''
- def __init__(self, app_name, po_path, json_path, mo_path):
+ def __init__(self, app_name, po_path, json_path, mo_path, root):
self.__app_name = app_name
self.__po_path = po_path
self.__json_path = json_path
self.__mo_path = mo_path
+ self.__root = root
def build(self):
+ orig_dir = getcwd()
+ chdir(self.__root)
self.__build_pot()
po_files = [name for name in listdir(self.__po_path)
if isfile(join(self.__po_path, name)) and
name.endswith('.po')]
language_codes = [f.split('.')[0] for f in po_files]
for l in language_codes: self.__process_language(l)
+ chdir(orig_dir)
def __build_pot(self):
'''Builds the pot file in the lng_dir_code directory.'''