Yes, I know, it's sort of passe to post your addon updating script. But this is what I've been using to keep my addons up to date for the last few months.
It does things how I like 'em. No-exts version of addons; delete the folders before unzipping new ones. It's efficient, from a server-resources perspective -- it grabs the list of addons / versions from the index page, then works out your current version from the changelog files in the directories. If there's a .ignore file in a directory or a .svn directory it'll skip that addon.
(If your WoW directory is somewhere other than the default, you'd have to change default_wowdir on line 6 to point to the correct location.)
Really love the script, simple, easy, quick... everything I wanted!
Recently, though, it seems to be behaving strangely.
The log will indicate errors in updating addons that I don't have installed, and it will also download an XML file that seems to be the file listing and will save it in the addon folders as the changelog. This behavior only started recently so I suspect some change might have been made with the wowace listing.
Just wondering if you know this, or have an updated version of the script I don't know about!
break19: Python 2.4 changed how the logging package works -- in 2.3 it didn't take arguments, in 2.4+ it does. I'm writing for 2.4+, since that's what I have installed everywhere.
Take this attached zip of an updated version of WAup.py. Comment out line 59 (starts with "logging.basicConfig") and you should be okay. There's a chance that you'll have to comment out every line starting with "logging" or "console" to make it work, though.
Attempts to guess an appropriate wow directory on Windows and Mac.
When run without any arguments, wowace.py updates all your addons automatically. You can call it with specific addon names to update (or install) just those addons.
e.g. "wowace.py FuBar_QuestsFu" -- note that since the default is to fulfill dependencies, this would also install FuBar if you didn't have it, and any libraries that are required if you're not using externals.
Usage: wowace.py [options] [addon1] ... [addon99]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-e, --externals Download addons with externals
-n, --nodeps Don't fetch dependencies
-u, --unpackage Unpackage downloaded addons
-k, --keepold Don't delete directories before replacing them
-f, --force Redownload all addons, even if current
-r, --remove Remove addons passed as arguments instead of updating them
--wowdir=DIR Set the WoW addon directory [default: <platform-dependent> ]
--wowace=URL Set the wowace file repository location [default: [url]http://files.wowace.com/][/url]
I am currently running your python code under 10.4.9 with Python 2.5.1:
PowerMacG5:~/Desktop/wowacepy-2 nakago$ ./wowace.py
INFO Checking http://files.wowace.com/latest-noext.xml for updated addons
INFO Upgrading FuBar_ItemListFu from 20243 to 26541
INFO Upgrading Ace2 from 27198 to 35202
INFO Upgrading FuBarPlugin-2.0 from 26156 to 34599
INFO Installing new addon: DewdropLib
INFO Installing new addon: TabletLib
Traceback (most recent call last):
File "./wowace.py", line 319, in <module>
dispatch()
File "./wowace.py", line 316, in dispatch
updater.update_all(get_deps=options.get_deps, unpackage=options.unpackage, delete_old=options.delete_old, force=options.force)
File "./wowace.py", line 102, in update_all
for addon in self.localaddons:
RuntimeError: dictionary changed size during iteration
Are you by chance removing/chaning your dict during your iteration of it? Unsure if this is a 2.5.1 issue, I need to run 2.5.1 for my own reasons, so would be awesome if it wasn't the case. I am looking through your code as we speak and will see if I can come up with a work around ;)
Now checks to make sure an addon is still installed before downloading updates to it.
Warns when installing an addon with a required dependency that cannot be filled from the server. (This gets false positives sometimes if you're using unembedded libs -- it's very dependent on people putting the right folder names in the TOC.)
Warns if you'll need to restart WoW after updating an addon. (Checking to see if any file paths have changed.)
Unpackaging is really hooked up from the command line now, honest.
This release contains a gui. You don't have to use it. If you want to use it you'll need to have wxPython installed, then just run gui.py instead of wowace.py.
(The GUI has not been extensively tested, and is currently not as configurable as the command-line client. You have been warned.)
macosx$ ./wowace.py -f PitBullINFO Loading local addons
INFO Checking http://files.wowace.com/latest-noext.xml for updated addons
INFO Upgrading PitBull from 40025 to 40025
INFO Upgrading Ace2 from 39907 to 39907
INFO Upgrading SharedMediaLib from 36994 to 36994
INFO Upgrading Ace2 from 39907 to 39907
Traceback (most recent call last):
File "./wowace.py", line 363, in <module>
dispatch()
File "./wowace.py", line 356, in dispatch
updater.update_addon(arg, get_deps=options.get_deps, unpackage=options.unpackage, delete_old=options.delete_old, force=options.force)
File "./wowace.py", line 94, in update_addon
self.update_addon(dep, get_deps, unpackage, delete_old, force)
File "./wowace.py", line 94, in update_addon
self.update_addon(dep, get_deps, unpackage, delete_old, force)
File "./wowace.py", line 86, in update_addon
unzip(zipdata, self.wowdir)
File "./wowace.py", line 279, in unzip
os.makedirs(directory)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.py", line 166, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/Applications/World of Warcraft/Interface/Addons/Ace2/AceLibrary'
I get this error a lot, and have to manually remove the offending directory before it'll install without crashing. Also if I install multiple addons, it attempts to install the dependencys for each, every time, no matter if they are already installed or not.
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.py", line 166, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/Applications/World of Warcraft/Interface/Addons/Ace2/AceLibrary'
I get this error a lot, and have to manually remove the offending directory before it'll install without crashing.
Interesting. I'm not sure why it's doing that -- it should be (a) deleting the entire directory first, and (b) checking to make sure the sub-directories don't already exist before extracting.
I'll have to investigate -- I haven't tried running this on a Mac yet.
Also if I install multiple addons, it attempts to install the dependencys for each, every time, no matter if they are already installed or not.
Looking at the snippet you provided, it's doing that because you're using -f. If you're forcing the update regardless of your installed version, that setting will flow-down to the dependencies, which will all get reinstalled anyway.
I've added a check to the SVN version to make sure it won't download a given addon more than once per update, though. I don't update with -f myself, so it hadn't occurred to me that it would behave like that.
Currently in trunk is an option to run the various LOD scripts in addons. (Making this work on *nix involved having to make Python's zipfile module extract files with permissions intact, which is harder than you might think.)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
---
Yes, I know, it's sort of passe to post your addon updating script. But this is what I've been using to keep my addons up to date for the last few months.
It does things how I like 'em. No-exts version of addons; delete the folders before unzipping new ones. It's efficient, from a server-resources perspective -- it grabs the list of addons / versions from the index page, then works out your current version from the changelog files in the directories. If there's a .ignore file in a directory or a .svn directory it'll skip that addon.
(If your WoW directory is somewhere other than the default, you'd have to change default_wowdir on line 6 to point to the correct location.)
Recently, though, it seems to be behaving strangely.
The log will indicate errors in updating addons that I don't have installed, and it will also download an XML file that seems to be the file listing and will save it in the addon folders as the changelog. This behavior only started recently so I suspect some change might have been made with the wowace listing.
Just wondering if you know this, or have an updated version of the script I don't know about!
Thanks,
Glash
As Rabbit said, the files page (and the contents and naming scheme of various useful files) suddenly changed.
Here's a fixed version. (Which actually adds the completely untested option of downloading files with externals if you so prefer.)
Thanks for the updated version, it is greatly appreciated :)
Glash
currently using Python 2.3.5 on Mac OS X 10.4.8
Traceback (most recent call last):
File "WAup.py", line 95, in ?
logging.basicConfig(filename = os.path.join(default_wowdir,'WAup.log'), filemode = 'a', level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s',)
TypeError: basicConfig() takes no arguments (4 given)
Take this attached zip of an updated version of WAup.py. Comment out line 59 (starts with "logging.basicConfig") and you should be okay. There's a chance that you'll have to comment out every line starting with "logging" or "console" to make it work, though.
Good work.
It works for me -- haven't tested on anything other than WinXP, though.
(There's a Google Code project now. It's shiny.)
New features:
When run without any arguments, wowace.py updates all your addons automatically. You can call it with specific addon names to update (or install) just those addons.
e.g. "wowace.py FuBar_QuestsFu" -- note that since the default is to fulfill dependencies, this would also install FuBar if you didn't have it, and any libraries that are required if you're not using externals.
This is just one bugfix: there was a typo in the previous version which caused an error when specifying addons to install on the command line.
PowerMacG5:~/Desktop/wowacepy-2 nakago$ ./wowace.py
INFO Checking http://files.wowace.com/latest-noext.xml for updated addons
INFO Upgrading FuBar_ItemListFu from 20243 to 26541
INFO Upgrading Ace2 from 27198 to 35202
INFO Upgrading FuBarPlugin-2.0 from 26156 to 34599
INFO Installing new addon: DewdropLib
INFO Installing new addon: TabletLib
Traceback (most recent call last):
File "./wowace.py", line 319, in <module>
dispatch()
File "./wowace.py", line 316, in dispatch
updater.update_all(get_deps=options.get_deps, unpackage=options.unpackage, delete_old=options.delete_old, force=options.force)
File "./wowace.py", line 102, in update_all
for addon in self.localaddons:
RuntimeError: dictionary changed size during iteration
Are you by chance removing/chaning your dict during your iteration of it? Unsure if this is a 2.5.1 issue, I need to run 2.5.1 for my own reasons, so would be awesome if it wasn't the case. I am looking through your code as we speak and will see if I can come up with a work around ;)
Here's a new version, fixing that: http://wowacepy.googlecode.com/files/wowacepy-2.0.3.zip
This release contains a gui. You don't have to use it. If you want to use it you'll need to have wxPython installed, then just run gui.py instead of wowace.py.
(The GUI has not been extensively tested, and is currently not as configurable as the command-line client. You have been warned.)
INFO Checking http://files.wowace.com/latest-noext.xml for updated addons
INFO Upgrading PitBull from 40025 to 40025
INFO Upgrading Ace2 from 39907 to 39907
INFO Upgrading SharedMediaLib from 36994 to 36994
INFO Upgrading Ace2 from 39907 to 39907
Traceback (most recent call last):
File "./wowace.py", line 363, in <module>
dispatch()
File "./wowace.py", line 356, in dispatch
updater.update_addon(arg, get_deps=options.get_deps, unpackage=options.unpackage, delete_old=options.delete_old, force=options.force)
File "./wowace.py", line 94, in update_addon
self.update_addon(dep, get_deps, unpackage, delete_old, force)
File "./wowace.py", line 94, in update_addon
self.update_addon(dep, get_deps, unpackage, delete_old, force)
File "./wowace.py", line 86, in update_addon
unzip(zipdata, self.wowdir)
File "./wowace.py", line 279, in unzip
os.makedirs(directory)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.py", line 166, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/Applications/World of Warcraft/Interface/Addons/Ace2/AceLibrary'
I get this error a lot, and have to manually remove the offending directory before it'll install without crashing. Also if I install multiple addons, it attempts to install the dependencys for each, every time, no matter if they are already installed or not.
Interesting. I'm not sure why it's doing that -- it should be (a) deleting the entire directory first, and (b) checking to make sure the sub-directories don't already exist before extracting.
I'll have to investigate -- I haven't tried running this on a Mac yet.
Looking at the snippet you provided, it's doing that because you're using -f. If you're forcing the update regardless of your installed version, that setting will flow-down to the dependencies, which will all get reinstalled anyway.
I've added a check to the SVN version to make sure it won't download a given addon more than once per update, though. I don't update with -f myself, so it hadn't occurred to me that it would behave like that.
You can get it here: http://wowacepy.googlecode.com/svn/trunk/
(I'll make a new release once I've worked out what's causing the directory issue. And had a chance to test the aforementioned change.)