Update: I no longer use this recipe, as it turned out to be an elaborate workaround for Paver 1.0 ignoring
distutils.cfg when using a Paver-based
setup.py file. I'm now using a patch that allows Paver to honor such configuration files.
I've been using Paver, a tool to help manage various bits of administrivia surrounding Python projects, with Schevo for several months now. Now that Paver has a 1.0 release, I'm also using it to help streamline such tasks for the commercial software I'm helping develop.
One of the patterns I'm used to is attaching
dev to the end of versions, to help differentiate between development versions and release versions.
I wanted to go further than this, also attaching the name of the current git branch name to the version number. That practice is useful when you use branching to manage feature development and bug fixes.
Here's the pattern I settled on. The relevant parts of
pavement.py look like this:
from paver.easy import * from paver.setuputils import setup VERSION = '1.2.3' DEVELOPMENT = True # Use branch name if git information is available; otherwise, use # version number from setup_meta. if DEVELOPMENT: try: git_head_path = path('.git/HEAD') contents = git_head_path.open('rU').readline().strip() name, value = contents.split() BRANCH = value.split('/')[-1] if BRANCH != 'master': VERSION += '-' + BRANCH except: pass VERSION += '-dev' setup( name='MyProject', version=VERSION, ... )
When generating releases, set
False, commit that change, tag and release, then change the value back to
True and commit again.