python plugin installer unzip fails
|Reported by:||browlingson||Owned by:||nobody|
|Priority:||major: does not work as expected||Milestone:|
|Component:||Python plugins and bindings||Version:||Trunk|
|Must Fix for Release:||No||Platform:||All|
|Platform Version:||Awaiting user input:||no|
The plugin installer downloads python plugins as a zip file. The code in qgis_plugins.py fails to unzip correctly if the top-level folder entry is not included in the zip.
It is possible to make a zip file with no top-level folder entry by doing:
zip foo.zip ./foo/*
zip -r foo.zip ./foo
The code fails because it tries to create the directory hierarchy by looking for entries in the zip that end in '/'. If this isn't in the zip file then it then tries to extract a file to a non-existing directory, giving an error dialog that suggests (wrongly) it may be a permission problem.
Googling for python and unzip found the source of this code and some fixes in the comments.
There's a few 'try:except' clauses in the code that might be rewritten to return the exception so that a user gets more information when something fails.
Oh, and a line in installer_plugin.py that should maybe be: plugindir = os.path.join(os.path.normpath(str(QgsApplication.qgisSettingsDirPath())), "python","plugins")
instead of concatenating path components.