... because this tool may not be run with Python 2. This allows us to
reduce additional dependencies.

Change-Id: I21f16361d8678ea5eb10966fde75228dcec8f861
This commit is contained in:
Takashi Kajinami 2024-02-19 02:50:53 +09:00
parent e2a47de10a
commit ccb73f3b21
2 changed files with 4 additions and 6 deletions

View File

@ -3,7 +3,6 @@
# Not currently needed for anything else. # Not currently needed for anything else.
pydot pydot
PyYAML>=3.1.0 PyYAML>=3.1.0
six>=1.9.0
yamlordereddictloader yamlordereddictloader
mwclient==0.8.1 mwclient==0.8.1
ruamel.yaml ruamel.yaml

View File

@ -18,7 +18,7 @@ A tool that will translate a projects.yaml file into a visualized graph.
Usage: universe_dot.py <projects-file> <output-file> just-project? ... Usage: universe_dot.py <projects-file> <output-file> just-project? ...
To run make sure pydot (or pydot2) is installed, as well as six and pyyaml. To run make sure pydot (or pydot2) is installed, as well as pyyaml.
After these are installed run this like: After these are installed run this like:
@ -42,7 +42,6 @@ import sys
import time import time
import pydot import pydot
import six
import yaml import yaml
if len(sys.argv) == 1: if len(sys.argv) == 1:
@ -57,7 +56,7 @@ just_projects = set(sys.argv[3:])
print("Reading projects from '%s'" % projects_file) print("Reading projects from '%s'" % projects_file)
with open(projects_file, 'rb') as fh: with open(projects_file, 'rb') as fh:
projects = yaml.safe_load(fh) projects = yaml.safe_load(fh)
project_names = sorted(six.iterkeys(projects)) project_names = sorted(projects.keys())
if just_projects: if just_projects:
print("Restricting to just %s projects" % list(just_projects)) print("Restricting to just %s projects" % list(just_projects))
for project_name in list(project_names): for project_name in list(project_names):
@ -83,7 +82,7 @@ for project_name in project_names:
node_count += 1 node_count += 1
graph_nodes[project_name] = node graph_nodes[project_name] = node
deliverables = projects[project_name].get('deliverables', []) deliverables = projects[project_name].get('deliverables', [])
deliverable_names = sorted(six.iterkeys(deliverables)) deliverable_names = sorted(deliverables.keys())
for deliverable_name in deliverable_names: for deliverable_name in deliverable_names:
edges_needed += 1 edges_needed += 1
node_path = "%s/%s" % (project_name, deliverable_name) node_path = "%s/%s" % (project_name, deliverable_name)
@ -124,7 +123,7 @@ for project_name in project_names:
node = graph_nodes[project_name] node = graph_nodes[project_name]
graph.add_node(node) graph.add_node(node)
deliverables = projects[project_name].get('deliverables', []) deliverables = projects[project_name].get('deliverables', [])
deliverable_names = sorted(six.iterkeys(deliverables)) deliverable_names = sorted(deliverables.keys())
for deliverable_name in deliverable_names: for deliverable_name in deliverable_names:
print(" Inserting node for '%s'" % deliverable_name) print(" Inserting node for '%s'" % deliverable_name)
node_path = "%s/%s" % (project_name, deliverable_name) node_path = "%s/%s" % (project_name, deliverable_name)