如何告诉buildout忽略二进制分发并从源代码构建?

时间:2012-01-13 15:23:12

标签: buildout

我在buildout中包含一个使用C扩展的egg(jsonlib)。 在pypi上,存在预编译的blob。但它与我的环境不兼容:我收到undefined symbol: PyUnicodeUCS4_FromEncodedObject错误。 我知道这与编译时和运行时的不同环境有关。 要解决它,buildout应该编译包而不是使用预构建的包。

无论在pypi上找到哪些预编译的egg文件,我如何告诉buildout编译一个包(所有包也没关系)?

1 个答案:

答案 0 :(得分:1)

你去了:

[buildout]
parts = getit

# used to show which download was fetched
download-cache = .

[getit]
recipe = zc.recipe.egg
# this is the first key: ignore using the pypi index
index = .
# this is the second key: provide a direct link to the sdist
find-links = https://pypi.python.org/packages/source/h/hachoir-core/hachoir-core-1.3.3.tar.gz
eggs = hachoir-core==1.3.3

并且仅针对某些使用条件部分的操作系统(免责声明,我写了这篇文章)和最新版本的buildout:

[buildout]
parts = getit
download-cache = .

[getit: macosx]
recipe = zc.recipe.egg
index = .
find-links = https://pypi.python.org/packages/source/h/hachoir-core/hachoir-core-1.3.3.tar.gz
eggs = hachoir-core==1.3.3

[getit: not macosx]
recipe = zc.recipe.egg
# use pypi alright
eggs = hachoir-core==1.3.3

运行之后,检查目录,它将有一份获取的存档副本进行验证:那里没有预制的鸡蛋;)