ya2 · news · projects · code · about

fixes for building
authorFlavio Calva <f.calva@gmail.com>
Sat, 6 May 2023 07:23:22 +0000 (09:23 +0200)
committerFlavio Calva <f.calva@gmail.com>
Sat, 6 May 2023 07:23:22 +0000 (09:23 +0200)
setup.py
tests/test_setup.py
ya2/build/lang.py
ya2/build/models.py

index bff22e564a11f9f3e2f38e6b30c8bf842e0f717d..aa5273fc78b123cd39f0220111d752d614a34cd0 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -63,7 +63,7 @@ class ImagesCommand(BaseCommand):
         s.build()
         find_info = FindFileNamesArgs(
             ['jpg', 'png'],
-            ['models', 'gltf', 'bam'],
+            ['models', 'gltf', 'bam', 'build'],
             ['_png.png'])
         images = find_file_names(find_info)
         i = ImagesBuilder(images, int(BaseCommand.cores))
@@ -76,6 +76,9 @@ class L10nCommand(BaseCommand):
         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/')
+        l.build()
 
 
 class BDistAppsCommand(bdist_apps):
index 2405206de1fd26879bebd2cc58e99f84907b6857..eb89afee07125b0e423978bf7778d870f7b3e57a 100644 (file)
@@ -78,14 +78,14 @@ class SetupTests(TestCase):
     def test_l10n_command(self, l_mock):
         cmd = L10nCommand(Distribution())
         cmd.run()
-        assert l_mock.call_count == 1
+        assert l_mock.call_count == 2  # 1  -  added test building
         build_args = l_mock.call_args_list[0].args
         assert isinstance(build_args[0], str)
         assert 'locale' in build_args[1]
         assert isinstance(build_args[2], str)
         assert 'locale' in build_args[3]
         build_mock = l_mock.return_value.build
-        build_mock.assert_called_once()
+        build_mock.call_count == 2  # build_mock.assert_called_once()
         assert not build_mock.call_args_list[0].args
 
     @patch.object(direct.dist.commands.bdist_apps, 'run', autospec=True)
index 1592fb59ffd60c5d8d8465a92ccd0ffdc47f50a5..4a9a2c80ab0290449abcf02c4287ea415635bb5c 100644 (file)
@@ -68,8 +68,8 @@ class LanguageBuilder:
         mo_name = mo_template % (self.__mo_path, language_code, self.__app_name)
         lng_code = mo_name[len(self.__mo_path):].split('/')[0]
         lng_dir = self.__mo_path + lng_code + '/LC_MESSAGES/'
-        cmd = 'msgfmt -o {lng_dir}{appname}.mo assets/locale/po/{lng_code}.po'
-        system(cmd.format(lng_dir=lng_dir, appname=self.__app_name, lng_code=lng_code))
+        cmd = 'msgfmt -o {lng_dir}{appname}.mo {po_path}{lng_code}.po'
+        system(cmd.format(lng_dir=lng_dir, appname=self.__app_name, po_path=self.__po_path, lng_code=lng_code))
 
     def __merge(self, lng_code):
         '''Merges the new strings with the previous ones.'''
index d875dbc81bfe47f29621bcad0f460adb1c21d0aa..07980b311ede55216268b128035ca5aba85e12d6 100644 (file)
@@ -137,7 +137,7 @@ class Gltf2Bam:
         self.__jpg_png_files = []
         for l in self.__lines:
             if ('.png' in l or '.jpg' in l) and '"uri"' in l:
-                r = l[l.index('"uri"') + 9:].rstrip(',\n"')
+                r = l[l.index('"uri"') + 7:].rstrip(',\n"')
                 t = f'{dirname(self.__gltf_name)}/{r}'
                 self.__jpg_png_files += [t.replace('/models/blend/', '/models/gltf/', 1)]
         self.__create_dds_files()