Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

zc.buildout recipe that parses compile time options from config scripts

Project description

The LibInc recipe can parse CFLAGS, LDFLAGS and other information tipically returned by libraries config scripts like gdal-config, libpng-config and others. The parsed information can be used by other recipes as hexagonit.recipe.cmmi or zc.recipe.egg to make the build process more robust.

The initial version of this recipe has been written within the PrimaGIS topic of the 2007 Plone Naples Sprint and it is used for the PCL/PrimaGIS buildout.

Home page:

Copyright (c) 2007-2010 B-Open Solutions srl ( All rights reserved.

Distributed under the terms of the ZPL 2.1

Detailed Documentation

Warning: Work in progress

This zc.buildout recipe is pre-alpha quality.

Supported options

a list of commands that return the linking options, one per line

Example usage

We’ll use a simple config command to demonstrate the recipe.

>>> import os.path
>>> testdata = join(os.path.dirname(__file__), 'testdata')
>>> ls(testdata)
-  sample-config

The options are accessible by other recipes:

>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', '',
... """
... import logging
... class Echo:
...     def __init__(self, buildout, name, options):
..., self.options = name, options
...     def install(self):
...         logging.getLogger('echo', ''))
...         return ()
...     def update(self):
...         pass
... """)
>>> write(sample_buildout, 'recipes', '',
... """
... from setuptools import setup
... setup(
...     name = "recipes",
...     entry_points = {'zc.buildout': ['echo= echo:Echo']},
...     )
... """)

Let’s create a buildout to build and install the package.

>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts = package
... [package]
... recipe = recipes:echo
... echo =
...     include-dirs: ${config-package:include-dirs}
...     library-dirs: ${config-package:library-dirs}
...     libraries: ${config-package:libraries}
...     cflags: ${config-package:cflags}
...     ldflags: ${config-package:ldflags}
... [config-package]
... recipe = bopen.recipe.libinc
... flags-command =
...     %(testdata)s/sample-config --cflags
...     %(testdata)s/sample-config --libs
...     %(testdata)s/sample-config --version
... include-dirs = /usr/include/mysample
... library-dirs = /usr/lib/mysample
... libraries = mysample
... """ % {'testdata': testdata})
>>> print system(buildout + ' -N')
Develop: ...
config-package: .../testdata/sample-config --cflags -> -I/usr/include -I/usr/include/sample
config-package: .../testdata/sample-config --libs -> -L/usr/lib -L/usr/lib/sample -lsample -lsample_rt
config-package: .../testdata/sample-config --version -> 1.0
    include-dirs: /usr/include /usr/include/sample /usr/include/mysample
    library-dirs: /usr/lib /usr/lib/sample /usr/lib/mysample
    libraries: sample sample_rt mysample
    cflags: -I/usr/include -I/usr/include/sample -I/usr/include/mysample
    ldflags: -L/usr/lib -L/usr/lib/sample -L/usr/lib/mysample -lsample -lsample_rt -lmysample
Installing config-package.
Installing package.
    include-dirs: /usr/include /usr/include/sample /usr/include/mysample
    library-dirs: /usr/lib /usr/lib/sample /usr/lib/mysample
    libraries: sample sample_rt mysample
    cflags: -I/usr/include -I/usr/include/sample -I/usr/include/mysample
    ldflags: -L/usr/lib -L/usr/lib/sample -L/usr/lib/mysample -lsample -lsample_rt -lmysample

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bopen.recipe.libinc, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size bopen.recipe.libinc-0.3.0-py2.4.egg (9.1 kB) File type Egg Python version 2.4 Upload date Hashes View hashes
Filename, size bopen.recipe.libinc-0.3.0-py2.5.egg (9.2 kB) File type Egg Python version 2.5 Upload date Hashes View hashes
Filename, size bopen.recipe.libinc-0.3.0-py2.6.egg (9.2 kB) File type Egg Python version 2.6 Upload date Hashes View hashes
Filename, size bopen.recipe.libinc-0.3.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page