Skip to content

Commit

Permalink
Merge pull request #41826 from jakimowb/master
Browse files Browse the repository at this point in the history
fixed QgsPluginInstaller.installFromZipFile
  • Loading branch information
m-kuhn committed Feb 26, 2021
2 parents e89d715 + 048af49 commit 67c27c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/pyplugin_installer/installer.py
Expand Up @@ -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]

Expand Down

0 comments on commit 67c27c2

Please sign in to comment.