Bug 127128 - Inspector scripts are not compatible with Python v3
Summary: Inspector scripts are not compatible with Python v3
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Zan Dobersek
Depends on:
Reported: 2014-01-16 11:58 PST by Marcel Tiede
Modified: 2014-01-18 01:00 PST (History)
3 users (show)

See Also:

Patch (2.65 KB, patch)
2014-01-17 03:12 PST, Zan Dobersek
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Tiede 2014-01-16 11:58:59 PST
Trying to build the current unstable release 2.3.4 under Archlinux fails. Archlinux is using python3 as "/usr/bin/python".

File "./Source/JavaScriptCore/inspector/scripts/jsmin.py", line 33, in <module>
    from StringIO import StringIO
ImportError: No module named 'StringIO'

As I'm not a python developer I tried fixing this by simply loading the python3 Module io for StringIO, what revealed the next error:

 File "./Source/JavaScriptCore/inspector/scripts/generate-combined-inspector-json.py", line 32
    print "usage: %s [json files or directory of json files ...]" % os.path.basename(sys.argv[0])
SyntaxError: invalid syntax

Using parentheses for all print commands in the file "generate-combined-inspector-json.py" fixed the compilation issue.
Comment 1 Zan Dobersek 2014-01-17 03:12:23 PST
Created attachment 221453 [details]
Comment 2 Benjamin Poulain 2014-01-17 13:06:56 PST
Comment on attachment 221453 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=221453&action=review


> Source/JavaScriptCore/inspector/scripts/jsmin.py:36
> +try:
> +    from StringIO import StringIO
> +except ImportError:
> +    from io import StringIO

Maybe add a Python3 comment here so that we know to remove it in the future?
Comment 3 Zan Dobersek 2014-01-18 01:00:22 PST
Committed r162250: <http://trac.webkit.org/changeset/162250>