Skip to content

Commit

Permalink
Merge pull request #109 from espressif/fix/search_sdkconfig_path_1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
hfudev authored Dec 29, 2023
2 parents ab260b2 + 7d223a2 commit e5f496a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 10 additions & 5 deletions idf_build_apps/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions idf_build_apps/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e5f496a

Please sign in to comment.