Updates for issue #246

1) Added version argument to display version.
2) Refactored version information to reside in a single file.
   a)  setup.py references this file
   b)  conf.py references this file
   c)  version argument references this file
This commit is contained in:
Jeremiah C Leary 2019-06-28 07:48:37 -05:00
parent 86ee77d219
commit 3623151b5b
4 changed files with 18 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import vsg.version
# -- General configuration ------------------------------------------------
@ -54,9 +55,9 @@ author = u'Jeremiah C Leary'
# built documents.
#
# The short X.Y version.
version = u'0.38'
version = str(vsg.version.version)
# The full version, including alpha/beta/rc tags.
release = u'0.38'
release = str(vsg.version.version)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -2,6 +2,8 @@ from setuptools import setup
from setuptools import find_packages
from vsg import version
def readme():
with open('README.rst') as f:
return f.read()
@ -9,7 +11,7 @@ def readme():
setup(
name='vsg',
version='0.38',
version=str(version.version),
description='VHDL Style Guide',
long_description=readme(),
classifiers=[

View File

@ -11,6 +11,7 @@ import yaml
from . import rule_list
from . import vhdlFile
from . import junit
from . import version
def parse_command_line_arguments():
@ -31,6 +32,7 @@ def parse_command_line_arguments():
parser.add_argument('-of', '--output_format', action='store', default='vsg', choices=['vsg', 'syntastic'], help='Sets the output format.')
parser.add_argument('-b', '--backup', default=False, action='store_true', help='Creates copy of input file for comparison with fixed version.')
parser.add_argument('-oc', '--output_configuration', default=None, action='store', help='Output configuration file name')
parser.add_argument('-v', '--version', default=False, action='store_true', help='Displays version information')
if len(sys.argv) == 1:
parser.print_help()
@ -147,6 +149,8 @@ def main():
commandLineArguments = parse_command_line_arguments()
version.print_version(commandLineArguments)
configuration = read_configuration_files(commandLineArguments)
update_command_line_arguments(commandLineArguments, configuration)

8
vsg/version.py Normal file
View File

@ -0,0 +1,8 @@
version = 0.39
def print_version(oCommandLineArguments):
if (oCommandLineArguments.version):
print('VHDL Style Guide (VSG) version ' + str(version))
exit(0)