summaryrefslogtreecommitdiff
path: root/tools/gyp/tools/pretty_vcproj.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gyp/tools/pretty_vcproj.py')
-rwxr-xr-xtools/gyp/tools/pretty_vcproj.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/tools/gyp/tools/pretty_vcproj.py b/tools/gyp/tools/pretty_vcproj.py
index 6099bd7cc4..8263389d9b 100755
--- a/tools/gyp/tools/pretty_vcproj.py
+++ b/tools/gyp/tools/pretty_vcproj.py
@@ -12,7 +12,7 @@
It outputs the resulting xml to stdout.
"""
-__author__ = 'nsylvain (Nicolas Sylvain)'
+from __future__ import print_function
import os
import sys
@@ -20,6 +20,14 @@ import sys
from xml.dom.minidom import parse
from xml.dom.minidom import Node
+__author__ = 'nsylvain (Nicolas Sylvain)'
+
+try:
+ cmp
+except NameError:
+ def cmp(x, y):
+ return (x > y) - (x < y)
+
REPLACEMENTS = dict()
ARGUMENTS = None
@@ -61,7 +69,7 @@ class CmpNode(object):
def PrettyPrintNode(node, indent=0):
if node.nodeType == Node.TEXT_NODE:
if node.data.strip():
- print '%s%s' % (' '*indent, node.data.strip())
+ print('%s%s' % (' '*indent, node.data.strip()))
return
if node.childNodes:
@@ -73,23 +81,23 @@ def PrettyPrintNode(node, indent=0):
# Print the main tag
if attr_count == 0:
- print '%s<%s>' % (' '*indent, node.nodeName)
+ print('%s<%s>' % (' '*indent, node.nodeName))
else:
- print '%s<%s' % (' '*indent, node.nodeName)
+ print('%s<%s' % (' '*indent, node.nodeName))
all_attributes = []
for (name, value) in node.attributes.items():
all_attributes.append((name, value))
all_attributes.sort(CmpTuple())
for (name, value) in all_attributes:
- print '%s %s="%s"' % (' '*indent, name, value)
- print '%s>' % (' '*indent)
+ print('%s %s="%s"' % (' '*indent, name, value))
+ print('%s>' % (' '*indent))
if node.nodeValue:
- print '%s %s' % (' '*indent, node.nodeValue)
+ print('%s %s' % (' '*indent, node.nodeValue))
for sub_node in node.childNodes:
PrettyPrintNode(sub_node, indent=indent+2)
- print '%s</%s>' % (' '*indent, node.nodeName)
+ print('%s</%s>' % (' '*indent, node.nodeName))
def FlattenFilter(node):
@@ -283,8 +291,8 @@ def main(argv):
# check if we have exactly 1 parameter.
if len(argv) < 2:
- print ('Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] '
- '[key2=value2]' % argv[0])
+ print('Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] '
+ '[key2=value2]' % argv[0])
return 1
# Parse the keys