| Kevin Cheng | ee6030f | 2018-06-26 10:55:30 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # Copyright 2018 - The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | r"""Setup entry point. |
| 17 | |
| 18 | Setup will handle all of the necessary steps to enable acloud to create a local |
| 19 | or remote instance of an Android Virtual Device. |
| 20 | """ |
| 21 | |
| 22 | from __future__ import print_function |
| 23 | |
| Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 24 | from acloud.internal.lib import utils |
| 25 | from acloud.setup import host_setup_runner |
| Kevin Cheng | ee6030f | 2018-06-26 10:55:30 -0700 | [diff] [blame] | 26 | |
| Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 27 | |
| 28 | def Run(): |
| Kevin Cheng | ee6030f | 2018-06-26 10:55:30 -0700 | [diff] [blame] | 29 | """Run setup. |
| 30 | |
| 31 | Args: |
| 32 | args: Namespace object from argparse.parse_args. |
| 33 | """ |
| Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 34 | # Setup process will be in the following manner: |
| 35 | # 1.Print welcome message. |
| 36 | _PrintWelcomeMessage() |
| 37 | |
| 38 | # 2.Init all subtasks in queue and traverse them. |
| 39 | task_queue = [host_setup_runner.CuttlefishPkgInstaller(), |
| 40 | host_setup_runner.CuttlefishHostSetup(),] |
| 41 | |
| 42 | for subtask in task_queue: |
| 43 | subtask.Run() |
| 44 | |
| 45 | # 3.Print the usage hints. |
| 46 | _PrintUsage() |
| 47 | |
| 48 | |
| 49 | def _PrintWelcomeMessage(): |
| 50 | """Print welcome message when acloud setup been called.""" |
| 51 | |
| 52 | # pylint: disable=anomalous-backslash-in-string |
| 53 | asc_art = " \n" \ |
| 54 | " ___ _______ ____ __ _____ \n" \ |
| 55 | " / _ |/ ___/ / / __ \/ / / / _ \\ \n" \ |
| 56 | " / __ / /__/ /__/ /_/ / /_/ / // / \n" \ |
| 57 | "/_/ |_\\___/____/\\____/\\____/____/ \n" \ |
| 58 | " \n" |
| 59 | |
| 60 | print("\nWelcome to") |
| 61 | print(asc_art) |
| 62 | |
| 63 | |
| 64 | def _PrintUsage(): |
| 65 | """Print cmd usage hints when acloud setup been finished.""" |
| 66 | utils.PrintColorString("\nIf you'd like more info, run '#acloud create --help'") |