30 December 2011

How to make PyGimp Portable

There are become more and more plugins being implemented in python right?
This was explained two years ago in my older post here
Here is the small patch (applicable for gimp-2.7.4 too)

After build Gimp, we need to adjust the following files
lib\gimp\2.0\environ\default.env :
add the following line and remove any existing PATH declaration
#add binpath in non hardecoded way

lib\gimp\2.0\environ\pygimp.env (there should be a blank line in the end) :
; PYTHONPATH=${gimp_plug_in_dir}/python
Inside lib\gimp\2.0\interpreters add a text file with arbitrary filename (for.ex pygimp.interp) then add:
#add bundled python in non hardcoded way
#pythonw.exe choosen to omit console dialog freakshow

That's it! Enjoy
if you're confused try my old gimp build here to see how it actually works

If we have python plugins not installed in default location we could add it into pygimp.env (note: there should be a blank line in the end)
; PYTHONPATH=${gimp_plug_in_dir}/python:${gimp_plug_in_dir}/../../../[somewhere]

If somehow we have ghostscript to works with, we could make it portable too by adding this line to default.env:

if you moved gimp-x.x.x.exe out of bin folder then omit "/bin" from pathname, similarly if you place python folder somewhere else adjust it too
gimp_plug_in_dir=[gimp installation root]\lib\gimp\2.0
gimp_plug_in_dir always return correct path wherever you move around gimp's location (based on DllMain getmodulefilename function)

No comments:

Post a Comment