Skip to content

Commit

Permalink
Fix melpa parsing
Browse files Browse the repository at this point in the history
Previous fix for elpa has broken melpa. Support all three maintainer* variants
  • Loading branch information
AMDmi3 committed Jun 14, 2024
1 parent 2f671a3 commit 00717fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions repology/parsers/parsers/elpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{}])

Expand All @@ -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)
Expand Down

0 comments on commit 00717fb

Please sign in to comment.