mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-17 04:10:24 +00:00
Set version in setup.py docs automatically
This commit is contained in:
parent
ed011eaeaa
commit
a7c6ff9392
3 changed files with 22 additions and 4 deletions
14
docs/conf.py
14
docs/conf.py
|
|
@ -43,14 +43,22 @@ master_doc = 'index'
|
|||
project = u'django-model-utils'
|
||||
copyright = u'2013, Carl Meyer'
|
||||
|
||||
parent_dir = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
def get_version():
|
||||
with open(os.path.join(parent_dir, 'model_utils', '__init__.py')) as f:
|
||||
for line in f:
|
||||
if line.startswith('__version__ ='):
|
||||
return line.split('=')[1].strip().strip('"\'')
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.4'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.4.0'
|
||||
release = get_version()
|
||||
# The short X.Y version.
|
||||
version = release
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
from .choices import Choices
|
||||
from .tracker import FieldTracker, ModelTracker
|
||||
|
||||
__version__ = '1.4.0.post1'
|
||||
|
|
|
|||
10
setup.py
10
setup.py
|
|
@ -1,3 +1,4 @@
|
|||
from os.path import join
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
|
|
@ -6,9 +7,16 @@ long_description = (open('README.rst').read() +
|
|||
open('TODO.rst').read())
|
||||
|
||||
|
||||
def get_version():
|
||||
with open(join('model_utils', '__init__.py')) as f:
|
||||
for line in f:
|
||||
if line.startswith('__version__ ='):
|
||||
return line.split('=')[1].strip().strip('"\'')
|
||||
|
||||
|
||||
setup(
|
||||
name='django-model-utils',
|
||||
version='1.4.0.post1',
|
||||
version=get_version(),
|
||||
description='Django model mixins and utilities',
|
||||
long_description=long_description,
|
||||
author='Carl Meyer',
|
||||
|
|
|
|||
Loading…
Reference in a new issue