diff --git a/install b/install new file mode 100644 index 0000000..ea143f7 --- /dev/null +++ b/install @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import os, sys, shutil, urllib.request, time + +if "--local" in sys.argv: + print("Installing local Neuro3D Blender addon.") + shutil.make_archive("neuro3d", 'zip', ".", "neuro3d") +else: + print("Downloading Neuro3D Blender addon.") + archive = "https://github.com/Helveg/neuro3d/releases/latest/download/neuro3d.zip" + with urllib.request.urlopen(archive) as w: + with open("neuro3d.zip", 'wb') as f: + f.write(w.read()) +try: + with open("_tmp_n3d_install.py", "w") as f: + f.write(""" +import bpy, os + +bpy.ops.preferences.addon_install( + filepath=os.path.abspath("neuro3d.zip"), overwrite=True +) +bpy.ops.preferences.addon_enable(module="neuro3d") +bpy.ops.wm.save_userpref() +""") + try: + print("Launching Blender, installing zip.") + os.system(f"blender --background --python _tmp_n3d_install.py") + finally: + os.remove("_tmp_n3d_install.py") +finally: + os.remove("neuro3d.zip") diff --git a/installer/blender_install.py b/installer/blender_install.py deleted file mode 100644 index fe3eb79..0000000 --- a/installer/blender_install.py +++ /dev/null @@ -1,7 +0,0 @@ -import bpy, os - -bpy.ops.preferences.addon_install( - filepath=os.path.abspath("neuro3d.zip"), overwrite=True -) -bpy.ops.preferences.addon_enable(module="neuro3d") -bpy.ops.wm.save_userpref() diff --git a/installer/install b/installer/install deleted file mode 100644 index 031b7ae..0000000 --- a/installer/install +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, shutil, urllib.request - -if "--local" in sys.argv: - print("Installing local Neuro3D Blender addon.") - shutil.make_archive("neuro3d", 'zip', ".", "neuro3d") -else: - print("Downloading Neuro3D Blender addon.") - archive = "https://github.com/Helveg/neuro3d/releases/latest/download/neuro3d.zip" - with urllib.request.urlopen(archive) as w: - with open("neuro3d.zip", 'wb') as f: - f.write(w.read()) -try: - print("Launching Blender, installing zip.") - os.system(f"blender --background --python installer/blender_install.py") -finally: - os.remove("neuro3d.zip") diff --git a/neuro3d/__init__.py b/neuro3d/__init__.py index 77ff33b..7d13518 100644 --- a/neuro3d/__init__.py +++ b/neuro3d/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.1" +__version__ = "0.0.3" import warnings import numpy as np