feat: config support prepararation
This commit is contained in:
@ -4,10 +4,11 @@ import os
|
||||
from pathlib import Path
|
||||
import bpy
|
||||
|
||||
thirdPartyDir = os.path.dirname(os.path.abspath(__file__))+"/libs"
|
||||
python_path = Path(bpy.app.binary_path_python)
|
||||
cwd_for_subprocesses = python_path.parent
|
||||
target = None
|
||||
CONFIG_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),"config")
|
||||
APP_CONFIG = os.path.join(CONFIG_DIR,"config.yaml")
|
||||
THIRD_PARTY = os.path.join(os.path.dirname(os.path.abspath(__file__)),"libs")
|
||||
PYTHON_PATH = Path(bpy.app.binary_path_python)
|
||||
SUBPROCESS_DIR = PYTHON_PATH.parent
|
||||
|
||||
def module_can_be_imported(name):
|
||||
try:
|
||||
@ -26,14 +27,14 @@ def get_package_install_directory():
|
||||
def install_pip():
|
||||
# pip can not necessarily be imported into Blender after this
|
||||
get_pip_path = Path(__file__).parent / "libs" / "get-pip.py"
|
||||
subprocess.run([str(python_path), str(get_pip_path)], cwd=cwd_for_subprocesses)
|
||||
subprocess.run([str(PYTHON_PATH), str(get_pip_path)], cwd=SUBPROCESS_DIR)
|
||||
|
||||
|
||||
def install_package(name):
|
||||
target = get_package_install_directory()
|
||||
|
||||
subprocess.run([str(python_path), "-m", "pip", "install",
|
||||
name, '--target', target], cwd=cwd_for_subprocesses)
|
||||
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install",
|
||||
name, '--target', target], cwd=SUBPROCESS_DIR)
|
||||
|
||||
def setup(dependencies):
|
||||
if not module_can_be_imported("pip"):
|
||||
|
Reference in New Issue
Block a user