Issue:
If the blender file path passed to pack.Packer is a symlink, BAT will raise an AssertianError:
468 # exist on the local filesystem.
469 bfile_pp = action.new_path
--> 470 assert bfile_pp is not None
471
472 # Use tempfile to create a unique name in our temporary directoy.
AssertionError:Platform: Mac OS
Steps to reproduce:
- Create a blender project with a linked library
- Symlink that project to another location
- Run the following: Packer(blendfile, blendfile.parent, output)
If blendfile is a Path pointing to a symlink, it will cause the above error.
Cause
The issue seems to be caused in strategise and _group_rewrites. An action is added in stretegise for the root .blend file (line 244) that's tied to the blendfile Path that's passed in (the unresolved path). In _group_rewrites, the action is updated for all its rewrites (line 369). However, it attempts to find the action using the resolved path, so it's unable to find the original action created for the root .blend file (instead, it creates a new action that doesn't have the new_path field set, which causes the AssertionError).
Fix:
This patch fixes the error by resolving blendfile so it doesn't create duplicate keys.