Update and optimize template

This commit is contained in:
Jeremy D
2022-02-09 11:58:02 +01:00
parent 681b7aa88e
commit f92c651c80
4 changed files with 10 additions and 35 deletions
+4 -30
View File
@@ -1,31 +1,5 @@
#!/bin/sh
# To disable the sdt with each command, add ' > /dev/null 2>&1' to redirect all info
# Set all variables
MOUNT_FOLDER="/addon-moderlab"
INSTALL_ADDON="$MOUNT_FOLDER/tests/utils/blender_addon.py"
#!/bin/bash
MOUNT_FOLDER="addon_moderlab"
export FOLDER_TEST=$MOUNT_FOLDER
# ----- ----- ----- -----
# From a previous archive generated, install the moderlab plugin
/opt/blender/blender --background --python "$INSTALL_ADDON" -- "$MOUNT_FOLDER" > /dev/null 2>&1
install_error=$?
if [ $install_error = 1 ]; then
echo Blender Test Error
echo Exit code is install_error
(exit 1)
else
# ----- ----- ----- -----
# Launch Blender Test
/opt/blender/blender --background -noaudio --disable-autoexec --addons moderlab_type --python-exit-code 1 --python "$1" -- --verbose
blender_error=$?
if [ $blender_error = 1 ]; then
echo Blender Test Error
echo Exit code is $blender_error
(exit 1)
fi
fi
/opt/blender/blender --background --python-exit-code 1 --python "/addon_moderlab/tests/utils/blender_addon.py" > /dev/null 2>&1 || exit 1
/opt/blender/blender --background -noaudio --disable-autoexec --python-exit-code 1 --python "$1" -- --verbose || exit 1
+1 -1
View File
@@ -13,7 +13,7 @@ class ActivateAddon(unittest.TestCase):
@staticmethod
def get_folder_name():
"""Return the folder name to get the addon name we want activated"""
addon = glob.glob("/addon-moderlab/*/__init__.py", recursive=True)
addon = glob.glob("/addon_moderlab/*/__init__.py", recursive=True)
return os.path.basename(os.path.dirname(addon[0]))
def test_activate_addon(self):
+1 -1
View File
@@ -18,7 +18,7 @@ def b3d_launch_blender_test(client: docker = docker.from_env(), test: list = Non
local_path = os.environ.get('GITHUB_WORKSPACE')
else:
local_path = os.getcwd()
container_folder = '/addon-moderlab'
container_folder = '/addon_moderlab'
volume = [f'{local_path}:{container_folder}']
image_name = tag
if test is None:
+4 -3
View File
@@ -5,16 +5,17 @@ import bpy
dependency = {
# 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'],
'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'],
# 'moderlab_pie': ['moderlab_pie.zip', 'Moderlab-Production/BlenderPieMenu'],
# 'uv-packer': ['uv-packer.zip', 'Moderlab-Production/UvPacker'],
}
def b3d_install_addon(addon_path: str):
def b3d_install_addon():
for key, value in dependency.items():
bpy.ops.preferences.addon_install(filepath=f'{addon_path}/{value[0]}')
bpy.ops.preferences.addon_install(filepath=f'/addon_moderlab/{value[0]}')
bpy.ops.preferences.addon_enable(module=key)
bpy.ops.wm.save_userpref()
if __name__ == '__main__':
b3d_install_addon(sys.argv[-1])
b3d_install_addon()