Updated version.

This commit is contained in:
Jannis Leidel 2013-11-26 16:29:00 +01:00
parent 11e2f1d349
commit 11b1dc2a46
3 changed files with 16 additions and 10 deletions

View file

@ -2,7 +2,7 @@
from .base import Settings, Configuration
from .decorators import pristinemethod
__version__ = '0.6'
__version__ = '0.7'
__all__ = ['Configuration', 'pristinemethod', 'Settings']

View file

@ -3,7 +3,7 @@
Project templates
^^^^^^^^^^^^^^^^^
Don't miss the Django :ref:`project templates pre-configured with
Don't miss the Django :ref:`project templates pre-configured with
django-configurations<project-templates>` to simplify getting started
with new Django projects.

View file

@ -1,23 +1,29 @@
from __future__ import print_function
import ast
import os
import re
import codecs
from setuptools import setup
class VersionFinder(ast.NodeVisitor):
def __init__(self):
self.version = None
def visit_Assign(self, node):
if node.targets[0].id == '__version__':
self.version = node.value.s
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def find_version(*parts):
finder = VersionFinder()
finder.visit(ast.parse(read(*parts)))
return finder.version
setup(