Skip to content

Instantly share code, notes, and snippets.

@lapointexavier
Last active March 16, 2022 19:15
Show Gist options
  • Save lapointexavier/4e007914ce535eb6a0acf931a23bd93e to your computer and use it in GitHub Desktop.
Save lapointexavier/4e007914ce535eb6a0acf931a23bd93e to your computer and use it in GitHub Desktop.
AWS SDK CRT dep tree
#!/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()
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