Skip to main content

generate a version number from darcs history

Project description

What Does It Do

Create _version.py, based upon the latest darcs release tag.

If your source tree is coming from darcs (i.e. it is in a darcs repository), this tool will determine the most recent release tag, count the patches that have been applied since then, and compute a version number to be written into _version.py . This version number will be available by doing:

from your_package_name import __version__

Source trees that do not come from darcs (e.g. release tarballs, nightly tarballs) and are not within a darcs repository should instead, come with a _version.py that was generated before the tarball was produced. In this case, this tool will quietly exit without modifying the existing _version.py .

‘release tags’ are tags in the source repository that match the following regexp:

^your_package_name-(d+)(.(d+)(.(d+))?)?((a|b|c|rc)(d+))?

Installation

With easy_install:

easy_install darcsver

Alternative manual installation:

tar -zxvf darcsver-X.Y.Z.tar.gz cd darcsver-X.Y.Z python setup.py install

Where X.Y.Z is a version number.

Alternative to make a specific package use darcsver without installing darcsver into the system:

Put “setup_requires=[‘darcsver’]” in the call to setup() in the package’s setup.py file.

Usage

There are two ways to use this: the command-line tool and the setuptools plugin.

To use the command-line tool, execute it as:

darcsver $PACKAGE_NAME $PATH_TO_VERSION_PY

To use the setuptools plugin (which enables you to write “./setup.py darcsver” and which cleverly figures out where the _version.py file ought to go), you must first package your python module with setup.py and use setuptools.

The former is well documented in the distutils manual:

http://docs.python.org/dist/dist.html

To use setuptools instead of distutils, just edit setup.py and change

from distutils.core import setup

to

from setuptools import setup

References

How to distribute Python modules with Distutils:

http://docs.python.org/dist/dist.html

Setuptools complete manual:

http://peak.telecommunity.com/DevCenter/setuptools

Thanks to Yannick Gingras for providing the prototype for this README.txt.

Project details


Download files

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

Source Distribution

darcsver-1.6.1.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file darcsver-1.6.1.tar.gz.

File metadata

  • Download URL: darcsver-1.6.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for darcsver-1.6.1.tar.gz
Algorithm Hash digest
SHA256 b18fcf5845b2f3467e3917bf3f5f7a9d2ed918d5608a308b8791bc8b2301aed7
MD5 23e7d2cd5559a492186927efa2e53765
BLAKE2b-256 356fd1c8efae3d58cc2c5126186d2fd4716157ed8d85e8eb9c36b0d5d21029f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page