Skip to content

Commit 313998b

Browse files
willynillyproycon
authored andcommitted
Fixed Author-email and Maintainer-email for single author or single maintainer
It should partially fix issue #53. it won't handle multiple authors or multiple containers yet.
1 parent fc208cf commit 313998b

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

codemeta/parsers/python.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,17 @@ def parse_python(
309309
mail=pkg.metadata.get("Author-email", ""),
310310
baseuri=args.baseuri,
311311
)
312-
elif key == "Author-email":
313-
continue # already handled by the above
312+
elif key == "Author-email": # importlib.metadata
313+
add_authors(
314+
g,
315+
res,
316+
value=pkg.metadata.get("Author-email", "").rsplit("<")[0],
317+
single_author=True,
318+
mail=pkg.metadata.get("Author-email", "")
319+
.rsplit("<")[-1]
320+
.rstrip(">"),
321+
baseuri=args.baseuri,
322+
)
314323
elif key == "maintainers" and isinstance(value, (list, tuple)): # pyproject
315324
for e in value:
316325
if isinstance(e, str):
@@ -335,8 +344,17 @@ def parse_python(
335344
mail=pkg.metadata.get("Maintainer-email", ""),
336345
baseuri=args.baseuri,
337346
)
338-
elif key == "Maintainer-email":
339-
continue # already handled by the above
347+
elif key == "Maintainer-email": # importlib.metadata
348+
add_authors(
349+
g,
350+
res,
351+
value=pkg.metadata.get("Maintainer-email", "").rsplit("<")[0],
352+
single_author=True,
353+
mail=pkg.metadata.get("Maintainer-email", "")
354+
.rsplit("<")[-1]
355+
.rstrip(">"),
356+
baseuri=args.baseuri,
357+
)
340358
elif key == "Project-URL":
341359
if "," in value:
342360
label, url = value.split(",", 1) # according to spec

0 commit comments

Comments
 (0)