From 08d9e32e6318bc62171cf62bc38d70cd054f19be Mon Sep 17 00:00:00 2001 From: Brian Daniels Date: Thu, 21 Mar 2019 20:27:59 -0500 Subject: [PATCH] Add utility functions and Exceptions These functions will be used to handle some of the error state and warning messages produced when the scripts attempt to select a valid toolchain. --- tools/utils.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/utils.py b/tools/utils.py index 37d6c885f7..21423c07d7 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -296,6 +296,11 @@ class NotSupportedException(Exception): class InvalidReleaseTargetException(Exception): pass +class NoValidToolchainException(Exception): + """A class representing no valid toolchain configurations found on + the system""" + pass + def split_path(path): """spilt a file name into it's directory name, base name, and extension @@ -597,3 +602,16 @@ def generate_update_filename(name, target): name, getattr(target, "OUTPUT_EXT_UPDATE", "bin") ) + +def print_end_warnings(end_warnings): + """ Print a formatted list of warnings + + Positional arguments: + end_warnings - A list of warnings (strings) to print + """ + if end_warnings: + warning_separator = "-" * 60 + print(warning_separator) + for end_warning in end_warnings: + print(end_warning) + print(warning_separator)