Skip to content

Commit

Permalink
adding wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrunnels committed Nov 21, 2023
1 parent 83a8396 commit ae4b023
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 4 additions & 13 deletions scripts/install.py
Original file line number Diff line number Diff line change
@@ -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---")
20 changes: 20 additions & 0 deletions scripts/wrapper.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit ae4b023

Please sign in to comment.