Skip to content

Commit

Permalink
python: support "homepage" and "documentation" fields from pyproject.…
Browse files Browse the repository at this point in the history
…toml, limited support for "readme" too
  • Loading branch information
proycon committed Sep 18, 2023
1 parent ed9572a commit 5a0a71f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions codemeta/parsers/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,17 @@ def parse_python(
parse_url(label, url, g, res, crosswalk, args)
elif key == "repository":
add_triple(g, res, "codeRepository", value, args)
elif key == "homepage":
add_triple(g, res, "url", value, args)
elif key == "documentation":
add_triple(g, res, "softwareHelp", value, args)
elif key == "readme":
if value.startswith("http"):
#this is actually against the pyproject.toml spec (it expects a path)
add_triple(g, res, "readme", value, args)
else:
#this is in accordance with the spec, but we can't deal with it because we can't convert it to a url (github encodes the git branch in it and we don't know it (and the master/main change complicates best guesses), other platforms may do something similar)
print("WARNING: Readme value seems not to be a URL, can not unambiguously resolve it to a URL either.. ignoring..", file=sys.stderr)
elif key == "dependencies":
if isinstance(value, dict):
for k, v in value.items():
Expand Down

0 comments on commit 5a0a71f

Please sign in to comment.