blob: 93d3c3d86f4c885a930fed70ae5ae5b9065ad099 [file] [log] [blame]
Kevin Chengee6030f2018-06-26 10:55:30 -07001#!/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.
16r"""Setup entry point.
17
18Setup will handle all of the necessary steps to enable acloud to create a local
19or remote instance of an Android Virtual Device.
20"""
21
22from __future__ import print_function
23
Sam Chiu81bdc652018-06-29 18:45:08 +080024from acloud.internal.lib import utils
25from acloud.setup import host_setup_runner
Kevin Chengee6030f2018-06-26 10:55:30 -070026
Sam Chiu81bdc652018-06-29 18:45:08 +080027
28def Run():
Kevin Chengee6030f2018-06-26 10:55:30 -070029 """Run setup.
30
31 Args:
32 args: Namespace object from argparse.parse_args.
33 """
Sam Chiu81bdc652018-06-29 18:45:08 +080034 # 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
49def _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
64def _PrintUsage():
65 """Print cmd usage hints when acloud setup been finished."""
66 utils.PrintColorString("\nIf you'd like more info, run '#acloud create --help'")