From dcc9459690972a7889bb6e1a01b54e60ff779147 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Wed, 5 Jun 2019 14:16:19 +0700 Subject: [PATCH] tools, ci: Use non-interactive mode for idf_tools in CI --- .gitlab-ci.yml | 3 +-- tools/idf_tools.py | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b2acd481..398c5b6c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,8 +74,7 @@ variables: rm -rf "$CUSTOM_TOOLCHAIN_PATH" .setup_tools: &setup_tools | - tools/idf_tools.py install && - eval "$(tools/idf_tools.py export)" + tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1 before_script: - source tools/ci/setup_python.sh diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 362a5f46b..d53e036bf 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -128,6 +128,7 @@ EXPORT_KEY_VALUE = 'key-value' global_quiet = False +global_non_interactive = False global_idf_path = None global_idf_tools_path = None global_tools_json = None @@ -521,7 +522,7 @@ class IDFTool(object): for retry in range(DOWNLOAD_RETRY_COUNT): local_temp_path = local_path + '.tmp' info('Downloading {} to {}'.format(archive_name, local_temp_path)) - urlretrieve(url, local_temp_path, report_progress) + urlretrieve(url, local_temp_path, report_progress if not global_non_interactive else None) sys.stdout.write("\rDone\n") sys.stdout.flush() if not self.check_download_file(download_obj, local_temp_path): @@ -1150,6 +1151,7 @@ def main(argv): parser = argparse.ArgumentParser() parser.add_argument('--quiet', help='Don\'t output diagnostic messages to stdout/stderr', action='store_true') + parser.add_argument('--non-interactive', help='Don\'t output interactive messages and questions', action='store_true') parser.add_argument('--tools-json', help='Path to the tools.json file to use') parser.add_argument('--idf-path', help='ESP-IDF path to use') @@ -1204,6 +1206,10 @@ def main(argv): global global_quiet global_quiet = True + if args.non_interactive: + global global_non_interactive + global_non_interactive = True + global global_idf_path global_idf_path = os.environ.get('IDF_PATH') if args.idf_path: