Updater question
Hello,
So I work on my personal update script with will:
- download addon
- update Blender (multiple version)
- extract latest zip and update Daz script
I have done this with bat + blender python script but I hit wall with:
a) I’m unable to disable script, using:
bpy.ops.preferences.addon_disable(module="Diffeomorphic-import_daz-e386caf85dfd")
nothing happens, I did used exception no error, I think the issue with this one is that this is not module name.
Using:
bpy.ops.preferences.addon_disable(module="DAZ (.duf, .dsf) format")
got me:
addon_utils.disable: DAZ (.duf, .dsf) format not disabled
b) unable to uninstall script
Surprisingly I can install it @@'''.
The question is:
- why this happens ? what I do incorrectly
- is auto update planed to be added in the feature ? Well kinda pointless as this would also require update to Daz scripts but maybe ?
Thanks in advance for reply.
I work with blender 2.91 and 2.92 (but above script should work there, at least those APIs are there)
Comments (15)
-
-
reporter @engetudouiti Thanks for the info.
Indeed, my script doesn’t work for other addons also.
I will read more about this than
-
reporter - attached update.7z
-
reporter Attached scripts that will auto update.
NOTE: NO WARRANTY whatsoever, check the scripts before using !!! Use at your own risk !!! I didn’t tested it properly, tested only on one machine with EN localization so this may not work everywhere. Fell free to improve it.
Module name is name of directory, issue with disable and remove is still present but resolved it by install with override.
Had to repackage zip to remove SHA from downloaded versions and append
-dev
so it’s different then release version and same for every other development version as I would need to keep a track of all previous versions installed.Basically there are few problems with:
- blender list only enabled addons module name
- blender list addon name (one in bl_info) for disabled but I was unable to use that to remove or disable addon)
- dev releases appends SHA so it’s hard to get list of older dev versions installed so I had to rename directory to something constant
Scripts require 7zip & curl with needs to be downloaded separately.
-
Just my 2 Cents on this Issue:
I made an Issue about that myself long time ago, but you could use
https://github.com/CGCookie/blender-addon-updater
It looks really easy to implement…
-
repo owner So I had a look at the cgcookie addon updater and copied it to my plugin. It seems to work, or at least it does not crash. If I understand corretly it is set to update to the current master branch. When I tested nothing is updated, but that may be because I am already up-to-date at the master branch.
-
reporter @Thomas Is it me or it adds additional tab on right side called “Tools” with the name “Updated Demo Panel” - can this be disabled ?
-
repo owner I just copied the code from the demo without taking too much notice to what it did. The extra tab is gone now, and the interesting content should appear in the main panel when an update is available. This was the first time that I actually tested updating, since there wasn’t any commits to update to when the code was originally added. It seems to work, or at least something happens: a zipped version of the master branch was downloaded. This is not very useful since it changes so often, but it is probably possible to create branches for stable releases that can be auto-downloaded.
-
I could confrim basically it seem work, but about files in “to_daz_studio/Scripts” (which we need manuall copy)
seems not up-date when compare your commits file version.
eg, I use up-date button in preference tab, then install master (recent). then I confirmed some py files have been changed, with your commits source.
But those daz script files (in blender add on directory) seems not up-date.
I check time stamp too. eg
my current export_highdef_to_blender.dsa time stamp = 2020/11/20 then version = 0 .7
after up-date and re-launch blender.. but from your commits, version should be 0.8
(of course I means, downloaded scirpt files in blender add on. not file in daz library which I copy and paste before)
-
Then interesting thing for me is,, when I up-date Daz importer via blender prference,
it seems actually download new version daz scripts in
C:\…..\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\import_daz_updater\source\to_daz_studio\Scripts\Diffeomorphic
But not overwrite dsa dsb dse, where we will copy and paste in daz library.
C:\…..\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\to_daz_studio\Scripts\Diffeomorphic
only png seems change time stamp.
So I suppose if there is some setting to set file type, which will be over-written. (py, txt, img etc)
but not touch about other file type, when up-date( overwrite( from dowonloaded sources. And maybe same thing seems happen about DATA directory files.
Actuall files in Foundation\Blender\2.92\scripts\addons\import_daz\to_daz_studio\DATA
seems not up-date. I suspect those files are json , so maybe these files are ignored when up-date and overwrite.
Though I believe there should be place which discribe, file type.
-
At least, I suppose in addon_update.py line 89 to 92 (in def init)
# set patterns for what files to overwrite on update self._overwrite_patterns = ["*.py","*.pyc"] self._remove_pre_update_patterns = []
may need to change?
(I do not know if there is other variable which may decide sub directory stage counts which check and up-date)
-
repo owner Added *.dsa and *.json to the overwrite patterns. I am a bit worried that the updater code uses a json file itself, but since it is not committed a conflict may be avoided. Then I noticed that there a lot of lines of code changed with the last commit, but apparently it is just my text editor that replaced tabs with four spaces. What is more worrisome is that the update failed because some temporary files existed, and I had to remove them by hand before I could auto-update.
-
So I read git hub documents of up-dater, then maybe (can not confirm)
you can use [““] to force up-dater up-date all. (it seems old default behavor of this add on)
And yes I understand what you worried,, then I think it may not happen (maybe ^^;)
-
I see at current I may not fully rely auto-update, untill you will find best setting for all ^^
(I may sometimes report, when I use it, but to test other issue update I may need to be avoided)
-
repo owner - changed status to closed
- Log in to comment
Though I mainly only downlaod these beta versions about import_daz (with use Git) and manually locate them for my add-on directory, but at least for most of recent versions module name should be “improt_daz” ,
though I do not know if stable versions use those long name as module.
bpy.ops.preferences.addon_disable(module="import_daz")
Though I think bpy.ops is strict with context, then I do not know if you can do it without open preference
but if your bat + sicript work for other add ons, you may only need to change the module name I suppose.