Skip to content

Commit 6ce809a

Browse files
Initial checkin
- base parser - base documentation - base test cases - CI integration Signed-off-by: Konrad Weihmann <[email protected]>
1 parent f8ad155 commit 6ce809a

20 files changed

+5175
-1
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Python package
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
max-parallel: 4
10+
matrix:
11+
python-version: [3.5, 3.6, 3.7, 3.8]
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install dependencies
20+
run: |
21+
python3 -m pip install --upgrade pip
22+
pip install -r requirements.txt
23+
pip install pytest
24+
- name: Lint with flake8
25+
run: |
26+
pip install flake8
27+
cd oelint_parser
28+
# stop the build if there are Python syntax errors or undefined names
29+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
30+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
31+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
32+
- name: Build
33+
run: python3 setup.py build
34+
- name: Test
35+
run: pytest
36+
- name: Install
37+
run: python3 setup.py install

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# oelint-parsr
1+
# oelint-parser
2+
23
alternative parser for bitbake recipes
4+
5+
## API documentation
6+
7+
Find the full API docs [here](docs/api-documentation.md)
8+
9+
## Examples
10+
11+
```python
12+
from oelint_parser.cls_stash import Stash
13+
14+
# create an stash object
15+
_stash = Stash()
16+
17+
# add any bitbake like file
18+
_stash.AddFile("/some/file")
19+
20+
# Resolves proper cross file dependencies
21+
_stash.Finalize()
22+
23+
# Use _stash.GetItemsFor() method to filter the stash
24+
```
25+
26+
### Get variables from the files
27+
28+
To get variables from the stash object do
29+
30+
```python
31+
from oelint_parser.cls_item import Variable
32+
33+
# get all variables of the name PV from all files
34+
for x in _stash.GetItemsFor(attribute=Variable.ATTR_VAR, attributeValue="PV"):
35+
print(x)
36+
```
37+
38+
this returns the raw object representation
39+
40+
### Expand raw variables
41+
42+
```python
43+
from oelint_parser.cls_item import Variable
44+
from oelint_parser.helper_files import expand_term
45+
46+
# get all variables of the name PV from all files
47+
for x in _stash.GetItemsFor(attribute=Variable.ATTR_VAR, attributeValue="PV"):
48+
# raw unexpanded variable
49+
print(x.VarValue)
50+
# raw unexpanded variable without quotes
51+
print(x.VarValueStripped)
52+
# expanded variable
53+
print(expand_term(stash, "/some/file", x.VarValueStripped))
54+
# single items from a list
55+
print(x.get_items())
56+
# expanded single items from a list
57+
print([expand_term(stash, "/some/file", y) for y in x.get_items()])
58+
```

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh -e
2+
python3 setup.py build
3+
python3 setup.py sdist
4+
pytest

0 commit comments

Comments
 (0)