[Distutils] Change the python interpreter for a recipe (solved)

Reinout van Rees reinout at vanrees.org
Fri Aug 20 10:03:15 CEST 2010


On 08/19/2010 03:53 PM, udono wrote:
> Problem is to buildout a complete deployment of trytond including a
> database and installation of all needed modules. The buildout has these
> coarse-grained stages/parts:
>
> 1. Install dependencies into mypython as eggs
> 2. Install trytond and all tryton-modules needed
> 3. Create Database/Install Modules: (my custom recipe)
>     import trytond
>     create_database if not exist
>     install_modules into database
> 4. Debian system works (init.d-script, links to /var/log, /var/run,...)
>
> Part 3 is the problem, because for now, import trytond needs to be
> started in the mypython environment, because of the dependencies.

You could make a recipe that just calls bin/mypython with the options 
you need.  os.system() (or rather the subprocess.Popen() call, look at 
zc.buildout's easyinstall.py around line 147 for an example).

Perhaps make the assumption that you've got a [trytond] part.  You can 
then grab the ${trytond:interpreter} option from within your recipe and 
grab the bin directory from the buildout options.

Assuming the [trytond] part runs before your recipe you're pretty much 
set, I'd guess.  Bonus points if your recipe can detect whether it 
actually needs to run by checking whether a database file exists or 
something like that.



Reinout


-- 
Reinout van Rees - reinout at vanrees.org - http://reinout.vanrees.org
Programmer at http://www.nelen-schuurmans.nl
"Military engineers build missiles. Civil engineers build targets"



More information about the Distutils-SIG mailing list