MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / parse_setup_py

Function parse_setup_py

src/packagedcode/pypi_setup_py.py:72–84  ·  view source on GitHub ↗

Return a mapping of setuptools.setup() call argument found in a setup.py file at ``location`` or an empty mapping.

(location)

Source from the content-addressed store, hash-verified

70
71
72def parse_setup_py(location):
73 """
74 Return a mapping of setuptools.setup() call argument found in a setup.py
75 file at ``location`` or an empty mapping.
76 """
77 path = Path(location)
78 tree = tuple(ast.parse(path.read_text(encoding='utf8')).body)
79 body = tuple(get_body(tree))
80
81 call = get_setup_call(tree)
82 result = get_call_kwargs(call, body)
83
84 return clean_setup(result)
85
86
87def get_body(elements):

Callers 1

get_setup_py_argsFunction · 0.90

Calls 5

get_bodyFunction · 0.85
get_setup_callFunction · 0.85
get_call_kwargsFunction · 0.85
clean_setupFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected