Buildout, psycopg2, postgresql

独自空忆成欢 提交于 2019-12-06 13:09:33

问题


I'm trying to make buildout config that installs psycopg2 egg and postgres from source if needed:

parts =
    ...
    postgre
    psycopg2
    ...

[postgre]
recipe = hexagonit.recipe.cmmi
url = ftp://ftp3.ua.postgresql.org/pub/mirrors/postgresql/source/v9.0.0/postgresql-9.0.0.tar.gz
configure-options =
    --without-readline

[psycopg2]
recipe = zc.recipe.egg:custom
egg = psycopg2
include-dirs =
    ${postgre:location}/include
library-dirs =
    ${postgre:location}/lib
rpath =
    ${postgre:location}/lib

The problem is that it always builds postgresql from source, even if the user already has postgresql installed.

How can I tell buildout to check if user already have all necessary to build psycopg2?


回答1:


You can do it, but you'll have to make your own recipe to do that check. There's no existing recipe that does what you want.

An alternative is to have two buildout configs. The main buildout.cfg assumes postgresql is available and doesn't attempt to build it.

A second withpostgres.cfg could look like this:

[buildout]
parts +=
    postgre
    psycopg2

[postgres]
... your existing one ...

[psycopg2]
... your existing one ...

Users that need to build it from source can use the second configuration by calling bin/buildout -c withpostres.cfg.

Would that solve your issue?



来源:https://stackoverflow.com/questions/3999081/buildout-psycopg2-postgresql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!