How do I tell buildout to ignore a binary distribution and build from source instead?

爷,独闯天下 提交于 2020-01-11 07:22:27

问题


I am including in a buildout an egg (jsonlib) that uses C extensions. On pypi a precompiled blob is present. But it's not compatible with my environment: I get a undefined symbol: PyUnicodeUCS4_FromEncodedObject error. I know this has to do with different environments at compile time and runtime. To solve it buildout should compile the package instead of using the prebuilt one.

How do I tell buildout to compile a package (all packages would be fine too) no matter what precompiled egg files it finds on pypi?


回答1:


There you go:

[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

And to do this only for some OS using conditional sections (disclaimer, I wrote this) with the latest version of 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

after running this, check the dist dir, it will have a copy of the fetched archive for verification: no prebuilt eggs in there ;)



来源:https://stackoverflow.com/questions/8852842/how-do-i-tell-buildout-to-ignore-a-binary-distribution-and-build-from-source-ins

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