Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install buildout.variables

How to install buildout.variables

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install buildout.variables
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.3 Available View build log
Linux (64-bit)
0.3 Available View build log
 
License
GPL
Dependencies
Lastest release
version 0.3 on Mar 21st, 2013

buildout.variables

Provides dynamic variables in buildouts.

An example use are unique DB names and conflict free parallel continuous integration runs on one machine.

Example buildout section:

[variables]
recipe = buildout.variables
index-file = ${env:HOME}/jenkins-buildout-index.json
index-start = 0
index-key = ${env:JOB_NAME}
portbase = indexed 12{index}00
port = int portbase 0:100
port-instance = new port
jobname = str "${env:JOB_NAME}" [^a-zA-Z0-9] _

[env]
recipe = gocept.recipe.env

There are several things going on here.

The first are the index- options. They provide you with the possiblity to get unique indices based on a key and stored in a shared file. That way each buildout gets the same index for each key used. In the example above the key is the JOB_NAME environment variable (set by Jenkins for example) and the index starts at 0. If a buildout with a different JOB_NAME is run, then it will get the next free index.

The portbase option evaluates "12{index}00".format(index=index). Thus the first job will get 12000 and the second job 12100 and so on.

The port option declares a range of integers which can be used to get unique ports for whatever you need them for. The port-instance option uses that to declare a port which can be used with ${variables:port-instance} throughout the buildout and would be 12000 in this example. If you declare more, then up to 12099 will be possible before you get an error. Which variable gets which port is determined by lexical order of the variable name.

The jobname option takes ${env:JOB_NAME} and runs re.sub on it. In this example everything besides letters and numbers is replaced by an underscore.

Besides integer ranges you can't use other dynamic variables from the same section.

Credits

Thanks to Legacy Parts Corporation and http://enquos.com for which this package was initially created.

Changelog

0.3 - 2013-03-15
  • First official release. [fschulze]
0.2 - Unreleased
  • Fix persisted index. [fschulze]
0.1 - Unreleased
  • Initial version. [fschulze (Florian Schulze)]

Subscribe to package updates

Last updated Mar 21st, 2013

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.