This is an automated email from the ASF dual-hosted git repository.

leandron pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 6d0761e  [RVM] Fix AttributeError when action is not specified (#9683)
6d0761e is described below

commit 6d0761e99817323f0f2e9a98c50c5769a3367e0c
Author: Gustavo Romero <[email protected]>
AuthorDate: Thu Dec 9 11:48:09 2021 -0300

    [RVM] Fix AttributeError when action is not specified (#9683)
    
    Although an action (build, test, or release) is always required by
    base-tool-box.py currently actions are not set as "required" in the
    parser, hence it doesn't complain when an action is missing and later
    when 'args.platform' attribute (present in all actions) is referenced
    the tool exits abruptly due to an AttributeError (because 'platform' is
    not set), without giving any clue on what went wrong. For instance:
    
    $ python3 ./base-box-tool.py --provider virtualbox # no action is given
    
    This commit fixes it by setting action subparsers as required so the
    parser complains when no action is specified.
    
    Signed-off-by: Gustavo Romero <[email protected]>
---
 apps/microtvm/reference-vm/base-box-tool.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/apps/microtvm/reference-vm/base-box-tool.py 
b/apps/microtvm/reference-vm/base-box-tool.py
index 42b90c6..26db8c4 100755
--- a/apps/microtvm/reference-vm/base-box-tool.py
+++ b/apps/microtvm/reference-vm/base-box-tool.py
@@ -475,6 +475,8 @@ def parse_args():
         description="Automates building, testing, and releasing a base box"
     )
     subparsers = parser.add_subparsers(help="Action to perform.")
+    subparsers.required = True
+    subparsers.dest = "action"
     parser.add_argument(
         "--provider",
         choices=ALL_PROVIDERS,

Reply via email to