<div class="gmail_quote">On Sat, Jun 5, 2010 at 12:05 AM, Borys Jurgiel <span dir="ltr">&lt;<a href="mailto:borysiasty@aster.pl">borysiasty@aster.pl</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Dnia piątek, 4 czerwca 2010 o 23:32:15 Giuseppe Sucameli napisał(a):<br>
<div class="im">&gt; Solved... The issue is the one I described in the previous mail.<br>
&gt;<br>
&gt; However, if I install the experimental GdalTools (v.1.2.3) and<br>
&gt; I restart QGis as required, the plugin doesn&#39;t replace the one in trunk.<br>
&gt;<br>
&gt; Is it the correct behaviour?<br>
&gt; If it is, maintaining the experimental one make no sense!<br>
<br>
</div>It should replace it. Otherwise there were no possibility to upgrade plugins.<br>
<br>
As you probably know, plugins bundled with qgis are installed in the<br>
/usr/share/qgis/python/plugins (or similar), while plugins installed by the<br>
installer go to ~/.qgis/python/plugins.<br>
<br>
Now, plugins in the home directory *always* cover the ones in /usr (even<br>
regardless of the version - if the instance in the home directory is older,<br>
qgis only displays a warning message and suggest to uninstall it).<br>
</blockquote></div>I tried and re-tried but the GdalTools experimental (local) doesn&#39;t replace the <br>GdalTools in trunk (system). <br><br>I guess that the plugin_installer works well. The  issue may be in <br>python/utils.py in updateAvailablePlugins function: <br>

there are no tests to check if the local plugin is newer then the system one.<br><br>I make some changes to the file above, lines 89:98<br><br><b>from:</b><br><br><span style="font-family: courier new,monospace;">  for pluginpath in plugindirs:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      newplugins = findPlugins(pluginpath)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      if len(newplugins) &gt; 0:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">          if pluginpath not in sys.path:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">              sys.path.append(pluginpath)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">          for p in newplugins:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">              if p not in plugins: </span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">                  plugins.append(p)</span><br><br><b>to:</b><br><i><br><span style="font-family: arial narrow,sans-serif;">  <b><span style="font-family: courier new,monospace;">plugin2path = {}</span></b></span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  </span></i><span style="font-family: courier new,monospace;">for pluginpath in plugindirs:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      newplugins = findPlugins(pluginpath)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      if len(newplugins) &gt; 0:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">          if pluginpath not in sys.path:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">              sys.path.append(pluginpath)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">          for p in newplugins:</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">              if p not in plugins: </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                  plugins.append(p)</span><i style="font-family: courier new,monospace;"><br>

<b>                  plugin2path[p] = pluginpath<br>              else:<br>                  exec( &quot;from %s.__init__ import version &quot; % p )<br>                  newvers = version()[8:]<br>                  newvers = map(int, newvers.split(&quot;.&quot;))<br>

<br>                  oldpath = sys.path<br>                  sys.path.append( plugin2path[p] )<br>                  exec( &quot;from %s.__init__ import version &quot; % p )<br>                  oldvers = version()[8:]<br>

                  oldvers = map(int, oldvers.split(&quot;.&quot;))<br>                  sys.path = oldpath<br><br>                  if newvers &gt; oldvers:<br>                      plugins.append(p)<br>                      plugin2path[p] = pluginpath<br>

<br>  del plugin2path</b></i><br style="font-family: arial narrow,sans-serif;" clear="all"><br>I wrote this code on the fly, so I&#39;m not sure it&#39;s very good, but it seems to <br>resolve this problem. <br><br>The installation works as expected: therefore I can replace the GdalTools <br>

in trunk with the experimental one.<br><br>Uninstalling the plugin the Raster menu is removed (because QGis unload it)<br>but restarting QGis I can see again the Raster menu with GdalTools in trunk.<br><br>What do you think about?<br>

<br>-- <br>Giuseppe Sucameli<br>