From: W. Trevor King Date: Tue, 2 Aug 2016 04:02:50 +0000 (-0700) Subject: igor.script: Replace ArgumentParser(version=...) with a version argument X-Git-Tag: v0.3~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2b2b425de4fe919e05018f773323e76472e4c737;p=igor.git igor.script: Replace ArgumentParser(version=...) with a version argument ArgumentParser lost its undocumented version argument in 3.3.0 [1,2,3]. The version action is the documented way to do this [4]. [1]: http://bugs.python.org/issue13248 [2]: https://hg.python.org/cpython/rev/5393382c1b1d [3]: https://hg.python.org/cpython/file/374f501f4567/Misc/HISTORY#l477 [4]: https://docs.python.org/3/library/argparse.html#action --- diff --git a/igor/script.py b/igor/script.py index acb1a22..685fdd1 100644 --- a/igor/script.py +++ b/igor/script.py @@ -36,8 +36,10 @@ class Script (object): log_levels = [_logging.ERROR, _logging.WARNING, _logging.INFO, _logging.DEBUG] def __init__(self, description=None, filetype='IGOR Binary Wave (.ibw) file'): - self.parser = _argparse.ArgumentParser( - description=description, version=__version__) + self.parser = _argparse.ArgumentParser(description=description) + self.parser.add_argument( + '--version', action='version', + version='%(prog)s {}'.format(__version__)) self.parser.add_argument( '-f', '--infile', metavar='FILE', default='-', help='input {}'.format(filetype))