Skip to content

Commit 4cf542c

Browse files
committed
updated for version 0.22
1 parent e7d2fd0 commit 4cf542c

File tree

11 files changed

+93
-14
lines changed

11 files changed

+93
-14
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.21.0/arduino-cli_0.21.0_Linux_64bit.tar.gz
57-
tar xzf arduino-cli_0.21.0_Linux_64bit.tar.gz
58-
rm arduino-cli_0.21.0_Linux_64bit.tar.gz
56+
wget https://github.com/arduino/arduino-cli/releases/download/0.21.0/arduino-cli_0.22.0_Linux_64bit.tar.gz
57+
tar xzf arduino-cli_0.22.0_Linux_64bit.tar.gz
58+
rm arduino-cli_0.22.0_Linux_64bit.tar.gz
5959
- name: Install test dependencies
6060
run: |
6161
pip install pytest

pyduinocli/commands/board.py

Lines changed: 14 additions & 2 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.BOARD)
1414

15-
def attach(self, port=None, fqbn=None, sketch_path=None, discovery_timeout=None, protocol=None):
15+
def attach(self, port=None, fqbn=None, sketch_path=None, discovery_timeout=None, protocol=None, board_options=None):
1616
"""
1717
Calls the :code:`board attach` command.
1818
@@ -26,6 +26,8 @@ def attach(self, port=None, fqbn=None, sketch_path=None, discovery_timeout=None,
2626
:type discovery_timeout: str or NoneTYpe
2727
:param protocol: Upload port protocol, e.g: serial
2828
:type protocol: str or NoneTYpe
29+
:param board_options: Board options
30+
:type board_options: dict or NoneTYpe
2931
:return: The output of the related command
3032
:rtype: dict
3133
"""
@@ -40,9 +42,13 @@ def attach(self, port=None, fqbn=None, sketch_path=None, discovery_timeout=None,
4042
args.append(CommandBase._strip_arg(sketch_path))
4143
if discovery_timeout:
4244
args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)])
45+
if board_options:
46+
for option_name, option_value in board_options.items():
47+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
48+
args.extend([flags.BOARD_OPTIONS, option])
4349
return self._exec(args)
4450

45-
def details(self, fqbn, full=None, list_programmers=None):
51+
def details(self, fqbn, full=None, list_programmers=None, board_options=None):
4652
"""
4753
Calls the :code:`board details` command.
4854
@@ -52,6 +58,8 @@ def details(self, fqbn, full=None, list_programmers=None):
5258
:type full: bool or NoneTYpe
5359
:param list_programmers: Show list of available programmers
5460
:type list_programmers: bool or NoneTYpe
61+
:param board_options: Board options
62+
:type board_options: dict or NoneTYpe
5563
:return: The output of the related command
5664
:rtype: dict
5765
"""
@@ -60,6 +68,10 @@ def details(self, fqbn, full=None, list_programmers=None):
6068
args.append(flags.FULL)
6169
if list_programmers is True:
6270
args.append(flags.LIST_PROGRAMMERS)
71+
if board_options:
72+
for option_name, option_value in board_options.items():
73+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
74+
args.extend([flags.BOARD_OPTIONS, option])
6375
return self._exec(args)
6476

6577
def list(self, discovery_timeout=None, watch=None):

pyduinocli/commands/burn_bootloader.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ def __init__(self, base_args):
1212
CommandBase.__init__(self, base_args)
1313
self._base_args.append(commands.BURN_BOOTLOADER)
1414

15-
def __call__(self, discovery_timeout=None, fqbn=None, port=None, programmer=None, protocol=None, verify=None):
15+
def __call__(self,
16+
discovery_timeout=None, fqbn=None, port=None, programmer=None, protocol=None, verify=None,
17+
board_options=None):
1618
"""
1719
Calls the :code:`burn-bootloader` command
1820
@@ -28,6 +30,8 @@ def __call__(self, discovery_timeout=None, fqbn=None, port=None, programmer=None
2830
:type discovery_timeout: str or NoneType
2931
:param protocol: Upload port protocol, e.g: serial
3032
:type protocol: str or NoneType
33+
:param board_options: Board options
34+
:type board_options: dict or NoneTYpe
3135
:return: The output of the related command
3236
:rtype: dict
3337
"""
@@ -44,4 +48,8 @@ def __call__(self, discovery_timeout=None, fqbn=None, port=None, programmer=None
4448
args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)])
4549
if verify is True:
4650
args.append(flags.VERIFY)
51+
if board_options:
52+
for option_name, option_value in board_options.items():
53+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
54+
args.extend([flags.BOARD_OPTIONS, option])
4755
return self._exec(args)

pyduinocli/commands/compile.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def __call__(self,
1616
sketch, build_cache_path=None, build_path=None, build_properties=None, fqbn=None, output_dir=None,
1717
port=None, preprocess=None, show_properties=None, upload=None, verify=None, vid_pid=None,
1818
warnings=None, libraries=None, library=None, optimize_for_debug=None, export_binaries=None,
19-
programmer=None, clean=None, only_compilation_database=None, discovery_timeout=None, protocol=None):
19+
programmer=None, clean=None, only_compilation_database=None, discovery_timeout=None, protocol=None,
20+
board_options=None, encrypt_key=None, keys_keychain=None, sign_key=None):
2021
"""
2122
Calls the :code:`compile` command
2223
@@ -64,6 +65,14 @@ def __call__(self,
6465
:type discovery_timeout: str or NoneType
6566
:param protocol: Upload port protocol, e.g: serial
6667
:type protocol: str or NoneType
68+
:param board_options: Board options
69+
:type board_options: dict or NoneTYpe
70+
:param encrypt_key: The name of the custom encryption key to use to encrypt a binary during the compile process. Used only by the platforms that support it.
71+
:type encrypt_key: str or NoneTYpe
72+
:param keys_keychain: The path of the dir to search for the custom keys to sign and encrypt a binary. Used only by the platforms that support it.
73+
:type keys_keychain: str or NoneTYpe
74+
:param sign_key: The name of the custom signing key to use to sign a binary during the compile process. Used only by the platforms that support it.
75+
:type sign_key: str or NoneTYpe
6776
:return: The output of the related command
6877
:rtype: dict
6978
"""
@@ -113,5 +122,15 @@ def __call__(self,
113122
args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)])
114123
if protocol:
115124
args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)])
125+
if board_options:
126+
for option_name, option_value in board_options.items():
127+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
128+
args.extend([flags.BOARD_OPTIONS, option])
129+
if encrypt_key:
130+
args.extend([flags.ENCRYPT_KEY, CommandBase._strip_arg(encrypt_key)])
131+
if keys_keychain:
132+
args.extend([flags.KEYS_KEYCHAIN, CommandBase._strip_arg(keys_keychain)])
133+
if sign_key:
134+
args.extend([flags.SIGN_KEY, CommandBase._strip_arg(sign_key)])
116135
args.append(CommandBase._strip_arg(sketch))
117136
return self._exec(args)

pyduinocli/commands/daemon.py

Lines changed: 5 additions & 1 deletion
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):
15+
def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, ip=None, debug_file=None):
1616
"""
1717
Calls the :code:`daemon` command
1818
@@ -26,6 +26,8 @@ def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, ip=
2626
:type debug_filter: str or NoneType
2727
:param ip: The IP address the daemon will listen to (default "127.0.0.1")
2828
:type ip: str or NoneType
29+
:param debug_file: Append debug logging to the specified file
30+
:type debug_file: str or NoneType
2931
:return: The output of the related command
3032
:rtype: dict
3133
"""
@@ -38,4 +40,6 @@ def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, ip=
3840
args.append(flags.DEBUG)
3941
if debug_filter:
4042
args.extend([flags.DEBUG_FILTER, CommandBase._strip_arg(debug_filter)])
43+
if debug_file:
44+
args.extend([flags.DEBUG_FILE, CommandBase._strip_arg(debug_file)])
4145
return self._exec(args)

pyduinocli/commands/debug.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, base_args):
1414
self._base_args.append(commands.DEBUG)
1515

1616
def __call__(self, fqbn=None, input_dir=None, port=None, interpreter=None, info=None, programmer=None, sketch=None,
17-
discovery_timeout=None, protocol=None):
17+
discovery_timeout=None, protocol=None, board_options=None):
1818
"""
1919
Calls the :code:`debug` command
2020
@@ -36,6 +36,8 @@ def __call__(self, fqbn=None, input_dir=None, port=None, interpreter=None, info=
3636
:type discovery_timeout: str or NoneType
3737
:param protocol: Upload port protocol, e.g: serial
3838
:type protocol: str or NoneType
39+
:param board_options: Board options
40+
:type board_options: dict or NoneTYpe
3941
:return: The output of the related command
4042
:rtype: dict
4143
"""
@@ -58,4 +60,8 @@ def __call__(self, fqbn=None, input_dir=None, port=None, interpreter=None, info=
5860
args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)])
5961
if protocol:
6062
args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)])
63+
if board_options:
64+
for option_name, option_value in board_options.items():
65+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
66+
args.extend([flags.BOARD_OPTIONS, option])
6167
return self._exec(args)

pyduinocli/commands/lib.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def install(self, libraries=None, git_urls=None, zip_paths=None):
6060
args.extend(CommandBase._strip_args(zip_paths))
6161
return self._exec(args)
6262

63-
def list(self, all=None, updatable=None, fqbn=None):
63+
def list(self, all=None, updatable=None, fqbn=None, board_options=None):
6464
"""
6565
Calls the :code:`lib list` command
6666
@@ -70,6 +70,8 @@ def list(self, all=None, updatable=None, fqbn=None):
7070
:type updatable: bool or NoneType
7171
:param fqbn: Shows libraries for the specified board
7272
:type fqbn: str or NoneType
73+
:param board_options: Board options
74+
:type board_options: dict or NoneTYpe
7375
:return: The output of the related command
7476
:rtype: dict
7577
"""
@@ -80,6 +82,10 @@ def list(self, all=None, updatable=None, fqbn=None):
8082
args.append(flags.UPDATABLE)
8183
if fqbn is not None:
8284
args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)])
85+
if board_options:
86+
for option_name, option_value in board_options.items():
87+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
88+
args.extend([flags.BOARD_OPTIONS, option])
8389
return self._exec(args)
8490

8591
def search(self, keywords=None, names=None):
@@ -139,19 +145,25 @@ def upgrade(self, upgrades=None):
139145
args.extend(CommandBase._strip_args(upgrades))
140146
return self._exec(args)
141147

142-
def examples(self, library, fqbn=None):
148+
def examples(self, library, fqbn=None, board_options=None):
143149
"""
144150
Calls the :code:`lib examples` command
145151
146152
:param library: The name of the library
147153
:type library: str
148154
:param fqbn: The board FQBN
149155
:type fqbn: str or NoneType
156+
:param board_options: Board options
157+
:type board_options: dict or NoneTYpe
150158
:return: The output of the related command
151159
:rtype: dict
152160
"""
153161
args = [commands.EXAMPLES, CommandBase._strip_arg(library)]
154162
if fqbn is not None:
155163
args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)])
164+
if board_options:
165+
for option_name, option_value in board_options.items():
166+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
167+
args.extend([flags.BOARD_OPTIONS, option])
156168
return self._exec(args)
157169

pyduinocli/commands/monitor.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def __init__(self, base_args):
1212
CommandBase.__init__(self, base_args)
1313
self._base_args.append(commands.MONITOR)
1414

15-
def __call__(self, config=None, describe=None, discovery_timeout=None, fqbn=None, port=None, protocol=None, quiet=None):
15+
def __call__(self, config=None, describe=None, discovery_timeout=None, fqbn=None, port=None, protocol=None,
16+
quiet=None, board_options=None):
1617
"""
1718
Calls the :code:`monitor` command
1819
@@ -30,6 +31,8 @@ def __call__(self, config=None, describe=None, discovery_timeout=None, fqbn=None
3031
:type protocol: str or NoneType
3132
:param quiet: Run in silent mode, show only monitor input and output.
3233
:type quiet: bool or NoneType
34+
:param board_options: Board options
35+
:type board_options: dict or NoneTYpe
3336
:return: The output of the related command
3437
:rtype: dict
3538
"""
@@ -48,4 +51,8 @@ def __call__(self, config=None, describe=None, discovery_timeout=None, fqbn=None
4851
args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)])
4952
if quiet is True:
5053
args.append(flags.QUIET)
54+
if board_options:
55+
for option_name, option_value in board_options.items():
56+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
57+
args.extend([flags.BOARD_OPTIONS, option])
5158
return self._exec(args)

pyduinocli/commands/upload.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, base_args):
1313
self._base_args.append(commands.UPLOAD)
1414

1515
def __call__(self, sketch=None, fqbn=None, input_dir=None, input_file=None, port=None, verify=None, programmer=None,
16-
discovery_timeout=None, protocol=None):
16+
discovery_timeout=None, protocol=None, board_options=None):
1717
"""
1818
Calls the :code:`upload` command
1919
@@ -35,6 +35,8 @@ def __call__(self, sketch=None, fqbn=None, input_dir=None, input_file=None, port
3535
:type discovery_timeout: str or NoneType
3636
:param protocol: Upload port protocol, e.g: serial
3737
:type protocol: str or NoneType
38+
:param board_options: Board options
39+
:type board_options: dict or NoneTYpe
3840
:return: The output of the related command
3941
:rtype: dict
4042
"""
@@ -57,4 +59,8 @@ def __call__(self, sketch=None, fqbn=None, input_dir=None, input_file=None, port
5759
args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)])
5860
if protocol:
5961
args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)])
62+
if board_options:
63+
for option_name, option_value in board_options.items():
64+
option = "%s=%s" % (CommandBase._strip_arg(option_name), CommandBase._strip_arg(option_value))
65+
args.extend([flags.BOARD_OPTIONS, option])
6066
return self._exec(args)

pyduinocli/constants/flags.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@
5555
CONFIG = '--config'
5656
DESCRIBE = '--describe'
5757
QUIET = '--quiet'
58+
BOARD_OPTIONS = '--board-options'
59+
ENCRYPT_KEY = '--encrypt-key'
60+
KEYS_KEYCHAIN = '--keys-keychain'
61+
SIGN_KEY = '--sign-key'
62+
DEBUG_FILE = '--debug-file'

0 commit comments

Comments
 (0)