From 26abc2572c38703d511e783c4730603cf2b9a180 Mon Sep 17 00:00:00 2001 From: horw Date: Fri, 24 Nov 2023 16:03:16 +0800 Subject: [PATCH] fix: ability setup session args to None --- idf_build_apps/app.py | 2 +- idf_build_apps/session_args.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/idf_build_apps/app.py b/idf_build_apps/app.py index 4b39441..b6402f8 100644 --- a/idf_build_apps/app.py +++ b/idf_build_apps/app.py @@ -387,7 +387,7 @@ def _process_sdkconfig_files(self): except OSError: pass - if self.session_args.override_sdkconfig_items: + if self.session_args and self.session_args.override_sdkconfig_items: res.append(self.session_args.override_sdkconfig_file_path) if 'CONFIG_IDF_TARGET' in self.session_args.override_sdkconfig_items: self._sdkconfig_files_defined_target = self.session_args.override_sdkconfig_items['CONFIG_IDF_TARGET'] diff --git a/idf_build_apps/session_args.py b/idf_build_apps/session_args.py index 1a9d935..dcec826 100644 --- a/idf_build_apps/session_args.py +++ b/idf_build_apps/session_args.py @@ -80,10 +80,10 @@ def _create_override_sdkconfig_merged_file(self, override_sdkconfig_merged_items _session_args: t.Optional[SessionArgs] = None -def get_session_args() -> SessionArgs: +def get_session_args() -> t.Optional[SessionArgs]: global _session_args if _session_args is None: - raise Exception('SessionArgs have not been set up yet.') + warnings.warn('SessionArgs have not been set up yet.') return _session_args