File size: 904 Bytes
e98c0d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
import json

from lib import parser, hasher

if __name__ == "__main__":
    args = json.loads(sys.stdin.read())

    # TODO Python 3.10 added native switch statements, so switch this if/elif
    # to that once we drop support for 3.9.
    if args["function"] == "parse_requirements":
        print(parser.parse_requirements(args["args"][0]))
    elif args["function"] == "parse_setup":
        print(parser.parse_setup(args["args"][0]))
    elif args["function"] == "parse_pep621_pep735_dependencies":
        print(parser.parse_pep621_pep735_dependencies(args["args"][0]))
    elif args["function"] == "get_dependency_hash":
        print(hasher.get_dependency_hash(*args["args"]))
    elif args["function"] == "get_pipfile_hash":
        print(hasher.get_pipfile_hash(*args["args"]))
    elif args["function"] == "get_pyproject_hash":
        print(hasher.get_pyproject_hash(*args["args"]))