diff --git a/idf_build_apps/app.py b/idf_build_apps/app.py index e9772ef..c45c19a 100644 --- a/idf_build_apps/app.py +++ b/idf_build_apps/app.py @@ -296,17 +296,22 @@ def _process_sdkconfig_files(self): """ res = [] + # put the expanded variable files in a temporary directory + # will remove if the content is the same as the original one expanded_dir = os.path.join(self.work_dir, 'expanded_sdkconfig_files', os.path.basename(self.build_dir)) if not os.path.isdir(expanded_dir): os.makedirs(expanded_dir) for f in self._sdkconfig_defaults + ([self.sdkconfig_path] if self.sdkconfig_path else []): - if not os.path.isabs(f): - f = os.path.join(self.work_dir, f) - + # use filepath if abs/rel already point to itself if not os.path.isfile(f): - LOGGER.debug('=> sdkconfig file %s not exists, skipping...', f) - continue + # find it in the app_dir + LOGGER.debug('sdkconfig file %s not found, checking under app_dir...', f) + f = os.path.join(self.app_dir, f) + + if not os.path.isfile(f): + LOGGER.debug('=> sdkconfig file %s not exists, skipping...', f) + continue expanded_fp = os.path.join(expanded_dir, os.path.basename(f)) with open(f) as fr: diff --git a/idf_build_apps/constants.py b/idf_build_apps/constants.py index c124188..ea1265a 100644 --- a/idf_build_apps/constants.py +++ b/idf_build_apps/constants.py @@ -22,9 +22,9 @@ if _BUILDING_DOCS: _idf_env = tempfile.gettempdir() else: - _idf_env = os.getenv('IDF_PATH', '') -if not os.path.isdir(_idf_env): - raise ValueError('Invalid value for IDF_PATH: {}'.format(_idf_env)) + _idf_env = os.getenv('IDF_PATH') or '' + if not _idf_env: + raise SystemExit('environment variable IDF_PATH must be set') IDF_PATH = Path(_idf_env).resolve()