gsi_util: adding subcommand framework
With this CL, new command can be easily added:
1. Add a new file: gsi/gsi_util/gsi_util/commands/hello.py
And implements a function to register parsers into gsi_util's main parser.
def setup_command_args(subparsers)
2. In gsi/gsi_util/gsi_util.py, add the new command into GsiUtil():
_COMMANDS = ['hello']
Bug: 70588453
Test: make gsi_util
Test: gsi_util --help
Test: gsi_util hello --foo
Test: gsi_util --debug hello --bar
Change-Id: I54fa6d1dea5afed724d9ac4a99f88bf78da82732
diff --git a/gsi/gsi_util/Android.bp b/gsi/gsi_util/Android.bp
new file mode 100644
index 0000000..be7b569
--- /dev/null
+++ b/gsi/gsi_util/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+python_binary_host {
+ name: "gsi_util",
+ srcs: [
+ "gsi_util.py",
+ "gsi_util/*.py",
+ "gsi_util/commands/*.py",
+ ],
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: false,
+ },
+ },
+}