简体   繁体   中英

Installing Python c-extensions with buildout

A project I'm working on needs avro, which requires python-snappy, which requires snappy. I am having trouble coming up with the right buildout incantation to actually get everything to work together.

The following buildout.cfg builds successfully, but it installs avro to develop-eggs , and anything else (such as in the [test] section) that tries to reference it tries to build it again and fails.

buildout.cfg

[buildout]
eggs-directory = eggs
extensions =
    buildout.dumppickedversions
eggs =
    avro
    httplib2
    pyramid
parts =
    avro
    test
    mongodb

[snappy]
# Dependency for avro
recipe = zc.recipe.cmmi
url = http://snappy.googlecode.com/files/snappy-1.0.5.tar.gz

[avro]
recipe = zc.recipe.egg:custom
egg = avro
include-dirs = ${snappy:location}/include
library-dirs = ${snappy:location}/lib

[test]
recipe = pbp.recipe.noserunner
script = runtests
eggs =
    ${buildout:eggs}
    pbp.recipe.noserunner
    WebTest

[mongodb]
recipe = rod.recipe.mongodb
base-url = http://downloads.mongodb.org
version = 2.0.4
darwin-32bit-url = ${mongodb:base-url}/osx/mongodb-osx-i386-${mongodb:version}.tgz
darwin-64bit-url = ${mongodb:base-url}/osx/mongodb-osx-x86_64-${mongodb:version}.tgz
linux2-32bit-url = ${mongodb:base-url}/linux/mongodb-linux-i686-${mongodb:version}.tgz
linux2-64bit-url = ${mongodb:base-url}/linux/mongodb-linux-x86_64-${mongodb:version}.tgz
logpath=${buildout:parts-directory}/mongodb/log
dbpath=${buildout:parts-directory}/mongodb/data
master=true
update=true

Output

Uninstalling avro.
Updating snappy.
Installing avro.
zip_safe flag not set; analyzing archive contents...
Installing test.
Getting distribution for 'python-snappy'.
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
snappymodule.cc:28:20: error: Python.h: No such file or directory
snappymodule.cc:31:22: error: snappy-c.h: No such file or directory
snappymodule.cc:36: error: ISO C++ forbids declaration of ‘PyObject’ with no type
snappymodule.cc:36: error: expected ‘;’ before ‘*’ token
snappymodule.cc:54: error: expected initializer before ‘*’ token
snappymodule.cc:59: error: expected initializer before ‘*’ token
snappymodule.cc:43: warning: ‘_state’ defined but not used
error: Setup script exited with error: command 'gcc' failed with exit status 1
An error occurred when trying to install python-snappy 0.4. Look above this message for any errors that were output by easy_install.
While:
  Installing test.
  Getting distribution for 'python-snappy'.
Error: Couldn't install: python-snappy 0.4

Is there a straightforward approach to handling extension-dependencies with buildout? What should I be doing here?

This error usually indicates missing development libraries, and can be resolved with something like:

$ aptitude install python-devel

In other words, it does not appear to be buildout-related.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM