Skip to content

Commit

Permalink
reintroduced --no-extras parameter to filter out 'extra' (python) dep…
Browse files Browse the repository at this point in the history
…endencies #24
  • Loading branch information
proycon committed Sep 12, 2022
1 parent d849efe commit a2d2149
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions codemeta/codemeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def main():
parser.add_argument('--textv', type=str, help="Set extra text to add to a validation report. Use with --validate", action='store',required=False)
parser.add_argument('--css',type=str, help="Associate a CSS stylesheet (URL) with the HTML output, multiple stylesheets can be separated by a comma", action='store', required=False)
parser.add_argument('--no-cache',dest="no_cache", help="Do not cache context files, force redownload", action='store_true', required=False)
parser.add_argument('--no-extras',dest="no_extras", help="Do not include dependencies that are marked as 'extras', applies only to Python", action='store_true', required=False)
parser.add_argument('--toolstore', help="When converting to HTML, link pages together as served by the CLARIAH tool store (/~https://github.com/CLARIAH/tool-discovery)", action='store_true', required=False)
parser.add_argument('--strict', dest='strict', help="Strictly adhere to the codemeta standard and disable any extensions on top of it", action='store_true')
parser.add_argument('--released', help="Signal that this software is released, this affects whether development status maps to either WIP or active", action='store_true')
Expand Down
3 changes: 3 additions & 0 deletions codemeta/parsers/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def parsedependency(s: str):
"""Parses a pip dependency specification, returning the identifier, version"""
end = min(
s.find(" ") if s.find(" ") != -1 else 999999,
s.find(";") if s.find(";") != -1 else 999999,
s.find(">") if s.find(">") != -1 else 999999,
s.find("=") if s.find("=") != -1 else 999999
)
Expand Down Expand Up @@ -184,6 +185,8 @@ def parse_python(g: Graph, res: Union[URIRef, BNode], packagename: str, crosswal
#pylint: disable=W0621
def add_dependency(g: Graph, res: Union[URIRef, BNode], value: str, args: AttribDict):
for dependency in splitdependencies(value):
if 'extra ==' in dependency and args.no_extras:
continue
dependency, depversion = parsedependency(dependency.strip())
print(f"Found dependency {dependency} {depversion}",file=sys.stderr)
depres = URIRef(generate_uri(dependency+depversion.replace(' ',''),args.baseuri,"dependency")) #version number is deliberately in ID here!
Expand Down

0 comments on commit a2d2149

Please sign in to comment.