Skip to content

Commit

Permalink
Merge pull request #1116 from fpistm/CI_dev
Browse files Browse the repository at this point in the history
[CI] Add url option
  • Loading branch information
fpistm authored Jul 9, 2020
2 parents cfc2de7 + 422fde9 commit 2d498c7
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions CI/build/arduino-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -198,11 +200,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"))
Expand All @@ -215,14 +217,17 @@ 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],
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"):
Expand All @@ -232,13 +237,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)
Expand Down Expand Up @@ -465,7 +470,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)
Expand All @@ -488,7 +493,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)
Expand Down Expand Up @@ -874,6 +879,12 @@ def build(build_conf):
+ cores_config_file_default,
)

parser.add_argument(
"-u", "--url", metavar="<string>", 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"
)
Expand Down

0 comments on commit 2d498c7

Please sign in to comment.