aisbaa
aisbaa

Reputation: 10643

zc.buildout versions

I have an issue with python egg versions. On my development machine I have python-ldap version 2.3.13, while colleges on their machines have version 2.3.10. Both python-ldap libs are installed on os level.

Is it possible to tell buildout not to look for newest python-ldap version?

I'm looking for something like this:

# using buildout-versions extension
[versions]
python-ldap = any
or
python-ldap => 2.1

I would not like to use buildout -N, since I'd like to get other egg newest versions.

Upvotes: 4

Views: 271

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1125078

Buildout only let's you pin (exact) versions by using a versions section:

[buildout]
versions = myversions

[versions]
python-ldap = 2.3.13

where the versions key in the [buildout] section names a section to be used for the pins (most just call that section [versions] as well).

If you need to pin that to a version that differs from machine to machine, you'll have to use a recipe that generates versions based on external parameters.

In the following example I am using the mr.scripty recipe to run some python to fetch the version pin for me:

[buildout]
versions = versions

[versions]
python-ldap = ${dynamic:python-ldap}

[dynamic]
recipe = mr.scripty
python-ldap =
    ... import subprocess
    ... return subprocess.check_output(
    ...    'dpkg-query', '-W', '-f', '${Version}', 'python-ldap').rsplit('-')[0]

The example above uses the dpkg-query utility to determine the version of the python-ldap package on Debian or Ubuntu; adjust as needed for your own platform.

Upvotes: 4

Related Questions