Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: tools/graphviz.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/graphviz.py
diff --git a/tools/graphviz.py b/tools/graphviz.py
index 326ae221cf8e820ef3cadfcffc515ffc3074a5e1..538b059da4a7e640ab9365686f08d45664dfd528 100755
--- a/tools/graphviz.py
+++ b/tools/graphviz.py
@@ -8,6 +8,8 @@
generate input suitable for graphviz to render a dependency graph of
targets."""
+from __future__ import print_function
+
import collections
import json
import sys
@@ -50,9 +52,9 @@ def WriteGraph(edges):
build_file, target_name, toolset = ParseTarget(src)
files[build_file].append(src)
- print 'digraph D {'
- print ' fontsize=8' # Used by subgraphs.
- print ' node [fontsize=8]'
+ print('digraph D {')
+ print(' fontsize=8') # Used by subgraphs.
+ print(' node [fontsize=8]')
# Output nodes by file. We must first write out each node within
# its file grouping before writing out any edges that may refer
@@ -63,31 +65,31 @@ def WriteGraph(edges):
# the display by making it a box without an internal node.
target = targets[0]
build_file, target_name, toolset = ParseTarget(target)
- print ' "%s" [shape=box, label="%s\\n%s"]' % (target, filename,
- target_name)
+ print(' "%s" [shape=box, label="%s\\n%s"]' % (target, filename,
+ target_name))
else:
# Group multiple nodes together in a subgraph.
- print ' subgraph "cluster_%s" {' % filename
- print ' label = "%s"' % filename
+ print(' subgraph "cluster_%s" {' % filename)
+ print(' label = "%s"' % filename)
for target in targets:
build_file, target_name, toolset = ParseTarget(target)
- print ' "%s" [label="%s"]' % (target, target_name)
- print ' }'
+ print(' "%s" [label="%s"]' % (target, target_name))
+ print(' }')
# Now that we've placed all the nodes within subgraphs, output all
# the edges between nodes.
for src, dsts in edges.items():
for dst in dsts:
- print ' "%s" -> "%s"' % (src, dst)
+ print(' "%s" -> "%s"' % (src, dst))
- print '}'
+ print('}')
def main():
if len(sys.argv) < 2:
- print >>sys.stderr, __doc__
- print >>sys.stderr
- print >>sys.stderr, 'usage: %s target1 target2...' % (sys.argv[0])
+ print(__doc__, file=sys.stderr)
+ print(file=sys.stderr)
+ print('usage: %s target1 target2...' % (sys.argv[0]), file=sys.stderr)
return 1
edges = LoadEdges('dump.json', sys.argv[1:])

Powered by Google App Engine
This is Rietveld 408576698