diff --git a/docs/conf.py b/docs/conf.py index e37017b..1ba36ca 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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. diff --git a/imagekit/__init__.py b/imagekit/__init__.py index 1d7d570..1ce4055 100644 --- a/imagekit/__init__.py +++ b/imagekit/__init__.py @@ -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 diff --git a/setup.py b/setup.py index c43c172..6fdb8fb 100644 --- a/setup.py +++ b/setup.py @@ -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',