Add command line options to show version number
Add -V command line option (and --version as an alias) to both wireviz.py and build_examples.py that show version number. Move the version number from setup.py into __init__.py to access the same version number specification from all files needing it. This solves part 4 of issue #167.
This commit is contained in:
parent
c4957f1475
commit
7df8a4b7cf
4
setup.py
4
setup.py
@ -4,6 +4,8 @@
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
from src.wireviz import __version__
|
||||
|
||||
project_name = 'wireviz'
|
||||
|
||||
# Utility function to read the README file.
|
||||
@ -15,7 +17,7 @@ def read(fname):
|
||||
|
||||
setup(
|
||||
name=project_name,
|
||||
version='0.1',
|
||||
version=__version__,
|
||||
author='Daniel Rojas',
|
||||
#author_email='',
|
||||
description='Easily document cables and wiring harnesses',
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
# Please don't import anything in this file to avoid issues when it is imported in setup.py
|
||||
|
||||
__version__ = '0.1.1'
|
||||
@ -9,7 +9,7 @@ from pathlib import Path
|
||||
script_path = Path(__file__).absolute()
|
||||
|
||||
sys.path.insert(0, str(script_path.parent.parent)) # to find wireviz module
|
||||
from wireviz import wireviz
|
||||
from wireviz import wireviz, __version__
|
||||
from wv_helper import open_file_write, open_file_read, open_file_append
|
||||
|
||||
|
||||
@ -128,6 +128,7 @@ def restore_generated(groupkeys, branch = ''):
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Wireviz Example Manager',)
|
||||
parser.add_argument('-V', '--version', action='version', version='%(prog)s - wireviz ' + __version__)
|
||||
parser.add_argument('action', nargs='?', action='store',
|
||||
choices=['build','clean','compare','diff','restore'], default='build',
|
||||
help='what to do with the generated files (default: build)')
|
||||
|
||||
@ -12,7 +12,7 @@ import yaml
|
||||
if __name__ == '__main__':
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
|
||||
from wireviz import __version__
|
||||
from wireviz.Harness import Harness
|
||||
from wireviz.wv_helper import expand, open_file_read
|
||||
|
||||
@ -211,6 +211,7 @@ def parse_cmdline():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Generate cable and wiring harness documentation from YAML descriptions',
|
||||
)
|
||||
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__)
|
||||
parser.add_argument('input_file', action='store', type=str, metavar='YAML_FILE')
|
||||
parser.add_argument('-o', '--output_file', action='store', type=str, metavar='OUTPUT')
|
||||
# Not implemented: parser.add_argument('--generate-bom', action='store_true', default=True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user