Ticket #21400: 21400.diff

File 21400.diff, 1.1 KB (added by Claude Paroz, 11 years ago)

Getting VERSION from current tree

  • docs/conf.py

    diff --git a/docs/conf.py b/docs/conf.py
    index 49e70fa..d12cb44 100644
    a b  
    1313
    1414from __future__ import unicode_literals
    1515
     16import re
    1617import sys
    1718from os.path import abspath, dirname, join
    1819
    copyright = 'Django Software Foundation and contributors'  
    5859version = '1.7'
    5960# The full version, including alpha/beta/rc tags.
    6061try:
    61     from django import VERSION, get_version
     62    from django import get_version
    6263except ImportError:
    6364    release = version
    6465else:
    6566    def django_release():
     67        VERSION = ()
     68        path = join(dirname(dirname(__file__)), 'django', '__init__.py')
     69        with open(path) as f:
     70            for line in f:
     71                if line.startswith('VERSION'):
     72                    VERSION = eval(re.findall(r'\(.*\)', line)[0])
     73                    break
     74
    6675        pep386ver = get_version()
    67         if VERSION[3:5] == ('alpha', 0) and 'dev' not in pep386ver:
     76        if VERSION and VERSION[3:5] == ('alpha', 0) and 'dev' not in pep386ver:
    6877            return pep386ver + '.dev'
    6978        return pep386ver
    7079
Back to Top