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:
- Install dependencies into mypython as eggs
- Install trytond and all tryton-modules needed
- Create Database/Install Modules: (my custom recipe) import trytond create_database if not exist install_modules into database
- 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