Skip to content

Commit

Permalink
ref: replace if_parser with esp_bool_parser package
Browse files Browse the repository at this point in the history
  • Loading branch information
horw committed Jan 7, 2025
1 parent 49f4aed commit 46d6549
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 412 deletions.
9 changes: 9 additions & 0 deletions idf_build_apps/manifest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@
"""
Manifest file
"""

from esp_bool_parser import register_addition_attribute
from manifest import FolderRule


def folder_rule_attr(target, **kwargs):
return 1 if target in FolderRule.DEFAULT_BUILD_TARGETS else 0

register_addition_attribute('INCLUDE_DEFAULT', folder_rule_attr)
240 changes: 0 additions & 240 deletions idf_build_apps/manifest/if_parser.py

This file was deleted.

8 changes: 3 additions & 5 deletions idf_build_apps/manifest/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@
from ..yaml import (
parse,
)
from .if_parser import (
BOOL_EXPR,
BoolStmt,
)
from esp_bool_parser import parse_bool_expr
from esp_bool_parser.bool_parser import BoolStmt

LOGGER = logging.getLogger(__name__)


class IfClause:
def __init__(self, stmt: str, temporary: bool = False, reason: t.Optional[str] = None) -> None:
try:
self.stmt: BoolStmt = BOOL_EXPR.parseString(stmt)[0]
self.stmt: BoolStmt = parse_bool_expr(stmt)
except (ParseException, InvalidIfClause) as ex:
raise InvalidIfClause(f'Invalid if clause: {stmt}. {ex}')

Expand Down
Loading

0 comments on commit 46d6549

Please sign in to comment.