From ae4b02305a08f163d4515efec10219ea38034952 Mon Sep 17 00:00:00 2001 From: Brandon Runnels Date: Tue, 21 Nov 2023 15:43:29 -0700 Subject: [PATCH] adding wrapper --- .github/workflows/linux.yml | 4 ++-- scripts/install.py | 17 ++++------------- scripts/wrapper.py | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 scripts/wrapper.py diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5a8318e..aa057c4 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,8 +9,8 @@ jobs: steps: - uses: actions/checkout@v2 - name: installing preliminaries - run: sudo apt install blender + run: sudo apt install blender python3 - name: package add-on run: make - name: install blender plugin - run: blender -b --python scripts/install.py --python-exit-code 1 + run: python3 scripts/wrapper.py blender -b --python scripts/install.py --python-exit-code 1 diff --git a/scripts/install.py b/scripts/install.py index c5b40e4..2151f49 100644 --- a/scripts/install.py +++ b/scripts/install.py @@ -1,13 +1,4 @@ -try: - import bpy - bpy.ops.preferences.addon_install(filepath="bleMD.zip",overwrite=True) - bpy.ops.preferences.addon_enable(module='bleMD') - -except Exception as e: - print("Aha I caught an exception") - print(e) - raise e -### You must print this line, otherwise the Github action will think -### the script failed. -#print("SCRIPT COMPLETED SUCCESSFULLY") - +import bpy +bpy.ops.preferences.addon_install(filepath="bleMD.zip",overwrite=True) +bpy.ops.preferences.addon_enable(module='bleMD') +print("---successful completion---") diff --git a/scripts/wrapper.py b/scripts/wrapper.py new file mode 100644 index 0000000..b88f5fe --- /dev/null +++ b/scripts/wrapper.py @@ -0,0 +1,20 @@ +import subprocess +import sys + +try: + output = subprocess.check_output(sys.argv[1:]) + print(output.decode('ascii')) + if not "---successful completion---" in output.decode('ascii'): + raise Exception("Script errored out") + print("Successful completion") +except FileNotFoundError as e: + print("could not find file", e)#, e.output) + raise e +except subprocess.CalledProcessError as e: + print("error code", e.returncode)#, e.output) + raise e +except Exception as e: + print(e) + raise e + +print("Ah yes, definitely successful")