[Qgis-developer] repo builder tool

Martin Dobias wonder.sk at gmail.com
Fri Nov 21 15:37:03 EST 2008

Hi Barry,

On Fri, Nov 21, 2008 at 9:18 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
> Hi All,
>  had a good chat with Carson about building plugin repositories from
> code the other day. Seems a common pattern could be:
>  1. keep a tagged SVN copy of 'stable' plugins
>  2. check out all plugins from that tag
>  3. build zip files of plugins
>  4. construct the repository xml description
>  5. put the zips and xml in the right place.

sounds good.

>  I had a quick go at writing some python utils to help with this. Step
> 3 is a bit tricky, I've written something to ignore .svn and .pyc
> files and produce the .zip. It's done in python because I couldn't get
> the zip binary to exclude what I wanted - it's probably easy enough
> but I'm impatient and did it in python.

You could use 'svn export' instead of 'svn checkout' - it will leave
out all SVN specific files.

>  Step 4 is easy as long as the plugin module __init.py__ doesn't
> import anything it can't get in a standalone (non-qgis) environment.
> Putting any other imports into the classFactory function is a neat
> trick which fixes this. Then the script can get the info it needs out
> of the module for the xml file.

Importing the rest of plugin code in classFactory method should be a
general good practise for python plugins. Not only because of this but
also it shouldn't slow down QGIS with unneeded imports on startup if
the plugin isn't enabled.

Anyway, it would be a better idea to keep metadata out of python code
- it's not something that couldn't be stored in a plain text format
with well-defined syntax. There is a potentional security risk if you
allow untrusted people upload plugins to a server and then
automatically read metadata in python - an attacker could run
arbitrary code on the host. But I was young and naive back then when
creating support for python plugins :-)


More information about the Qgis-developer mailing list