mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
support conflicts when downloading from AnkiWeb
users can now upload .ankiaddon files as well - package/name remains defined by the add-on listing as before
This commit is contained in:
parent
112fc8e7c1
commit
8c58e7a76a
1 changed files with 6 additions and 3 deletions
|
@ -179,15 +179,18 @@ and have been disabled: %(found)s") % dict(name=self.addonName(dir), found=addon
|
||||||
|
|
||||||
def install(self, file, manifest=None):
|
def install(self, file, manifest=None):
|
||||||
"""Install add-on from path or file-like object. Metadata is read
|
"""Install add-on from path or file-like object. Metadata is read
|
||||||
from the manifest file by default, but this may me bypassed
|
from the manifest file, with keys overriden by supplying a 'manifest'
|
||||||
by supplying a 'manifest' dictionary"""
|
dictionary"""
|
||||||
try:
|
try:
|
||||||
zfile = ZipFile(file)
|
zfile = ZipFile(file)
|
||||||
except zipfile.BadZipfile:
|
except zipfile.BadZipfile:
|
||||||
return False, "zip"
|
return False, "zip"
|
||||||
|
|
||||||
with zfile:
|
with zfile:
|
||||||
manifest = manifest or self._readManifestFile(zfile)
|
file_manifest = self._readManifestFile(zfile)
|
||||||
|
if manifest:
|
||||||
|
file_manifest.update(manifest)
|
||||||
|
manifest = file_manifest
|
||||||
if not manifest:
|
if not manifest:
|
||||||
return False, "manifest"
|
return False, "manifest"
|
||||||
package = manifest["package"]
|
package = manifest["package"]
|
||||||
|
|
Loading…
Reference in a new issue