Skip to content
Permalink
Browse files

QgsPluginInstaller can now read zipfiles where 1st internal file is l…

…ocated in plugin subfolder

(cherry picked from commit 048af49)
  • Loading branch information
jakimowb authored and nyalldawson committed Mar 19, 2021
1 parent 15c6bec commit 67a9ff6bba71e2ac16c0ee7394daf1acdb82c49f
Showing with 6 additions and 1 deletion.
  1. +6 −1 python/pyplugin_installer/installer.py
@@ -570,8 +570,13 @@ def installFromZipFile(self, filePath):
settings.setValue(settingsGroup + '/lastZipDirectory',
QFileInfo(filePath).absoluteDir().absolutePath())

pluginName = None
with zipfile.ZipFile(filePath, 'r') as zf:
pluginName = os.path.split(zf.namelist()[0])[0]
# search for metadata.txt. In case of multiple files, we can assume that
# the shortest path relates <pluginname>/metadata.txt
metadatafiles = sorted(f for f in zf.namelist() if f.endswith('metadata.txt'))
if len(metadatafiles) > 0:
pluginName = os.path.split(metadatafiles[0])[0]

pluginFileName = os.path.splitext(os.path.basename(filePath))[0]

0 comments on commit 67a9ff6

Please sign in to comment.