Skip to content

Commit

Permalink
fix: use relative SESSION_ARGS import
Browse files Browse the repository at this point in the history
  • Loading branch information
horw committed Dec 1, 2023
1 parent 63df3b0 commit b91d3ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 deletions idf_build_apps/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
computed_field,
)

import idf_build_apps
from idf_build_apps import (
SESSION_ARGS,
)

from . import (
LOGGER,
Expand Down Expand Up @@ -382,12 +384,10 @@ def _process_sdkconfig_files(self):
except OSError:
pass

if idf_build_apps.SESSION_ARGS.override_sdkconfig_items:
res.append(idf_build_apps.SESSION_ARGS.override_sdkconfig_file_path)
if 'CONFIG_IDF_TARGET' in idf_build_apps.SESSION_ARGS.override_sdkconfig_items:
self._sdkconfig_files_defined_target = idf_build_apps.SESSION_ARGS.override_sdkconfig_items[
'CONFIG_IDF_TARGET'
]
if SESSION_ARGS.override_sdkconfig_items:
res.append(SESSION_ARGS.override_sdkconfig_file_path)
if 'CONFIG_IDF_TARGET' in SESSION_ARGS.override_sdkconfig_items:
self._sdkconfig_files_defined_target = SESSION_ARGS.override_sdkconfig_items['CONFIG_IDF_TARGET']

self._sdkconfig_files = res

Expand Down
10 changes: 7 additions & 3 deletions idf_build_apps/session_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def set(self, parsed_args, *, workdir=None):
self.workdir = workdir
self._setup_override_sdkconfig(parsed_args)

def clean(self):
self.override_sdkconfig_items = {}
self.override_sdkconfig_file_path = None

def _setup_override_sdkconfig(self, args):
override_sdkconfig_items = self._get_override_sdkconfig_items(
args.override_sdkconfig_items.split(',') if args.override_sdkconfig_items else ()
Expand All @@ -24,10 +28,10 @@ def _setup_override_sdkconfig(self, args):
args.override_sdkconfig_files.split(',') if args.override_sdkconfig_files else ()
)

override_sdkconfig_merged_items = override_sdkconfig_files_items.update(override_sdkconfig_items)
self.override_sdkconfig_items = override_sdkconfig_merged_items
override_sdkconfig_files_items.update(override_sdkconfig_items)
self.override_sdkconfig_items = override_sdkconfig_files_items

override_sdkconfig_merged_file = self._create_override_sdkconfig_merged_file(override_sdkconfig_merged_items)
override_sdkconfig_merged_file = self._create_override_sdkconfig_merged_file(self.override_sdkconfig_items)
self.override_sdkconfig_file_path = override_sdkconfig_merged_file

def _get_override_sdkconfig_files_items(self, override_sdkconfig_files: t.Tuple[str]) -> t.Dict:
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import idf_build_apps
from idf_build_apps import (
App,
session_args,
setup_logging,
)


@pytest.fixture(autouse=True)
def clean_cls_attr():
App.MANIFEST = None
idf_build_apps.SESSION_ARGS = session_args.SessionArgs()
idf_build_apps.SESSION_ARGS.clean()


@pytest.fixture(autouse=True)
Expand Down

0 comments on commit b91d3ed

Please sign in to comment.