Last active
March 16, 2022 19:15
-
-
Save lapointexavier/4e007914ce535eb6a0acf931a23bd93e to your computer and use it in GitHub Desktop.
AWS SDK CRT dep tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
from treelib import Tree | |
root_project = "aws-c-common" | |
base_url = "https://raw.githubusercontent.com/awslabs/{}/main/builder.json" | |
seen_deps = set() | |
def getJsonDeps(project_name): | |
start = requests.get(base_url.format(project_name)) | |
json_data = start.json() | |
if "downstream" in json_data: | |
return json_data["downstream"] | |
return [] | |
def walk(tree, children, parent): | |
for c in children: | |
child_project = c["name"] | |
if child_project not in seen_deps: | |
seen_deps.add(child_project) | |
tree.create_node(child_project, | |
child_project, parent=parent) | |
walk(tree, getJsonDeps(child_project), child_project) | |
def main(): | |
tree = Tree() | |
tree.create_node(root_project, root_project) | |
children = getJsonDeps(root_project) | |
walk(tree, children, root_project) | |
tree.show() | |
if __name__ == '__main__': | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws-c-common | |
├── aws-c-cal | |
├── aws-c-compression | |
│ └── aws-c-http | |
│ └── aws-c-auth | |
├── aws-c-io | |
│ └── aws-c-mqtt | |
└── aws-checksums | |
└── aws-c-event-stream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment