feat(blender): Add plugin sync to 5.0 and fix OS detection in 5.1#227
Merged
Conversation
Add Blender 5.0 plugin sync (simple plugins) support so the recipe
delivers plugins via DEADLINE_JA_ROOT_PREFIX the same way 5.1 does:
install conda activate.d/deactivate.d hooks plus a standalone
plugin_sync_bootstrap.py under $PREFIX/share/blender-plugin-sync,
and add recipe tests that verify those files are present.
Also fix a latent bug in the 5.1 activate script. The previous
test mixed `=` string equality with a glob pattern ("MINGW"*),
which is invalid sh and never matched, and the
`[ -n "${OS:-}" ]` fallback misclassified any environment that
happened to export OS as Windows. Replace with a `case` statement
matching MINGW*, MSYS*, and CYGWIN* against `uname -s` so Windows
is detected reliably across Git Bash, MSYS2, and Cygwin.
Signed-off-by: Godot Bian <13778003+godobyte@users.noreply.github.com>
leongdl
previously approved these changes
May 26, 2026
AlexTranAmz
previously approved these changes
May 26, 2026
jericht
previously approved these changes
May 26, 2026
Signed-off-by: Godot Bian <13778003+godobyte@users.noreply.github.com>
002fbac
AlexTranAmz
approved these changes
May 26, 2026
jericht
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was the problem/requirement? (What/Why)
Two issues addressed in one commit:
Blender 5.0 had no plugin sync support. The
blender-5.1recipe shipped activate/deactivate hooks plus an auto-enable startup script in PR #215. Blender 5.0 was left without those hooks, so customers on 5.0 couldn't use the simple-plugins delivery mechanism for their addons.Latent OS-detection bug in the 5.1 activate script. The original Windows check was:
[ "$x" = "MINGW"* ]mixes=string-equality with a glob pattern.test/[doesn't expand globs in operands, so this check never matched MINGW or MSYS. The fallback[ -n "${OS:-}" ]triggered on any environment that happened to export theOSvariable, including Linux containers that happen to have it set, which would mis-route plugin downloads to thewindows/S3 prefix.What was the solution? (How)
5.0 plugin sync:
Added
conda_recipes/blender-5.0/recipe/zzz-blender-plugin-sync-activate.shandzzz-blender-plugin-sync-deactivate.sh, mirroring the 5.1 layout.Added
conda_recipes/blender-5.0/recipe/plugin_sync_bootstrap.py— a standalone Python file invoked viablender -b --python <bootstrap>from the activate script. Bootstrap runs once per session during conda env-enter:bpy.ops.preferences.addon_install+addon_utils.enablefor each addon, thenbpy.ops.wm.save_userpref(). All subsequentblendercalls in the session pick up enabled addons from the persisted userpref.Why a one-shot bootstrap instead of a startup script: on Blender 5.0.x, scripts in
BLENDER_USER_SCRIPTS/startup/run with a restrictedbpy.context(_RestrictContext).addon_installraisesAttributeErrorreadingview_layer/sceneattributes, andaddon_utils.enablefails to import the module since it was never registered in the preferences DB.--pythonruns outside the restricted context, so install and enable both succeed there.The activate script sets
BLENDER_USER_CONFIGto a session-scoped path ($OPENJD_SESSION_WORKING_DIR/deadline-plugins/blender-config) so the userpref we write is isolated to the session and gets cleaned up by the worker at session end.Updated
conda_recipes/blender-5.0/recipe/build.shto copy all three files into$PREFIX/etc/conda/{activate,deactivate}.d/and$PREFIX/share/blender-plugin-sync/.Added
test -fsmoke checks for the three plugin-sync files torecipe.yaml.5.1 OS detection fix:
caseexpands glob patterns in match arms, which is what was originally intended. Also adds CYGWIN coverage. Drops theOSfallback so non-Windows environments that happen to exportOSaren't mis-detected.What is the impact of this change?
s3://<ja-bucket>/<root-prefix>/plugins/linux/blender/5.0/<addon>/and have them auto-enable on Deadline Cloud workers, with no manualaddon_install/addon_enablecalls in their job scripts.OS. No behavior change on workers where neither condition holds.~3 KBof scripts and a~3 KBPython file under the prefix.How was this change tested?
1. Unit tests of the activate/deactivate scripts (mocked
awsandblender, run on the host):Tests cover: silent skip when env vars missing, addon download/reorganization, BLENDER_USER_SCRIPTS + BLENDER_USER_CONFIG export, bootstrap invocation arguments, debug log creation, no startup/ generation, deactivate cleanup, single
.pyaddon handling, missing-bootstrap fallback. (Test scaffolding was developed alongside the internal port; not shipped in this PR but the same script structure runs against the public recipe.)2. End-to-end on a real SMF worker:
Built the 5.0 recipe with rattler-build, pushed to a dev S3 conda channel, and submitted a job that:
CondaPackages=blender=5.0.1=hb0f4dca_0andCondaChannels=s3://...addon_install/addon_enablecalls — relies entirely on the recipe's plugin sync to enable addons before the render runs.addon_utils.modules()+addon_utils.check()that every uploaded addon is in Blender's enabled list, and thatbpy.ops.flip_fluid_operators.*is populated (proves the C++ engine loaded).Result on the SMF worker (Blender 5.0.1, AL2023):
Pure-Python addons and a compiled C++ addon (FLIP Fluids 1.8.6 built from source on AL2023) both pass.
3. 5.1 OS detection fix:
Verified by inspection that the new
casestatement matches MINGW/MSYS/CYGWIN againstuname -sand that the previous[ ... = "MINGW"* ]form is invalid POSIX shell. No worker regression on Linux —casedoesn't match any of the patterns, so_SP_OSstayslinux, identical to the previous (broken) behavior on Linux.Was this change documented?
The behavior is documented inline in the new activate-script header, including a multi-paragraph explanation of why a
--pythonbootstrap is used instead of a startup script (_RestrictContextdiscussion). The 5.0 README didn't have plugin-sync content before, so no separate README change was needed in this PR. Customer-facing convention docs (S3 path layout) live in the existing 5.1 README and apply unchanged to 5.0.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.