Merge pull request #24 from Moderlab-Production/developp

Developp
This commit is contained in:
Aurelien Vaillant
2022-02-14 14:48:26 +01:00
committed by GitHub
6 changed files with 12 additions and 36 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
### PyCharm ### ### PyCharm ###
.idea/ .idea/
.run/
### Python ### ### Python ###
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
@@ -25,5 +26,5 @@ tests/unreal_sample/Saved
**/token.txt **/token.txt
# Virtual Environment # Virtual Environment
tests/venv **/venv/**
venv/ venv/
View File
+4 -30
View File
@@ -1,31 +1,5 @@
#!/bin/sh #!/bin/bash
MOUNT_FOLDER="addon_moderlab"
# 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"
export FOLDER_TEST=$MOUNT_FOLDER export FOLDER_TEST=$MOUNT_FOLDER
/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
# 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
+1 -1
View File
@@ -13,7 +13,7 @@ class ActivateAddon(unittest.TestCase):
@staticmethod @staticmethod
def get_folder_name(): def get_folder_name():
"""Return the folder name to get the addon name we want activated""" """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])) return os.path.basename(os.path.dirname(addon[0]))
def test_activate_addon(self): 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') local_path = os.environ.get('GITHUB_WORKSPACE')
else: else:
local_path = os.getcwd() local_path = os.getcwd()
container_folder = '/addon-moderlab' container_folder = '/addon_moderlab'
volume = [f'{local_path}:{container_folder}'] volume = [f'{local_path}:{container_folder}']
image_name = tag image_name = tag
if test is None: if test is None:
+4 -3
View File
@@ -5,16 +5,17 @@ import bpy
dependency = { dependency = {
# 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'], # 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'],
'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'], 'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'],
# 'moderlab_pie': ['moderlab_pie.zip', 'Moderlab-Production/BlenderPieMenu'],
# 'uv-packer': ['uv-packer.zip', 'Moderlab-Production/UvPacker'], # '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(): 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.preferences.addon_enable(module=key)
bpy.ops.wm.save_userpref() bpy.ops.wm.save_userpref()
if __name__ == '__main__': if __name__ == '__main__':
b3d_install_addon(sys.argv[-1]) b3d_install_addon()