-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.plano.py
109 lines (86 loc) · 2.91 KB
/
.plano.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
from burly import *
from plano import *
from plano.github import *
@command
def build():
burly_in = read("burly.sh").strip()
boilerplate = extract_boilerplate(burly_in)
functions = extract_functions(burly_in)
core_function_names = [
"assert",
"random_number",
"print", "print_result", "print_section",
"run", "log", "fail",
"green", "yellow", "red", "bold",
"init_logging", "handle_exit",
"enable_debug_mode",
"enable_strict_mode",
]
install_function_names = core_function_names + [
"program_is_available",
"check_required_programs",
"check_required_network_resources",
"check_writable_directories",
"ask_to_proceed",
"extract_archive",
]
uninstall_function_names = core_function_names + [
"check_writable_directories",
"ask_to_proceed",
]
burly_out = [boilerplate]
for name in install_function_names:
burly_out.append(functions[name])
install_sh_in = read("install.sh.in")
install_sh = string_replace(install_sh_in, "@burly@", "\n".join(burly_out))
burly_out = [boilerplate]
for name in uninstall_function_names:
burly_out.append(functions[name])
uninstall_sh_in = read("uninstall.sh.in")
uninstall_sh = string_replace(uninstall_sh_in, "@burly@", "\n".join(burly_out))
write("install.sh", install_sh)
write("uninstall.sh", uninstall_sh)
@command(passthrough=True)
def test(verbose=False, quiet=False, passthrough_args=[]):
build()
if verbose:
passthrough_args.append("--verbose")
if quiet:
passthrough_args.append("--quiet")
import tests
PlanoTestCommand(tests).main(passthrough_args)
@command
def clean():
remove(find(".", "__pycache__"))
@command
def lint():
"""
Use shellcheck to scan for problems
"""
check_program("shellcheck")
build()
run("shellcheck --shell sh --enable all --exclude SC3043,SC2310,SC2312 install.sh uninstall.sh")
@command
def update_burly():
"""
Update the embedded Burly repo
"""
update_external_from_github("external/burly", "ssorj", "burly")