mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update Python build scripts to use the print function
In Python 3, 'print' was changed from a statement to a function. Using the __future__ module allows scripts to use print function whether running with Python 2.6+ or Python 3.x. This commit changes as many instances of print as I could find to use the print function and the __future__ module.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
# && open /tmp/protocols.svg
|
||||
#===----------------------------------------------------------------------===#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
@@ -139,17 +141,17 @@ clusterEdges = set(
|
||||
for s in elements
|
||||
for t in graph[s] if t in elements)
|
||||
|
||||
print 'digraph ProtocolHierarchies {'
|
||||
print ' mclimit = 100; ranksep=1.5; ' # ; packmode="array1"
|
||||
print ' edge [dir="back"];'
|
||||
print ' node [shape = box, fontname = Helvetica, fontsize = 10];'
|
||||
print('digraph ProtocolHierarchies {')
|
||||
print(' mclimit = 100; ranksep=1.5; ') # ; packmode="array1"
|
||||
print(' edge [dir="back"];')
|
||||
print(' node [shape = box, fontname = Helvetica, fontsize = 10];')
|
||||
|
||||
for c in sorted(clusters):
|
||||
print ' subgraph "cluster_%s" {' % c
|
||||
print(' subgraph "cluster_%s" {' % c)
|
||||
for (s, t) in sorted(clusterEdges):
|
||||
if s in clusters[c]:
|
||||
print '%s -> %s [weight=100];' % (s, t)
|
||||
print '}'
|
||||
print('%s -> %s [weight=100];' % (s, t))
|
||||
print('}')
|
||||
|
||||
for node in sorted(graph.keys()):
|
||||
requirements = body.get(node, [])
|
||||
@@ -164,12 +166,12 @@ for node in sorted(graph.keys()):
|
||||
divider,
|
||||
'\n'.join('<TR><TD>%s</TD></TR>' % g for g in generics)))
|
||||
|
||||
print interpolate(' %(node)s [style = %(style)s, label=<%(label)s>]')
|
||||
|
||||
print(interpolate(' %(node)s [style = %(style)s, label=<%(label)s>]'))
|
||||
for (parent, children) in sorted(graph.items()):
|
||||
print ' %s -> {' % parent,
|
||||
print '; '.join(
|
||||
sorted(child for child in children if not (parent, child) in clusterEdges)),
|
||||
print '}'
|
||||
print(' %s -> {' % parent, end=' ')
|
||||
print('; '.join(
|
||||
sorted(child for child in children if not (parent, child) in clusterEdges)), end=' ')
|
||||
print('}')
|
||||
|
||||
print '}'
|
||||
print('}')
|
||||
|
||||
Reference in New Issue
Block a user