Skip to content

Commit fdca194

Browse files
committed
adds support for arduino-cli 0.30.0
1 parent d0ac344 commit fdca194

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ jobs:
5353
python-version: ${{ matrix.python }}
5454
- name: Download arduino-cli
5555
run: |
56-
wget https://github.com/arduino/arduino-cli/releases/download/0.29.0/arduino-cli_0.29.0_Linux_64bit.tar.gz
57-
tar xzf arduino-cli_0.29.0_Linux_64bit.tar.gz
58-
rm arduino-cli_0.29.0_Linux_64bit.tar.gz
56+
wget https://github.com/arduino/arduino-cli/releases/download/0.30.0/arduino-cli_0.30.0_Linux_64bit.tar.gz
57+
tar xzf arduino-cli_0.30.0_Linux_64bit.tar.gz
58+
rm arduino-cli_0.30.0_Linux_64bit.tar.gz
5959
- name: Install test dependencies
6060
run: |
6161
pip install pytest

pyduinocli/commands/board.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def details(self, fqbn, full=None, list_programmers=None, board_options=None):
5757
:param full: Show full board details
5858
:type full: bool or NoneTYpe
5959
:param list_programmers: Show list of available programmers
60-
:type list_programmers: bool or NoneTYpe
60+
:type list_programmers: bool or NoneType
6161
:param board_options: Board options
62-
:type board_options: dict or NoneTYpe
62+
:type board_options: dict or NoneType
6363
:return: The output of the related command
6464
:rtype: dict
6565
"""
@@ -74,14 +74,18 @@ def details(self, fqbn, full=None, list_programmers=None, board_options=None):
7474
args.extend([flags.BOARD_OPTIONS, option])
7575
return self._exec(args)
7676

77-
def list(self, discovery_timeout=None, watch=None):
77+
def list(self, discovery_timeout=None, watch=None, board_options=None, fqbn=None):
7878
"""
7979
Calls the :code:`board list` command.
8080
8181
:param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 1s)
8282
:type discovery_timeout: str or NoneType
8383
:param watch: Command keeps running and prints list of connected boards whenever there is a change. Added to pyduinocli for completion but won't actually return, use a loop instead
8484
:type watch: bool or NoneTYpe
85+
:param fqbn: Fully Qualified Board Name, e.g.: arduino:avr:uno
86+
:type fqbn: str or NoneType
87+
:param board_options: Dict of board options (option_name:value)
88+
:type board_options: dict or NoneType
8589
:return: The output of the related command
8690
:rtype: dict
8791
"""
@@ -90,6 +94,12 @@ def list(self, discovery_timeout=None, watch=None):
9094
args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)])
9195
if watch is True:
9296
args.append(flags.WATCH)
97+
if fqbn is not None:
98+
args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)])
99+
if board_options:
100+
for option_name, option_value in board_options.items():
101+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
102+
args.extend([flags.BOARD_OPTIONS, option])
93103
return self._exec(args)
94104

95105
def listall(self, boardname=None, show_hidden=None):

pyduinocli/commands/daemon.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, base_args):
1212
CommandBase.__init__(self, base_args)
1313
self._base_args.append(commands.DAEMON)
1414

15-
def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, ip=None, debug_file=None):
15+
def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, debug_file=None):
1616
"""
1717
Calls the :code:`daemon` command
1818
@@ -24,8 +24,6 @@ def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, ip=
2424
:type debug: bool or NoneType
2525
:param debug_filter: Display only the provided gRPC calls
2626
:type debug_filter: str or NoneType
27-
:param ip: The IP address the daemon will listen to (default "127.0.0.1")
28-
:type ip: str or NoneType
2927
:param debug_file: Append debug logging to the specified file
3028
:type debug_file: str or NoneType
3129
:return: The output of the related command

pyduinocli/commands/sketch.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ def __init__(self, base_args):
1212
CommandBase.__init__(self, base_args)
1313
self._base_args.append(commands.SKETCH)
1414

15-
def new(self, name):
15+
def new(self, name, overwrite=None):
1616
"""
1717
Calls the :code:`sketch new` command
1818
1919
:param name: The name of the sketch to create
2020
:type name: str
21+
:param overwrite: Overwrites an existing .ino sketch.
22+
:type overwrite: bool or NoneType
2123
:return: The output of the related command
2224
:rtype: dict
2325
"""
24-
return self._exec([commands.NEW, CommandBase._strip_arg(name)])
26+
args = [commands.NEW, CommandBase._strip_arg(name)]
27+
if overwrite is True:
28+
args.append(flags.OVERWRITE)
29+
return self._exec(args)
2530

26-
def archive(self, sketch_path=".", archive_path=None, include_build_dir=None):
31+
def archive(self, sketch_path=".", archive_path=None, include_build_dir=None, overwrite=None):
2732
"""
2833
Calls the :code:`sketch archive` command
2934
@@ -33,6 +38,8 @@ def archive(self, sketch_path=".", archive_path=None, include_build_dir=None):
3338
:type archive_path: str or NoneType
3439
:param include_build_dir: Includes the build directory in the archive
3540
:type include_build_dir: bool or NoneType
41+
:param overwrite: Overwrites an already existing archive
42+
:type overwrite: bool or NoneType
3643
:return: The output of the related command
3744
:rtype: dict
3845
"""
@@ -41,4 +48,6 @@ def archive(self, sketch_path=".", archive_path=None, include_build_dir=None):
4148
args.append(CommandBase._strip_arg(archive_path))
4249
if include_build_dir is True:
4350
args.append(flags.INCLUDE_BUILD_DIR)
51+
if overwrite is True:
52+
args.append(flags.OVERWRITE)
4453
return self._exec(args)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def get_long_description():
88

99
setuptools.setup(
1010
name="pyduinocli",
11-
version="0.25.0",
11+
version="0.30.0",
1212
author="Renaud Gaspard",
1313
author_email="gaspardrenaud@hotmail.com",
1414
description="Wrapper library around arduino-cli",

0 commit comments

Comments
 (0)