Reverting Addon Install test changes

pull/277/head^2
Rob 2024-12-18 10:21:37 -05:00
rodzic 86fd5bef8f
commit e8aa8a19c7
1 zmienionych plików z 37 dodań i 37 usunięć

Wyświetl plik

@ -6,45 +6,45 @@ import tempfile
INSTALL_CODE = f"""
import bpy\n
bpy.context.preferences.system.use_online_access = True\n
bpy.ops.extensions.repo_sync_all(use_active_only=False)\n
bpy.ops.extensions.package_install_files(filepath='{sys.argv[1]}', repo='user_default')\n
bpy.ops.extensions.package_install(repo_index=0, pkg_id="stl_format_legacy")\n
bpy.ops.extensions.package_install(repo_index=0, pkg_id="simplify_curves_plus")\n
bpy.ops.extensions.package_install(repo_index=0, pkg_id="curve_tools")\n
bpy.ops.wm.save_userpref()\n
import bpy
bpy.context.preferences.system.use_online_access = True
bpy.ops.extensions.repo_sync_all(use_active_only=False)
bpy.ops.extensions.package_install_files(filepath='{sys.argv[1]}', repo='user_default')
bpy.ops.extensions.package_install(repo_index=0, pkg_id="stl_format_legacy")
bpy.ops.extensions.package_install(repo_index=0, pkg_id="simplify_curves_plus")
bpy.ops.extensions.package_install(repo_index=0, pkg_id="curve_tools")
bpy.ops.wm.save_userpref()
"""
NUM_RETRIES = 10
# with tempfile.TemporaryDirectory() as td:
# file = pathlib.Path(td, "install.py")
# file.write_text(INSTALL_CODE)
with tempfile.TemporaryDirectory() as td:
file = pathlib.Path(td, "install.py")
file.write_text(INSTALL_CODE)
# blender 4.0 installing addon crashes sometimes on mac github actions...
for x in range(NUM_RETRIES):
try:
subprocess.run(
[shutil.which("blender"), "-b", "--python-text", INSTALL_CODE],
shell=False,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
print("installed addon okay")
sys.exit(0)
except subprocess.CalledProcessError as e:
print("Install addon failed, retrying:", e)
print("Command output:")
print("------------------------------")
print(e.output)
print("------------------------------")
for line in str(e.output):
if line.startswith("Writing: "):
crash_file = pathlib.Path(line[len("Writing: ") :])
if crash_file.exists():
print("Crash log:\n================")
print(crash_file.read_text())
print("============================")
# blender 4.0 installing addon crashes sometimes on mac github actions...
for x in range(NUM_RETRIES):
try:
subprocess.run(
[shutil.which("blender"), "-b", "-P", str(file)],
shell=False,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
print("installed addon okay")
sys.exit(0)
except subprocess.CalledProcessError as e:
print("Install addon failed, retrying:", e)
print("Command output:")
print("------------------------------")
print(e.output)
print("------------------------------")
for line in str(e.output):
if line.startswith("Writing: "):
crash_file = pathlib.Path(line[len("Writing: ") :])
if crash_file.exists():
print("Crash log:\n================")
print(crash_file.read_text())
print("============================")