|
3 | 3 | import argparse
|
4 | 4 | import base64
|
5 | 5 | import copy
|
| 6 | +import datetime |
6 | 7 | import glob
|
7 | 8 | import imp
|
8 | 9 | import os
|
|
13 | 14 | import stat
|
14 | 15 | import subprocess
|
15 | 16 | import sys
|
| 17 | +import time |
16 | 18 |
|
17 | 19 | this = sys.modules[__name__]
|
18 | 20 |
|
|
45 | 47 | config = imp.load_source('config', config_file)
|
46 | 48 | configs = {x:getattr(config, x) for x in dir(config) if not x.startswith('__')}
|
47 | 49 |
|
| 50 | +def add_build_arguments(parser): |
| 51 | + parser.add_argument( |
| 52 | + '--clean', |
| 53 | + help='Clean the build instead of building.', |
| 54 | + action='store_true', |
| 55 | + ) |
| 56 | + |
48 | 57 | def base64_encode(string):
|
49 | 58 | return base64.b64encode(string.encode()).decode()
|
50 | 59 |
|
@@ -144,13 +153,6 @@ def get_argparse(default_args=None, argparse_args=None):
|
144 | 153 | parser.set_defaults(**defaults)
|
145 | 154 | return parser
|
146 | 155 |
|
147 |
| -def add_build_arguments(parser): |
148 |
| - parser.add_argument( |
149 |
| - '--clean', |
150 |
| - help='Clean the build instead of building.', |
151 |
| - action='store_true', |
152 |
| - ) |
153 |
| - |
154 | 156 | def get_elf_entry(elf_file_path):
|
155 | 157 | global this
|
156 | 158 | readelf_header = subprocess.check_output([
|
@@ -211,6 +213,11 @@ def print_cmd(cmd, cmd_file=None, extra_env=None):
|
211 | 213 | st = os.stat(cmd_file)
|
212 | 214 | os.chmod(cmd_file, st.st_mode | stat.S_IXUSR)
|
213 | 215 |
|
| 216 | +def print_time(ellapsed_seconds): |
| 217 | + hours, rem = divmod(ellapsed_seconds, 3600) |
| 218 | + minutes, seconds = divmod(rem, 60) |
| 219 | + print("time {:02}:{:02}:{:02}".format(int(hours), int(minutes), int(seconds))) |
| 220 | + |
214 | 221 | def resolve_args(defaults, args, extra_args):
|
215 | 222 | if extra_args is None:
|
216 | 223 | extra_args = {}
|
|
0 commit comments