Permalink
Browse files

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

  • Loading branch information...
1 parent cad5d94 commit c46a403baacf7786b5154b06782207a8b3a52c25 @bryanveloso bryanveloso committed Mar 20, 2012
Showing with 37 additions and 4 deletions.
  1. +2 −2 docs/conf.py
  2. +31 −1 imagekit/__init__.py
  3. +4 −1 setup.py
View
@@ -50,9 +50,9 @@
# 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
@@ -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
@@ -11,9 +11,12 @@
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',

0 comments on commit c46a403

Please sign in to comment.