Commit 5b9e8cd6 authored by zandobersek@gmail.com's avatar zandobersek@gmail.com

Inspector scripts are not compatible with Python v3

https://bugs.webkit.org/show_bug.cgi?id=127128

Reviewed by Benjamin Poulain.

* inspector/scripts/generate-combined-inspector-json.py: Turn print statements into print function calls.
* inspector/scripts/jsmin.py: Try importing the StringIO class from the StringIO module (which will work for
Python v2) or, on import error, import the class from the io module (which will work for Python v3).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fafa5dd7
2014-01-18 Zan Dobersek <zdobersek@igalia.com>
Inspector scripts are not compatible with Python v3
https://bugs.webkit.org/show_bug.cgi?id=127128
Reviewed by Benjamin Poulain.
* inspector/scripts/generate-combined-inspector-json.py: Turn print statements into print function calls.
* inspector/scripts/jsmin.py: Try importing the StringIO class from the StringIO module (which will work for
Python v2) or, on import error, import the class from the io module (which will work for Python v3).
2014-01-17 Anders Carlsson <andersca@apple.com>
String::is8Bit() crashes if m_impl is null, handle this.
......
......@@ -29,7 +29,7 @@ import os
import sys
if len(sys.argv) < 2:
print "usage: %s [json files or directory of json files ...]" % os.path.basename(sys.argv[0])
print("usage: %s [json files or directory of json files ...]" % os.path.basename(sys.argv[0]))
sys.exit(1)
files = []
......@@ -47,12 +47,12 @@ files.sort()
# Validate each file is valid JSON and that there is a "domain" key.
first = True
print "{\"domains\":["
print("{\"domains\":[")
for file in files:
if first:
first = False
else:
print ","
print(",")
string = open(file).read()
......@@ -64,5 +64,5 @@ for file in files:
sys.stderr.write("File \"%s\" does not contain valid JSON:\n" % file)
raise
print string.rstrip()
print "]}"
print(string.rstrip())
print("]}")
......@@ -30,7 +30,11 @@
# SOFTWARE.
# */
from StringIO import StringIO
# Import StringIO from either the StringIO module (Python 2.x) or the io module (Python 3.x).
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
def jsmin(js):
ins = StringIO(js)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment