pw_arduino_build: fix list-boards and list-menu-options
- was broken if library_* args are not set
Change-Id: Iad987dbfe843195eef4996f075d7b2a051ee8787
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/24107
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/pw_arduino_build/py/pw_arduino_build/builder.py b/pw_arduino_build/py/pw_arduino_build/builder.py
index fce58b6..fcd77e4 100755
--- a/pw_arduino_build/py/pw_arduino_build/builder.py
+++ b/pw_arduino_build/py/pw_arduino_build/builder.py
@@ -89,9 +89,10 @@
self.compiler_path_override = compiler_path_override
self.variant_includes = ""
self.build_variant_path = False
- self.library_names = library_names
- self.library_path = os.path.realpath(
- os.path.expanduser(os.path.expandvars(library_path)))
+ if library_names and library_path:
+ self.library_names = library_names
+ self.library_path = os.path.realpath(
+ os.path.expanduser(os.path.expandvars(library_path)))
self.compiler_path_override_binaries = []
if self.compiler_path_override:
@@ -963,6 +964,9 @@
# - Else lib folder as root include -Ilibraries/libname
# (exclude source files in the examples folder in this case)
+ if not self.library_names or not self.library_path:
+ return []
+
library_path = self.library_path
folder_patterns = ["*"]
if self.library_names: