Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buildout: use dependencies from system Python

I'm trying to use buildout for a Python package which, when used, depends on 2 extension modules: dbus-python and pygobject. Both modules make buildout fail: dbus-python lacks a setup.py file, while pygobject has one but whose usage is discouraged -- instead configure, make, make install should be used. So, buildout isn't able to setup these dependencies in the development environment.

Here's my buildout.cfg:

[buildout]
develop = .
parts = eggs

[python]
recipe = zc.recipe.eggs
interpreter = python
eggs = foobar

where setup.py for the foobar package contains:

install_requires=['dbus-python', 'pygobject'],

While looking for a solution, I stumbled upon the recipe z3c.recipe.scripts and its ability to utilize system-wide installed eggs. However, when applied to my buildout.cfg ..

[python]
recipe = z3c.recipe.scripts
include-site-packages = true
allowed-eggs-from-site-packages = pygobject, dbus-python
interpreter = python
eggs = foobar    

.. it appears to have no effect (still fails), although both packages (dbus, gobject) are installed in my system Python. The same is true when I remove the allowed-eggs.. line.

My question: Did I got something wrong here on a conceptional level or is there an error in my buildout.cfg?

I know there's zc.recipe.cmmi, a recipe which installs eggs using configure, make, make install. However, simply referencing system Python eggs would be sufficient in my case. I do not need a 100% reproducible environment generated by buildout. Also, dbus-python and pygobject are installed by default on most Linux desktop systems, the environment where foobar is intended to be used.

like image 481
Oben Sonne Avatar asked Dec 12 '25 05:12

Oben Sonne


2 Answers

I haven't gotten the latest 1.5.x buildouts to work with system packages, too. There is one way: pin the versions. That way, zc.buildout 1.5.x will pick it up.

[buildout]
...
versions = versions

[versions]
pygobject = 1.2.3

Alternatively, what I do, you can use the old 1.4.4 buildout (you'll need a special bootstrap.py for that, google it) in combination with osc.recipe.sysegg.

[buildout]
...
parts = 
    ...
    sysegg

[sysegg]
recipe = osc.recipe.sysegg
force-sysegg = true 
eggs =
    dbus-python
    pygobject

I'd personally go for the osc.recipe.sysegg solution, as that's reliable.

like image 193
Reinout van Rees Avatar answered Dec 14 '25 19:12

Reinout van Rees


You might want to use a CMMI part for each of those poorly behaving python distributions and use the extra-paths option for your python part to make sure the CMMI parts are included in the python path.

like image 24
Ross Patterson Avatar answered Dec 14 '25 19:12

Ross Patterson