aboutsummaryrefslogtreecommitdiff
path: root/pw_stm32cube_build
diff options
context:
space:
mode:
authorArmando Montanez <amontanez@google.com>2022-04-05 13:15:18 -0700
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-05 23:21:26 +0000
commitdbd2ffba61123270e8e44dc86da887793472391e (patch)
tree4b7fccead39af8b06ae3143308f99734e0ca1bcf /pw_stm32cube_build
parent9e7043d2a82fdafd99a7dbe5911c70ff3a619eac (diff)
downloadpigweed-dbd2ffba61123270e8e44dc86da887793472391e.tar.gz
pw_stm32cube_build: Pre-bootstrap support
Allows the pw_stm32cube_build tools to be used from a context where the Python module has not yet been installed. This allows `gn gen` to succeed on projects that set dir_pw_third_party_stm32cube in their .gn file. Bug: b/227780139 Change-Id: Ie080039bca1f22da1d0257032bf9d79cea8c4953 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/90061 Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com> Reviewed-by: Anthony DiGirolamo <tonymd@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Diffstat (limited to 'pw_stm32cube_build')
-rw-r--r--pw_stm32cube_build/py/pw_stm32cube_build/__main__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pw_stm32cube_build/py/pw_stm32cube_build/__main__.py b/pw_stm32cube_build/py/pw_stm32cube_build/__main__.py
index fff71baa5..2170e34c6 100644
--- a/pw_stm32cube_build/py/pw_stm32cube_build/__main__.py
+++ b/pw_stm32cube_build/py/pw_stm32cube_build/__main__.py
@@ -18,7 +18,15 @@ import argparse
import pathlib
import sys
-from pw_stm32cube_build import find_files, gen_file_list, icf_to_ld, inject_init
+try:
+ from pw_stm32cube_build import (find_files, gen_file_list, icf_to_ld,
+ inject_init)
+except ImportError:
+ # Load from this directory if pw_stm32cube_build is not available.
+ import find_files # type: ignore
+ import gen_file_list # type: ignore
+ import icf_to_ld # type: ignore
+ import inject_init # type: ignore
def _parse_args() -> argparse.Namespace: