esp-bool-parser 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.github/workflows/test-esp-bool-parser.yml +31 -4
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/CHANGELOG.md +11 -1
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/PKG-INFO +2 -2
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/esp_bool_parser/__init__.py +1 -1
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/esp_bool_parser/bool_parser.py +23 -17
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/esp_bool_parser/soc_header.py +2 -1
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/esp_bool_parser/utils.py +18 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/pyproject.toml +2 -2
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.editorconfig +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.github/dependabot.yml +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.github/workflows/publish-pypi.yml +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.github/workflows/sync-jira.yml +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.github/workflows/test-build-docs.yml +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.gitignore +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.pre-commit-config.yaml +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/.readthedocs.yml +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/CONTRIBUTING.md +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/LICENSE +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/README.md +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/_apidoc_templates/module.rst_t +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/_apidoc_templates/package.rst_t +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/_apidoc_templates/toc.rst_t +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/_static/espressif-logo.svg +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/_static/theme_overrides.css +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/_templates/layout.html +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/conf_common.py +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/Makefile +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/api/esp_bool_parser.rst +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/api/modules.rst +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/conf.py +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/index.rst +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/others/CHANGELOG.md +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/docs/en/others/CONTRIBUTING.md +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/esp_bool_parser/constants.py +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/esp_bool_parser/py.typed +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/license_header.txt +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/tests/test_bool_parser.py +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/tests/test_load.py +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/tests/test_soc_caps.py +0 -0
- {esp_bool_parser-0.2.0 → esp_bool_parser-0.2.1}/tests/test_utils.py +0 -0
|
@@ -36,16 +36,43 @@ jobs:
|
|
|
36
36
|
runs-on: ubuntu-22.04
|
|
37
37
|
env:
|
|
38
38
|
FLIT_ROOT_INSTALL: 1
|
|
39
|
+
|
|
40
|
+
strategy:
|
|
41
|
+
fail-fast: false
|
|
42
|
+
matrix:
|
|
43
|
+
include:
|
|
44
|
+
- python-version: '3.7'
|
|
45
|
+
pyparsing: '==2.4'
|
|
46
|
+
- python-version: '3.14'
|
|
47
|
+
pyparsing: '>=3'
|
|
48
|
+
|
|
49
|
+
name: Test (Python ${{ matrix.python-version }}, pyparsing ${{ matrix.pyparsing }})
|
|
50
|
+
|
|
39
51
|
steps:
|
|
40
52
|
- uses: actions/checkout@v6
|
|
41
53
|
- uses: actions/setup-python@v5
|
|
42
54
|
with:
|
|
43
|
-
python-version:
|
|
55
|
+
python-version: ${{ matrix.python-version }}
|
|
56
|
+
allow-prereleases: true
|
|
57
|
+
|
|
58
|
+
- name: Install dependencies
|
|
59
|
+
run: |
|
|
60
|
+
pip install flit pyparsing${{ matrix.pyparsing }}
|
|
61
|
+
|
|
62
|
+
- name: Install package
|
|
63
|
+
run: flit install -s
|
|
64
|
+
|
|
44
65
|
- name: Run tests
|
|
45
66
|
run: |
|
|
46
|
-
pip
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
pip show pyparsing
|
|
68
|
+
python --version
|
|
69
|
+
|
|
70
|
+
pytest \
|
|
71
|
+
--cov esp_bool_parser \
|
|
72
|
+
--cov-report term-missing:skip-covered \
|
|
73
|
+
--junit-xml pytest.xml \
|
|
74
|
+
| tee pytest-coverage.txt
|
|
75
|
+
|
|
49
76
|
- name: Pytest coverage comment
|
|
50
77
|
uses: MishaKav/pytest-coverage-comment@main
|
|
51
78
|
with:
|
|
@@ -20,12 +20,22 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
<hr>
|
|
22
22
|
|
|
23
|
+
## v0.2.1 (2026-01-15)
|
|
24
|
+
|
|
25
|
+
### 🔧 Code Refactoring
|
|
26
|
+
|
|
27
|
+
- Add support for pyparsing 2.x and 3.x *(Igor Udot – 0da115a)*
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
23
31
|
## v0.2.0 (2026-01-13)
|
|
24
32
|
|
|
25
33
|
### 🔧 Code Refactoring
|
|
26
34
|
|
|
27
35
|
- update deprecated pyparsing functions to snake_case *(Igor Udot - 043674c)*
|
|
28
36
|
|
|
37
|
+
---
|
|
38
|
+
|
|
29
39
|
## v0.1.4 (2025-07-09)
|
|
30
40
|
|
|
31
41
|
### 📖 Documentation
|
|
@@ -91,6 +101,6 @@
|
|
|
91
101
|
<a href="https://www.github.com/espressif/cz-plugin-espressif">Commitizen Espressif plugin</a>
|
|
92
102
|
</b>
|
|
93
103
|
<br>
|
|
94
|
-
<sup><a href="https://www.espressif.com">Espressif Systems CO LTD. (
|
|
104
|
+
<sup><a href="https://www.espressif.com">Espressif Systems CO LTD. (2026)</a><sup>
|
|
95
105
|
</small>
|
|
96
106
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: esp-bool-parser
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Tools for building ESP-IDF related apps.
|
|
5
5
|
Author-email: Fu Hanxi <fuhanxi@espressif.com>
|
|
6
6
|
Requires-Python: >=3.7
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: pyparsing
|
|
19
|
+
Requires-Dist: pyparsing
|
|
20
20
|
Requires-Dist: packaging
|
|
21
21
|
Requires-Dist: sphinx ; extra == "doc"
|
|
22
22
|
Requires-Dist: sphinx-rtd-theme ; extra == "doc"
|
|
@@ -12,7 +12,6 @@ from packaging.version import (
|
|
|
12
12
|
Version,
|
|
13
13
|
)
|
|
14
14
|
from pyparsing import (
|
|
15
|
-
DelimitedList,
|
|
16
15
|
Keyword,
|
|
17
16
|
Literal,
|
|
18
17
|
ParseResults,
|
|
@@ -21,16 +20,24 @@ from pyparsing import (
|
|
|
21
20
|
Word,
|
|
22
21
|
alphas,
|
|
23
22
|
hexnums,
|
|
24
|
-
infix_notation,
|
|
25
23
|
nums,
|
|
26
24
|
opAssoc,
|
|
27
25
|
)
|
|
28
26
|
|
|
29
27
|
from .utils import (
|
|
28
|
+
_IS_OLD_PYPARSING,
|
|
30
29
|
InvalidInput,
|
|
30
|
+
pp_parse_string,
|
|
31
|
+
pp_set_parse_action,
|
|
31
32
|
to_version,
|
|
32
33
|
)
|
|
33
34
|
|
|
35
|
+
if _IS_OLD_PYPARSING:
|
|
36
|
+
from pyparsing import delimitedList as DelimitedList
|
|
37
|
+
from pyparsing import infixNotation as infix_notation
|
|
38
|
+
else:
|
|
39
|
+
from pyparsing import DelimitedList, infix_notation
|
|
40
|
+
|
|
34
41
|
|
|
35
42
|
class Stmt:
|
|
36
43
|
"""Statement"""
|
|
@@ -200,29 +207,28 @@ class BoolAnd(BoolExpr):
|
|
|
200
207
|
return all(stmt.get_value(target, config_name) for stmt in self.bool_stmts)
|
|
201
208
|
|
|
202
209
|
|
|
203
|
-
CAP_WORD = Word(alphas.upper(), nums + alphas.upper() + '_')
|
|
210
|
+
CAP_WORD = pp_set_parse_action(Word(alphas.upper(), nums + alphas.upper() + '_'))(ChipAttr)
|
|
204
211
|
|
|
205
212
|
DECIMAL_NUMBER = Word(nums)
|
|
206
213
|
HEX_NUMBER = Literal('0x') + Word(hexnums)
|
|
207
|
-
INTEGER = (HEX_NUMBER | DECIMAL_NUMBER)
|
|
214
|
+
INTEGER = pp_set_parse_action(HEX_NUMBER | DECIMAL_NUMBER)(Integer)
|
|
208
215
|
|
|
209
|
-
STRING = QuotedString('"')
|
|
216
|
+
STRING = pp_set_parse_action(QuotedString('"'))(String)
|
|
210
217
|
|
|
211
|
-
LIST = Suppress('[') + DelimitedList(INTEGER | STRING)
|
|
218
|
+
LIST = Suppress('[') + pp_set_parse_action(DelimitedList(INTEGER | STRING))(List_) + Suppress(']')
|
|
212
219
|
|
|
213
220
|
BOOL_OPERAND = CAP_WORD | INTEGER | STRING | LIST
|
|
214
221
|
|
|
215
|
-
EQ = Keyword('==')
|
|
216
|
-
NE = Keyword('!=')
|
|
217
|
-
LE = Keyword('<=')
|
|
218
|
-
LT = Keyword('<')
|
|
219
|
-
GE = Keyword('>=')
|
|
220
|
-
GT = Keyword('>')
|
|
221
|
-
NOT_IN = Keyword('not in')
|
|
222
|
-
IN = Keyword('in')
|
|
222
|
+
EQ = pp_set_parse_action(Keyword('=='))(lambda t: t[0])
|
|
223
|
+
NE = pp_set_parse_action(Keyword('!='))(lambda t: t[0])
|
|
224
|
+
LE = pp_set_parse_action(Keyword('<='))(lambda t: t[0])
|
|
225
|
+
LT = pp_set_parse_action(Keyword('<'))(lambda t: t[0])
|
|
226
|
+
GE = pp_set_parse_action(Keyword('>='))(lambda t: t[0])
|
|
227
|
+
GT = pp_set_parse_action(Keyword('>'))(lambda t: t[0])
|
|
228
|
+
NOT_IN = pp_set_parse_action(Keyword('not in'))(lambda t: t[0])
|
|
229
|
+
IN = pp_set_parse_action(Keyword('in'))(lambda t: t[0])
|
|
223
230
|
|
|
224
|
-
BOOL_STMT = BOOL_OPERAND + (EQ | NE | LE | LT | GE | GT | NOT_IN | IN) + BOOL_OPERAND
|
|
225
|
-
BOOL_STMT.set_parse_action(BoolStmt)
|
|
231
|
+
BOOL_STMT = pp_set_parse_action(BOOL_OPERAND + (EQ | NE | LE | LT | GE | GT | NOT_IN | IN) + BOOL_OPERAND)(BoolStmt)
|
|
226
232
|
|
|
227
233
|
AND = Keyword('and')
|
|
228
234
|
OR = Keyword('or')
|
|
@@ -267,4 +273,4 @@ def parse_bool_expr(stmt: str) -> BoolStmt:
|
|
|
267
273
|
print(value)
|
|
268
274
|
# Output: True
|
|
269
275
|
"""
|
|
270
|
-
return BOOL_EXPR
|
|
276
|
+
return pp_parse_string(BOOL_EXPR)(stmt)[0]
|
|
@@ -29,6 +29,7 @@ from .constants import (
|
|
|
29
29
|
ALL_TARGETS,
|
|
30
30
|
IDF_PATH,
|
|
31
31
|
)
|
|
32
|
+
from .utils import pp_parse_string
|
|
32
33
|
|
|
33
34
|
LOGGER = logging.getLogger(__name__)
|
|
34
35
|
|
|
@@ -65,7 +66,7 @@ def get_defines(header_path: str) -> t.List[str]:
|
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
def parse_define(define_line: str) -> ParseResults:
|
|
68
|
-
res = _define_expr
|
|
69
|
+
res = pp_parse_string(_define_expr)(define_line)
|
|
69
70
|
|
|
70
71
|
return res
|
|
71
72
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import importlib
|
|
5
5
|
import typing as t
|
|
6
6
|
|
|
7
|
+
import pyparsing
|
|
7
8
|
from packaging.version import (
|
|
8
9
|
Version,
|
|
9
10
|
)
|
|
@@ -74,3 +75,20 @@ def to_version(s: t.Any) -> Version:
|
|
|
74
75
|
return Version(str(s))
|
|
75
76
|
except ValueError:
|
|
76
77
|
raise InvalidInput(f'Invalid version: {s}')
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
_IS_OLD_PYPARSING = Version(pyparsing.__version__) < Version('3.0')
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def pp_set_parse_action(o):
|
|
84
|
+
if _IS_OLD_PYPARSING:
|
|
85
|
+
return o.setParseAction
|
|
86
|
+
else:
|
|
87
|
+
return o.set_parse_action
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def pp_parse_string(o):
|
|
91
|
+
if _IS_OLD_PYPARSING:
|
|
92
|
+
return o.parseString
|
|
93
|
+
else:
|
|
94
|
+
return o.parse_string
|
|
@@ -25,7 +25,7 @@ dynamic = ["version", "description"]
|
|
|
25
25
|
requires-python = ">=3.7"
|
|
26
26
|
|
|
27
27
|
dependencies = [
|
|
28
|
-
"pyparsing
|
|
28
|
+
"pyparsing",
|
|
29
29
|
"packaging",
|
|
30
30
|
]
|
|
31
31
|
|
|
@@ -59,7 +59,7 @@ annotated_tag = true
|
|
|
59
59
|
changelog_merge_prerelease = true
|
|
60
60
|
tag_format = "v$version"
|
|
61
61
|
update_changelog_on_bump = true
|
|
62
|
-
version = "0.2.
|
|
62
|
+
version = "0.2.1"
|
|
63
63
|
version_files = [
|
|
64
64
|
"esp_bool_parser/__init__.py",
|
|
65
65
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|