Skip to content

Commit

Permalink
ci(arduino_cli): ensure configuration exists
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Oct 21, 2021
1 parent 150acb8 commit feaa991
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion CI/build/arduino-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,17 @@ def check_config():
except subprocess.CalledProcessError as e:
print(f"'{' '.join(e.cmd)}' failed with code: {e.returncode}!")
print(e.stdout.decode("utf-8"))
quit(e.returncode)
# Ensure a configuration exists
try:
print("Try to create configuration file...")
output = subprocess.check_output(
[arduino_cli, "config", "init", "--additional-urls", stm32_url],
stderr=subprocess.STDOUT,
).decode("utf-8")
except subprocess.CalledProcessError as e:
print(f"'{' '.join(e.cmd)}' failed with code: {e.returncode}!")
print(e.stdout.decode("utf-8"))
quit(e.returncode)
else:
if stm32_url not in output.decode("utf-8"):
# Add it to the config
Expand Down

0 comments on commit feaa991

Please sign in to comment.