From 00717fb617acf4e13542c15f9b7c2249339fc83e Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 14 Jun 2024 17:49:29 +0300 Subject: [PATCH] Fix melpa parsing Previous fix for elpa has broken melpa. Support all three maintainer* variants --- repology/parsers/parsers/elpa.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/repology/parsers/parsers/elpa.py b/repology/parsers/parsers/elpa.py index 107cf98bb..787c32b2e 100644 --- a/repology/parsers/parsers/elpa.py +++ b/repology/parsers/parsers/elpa.py @@ -52,11 +52,12 @@ def _parse_data(data: str) -> list[_PackageData]: keyval_keywords = (lpar + Suppress(':keywords') + ZeroOrMore(qstring) + rpar).setParseAction(lambda s, l, t: [('keywords', [str(k) for k in t])]) keyval_commit = (lpar + Suppress(':commit') + dot + qstring + rpar).setParseAction(lambda s, l, t: [('commit', t[0])]) keyval_maintainer = (lpar + Suppress(':maintainer') + people_list + rpar).setParseAction(lambda s, l, t: [('maintainer', [str(m) for m in t])]) - keyval_maintainers = (lpar + Suppress(':maintainer') + OneOrMore(lpar + people_list + rpar) + rpar).setParseAction(lambda s, l, t: [('maintainers', [str(m) for m in t])]) + keyval_maintainer_multi = (lpar + Suppress(':maintainer') + OneOrMore(lpar + people_list + rpar) + rpar).setParseAction(lambda s, l, t: [('maintainer_multi', [str(m) for m in t])]) + keyval_maintainers = (lpar + Suppress(':maintainers') + lpar + people_list + rpar + rpar).setParseAction(lambda s, l, t: [('maintainers', [str(m) for m in t])]) keyval_author = (lpar + Suppress(':author') + people_list + rpar).setParseAction(lambda s, l, t: [('author', [str(a) for a in t])]) keyval_authors = (lpar + Suppress(':authors') + OneOrMore(lpar + people_list + rpar) + rpar).setParseAction(lambda s, l, t: [('authors', [str(a) for a in t])]) - keyval_item = keyval_url | keyval_keywords | keyval_commit | keyval_maintainer | keyval_maintainers | keyval_authors | keyval_author + keyval_item = keyval_url | keyval_keywords | keyval_commit | keyval_maintainer | keyval_maintainer_multi | keyval_maintainers | keyval_authors | keyval_author keyvals = (lpar + ZeroOrMore(keyval_item) + rpar).setParseAction(lambda s, l, t: [{k: v for k, v in t}]) | nil.setParseAction(lambda s, l, t: [{}]) @@ -78,7 +79,7 @@ def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMake pkg.set_version(pkgdata.version) pkg.set_summary(pkgdata.summary) - for key in ['maintainers', 'maintainer']: + for key in ['maintainers', 'maintainer', 'maintainer_multi']: if key in pkgdata.keyvals: maintainers: list[str] = sum(map(extract_maintainers, pkgdata.keyvals[key]), []) pkg.add_maintainers(maintainers)