[Soc-2017-dev] Daily Report - Jul 12 - Package Manager

Ellwood Zwovic gandalf3 at blendermonkey.com
Thu Jul 13 09:24:43 CEST 2017


Today I altered the install function to overwrite existing addons (but 
back them up and restore them in case the installation fails). This took 
awhile because I started out with the notion that the install function 
would check and compare version numbers of already installed addons. 
This eventually lead me to the realization that having multiple addon 
install locations (which may not all be writable) complicates matters 
more than I had first thought.

For example, what should be done if a user wants to update a 
package/addon which is bundled with blender (and therefore likely in 
/usr/share or some such non-user-writable dir)?

Blender currently becomes grumpy when multiple addons with the same name 
are anywhere in the search paths, so I think a change in that behavior 
will be required to fully solve this. Some ideas:

* Allow multiple versions of an addon to be installed at the same time 
(but probably not allow them to be /enabled/ at the same time).
* Let user-config addons override system addons.

Anyway, that's all a problem for the (hopefully not far off) future. In 
the end I decided the install function should simply install what it's 
asked to install, and version handling would best occur a level or two 
above.

As a side note, I was surprised by the apparent lack of a standard 
library equivalent to something like rm. I suspect I may be missing 
something there, but for now I made my own by combining shutil.rmtree 
and Path.unlink.


I also spent time trying to get pytest working:

I created a "tests" directory in bpkg_manager, added a simple test, and 
created an empty __init__.py. Unfortunately, pytest wanted to run the 
__init__.py in the parent directory (bpkg_manager), which tries to 
import bpy. I tried to mock bpy in my test, but that didn't have any 
effect. It turns out the empty __init__.py I added to turn the tests 
into a module (useful when using unittest) was causing this to happen.

Ellwood

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/soc-2017-dev/attachments/20170713/6a8dcf8d/attachment.htm 


More information about the Soc-2017-dev mailing list