Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/angrymane/bb-parser
https://github.com/angrymane/bb-parser
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/angrymane/bb-parser
- Owner: AngryMane
- Created: 2022-07-03T11:27:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-15T13:54:09.000Z (over 2 years ago)
- Last Synced: 2024-11-13T09:47:14.386Z (about 2 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bb-parser
This is a parser for bitbake file. I developed this for the following use-cases.
* parse bitbake with user's own reduce functions
* paser bitbake without any other bitbake modulesThis paser is based on the official parser, and the official parser's license is [GPL-2.0-only](https://spdx.org/licenses/GPL-2.0-only.html).
* [BBHandler](https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/parse/parse_py/BBHandler.py)
* [ConfHandler](https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/parse/parse_py/ConfHandler.py)# Why not official parser?
You can see the official paser by the following links. These are so greate works!
* [BBHandler](https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/parse/parse_py/BBHandler.py)
* [ConfHandler](https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/parse/parse_py/ConfHandler.py)But for instance, if I want to develop a linter for bitbake file, it's difficult to develop with the official parser because ...
* the official parser doesn't support custom reduce functions. Therefore, user can't customize what to do when specific syntax has come.
* the official parser is difficult to use without other bitbake modulesAs a work-around for these, I developed bb-paser.
# How to use
1. Download 3-files in bb-perser dir.
1. Copy these files into your project.
1. use like this```
from BitbakeParser import BitbakeParser
from BitbakeVisitor import BitbakeVisitorBasedef main() -> None:
if len(sys.argv) < 2 or not os.path.isfile(sys.argv[1]):
return
parser: BitbakeParser = BitbakeParser(BitbakeVisitorBase())
parser.parse(sys.argv[1])
```
Please note that `BitbakeVisitorBase` is just base class for visitor, so you can create your own visitor class derived on them.