blob: 0d14429f23050f3dc5cb3cc997c6e6f76be8a94b [file] [log] [blame]
Yuto Takano39639672021-08-05 19:47:48 +01001#!/usr/bin/env python3
2#
3# Copyright The Mbed TLS Contributors
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
Darryl Greend5802922018-05-08 15:30:59 +010018"""
Yuto Takano39639672021-08-05 19:47:48 +010019This script confirms that the naming of all symbols and identifiers in Mbed TLS
20are consistent with the house style and are also self-consistent.
Darryl Greend5802922018-05-08 15:30:59 +010021"""
Yuto Takano39639672021-08-05 19:47:48 +010022
23import argparse
24import textwrap
Darryl Greend5802922018-05-08 15:30:59 +010025import os
26import sys
27import traceback
28import re
29import shutil
30import subprocess
31import logging
32
Yuto Takano39639672021-08-05 19:47:48 +010033# Naming patterns to check against
Yuto Takanobb7dca42021-08-05 19:57:58 +010034MACRO_PATTERN = r"^(MBEDTLS|PSA)_[0-9A-Z_]*[0-9A-Z]$"
Yuto Takanoc1838932021-08-05 19:52:09 +010035IDENTIFIER_PATTERN = r"^(mbedtls|psa)_[0-9a-z_]*[0-9a-z]$"
Yuto Takano39639672021-08-05 19:47:48 +010036
37class Match(object):
38 def __init__(self, filename, line, pos, name):
39 self.filename = filename
40 self.line = line
41 self.pos = pos
42 self.name = name
43
44 def __str__(self):
45 return self.name
46
47class Problem(object):
48 def __init__(self):
49 self.textwrapper = textwrap.TextWrapper()
50 self.textwrapper.initial_indent = " * "
51 self.textwrapper.subsequent_indent = " "
52
53class SymbolNotInHeader(Problem):
54 def __init__(self, symbol_name):
55 self.symbol_name = symbol_name
56 Problem.__init__(self)
57
58 def __str__(self):
59 return self.textwrapper.fill(
60 "'{0}' was found as an available symbol in the output of nm, "
61 "however it was not declared in any header files."
62 .format(self.symbol_name))
63
64class PatternMismatch(Problem):
65 def __init__(self, pattern, match):
66 self.pattern = pattern
67 self.match = match
68 Problem.__init__(self)
69
70 def __str__(self):
71 return self.textwrapper.fill(
72 "{0}: '{1}' does not match the required pattern '{2}'."
73 .format(self.match.filename, self.match.name, self.pattern))
74
75class Typo(Problem):
76 def __init__(self, match):
77 self.match = match
78 Problem.__init__(self)
79
80 def __str__(self):
81 return self.textwrapper.fill(
82 "{0}: '{1}' looks like a typo. It was not found in any macros or "
83 "any enums. If this is not a typo, put //no-check-names after it."
84 .format(self.match.filename, self.match.name))
Darryl Greend5802922018-05-08 15:30:59 +010085
86class NameCheck(object):
87 def __init__(self):
88 self.log = None
Darryl Greend5802922018-05-08 15:30:59 +010089 self.check_repo_path()
90 self.return_code = 0
Yuto Takanoe503d612021-08-05 20:14:05 +010091 self.excluded_files = ["bn_mul"]
Darryl Greend5802922018-05-08 15:30:59 +010092
93 def set_return_code(self, return_code):
94 if return_code > self.return_code:
95 self.return_code = return_code
96
Yuto Takano39639672021-08-05 19:47:48 +010097 def setup_logger(self, verbose=False):
98 """
99 Set up a logger and set the change the default logging level from
100 WARNING to INFO. Loggers are better than print statements since their
101 verbosity can be controlled.
102 """
Darryl Greend5802922018-05-08 15:30:59 +0100103 self.log = logging.getLogger()
Yuto Takano39639672021-08-05 19:47:48 +0100104 if verbose:
105 self.log.setLevel(logging.DEBUG)
106 else:
107 self.log.setLevel(logging.INFO)
Darryl Greend5802922018-05-08 15:30:59 +0100108 self.log.addHandler(logging.StreamHandler())
109
110 def check_repo_path(self):
Yuto Takano39639672021-08-05 19:47:48 +0100111 """
112 Check that the current working directory is the project root, and throw
113 an exception if not.
114 """
Darryl Greend5802922018-05-08 15:30:59 +0100115 current_dir = os.path.realpath('.')
116 root_dir = os.path.dirname(os.path.dirname(
117 os.path.dirname(os.path.realpath(__file__))))
118 if current_dir != root_dir:
119 raise Exception("Must be run from Mbed TLS root")
120
Yuto Takano157444c2021-08-05 20:10:45 +0100121 def get_files(self, extension, directory):
Darryl Greend5802922018-05-08 15:30:59 +0100122 filenames = []
123 for root, dirs, files in sorted(os.walk(directory)):
124 for filename in sorted(files):
125 if (filename not in self.excluded_files and
Yuto Takano157444c2021-08-05 20:10:45 +0100126 filename.endswith("." + extension)):
Darryl Greend5802922018-05-08 15:30:59 +0100127 filenames.append(os.path.join(root, filename))
128 return filenames
129
Yuto Takano39639672021-08-05 19:47:48 +0100130 def parse_macros(self, header_files):
131 """
132 Parse all macros defined by #define preprocessor directives.
133
134 Args:
135 header_files: A list of filepaths to look through.
136
137 Returns:
138 A list of Match objects for the macros.
139 """
140 MACRO_REGEX = r"#define (?P<macro>\w+)"
141 NON_MACROS = (
142 "asm", "inline", "EMIT", "_CRT_SECURE_NO_DEPRECATE", "MULADDC_"
143 )
144
145 macros = []
146
147 for header_file in header_files:
Darryl Greend5802922018-05-08 15:30:59 +0100148 with open(header_file, "r") as header:
Yuto Takano39639672021-08-05 19:47:48 +0100149 for line in header:
150 macro = re.search(MACRO_REGEX, line)
151 if (macro and
152 not macro.group("macro").startswith(NON_MACROS)):
153 macros.append(Match(
154 header_file,
155 line,
156 (macro.start(), macro.end()),
157 macro.group("macro")))
Darryl Greend5802922018-05-08 15:30:59 +0100158
Yuto Takano39639672021-08-05 19:47:48 +0100159 return macros
Darryl Greend5802922018-05-08 15:30:59 +0100160
Yuto Takanobb7dca42021-08-05 19:57:58 +0100161 def parse_MBED_names(self, files):
Yuto Takano39639672021-08-05 19:47:48 +0100162 """
163 Parse all words in the file that begin with MBED. Includes macros.
164
165 Args:
Yuto Takanobb7dca42021-08-05 19:57:58 +0100166 files: A list of filepaths to look through.
Yuto Takano39639672021-08-05 19:47:48 +0100167
168 Returns:
169 A list of Match objects for words beginning with MBED.
170 """
171 MBED_names = []
172
Yuto Takanobb7dca42021-08-05 19:57:58 +0100173 for filename in files:
Yuto Takano39639672021-08-05 19:47:48 +0100174 with open(filename, "r") as fp:
175 for line in fp:
Yuto Takanoc62b4082021-08-05 20:17:07 +0100176 # Ignore any names that are deliberately opted-out
177 if re.search(r"// *no-check-names", line):
178 continue
179
Yuto Takano39639672021-08-05 19:47:48 +0100180 for name in re.finditer(r"\bMBED.+?_[A-Z0-9_]*", line):
181 MBED_names.append(Match(
182 filename,
183 line,
184 (name.start(), name.end()),
185 name.group(0)
186 ))
187
188 return MBED_names
189
190 def parse_enum_consts(self, header_files):
191 """
192 Parse all enum value constants that are declared.
193
194 Args:
195 header_files: A list of filepaths to look through.
196
197 Returns:
198 A list of (enum constants, containing filename).
199 """
200
201 enum_consts = []
202
203 for header_file in header_files:
204 # Emulate a finite state machine to parse enum declarations.
Darryl Greend5802922018-05-08 15:30:59 +0100205 state = 0
206 with open(header_file, "r") as header:
Yuto Takano39639672021-08-05 19:47:48 +0100207 for line in header:
Darryl Greend5802922018-05-08 15:30:59 +0100208 if state is 0 and re.match(r"^(typedef )?enum {", line):
209 state = 1
210 elif state is 0 and re.match(r"^(typedef )?enum", line):
211 state = 2
212 elif state is 2 and re.match(r"^{", line):
213 state = 1
214 elif state is 1 and re.match(r"^}", line):
215 state = 0
Yuto Takano0fd48f72021-08-05 20:32:55 +0100216 elif state is 1 and not re.match(r"^#", line):
Darryl Greend5802922018-05-08 15:30:59 +0100217 enum_const = re.match(r"^\s*(?P<enum_const>\w+)", line)
218 if enum_const:
Yuto Takano39639672021-08-05 19:47:48 +0100219 enum_consts.append(Match(
220 header_file,
221 line,
222 (enum_const.start(), enum_const.end()),
223 enum_const.group("enum_const")))
224
225 return enum_consts
Darryl Greend5802922018-05-08 15:30:59 +0100226
Yuto Takano39639672021-08-05 19:47:48 +0100227 def parse_identifiers(self, header_files):
228 """
229 Parse all lines of a header where a function identifier is declared,
230 based on some huersitics. Assumes every line that is not a comment or a
231 preprocessor directive contains some identifier.
Darryl Greend5802922018-05-08 15:30:59 +0100232
Yuto Takano39639672021-08-05 19:47:48 +0100233 Args:
234 header_files: A list of filepaths to look through.
235
236 Returns:
237 A list of (identifier, containing filename)
238 """
239 EXCLUDED_DECLARATIONS = (
Yuto Takano6f38ab32021-08-05 21:07:14 +0100240 r"^(extern \"C\"|(typedef )?(struct|union|enum)( {)?$|};?$|$)"
Darryl Greend5802922018-05-08 15:30:59 +0100241 )
Darryl Greend5802922018-05-08 15:30:59 +0100242
Yuto Takano39639672021-08-05 19:47:48 +0100243 identifiers = []
244
245 for header_file in header_files:
Darryl Greend5802922018-05-08 15:30:59 +0100246 with open(header_file, "r") as header:
Yuto Takano39639672021-08-05 19:47:48 +0100247 in_block_comment = False
Darryl Greend5802922018-05-08 15:30:59 +0100248
Yuto Takano39639672021-08-05 19:47:48 +0100249 for line in header:
250 # Skip parsing this line if it begins or ends a block
251 # comment, and set the state machine's state.
252 if re.search(r"/\*", line):
253 in_block_comment = True
254 continue
255 elif re.search(r"\*/", line) and in_block_comment:
256 in_block_comment = False
257 continue
258
259 # Skip parsing this line if it's a line comment, or if it
260 # begins with a preprocessor directive
Yuto Takano6f38ab32021-08-05 21:07:14 +0100261 if in_block_comment or re.match(r"^(//|#)", line):
Yuto Takano39639672021-08-05 19:47:48 +0100262 continue
263
264 if re.match(EXCLUDED_DECLARATIONS, line):
265 continue
Yuto Takano6f38ab32021-08-05 21:07:14 +0100266
Yuto Takano39639672021-08-05 19:47:48 +0100267 identifier = re.search(
268 # Matches: "mbedtls_aes_init("
Yuto Takano6f38ab32021-08-05 21:07:14 +0100269 r"([a-zA-Z_][a-zA-Z0-9_]*)\(",
Yuto Takano39639672021-08-05 19:47:48 +0100270 line
271 )
272
273 if identifier:
274 for group in identifier.groups():
275 if group:
276 identifiers.append(Match(
277 header_file,
278 line,
279 (identifier.start(), identifier.end()),
Yuto Takano6f38ab32021-08-05 21:07:14 +0100280 identifier.group(1)))
Yuto Takano39639672021-08-05 19:47:48 +0100281
282 return identifiers
283
284 def parse_symbols(self):
285 """
286 Compile the Mbed TLS libraries, and parse the TLS, Crypto, and x509
287 object files using nm to retrieve the list of referenced symbols.
288
289 Returns:
290 A list of unique symbols defined and used in the libraries.
291 """
292
293 symbols = []
294
295 # Back up the config and atomically compile with the full configratuion.
296 shutil.copy("include/mbedtls/mbedtls_config.h",
297 "include/mbedtls/mbedtls_config.h.bak")
Darryl Greend5802922018-05-08 15:30:59 +0100298 try:
Yuto Takano39639672021-08-05 19:47:48 +0100299 subprocess.run(
Yuto Takano062289c2021-08-05 20:19:57 +0100300 ["perl", "scripts/config.py", "full"],
Yuto Takano39639672021-08-05 19:47:48 +0100301 encoding=sys.stdout.encoding,
302 check=True
Darryl Greend5802922018-05-08 15:30:59 +0100303 )
304 my_environment = os.environ.copy()
305 my_environment["CFLAGS"] = "-fno-asynchronous-unwind-tables"
Yuto Takano39639672021-08-05 19:47:48 +0100306 subprocess.run(
Darryl Greend5802922018-05-08 15:30:59 +0100307 ["make", "clean", "lib"],
308 env=my_environment,
Yuto Takano39639672021-08-05 19:47:48 +0100309 encoding=sys.stdout.encoding,
310 stdout=subprocess.PIPE,
Darryl Greend5802922018-05-08 15:30:59 +0100311 stderr=subprocess.STDOUT,
Yuto Takano39639672021-08-05 19:47:48 +0100312 check=True
Darryl Greend5802922018-05-08 15:30:59 +0100313 )
Yuto Takano39639672021-08-05 19:47:48 +0100314
315 # Perform object file analysis using nm
316 symbols = self.parse_symbols_from_nm(
317 ["library/libmbedcrypto.a",
318 "library/libmbedtls.a",
319 "library/libmbedx509.a"])
320
321 symbols.sort()
322
323 subprocess.run(
Darryl Greend5802922018-05-08 15:30:59 +0100324 ["make", "clean"],
Yuto Takano39639672021-08-05 19:47:48 +0100325 encoding=sys.stdout.encoding,
326 check=True
Darryl Greend5802922018-05-08 15:30:59 +0100327 )
328 except subprocess.CalledProcessError as error:
329 self.log.error(error)
330 self.set_return_code(2)
Yuto Takano39639672021-08-05 19:47:48 +0100331 finally:
332 shutil.move("include/mbedtls/mbedtls_config.h.bak",
333 "include/mbedtls/mbedtls_config.h")
334
335 return symbols
336
337 def parse_symbols_from_nm(self, object_files):
338 """
339 Run nm to retrieve the list of referenced symbols in each object file.
340 Does not return the position data since it is of no use.
341
342 Returns:
343 A list of unique symbols defined and used in any of the object files.
344 """
345 UNDEFINED_SYMBOL = r"^\S+: +U |^$|^\S+:$"
346 VALID_SYMBOL = r"^\S+( [0-9A-Fa-f]+)* . _*(?P<symbol>\w+)"
Yuto Takanoe77f6992021-08-05 20:22:59 +0100347 EXCLUSIONS = ("FStar", "Hacl")
Yuto Takano39639672021-08-05 19:47:48 +0100348
349 symbols = []
350
351 nm_output = ""
352 for lib in object_files:
353 nm_output += subprocess.run(
354 ["nm", "-og", lib],
355 encoding=sys.stdout.encoding,
356 stdout=subprocess.PIPE,
357 stderr=subprocess.STDOUT,
358 check=True
359 ).stdout
360 for line in nm_output.splitlines():
361 if not re.match(UNDEFINED_SYMBOL, line):
362 symbol = re.match(VALID_SYMBOL, line)
Yuto Takanoe77f6992021-08-05 20:22:59 +0100363 if symbol and not symbol.group("symbol").startswith(EXCLUSIONS):
364 symbols.append(symbol.group("symbol"))
Yuto Takano39639672021-08-05 19:47:48 +0100365 else:
366 self.log.error(line)
367
368 return symbols
369
370 def parse_names_in_source(self):
371 """
372 Calls each parsing function to retrieve various elements of the code,
373 together with their source location. Puts the parsed values in the
374 internal variable self.parse_result.
375 """
376 self.log.info("Parsing source code...")
377
Yuto Takano157444c2021-08-05 20:10:45 +0100378 m_headers = self.get_files("h", os.path.join("include", "mbedtls"))
379 p_headers = self.get_files("h", os.path.join("include", "psa"))
Yuto Takanofa950ae2021-08-05 20:03:44 +0100380 t_headers = ["3rdparty/everest/include/everest/everest.h",
381 "3rdparty/everest/include/everest/x25519.h"]
Yuto Takano56e3a5c2021-08-05 20:29:42 +0100382 d_headers = self.get_files("h", os.path.join("tests", "include", "test", "drivers"))
Yuto Takano157444c2021-08-05 20:10:45 +0100383 l_headers = self.get_files("h", "library")
384 libraries = self.get_files("c", "library") + [
Yuto Takanofa950ae2021-08-05 20:03:44 +0100385 "3rdparty/everest/library/everest.c",
386 "3rdparty/everest/library/x25519.c"]
Yuto Takano39639672021-08-05 19:47:48 +0100387
Yuto Takanobb7dca42021-08-05 19:57:58 +0100388 all_macros = self.parse_macros(
Yuto Takano56e3a5c2021-08-05 20:29:42 +0100389 m_headers + p_headers + t_headers + l_headers + d_headers)
Yuto Takanofe026842021-08-05 20:34:24 +0100390 enum_consts = self.parse_enum_consts(m_headers + l_headers + t_headers)
Yuto Takano17220982021-08-05 20:30:18 +0100391 identifiers = self.parse_identifiers(m_headers + p_headers + t_headers + l_headers)
Yuto Takano39639672021-08-05 19:47:48 +0100392 symbols = self.parse_symbols()
Yuto Takanofa950ae2021-08-05 20:03:44 +0100393 mbed_names = self.parse_MBED_names(
Yuto Takano157444c2021-08-05 20:10:45 +0100394 m_headers + p_headers + t_headers + l_headers + libraries)
Yuto Takano39639672021-08-05 19:47:48 +0100395
396 # Remove identifier macros like mbedtls_printf or mbedtls_calloc
397 macros = list(set(all_macros) - set(identifiers))
398
399 self.log.info("Found:")
400 self.log.info(" {} Macros".format(len(all_macros)))
401 self.log.info(" {} Enum Constants".format(len(enum_consts)))
402 self.log.info(" {} Identifiers".format(len(identifiers)))
403 self.log.info(" {} Exported Symbols".format(len(symbols)))
404 self.log.info("Analysing...")
405
406 self.parse_result = {
407 "macros": macros,
408 "enum_consts": enum_consts,
409 "identifiers": identifiers,
410 "symbols": symbols,
411 "mbed_names": mbed_names
412 }
413
414 def perform_checks(self):
415 """
416 Perform each check in order, output its PASS/FAIL status. Maintain an
417 overall test status, and output that at the end.
418 """
419 problems = 0
420
421 problems += self.check_symbols_declared_in_header()
422
423 pattern_checks = [
424 ("macros", MACRO_PATTERN),
425 ("enum_consts", MACRO_PATTERN),
426 ("identifiers", IDENTIFIER_PATTERN)]
427 for group, check_pattern in pattern_checks:
428 problems += self.check_match_pattern(group, check_pattern)
429
430 problems += self.check_for_typos()
431
432 self.log.info("=============")
433 if problems > 0:
434 self.log.info("FAIL: {0} problem(s) to fix".format(str(problems)))
435 else:
436 self.log.info("PASS")
Darryl Greend5802922018-05-08 15:30:59 +0100437
438 def check_symbols_declared_in_header(self):
Yuto Takano39639672021-08-05 19:47:48 +0100439 """
440 Perform a check that all detected symbols in the library object files
441 are properly declared in headers.
442
443 Outputs to the logger the PASS/FAIL status, followed by the location of
444 problems.
Darryl Greend5802922018-05-08 15:30:59 +0100445
Yuto Takano39639672021-08-05 19:47:48 +0100446 Returns the number of problems that needs fixing.
447 """
448 problems = []
449 for symbol in self.parse_result["symbols"]:
450 found_symbol_declared = False
451 for identifier_match in self.parse_result["identifiers"]:
452 if symbol == identifier_match.name:
453 found_symbol_declared = True
454 break
455
456 if not found_symbol_declared:
457 problems.append(SymbolNotInHeader(symbol))
458
459 if problems:
Darryl Greend5802922018-05-08 15:30:59 +0100460 self.set_return_code(1)
Yuto Takano39639672021-08-05 19:47:48 +0100461 self.log.info("All symbols in header: FAIL")
462 for problem in problems:
463 self.log.info(str(problem) + "\n")
Darryl Greend5802922018-05-08 15:30:59 +0100464 else:
Yuto Takano39639672021-08-05 19:47:48 +0100465 self.log.info("All symbols in header: PASS")
466
467 return len(problems)
468
469 def check_match_pattern(self, group_to_check, check_pattern):
470 problems = []
471 for item_match in self.parse_result[group_to_check]:
472 if not re.match(check_pattern, item_match.name):
473 problems.append(PatternMismatch(check_pattern, item_match))
Yuto Takanoc763cc32021-08-05 20:06:34 +0100474 if re.match(r".*__.*", item_match.name):
475 problems.append(PatternMismatch("double underscore", item_match))
Yuto Takano39639672021-08-05 19:47:48 +0100476
477 if problems:
478 self.set_return_code(1)
479 self.log.info("Naming patterns of {}: FAIL".format(group_to_check))
480 for problem in problems:
481 self.log.info(str(problem) + "\n")
482 else:
483 self.log.info("Naming patterns of {}: PASS".format(group_to_check))
484
485 return len(problems)
Darryl Greend5802922018-05-08 15:30:59 +0100486
487 def check_for_typos(self):
Yuto Takano39639672021-08-05 19:47:48 +0100488 problems = []
489 all_caps_names = list(set([
490 match.name for match
491 in self.parse_result["macros"] + self.parse_result["enum_consts"]]
Darryl Greend5802922018-05-08 15:30:59 +0100492 ))
Yuto Takano39639672021-08-05 19:47:48 +0100493
494 TYPO_EXCLUSION = r"XXX|__|_$|^MBEDTLS_.*CONFIG_FILE$"
495
496 for name_match in self.parse_result["mbed_names"]:
497 if name_match.name not in all_caps_names:
498 if not re.search(TYPO_EXCLUSION, name_match.name):
499 problems.append(Typo(name_match))
500
501 if problems:
Darryl Greend5802922018-05-08 15:30:59 +0100502 self.set_return_code(1)
503 self.log.info("Likely typos: FAIL")
Yuto Takano39639672021-08-05 19:47:48 +0100504 for problem in problems:
505 self.log.info(str(problem) + "\n")
Darryl Greend5802922018-05-08 15:30:59 +0100506 else:
507 self.log.info("Likely typos: PASS")
Yuto Takano39639672021-08-05 19:47:48 +0100508
509 return len(problems)
Darryl Greend5802922018-05-08 15:30:59 +0100510
Yuto Takano39639672021-08-05 19:47:48 +0100511def main():
512 """
513 Main function, parses command-line arguments.
514 """
Darryl Greend5802922018-05-08 15:30:59 +0100515
Yuto Takano39639672021-08-05 19:47:48 +0100516 parser = argparse.ArgumentParser(
517 formatter_class=argparse.RawDescriptionHelpFormatter,
518 description=(
519 "This script confirms that the naming of all symbols and identifiers "
520 "in Mbed TLS are consistent with the house style and are also "
521 "self-consistent.\n\n"
522 "Expected to be run from the MbedTLS root directory."))
Darryl Greend5802922018-05-08 15:30:59 +0100523
Yuto Takano39639672021-08-05 19:47:48 +0100524 parser.add_argument("-v", "--verbose",
525 action="store_true",
526 help="enable script debug outputs")
527
528 args = parser.parse_args()
Darryl Greend5802922018-05-08 15:30:59 +0100529
Darryl Greend5802922018-05-08 15:30:59 +0100530 try:
531 name_check = NameCheck()
Yuto Takano39639672021-08-05 19:47:48 +0100532 name_check.setup_logger(verbose=args.verbose)
533 name_check.parse_names_in_source()
534 name_check.perform_checks()
Darryl Greend5802922018-05-08 15:30:59 +0100535 sys.exit(name_check.return_code)
536 except Exception:
537 traceback.print_exc()
538 sys.exit(2)
539
540
541if __name__ == "__main__":
Yuto Takano39639672021-08-05 19:47:48 +0100542 main()