Unified place for the version number

added --version to bigchain-cli
This commit is contained in:
Rodolphe Marques 2016-04-21 13:38:02 +02:00
parent e9bc552bb1
commit dcbaedf7ea
3 changed files with 20 additions and 3 deletions

View File

@ -5,6 +5,8 @@ for ``argparse.ArgumentParser``.
import argparse
import multiprocessing as mp
from bigchaindb.version import __version__
def start(parser, scope):
"""Utility function to execute a subcommand.
@ -46,7 +48,7 @@ def start(parser, scope):
func(args)
base_parser = argparse.ArgumentParser(add_help=False)
base_parser = argparse.ArgumentParser(add_help=False, prog='bigchaindb')
base_parser.add_argument('-c', '--config',
help='Specify the location of the configuration file')
@ -55,3 +57,7 @@ base_parser.add_argument('-y', '--yes', '--yes-please',
action='store_true',
help='Assume "yes" as answer to all prompts and run '
'non-interactively')
base_parser.add_argument('-v', '--version',
action='version',
version='%(prog)s {}'.format(__version__))

View File

@ -30,6 +30,11 @@ from recommonmark.parser import CommonMarkParser
# ones.
import sphinx_rtd_theme
# get version
_version = {}
with open('../../bigchaindb/version.py') as fp:
exec(fp.read(), _version)
extensions = [
'sphinx.ext.autodoc',
@ -71,7 +76,7 @@ author = 'BigchainDB Contributors'
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1.4'
release = _version['__version__']
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -4,8 +4,14 @@ BigchainDB: A Scalable Blockchain Database
For full docs visit https://bigchaindb.readthedocs.org
"""
import os, sys
from setuptools import setup, find_packages
# get the version
version = {}
with open('bigchaindb/version.py') as fp:
exec(fp.read(), version)
tests_require = [
'pytest',
'coverage',
@ -32,7 +38,7 @@ docs_require = [
setup(
name='BigchainDB',
version='0.1.4',
version=version['__version__'],
description='BigchainDB: A Scalable Blockchain Database',
long_description=__doc__,
url='https://github.com/BigchainDB/bigchaindb/',