servo_parsing: move version
in py3, version is not a kwarg to argparse anymore, but rather has to be
added manually the same way that we currently do `sversion`. This change
does that.
BUG=b:173654772
TEST=servod --version
servod v0.9999.0.dev
TEST=servod -v
servod v0.9999.0.dev
TEST=servod --sversion
servod v0.9999.0.dev-2738a95
2020-11-18 14:19:09
cococave.mtv.corp.google.com
Change-Id: I9811b916f8ff06e1c6e6f06d9444887dfd0dad68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/hdctools/+/2548290
Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-by: Brian Nemec <bnemec@chromium.org>
Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
diff --git a/servo/servo_parsing.py b/servo/servo_parsing.py
index 4fcc976..4b59649 100644
--- a/servo/servo_parsing.py
+++ b/servo/servo_parsing.py
@@ -199,9 +199,10 @@
or to create mutual exclusion with serialname and name (clients)
**kwargs: keyword arguments forwarded to _BaseServodParser
"""
- if 'version' not in kwargs:
- kwargs['version'] = VERSION
+ # Remove version from the kwargs and add it yourself.
+ v = kwargs.pop('version', VERSION)
super(BaseServodParser, self).__init__(**kwargs)
+ self.add_argument('-v', '--version', action='version', version=v)
self.add_argument('--sversion', action='version', version=SVERSION)
self.add_argument('-d', '--debug', action='store_true', default=False,
help='enable debug messages')