jan/feature/20260630-app-get-section-remove-method into master Remove App.get_section() which parses raw file sections by scanning for section headers and accumulating lines. This method is no longer needed since ProjectConf now handles all config file parsing. Signed-off-by: Jan Lindemann <jan@janware.com>
Refactor App to use the new ProjectConf module for parsing
make/project.conf files.
This commit
- removes the inline ad-hoc read_value() method and its nested
helper functions, replacing them with ProjectConf's
get_str_or_none() API.
- introduces two cached helper methods (__read_project_conf() and
__get_project_conf()) to read and cache ProjectConf instances per
project.
- updates get_value() to delegate to ProjectConf and moves the
proj_dir lookup to only run in the version branch where it is
needed.
- updates the topdir init to use __read_project_conf() with a
FileNotFoundError catch for optional config files.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add unit tests for the new ProjectConf module covering:
- Basic string and list value retrieval (get_str(), get_str_or_none(),
get_list(), get_list_or_none())
- Quoted values with preserved spaces and comment delimiters
- Inline comments outside quotes
- Comma-separated lists with quoted commas
- Line continuations
- Multiple sections
- Error cases: empty key, missing key/section, malformed sections,
unfinished continuations, unclosed quotes
- Error class is a subclass of ValueError
Also include a Makefile for running tests via `make test`.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
Introduce ProjectConf module to cleanly parse make/project.conf ini-like configuration files. The new class supports: - ini-style sections with header comments - Key-value pairs with backslash line continuation - Quoted values preserving spaces and comment delimiters (#) inside - Inline comments outside of quotes - Comma-separated list values with quoted commas - Cached section parsing to avoid re-parsing the same section - .get_section() to return an entire section unparsed Signed-off-by: Jan Lindemann <jan@janware.com>
Replace the @functools.lru_cache(maxsize=None) decorator with @functools.cache throughout App. functools.cache is a shorthand for functools.lru_cache(maxsize=None) introduced in Python 3.9 and is more concise and readable with identical behaviour. Signed-off-by: Jan Lindemann <jan@janware.com>