diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-01-02 21:57:07 +0200 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-01-02 21:57:07 +0200 |
commit | e174fa3c960fef3ed6225fa9a43e14e0e11332b0 (patch) | |
tree | 4e068457388b05165e0d7fdb6ed4c3bc33415b52 /src | |
parent | properly close open file handlers during tests (diff) | |
download | pkgcore-e174fa3c960fef3ed6225fa9a43e14e0e11332b0.tar.gz pkgcore-e174fa3c960fef3ed6225fa9a43e14e0e11332b0.tar.bz2 pkgcore-e174fa3c960fef3ed6225fa9a43e14e0e11332b0.zip |
domain: fix parsing of multiple USE_EXAPNDs
- add support for parsing of multiple USE_EXAPNDs
- fix error reporting when not USE_EXPAND has parsing error
- updates tests to catch warning thrown by parsing
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pkgcore/ebuild/domain.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pkgcore/ebuild/domain.py b/src/pkgcore/ebuild/domain.py index 9fef5f843..0dba49d5d 100644 --- a/src/pkgcore/ebuild/domain.py +++ b/src/pkgcore/ebuild/domain.py @@ -92,13 +92,16 @@ def package_use_splitter(iterable): def f(tokens: list[str]): i = iter(tokens) - for idx, x in enumerate(i): - if x.endswith(":"): + for idx, flag in enumerate(i): + if flag.endswith(":"): # we encountered `USE_EXPAND:` , thus all following tokens # are values of that. - x = x.lower()[:-1] + x = flag.lower()[:-1] l = tokens[0:idx] for flag in i: + if flag.endswith(":"): + x = flag.lower()[:-1] + continue if flag.startswith("-"): flag = f"-{x}_{flag[1:]}" else: @@ -107,7 +110,7 @@ def package_use_splitter(iterable): raise ParseError(f"token {flag} is not a valid use flag") l.append(flag) return l - elif not eapi_obj.is_valid_use_flag(x.lstrip("-")): + elif not eapi_obj.is_valid_use_flag(flag.lstrip("-")): raise ParseError(f"token {flag} is not a valid use flag") # if we made it here, there's no USE_EXPAND; thus just return the original sequence return tokens |