This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
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.
Fixes armory3d/armory#2473.
Previously, only the individual SDK submodules were cloned when using the "Update SDK" button in the Armory preferences, which eventually led to problems because armory.py wasn't compatible with the SDK.
Now, the entire SDK repo is cloned recursively which solves this issue. Due to the now removed
os.chdir(sdk_path)
calls, Blender previously locked the SDK path, but they are not needed (anymore?) here so I could remove them and now it works. In case an error happens e.g. due to other applications locking the path, it is shown in the user interface and the user is prompted to try again. Parts of the solution are a bit ugly since now some of the I/O calls need to be wrapped in a function to ensure correct error handling without redundant code all over the place, but I think it's pretty solid despite that.There are still many cases where both the old and the new code can fail (e.g. there is no backup created when an old backup already exists), so there is still some work that needs to be done in order to make the updater more fail-safe. Also, it would be possible to find out what processes lock the SDK path (if any) and then ask the user whether they should be automatically closed for them. However this is not possible out of the box without some very platform-specific fiddling involved. There is a package called
psutil
that could be used for this (and it could also help with some other parts of Armory), but I don't know whether you want to have an additional dependency and how we would cope with conflicting versions if other addons use that package as well.