Using Django's method of versioning. Also updating the docs' version.

This commit is contained in:
Bryan Veloso 2012-03-20 02:44:53 -07:00
parent cad5d94661
commit c46a403baa
3 changed files with 37 additions and 4 deletions

View file

@ -50,9 +50,9 @@ copyright = u'2011, Justin Driscoll, Bryan Veloso, Greg Newman, Chris Drackett &
# built documents.
#
# The short X.Y version.
version = '1.1.0'
version = '2.0.0'
# The full version, including alpha/beta/rc tags.
release = '1.1.0'
release = '2.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View file

@ -1,4 +1,34 @@
__title__ = 'django-imagekit'
__author__ = 'Justin Driscoll, Bryan Veloso, Greg Newman, Chris Drackett, Matthew Tretter, Eric Eldredge'
__version__ = (2, 0, 0, 'alpha', 1)
__version__ = (2, 0, 0, 'rc', 1)
__license__ = 'BSD'
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = __version__
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha releases
# | {a|b|c}N - for alpha, beta and rc releases
parts = 2 if version[2] == 0 else 3
main = '.'.join(str(x) for x in version[:parts])
sub = ''
if version[3] == 'alpha' and version[4] == 0:
# At the toplevel, this would cause an import loop.
from django.utils.version import get_svn_revision
svn_revision = get_svn_revision()[4:]
if svn_revision != 'unknown':
sub = '.dev%s' % svn_revision
elif version[3] != 'final':
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
sub = mapping[version[3]] + str(version[4])
return main + sub

View file

@ -11,9 +11,12 @@ if 'publish' in sys.argv:
read = lambda filepath: codecs.open(filepath, 'r', 'utf-8').read()
# Dynamically calculate the version based on imagekit.VERSION.
version = __import__('imagekit').get_version()
setup(
name='django-imagekit',
version=':versiontools:imagekit:',
version=version,
description='Automated image processing for Django models.',
long_description=read(os.path.join(os.path.dirname(__file__), 'README.rst')),
author='Justin Driscoll',