dayjaby / AnkiHub

Automatic update system for Anki plugins
23 stars 2 forks source link

Installation problems #2

Open Stvad opened 8 years ago

Stvad commented 8 years ago

Updating my plugin seems to have worked well. But I have a problem with installing it from scratch. As I've mentioned in #1 - I have 2 buttons "from Github". So I tried both of them :smile:.

With the first one - I'm getting the following error:

An error occurred in an add-on. Please post on the add-on forum: https://anki.tenderapp.com/discussions/add-ons

Traceback (most recent call last): File "C:\Users\root_000\Documents\Anki\addons_ankihub.py", line 271, in addRepository update([repo],install=True) File "C:\Users\root000\Documents\Anki\addonsankihub.py", line 225, in update newVersion = map(int,data['tag_name'][1:].split('.')) ValueError: invalid literal for int() with base 10: ''

With the second one - nothing happens after I press ok on the dialog window.

Windows, Anki 2.0.36. Maybe important - the extension was installed before, then I've deleted it and trying to install it via AnkiHub.

dayjaby commented 8 years ago

Atm I expect the release 'tag names' to be of the form v0.0 for major releases and v0.0.0 for minor releases. The difference between those kind of releases in AnkiHub: Major releases shall always contain the entire plugin and minor releases can be partial updates (e.g. if you change only one .py file).

So e.g. when the user has v1.0 installed and the newest release is v1.0.6, then the system will download all files for the releases from v1.0.1 to v1.0.6. But if the newest release is v1.1 it will only update this full release. So when you decide to always upload the entire plugin, please use only tag names of the form v0.0

According to that error message, if this is for Stvad/CrowdAnki then your tag names are ill formed: So just rename 0.3.1 to v0.3.1. This format is even suggested by github how to name the tags, but I admit that I should mention it in the usage instructions :P

Stvad commented 8 years ago

Yeah, this should be definitely mentioned in user manual :). Also, as I mentioned update seem to have worked, but not installation.

I still have some questions: Can I update file in some subdirectory in a partial update (and if yes - how)? If I fully update the plugin in a "minor" version will that still work fine?

Stvad commented 8 years ago

Also error messages on this kind of problems would be nice :)

dayjaby commented 8 years ago

If I fully update the plugin in a "minor" version will that still work fine?

Yes, it will! Though you should rather make a major release out of that, so the user doesn't have to download 10 "full" minor versions if he didn't update for a while. For most plugins this different treatment of major and minor releases might not be necessary, but at least my very specific usecase dayjaby/yomisama is about 50MB big and it's extremely annoying to upload this completely every time.

Can I update file in some subdirectory in a partial update

Yes, you can. Just have a zip file with the proper directory hierarchy. E.g. if you want to update addons/MyPlugin/MySubDir/myScript.py, then you can create the correct zip file by being in addons/ and running

7z a update.zip MyPlugin/MySubDir/myScript.py

Be aware, that this 7z a appends to a zip file. Make sure you delete the zip file before or you'll end up with ankihub.py and ___ankihub.py as well ^^

Stvad commented 8 years ago

I've renamed the tag, but it still not working for me :(. Now I'm getting:

An error occurred in an add-on. Please post on the add-on forum: https://anki.tenderapp.com/discussions/add-ons

Traceback (most recent call last): File "C:\Users\root_000\Documents\Anki\addons_ankihub.py", line 271, in addRepository update([repo],install=True) File "C:\Users\root000\Documents\Anki\addonsankihub.py", line 249, in update response = urllib2.urlopen("https://api.github.com/repos/{0}/releases/tags/{1}.0".format(path,majorTagName)) File "urllib2.py", line 126, in urlopen File "urllib2.py", line 406, in open File "urllib2.py", line 519, in http_response File "urllib2.py", line 444, in error File "urllib2.py", line 378, in _call_chain File "urllib2.py", line 527, in http_error_default urllib2.HTTPError: HTTP Error 404: Not Found

Stvad commented 8 years ago

I see. I understand the use case for minor versions :) Is there a way to quickly and conveniently do a "minor" release (i.e create an archive with a list of files that have changed)? I can imagine doing it via git, 7z and python/bash to tie them together, but maybe there is a better way?

dayjaby commented 8 years ago

I can imagine doing it via git, 7z and python/bash to tie them together, but maybe there is a better way?

I thought about the very same ^^ Maybe some kind of script that runs together with each git commit? Should be rather easy to solve.

I've renamed the tag, but it still not working for me :(

I had a similar issue today where https://api.github.com/repos/dayjaby/AnkiHub/releases/latest didn't give me the "latest" release. Similarily https://github.com/Stvad/CrowdAnki/releases/tag/v0.3 shows the proper major release, but https://api.github.com/repos/Stvad/CrowdAnki/releases/tags/v0.3 shows an error...should report those bugs to github I think.

Stvad commented 8 years ago

It need not be each commit, as you can get "files changed since tag x" via git. Would be really useful.

I'm not sure it's an error, I think link like https://api.github.com/repos/Stvad/CrowdAnki/releases/tags/vxxx will show you something, only if there is an actual "Github release" associated with that tag. If it's just tag it will return an error.

dayjaby commented 8 years ago

Yes, you are right. On https://github.com/Stvad/CrowdAnki/tags you should see a button "Add release notes" next to the tag v0.3. After adding those relesease notes, it should work!

So as a guideline: If you have a version v0.3.2 then v0.3, v0.3.1 and v0.3.2 must be proper "releases" in github.

Stvad commented 8 years ago

Ah, so it finally worked :). It would be nice to have a progress bar, while plugin is doing it's stuff on install. Also using same window as for update with all buttons/labels same and focused on update is not so great from UX perspective ;).

Stvad commented 8 years ago

Btw, You should add readme to the repo with the manual ;)