Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions esp_bool_parser/bool_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
opAssoc,
)

from .constants import (
IDF_VERSION,
IDF_VERSION_MAJOR,
IDF_VERSION_MINOR,
IDF_VERSION_PATCH,
)
from .soc_header import (
SOC_HEADERS,
)
from .utils import (
InvalidInput,
to_version,
Expand Down Expand Up @@ -82,6 +73,20 @@ def get_value(self, target: str, config_name: str) -> t.Any:
if self.attr == 'IDF_TARGET':
return target

if self.attr == 'CONFIG_NAME':
return config_name

# for non-keyword cap words, check if it is defined in the environment variables
if self.attr in os.environ:
return os.environ[self.attr]

from .constants import (
IDF_VERSION,
IDF_VERSION_MAJOR,
IDF_VERSION_MINOR,
IDF_VERSION_PATCH,
)

if self.attr == 'IDF_VERSION':
return IDF_VERSION

Expand All @@ -94,16 +99,11 @@ def get_value(self, target: str, config_name: str) -> t.Any:
if self.attr == 'IDF_VERSION_PATCH':
return IDF_VERSION_PATCH

if self.attr == 'CONFIG_NAME':
return config_name
from .soc_header import SOC_HEADERS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we prioritize loading the environment variables? so if I rely on one env var defined locally, there's no need to check and load the IDF_PATH (which may not exist)

The original comment:

for non-keyword cap words, check if it is defined in the environment variables

no idea why I put it here... I can't think of a real risk about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall the sequence could be

  • additional_attr
  • IDF_TARGET
  • CONFIG_NAME
  • env var
  • IDF_VERSION(_XXX) - lazy-load
  • SOC_CAPS - lazy-load


if self.attr in SOC_HEADERS[target]:
return SOC_HEADERS[target][self.attr]

# for non-keyword cap words, check if it is defined in the environment variables
if self.attr in os.environ:
return os.environ[self.attr]

return 0 # default return 0 as false


Expand Down
Loading