[Qgis-developer] Version number in plugin path?

Borys Jurgiel borys at wolf.most.org.pl
Tue Nov 4 09:24:38 EST 2008


> So probably a better way would be add a function to plugin's
> __init__.py called e.g. apiVersion() that would state what (minimal)
> version of QGIS the plugin needs. Plugins with apiVersion 1.1 won't be
> loaded in 1.0 but will load in 1.3. And if we break API in QGIS 2.0
> plugin manager will know that any plugins with apiVersion 1.x are
> unsupported.

Yes, we definitely need this feature anyway. I thought about it for 
distinguishing 0.x and 1.x plugins in Installer and I've decided to use the 
separate repos, but within 1.x series this is really important feature. As 
well for Installer to avoid installing uncompatible plugins as for plugin 
loading subsystem, to avoid... you know, loading them ;))

So +1 for introducing such filter to QGIS right now. Of course only plugins 
not supporting this feature will be always loaded. One small suggestion: 
maybe not 'apiVersion()' but rather 'minVersion()'. We can also 
implement 'maxVersion()' for possible future necessity.

> >  How do I keep both a 0.11-compatible version and a 1.0-compatible
> > version of my fnord plugin in the same directory? The folder name has
> > to be 'fnord' (doesn't it?).
>
> Well, I've forgotten to write that it won't be straightforward to use
> plugin in different versions of QGIS. The question is - do we really
> need/want it? If we really need that, there's a possibility to add
> some logic to its __init__.py that would detect QGIS version and
> configure itself appropriately. Or you can have the plugin in two
> different directories, e.g. fnord and fnord_legacy (or fnord_0-11).

Only one problem is that Installer uses the module name to associate installed 
and available instances of each plugin. We can introduce fnord_0-11, 
fnord_1-0 and fnord_1-1, but Installer won't associate them, so won't update 
them after QGIS upgrade. It could mask uncompatible plugins, but after 
upgrade from QGIS 1.0 to 1.1 your old installed plugin would disappear from 
Installer's list and the new uninstalled one would appear. I don't like this 
behaviour, because I believe Installer should show all installed plugins to 
allow uninstallation.

We can use something another as the plugin id, for example a method in the 
__init__.py. So every of fnord* plugins returns its id 'fnord'. But it would 
be a pretty favourable to make mistakes.

Finally, I have an idea. We can arrange that the first dot (or dash) in 
directory name delimits the plugin id and a suffix. So we can install 
fnord.1-2, fnord.0.x, fnord.anything_you-want and all of them will be 
recognizes just as 'fnord'. At least by Installer. What do you think?

B.


More information about the Qgis-developer mailing list