Title: [139048] trunk/Tools
Revision
139048
Author
[email protected]
Date
2013-01-08 02:10:24 -0800 (Tue, 08 Jan 2013)

Log Message

[GTK] Make Tools/gtk/generate-gtkdoc compatible with Python 3
https://bugs.webkit.org/show_bug.cgi?id=106195

Reviewed by Philippe Normand.

Perform changes in the generate-gtkdoc script and common and gtkdoc modules
to make the Python code compatible with Python 3. This includes modifying
print statements, exception handling, dictionary iteration and
byte-sequence-to-string conversion.

* gtk/common.py:
(get_build_path):
(pkg_config_file_variable):
(gtk_version_of_pkg_config_file):
* gtk/generate-gtkdoc:
(print_missing_api):
* gtk/gtkdoc.py:
(GTKDoc.__init__):
(GTKDoc._run_command):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (139047 => 139048)


--- trunk/Tools/ChangeLog	2013-01-08 09:37:53 UTC (rev 139047)
+++ trunk/Tools/ChangeLog	2013-01-08 10:10:24 UTC (rev 139048)
@@ -1,3 +1,25 @@
+2013-01-08  Zan Dobersek  <[email protected]>
+
+        [GTK] Make Tools/gtk/generate-gtkdoc compatible with Python 3
+        https://bugs.webkit.org/show_bug.cgi?id=106195
+
+        Reviewed by Philippe Normand.
+
+        Perform changes in the generate-gtkdoc script and common and gtkdoc modules
+        to make the Python code compatible with Python 3. This includes modifying
+        print statements, exception handling, dictionary iteration and
+        byte-sequence-to-string conversion.
+
+        * gtk/common.py:
+        (get_build_path):
+        (pkg_config_file_variable):
+        (gtk_version_of_pkg_config_file):
+        * gtk/generate-gtkdoc:
+        (print_missing_api):
+        * gtk/gtkdoc.py:
+        (GTKDoc.__init__):
+        (GTKDoc._run_command):
+
 2013-01-02  Steve Block  <[email protected]>
 
         Add chromium.org email address for Steve Block.

Modified: trunk/Tools/gtk/common.py (139047 => 139048)


--- trunk/Tools/gtk/common.py	2013-01-08 09:37:53 UTC (rev 139047)
+++ trunk/Tools/gtk/common.py	2013-01-08 10:10:24 UTC (rev 139048)
@@ -75,7 +75,7 @@
     if is_valid_build_directory(build_dir):
         return build_dir
 
-    print 'Could not determine build directory.'
+    print('Could not determine build directory.')
     sys.exit(1)
 
 
@@ -86,7 +86,7 @@
 def pkg_config_file_variable(package, variable):
     process = subprocess.Popen(['pkg-config', '--variable=%s' % variable, package],
                                stdout=subprocess.PIPE)
-    stdout = process.communicate()[0]
+    stdout = process.communicate()[0].decode("utf-8")
     if process.returncode:
         return None
     return stdout.strip()
@@ -99,7 +99,7 @@
 def gtk_version_of_pkg_config_file(pkg_config_path):
     process = subprocess.Popen(['pkg-config', pkg_config_path, '--print-requires'],
                                stdout=subprocess.PIPE)
-    stdout = process.communicate()[0]
+    stdout = process.communicate()[0].decode("utf-8")
 
     if 'gtk+-3.0' in stdout:
         return 3

Modified: trunk/Tools/gtk/generate-gtkdoc (139047 => 139048)


--- trunk/Tools/gtk/generate-gtkdoc	2013-01-08 09:37:53 UTC (rev 139047)
+++ trunk/Tools/gtk/generate-gtkdoc	2013-01-08 10:10:24 UTC (rev 139048)
@@ -143,9 +143,9 @@
     missing_api = generator.api_missing_documentation()
     if not missing_api:
         return
-    print "\nThe following API are missing documentation:"
+    print("\nThe following API are missing documentation:")
     for api in missing_api:
-        print "\t%s" % api
+        print("\t%s" % api)
 
 def generate_doc(generator):
     generator.generate(html='--skip-html' not in sys.argv)
@@ -178,27 +178,27 @@
     options = get_webkit1_options(common.gtk_version_of_pkg_config_file(pkg_config_path))
     generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options)
     if '--rebase' not in sys.argv:
-        print "Generating WebKit1 documentation..."
+        print("Generating WebKit1 documentation...")
         saw_webkit1_warnings = generate_doc(generator)
     else:
-        print "Rebasing WebKit1 documentation..."
+        print("Rebasing WebKit1 documentation...")
         try:
             generator.rebase_installed_docs()
-        except Exception,e:
-            print "Rebase did not happen, likely no documentation is present."
+        except Exception:
+            print("Rebase did not happen, likely no documentation is present.")
 
 # WebKit2 might not be enabled, so check for the pkg-config file before building documentation.
 pkg_config_path = common.build_path('Source', 'WebKit2', 'webkit2gtk-3.0.pc')
 if os.path.exists(pkg_config_path):
     generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, get_webkit2_options())
     if '--rebase' not in sys.argv:
-        print "\nGenerating WebKit2 documentation..."
+        print("\nGenerating WebKit2 documentation...")
         saw_webkit2_warnings = generate_doc(generator)
     else:
-        print "\nRebasing WebKit2 documentation..."
+        print("\nRebasing WebKit2 documentation...")
         try:
             generator.rebase_installed_docs()
-        except Exception,e:
-            print "Rebase did not happen, likely no documentation is present."
+        except Exception:
+            print("Rebase did not happen, likely no documentation is present.")
 
 sys.exit(saw_webkit1_warnings or saw_webkit2_warnings)

Modified: trunk/Tools/gtk/gtkdoc.py (139047 => 139048)


--- trunk/Tools/gtk/gtkdoc.py	2013-01-08 09:37:53 UTC (rev 139047)
+++ trunk/Tools/gtk/gtkdoc.py	2013-01-08 10:10:24 UTC (rev 139048)
@@ -107,7 +107,7 @@
 
         self.logger = logging.getLogger('gtkdoc')
 
-        for key, value in args.iteritems():
+        for key, value in iter(args.items()):
             setattr(self, key, value)
 
         def raise_error_if_not_specified(key):
@@ -185,7 +185,7 @@
         process = subprocess.Popen(args, env=env, cwd=cwd,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)
-        stdout, stderr = process.communicate()
+        stdout, stderr = [b.decode("utf-8") for b in process.communicate()]
 
         if print_output:
             if stdout:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to