From 011addbdd27dd337e0fc2db4805877c37d853ec7 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 8 Jul 2020 16:44:20 +0200 Subject: [PATCH 1/2] [CI] Fix stderr output Signed-off-by: Frederic Pillon --- CI/build/arduino-cli.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CI/build/arduino-cli.py b/CI/build/arduino-cli.py index fb4c8b0423..67196109f0 100644 --- a/CI/build/arduino-cli.py +++ b/CI/build/arduino-cli.py @@ -198,11 +198,11 @@ def check_config(): try: output = subprocess.check_output( - [arduino_cli, "version"], stderr=subprocess.DEVNULL, + [arduino_cli, "version"], stderr=subprocess.STDOUT, ) except subprocess.CalledProcessError as e: print('"' + " ".join(e.cmd) + '" failed with code: {}!'.format(e.returncode)) - print(e.stdout) + print(e.stdout.decode("utf-8")) quit(e.returncode) else: res = re.match(r".*Version:\s+(\d+\.\d+\.\d+).*", output.decode("utf-8")) @@ -218,11 +218,11 @@ def check_config(): try: output = subprocess.check_output( [arduino_cli, "core", "search", "stm32", "--additional-urls", stm32_url], - stderr=subprocess.DEVNULL, + stderr=subprocess.STDOUT, ) except subprocess.CalledProcessError as e: print('"' + " ".join(e.cmd) + '" failed with code: {}!'.format(e.returncode)) - print(e.stdout) + print(e.stdout.decode("utf-8")) quit(e.returncode) else: if arduino_platform not in output.decode("utf-8"): @@ -232,13 +232,13 @@ def check_config(): try: output = subprocess.check_output( [arduino_cli, "config", "dump", "--format", "json"], - stderr=subprocess.DEVNULL, + stderr=subprocess.STDOUT, ).decode("utf-8") except subprocess.CalledProcessError as e: print( '"' + " ".join(e.cmd) + '" failed with code: {}!'.format(e.returncode) ) - print(e.stdout) + print(e.stdout.decode("utf-8")) quit(e.returncode) else: cli_config = json.loads(output) @@ -465,7 +465,7 @@ def find_board(): ).decode("utf-8") except subprocess.CalledProcessError as e: print('"' + " ".join(e.cmd) + '" failed with code: {}!'.format(e.returncode)) - print(e.stdout) + print(e.stdout.decode("utf-8")) quit(e.returncode) else: boards_list = json.loads(output) @@ -488,7 +488,7 @@ def find_board(): print( '"' + " ".join(e.cmd) + '" failed with code: {}!'.format(e.returncode) ) - print(e.stdout) + print(e.stdout.decode("utf-8")) quit(e.returncode) else: board_detail = json.loads(output) From 422fde95f9613b37b071973dae615fc3825749f6 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 8 Jul 2020 16:45:27 +0200 Subject: [PATCH 2/2] [CI] Add url option Allow to change the default url for the board manager Signed-off-by: Frederic Pillon --- CI/build/arduino-cli.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CI/build/arduino-cli.py b/CI/build/arduino-cli.py index 67196109f0..a045b19e38 100644 --- a/CI/build/arduino-cli.py +++ b/CI/build/arduino-cli.py @@ -161,6 +161,8 @@ def check_config(): global root_output_dir global output_dir global log_file + global stm32_url + if args.ci is False: if os.path.isfile(path_config_filename): try: @@ -215,6 +217,9 @@ def check_config(): + arduino_cli_default_version ) + if args.url: + stm32_url = args.url + try: output = subprocess.check_output( [arduino_cli, "core", "search", "stm32", "--additional-urls", stm32_url], @@ -874,6 +879,12 @@ def build(build_conf): + cores_config_file_default, ) +parser.add_argument( + "-u", "--url", metavar="", help="additional URL for the board manager\ + Default url : " + + stm32_url, +) + parser.add_argument( "-v", "--verbose", help="enable arduino-cli verbose mode", action="store_true" )