[Qgis-developer] Re: GdalTools versions

Giuseppe Sucameli brush.tyler at gmail.com
Fri Jun 4 22:23:21 EDT 2010


Did I say I wrote it on the fly? :)
We can store into the temporary dict for each plugin the higher
version number instead of the path, it's surely better.

Cheers

2010/6/5 Giuseppe Sucameli <brush.tyler at gmail.com>

> On Sat, Jun 5, 2010 at 12:05 AM, Borys Jurgiel <borysiasty at aster.pl>wrote:
>
>> Dnia piątek, 4 czerwca 2010 o 23:32:15 Giuseppe Sucameli napisał(a):
>> > Solved... The issue is the one I described in the previous mail.
>> >
>> > However, if I install the experimental GdalTools (v.1.2.3) and
>> > I restart QGis as required, the plugin doesn't replace the one in trunk.
>> >
>> > Is it the correct behaviour?
>> > If it is, maintaining the experimental one make no sense!
>>
>> It should replace it. Otherwise there were no possibility to upgrade
>> plugins.
>>
>> As you probably know, plugins bundled with qgis are installed in the
>> /usr/share/qgis/python/plugins (or similar), while plugins installed by
>> the
>> installer go to ~/.qgis/python/plugins.
>>
>> Now, plugins in the home directory *always* cover the ones in /usr (even
>> regardless of the version - if the instance in the home directory is
>> older,
>> qgis only displays a warning message and suggest to uninstall it).
>>
> I tried and re-tried but the GdalTools experimental (local) doesn't replace
> the
> GdalTools in trunk (system).
>
> I guess that the plugin_installer works well. The issue may be in
> python/utils.py in updateAvailablePlugins function:
> there are no tests to check if the local plugin is newer then the system
> one.
>
> I make some changes to the file above, lines 89:98
>
> *from:*
>
>   for pluginpath in plugindirs:
>       newplugins = findPlugins(pluginpath)
>       if len(newplugins) > 0:
>           if pluginpath not in sys.path:
>               sys.path.append(pluginpath)
>           for p in newplugins:
>               if p not in plugins:
>                   plugins.append(p)
>
> *to:*
> *
>   plugin2path = {}
>   *for pluginpath in plugindirs:
>       newplugins = findPlugins(pluginpath)
>       if len(newplugins) > 0:
>           if pluginpath not in sys.path:
>               sys.path.append(pluginpath)
>           for p in newplugins:
>               if p not in plugins:
>                   plugins.append(p)*
>                   plugin2path[p] = pluginpath
>               else:
>                   exec( "from %s.__init__ import version " % p )
>                   newvers = version()[8:]
>                   newvers = map(int, newvers.split("."))
>
>                   oldpath = sys.path
>                   sys.path.append( plugin2path[p] )
>                   exec( "from %s.__init__ import version " % p )
>                   oldvers = version()[8:]
>                   oldvers = map(int, oldvers.split("."))
>                   sys.path = oldpath
>
>                   if newvers > oldvers:
>                       plugins.append(p)
>                       plugin2path[p] = pluginpath
>
>   del plugin2path*
>
> I wrote this code on the fly, so I'm not sure it's very good, but it seems
> to
> resolve this problem.
>
> The installation works as expected: therefore I can replace the GdalTools
> in trunk with the experimental one.
>
> Uninstalling the plugin the Raster menu is removed (because QGis unload it)
> but restarting QGis I can see again the Raster menu with GdalTools in
> trunk.
>
> What do you think about?
>
> --
> Giuseppe Sucameli
>



-- 
Giuseppe Sucameli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20100605/e060ffeb/attachment.html


More information about the Qgis-developer mailing list