summaryrefslogtreecommitdiff
path: root/__init__.py
diff options
context:
space:
mode:
authorOwl <isaclien9752@gmail.com>2025-08-27 23:54:31 -0400
committerOwl <isaclien9752@gmail.com>2025-08-27 23:54:31 -0400
commitf4ff299e4e073b71495a3e2a385fa96d65fb6f80 (patch)
tree02ccd603b6f3907d108abd3d3d76ecdb1235b14a /__init__.py
parentea2eeb7d18869bb19773782289dca325c14776d0 (diff)
downloadblenxy-f4ff299e4e073b71495a3e2a385fa96d65fb6f80.tar.gz
blenxy-f4ff299e4e073b71495a3e2a385fa96d65fb6f80.zip
rotations people, rotations...
Diffstat (limited to '__init__.py')
-rw-r--r--__init__.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/__init__.py b/__init__.py
index 5b0949c..3eebb3f 100644
--- a/__init__.py
+++ b/__init__.py
@@ -6,6 +6,7 @@
# that the python interpreter must have built in
import bpy, importlib, sys, subprocess, os, shutil
import math, mathutils, warnings, struct, site
+from . import file_ops
# elemental python modules blenxy needs
# that the python interpreter probably does not have built in/needs to be updated
@@ -14,12 +15,31 @@ new_modules = ["lxml", "numpy"]
# check which of the new modules needs to be installed
def new_mod_check(mod_names):
+ # variable to return
rtn = []
+
+ # traverse into all the new_modules
for mod_name in mod_names:
+ # skip numpy if the numpy_bad folder was created
+ if (mod_name == "numpy"):
+ for path in site.getsitepackages():
+ if ("2.79" in path):
+ numpy_path = path + "/numpy"
+ numpy_bad_path = path + "/numpy_bad"
+ # rename the existing numpy folder to numpy bad and install newer numpy
+ if (file_ops.f_exists(numpy_bad_path) == False):
+ file_ops.rename(numpy_path, numpy_bad_path)
+ rtn.append("numpy")
+ break
+ continue
+
+ # try importing the module
try:
importlib.import_module(mod_name)
except:
rtn.append(mod_name)
+
+ # done!
return rtn
# install given modules with pip but be sure to have pip first
@@ -42,14 +62,6 @@ def new_mod_install(mod_names):
# install the rest of the modules
if (mod_names != []):
for mod_name in mod_names:
- if (mod_name == "numpy"): # specific to the numpy module
- # get the numpy package path
- numpy_path = None
- for path in site.getsitepackages():
- if ("2.79" in path):
- numpy_path = path + "/numpy"
- break
- os.rename(numpy_path, numpy_path + "_bad")
# normal module installation
subprocess.run(pip_install + [mod_name])
return True