<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[281448] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/281448">281448</a></dd>
<dt>Author</dt> <dd>jbedard@apple.com</dd>
<dt>Date</dt> <dd>2021-08-23 09:33:58 -0700 (Mon, 23 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cygwin] Support Python 3 in run-webkit-tests
https://bugs.webkit.org/show_bug.cgi?id=229360
<rdar://problem/82192362>

Reviewed by Dewei Zhu.

* Scripts/libraries/webkitcorepy/setup.py: Bump version.
* Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Ditto.
* Scripts/libraries/webkitcorepy/webkitcorepy/tests/task_pool_unittest.py:
(TaskPoolUnittest): Skip some tests on cygwin.
* Scripts/webkitpy/common/system/abstractexecutive.py:
(AbstractExecutive.command_for_printing): Strings might be bytes on some platforms.
* Scripts/webkitpy/common/system/path.py:
(_CygPath.convert): Cygwin path process is not unicode.
* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo._win_version_str): Return Windows version string as unicode string.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptslibrarieswebkitcorepysetuppy">trunk/Tools/Scripts/libraries/webkitcorepy/setup.py</a></li>
<li><a href="#trunkToolsScriptslibrarieswebkitcorepywebkitcorepy__init__py">trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py</a></li>
<li><a href="#trunkToolsScriptslibrarieswebkitcorepywebkitcorepyteststask_pool_unittestpy">trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/task_pool_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemabstractexecutivepy">trunk/Tools/Scripts/webkitpy/common/system/abstractexecutive.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystempathpy">trunk/Tools/Scripts/webkitpy/common/system/path.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemplatforminfopy">trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/ChangeLog       2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2021-08-23  Jonathan Bedard  <jbedard@apple.com>
+
+        [Cygwin] Support Python 3 in run-webkit-tests
+        https://bugs.webkit.org/show_bug.cgi?id=229360
+        <rdar://problem/82192362>
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/libraries/webkitcorepy/setup.py: Bump version.
+        * Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Ditto.
+        * Scripts/libraries/webkitcorepy/webkitcorepy/tests/task_pool_unittest.py:
+        (TaskPoolUnittest): Skip some tests on cygwin.
+        * Scripts/webkitpy/common/system/abstractexecutive.py:
+        (AbstractExecutive.command_for_printing): Strings might be bytes on some platforms.
+        * Scripts/webkitpy/common/system/path.py:
+        (_CygPath.convert): Cygwin path process is not unicode.
+        * Scripts/webkitpy/common/system/platforminfo.py:
+        (PlatformInfo._win_version_str): Return Windows version string as unicode string.
+
</ins><span class="cx"> 2021-08-22  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [JSC] Remove already-shipped wasm option flags
</span></span></pre></div>
<a id="trunkToolsScriptslibrarieswebkitcorepysetuppy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/libraries/webkitcorepy/setup.py (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/libraries/webkitcorepy/setup.py      2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/setup.py 2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> setup(
</span><span class="cx">     name='webkitcorepy',
</span><del>-    version='0.9.0',
</del><ins>+    version='0.9.1',
</ins><span class="cx">     description='Library containing various Python support classes and functions.',
</span><span class="cx">     long_description=readme(),
</span><span class="cx">     classifiers=[
</span></span></pre></div>
<a id="trunkToolsScriptslibrarieswebkitcorepywebkitcorepy__init__py"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py      2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py 2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> from webkitcorepy.nested_fuzzy_dict import NestedFuzzyDict
</span><span class="cx"> from webkitcorepy.call_by_need import CallByNeed
</span><span class="cx"> 
</span><del>-version = Version(0, 9, 0)
</del><ins>+version = Version(0, 9, 1)
</ins><span class="cx"> 
</span><span class="cx"> from webkitcorepy.autoinstall import Package, AutoInstall
</span><span class="cx"> if sys.version_info > (3, 0):
</span></span></pre></div>
<a id="trunkToolsScriptslibrarieswebkitcorepywebkitcorepyteststask_pool_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/task_pool_unittest.py (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/task_pool_unittest.py      2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/task_pool_unittest.py 2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> 
</span><span class="cx"> import logging
</span><span class="cx"> import time
</span><ins>+import sys
</ins><span class="cx"> import unittest
</span><span class="cx"> 
</span><span class="cx"> from webkitcorepy import OutputCapture, TaskPool, log as logger
</span><span class="lines">@@ -59,16 +60,6 @@
</span><span class="cx"> class TaskPoolUnittest(unittest.TestCase):
</span><span class="cx">     alphabet = 'abcdefghijklmnopqrstuvwxyz'
</span><span class="cx"> 
</span><del>-    def test_single(self):
-        with OutputCapture(level=logging.WARNING) as captured:
-            with TaskPool(workers=1, force_fork=True) as pool:
-                pool.do(action, 'a')
-                pool.do(log, logging.WARNING, '1')
-                pool.wait()
-
-        self.assertEqual(captured.stdout.getvalue(), 'action(a)\n')
-        self.assertEqual(captured.webkitcorepy.log.getvalue(), 'worker/0 1\n')
-
</del><span class="cx">     def test_single_no_fork(self):
</span><span class="cx">         with OutputCapture(level=logging.WARNING) as captured:
</span><span class="cx">             with TaskPool(workers=1, force_fork=False) as pool:
</span><span class="lines">@@ -79,20 +70,6 @@
</span><span class="cx">         self.assertEqual(captured.stdout.getvalue(), 'action(a)\n')
</span><span class="cx">         self.assertEqual(captured.webkitcorepy.log.getvalue(), '1\n')
</span><span class="cx"> 
</span><del>-    def test_multiple(self):
-        with OutputCapture(level=logging.INFO) as captured:
-            with TaskPool(workers=4) as pool:
-                for character in self.alphabet:
-                    pool.do(action, character)
-                pool.wait()
-
-        lines = captured.stdout.getvalue().splitlines()
-        self.assertEquals(sorted(lines), ['action({})'.format(character) for character in self.alphabet])
-        self.assertEqual(
-            sorted(captured.webkitcorepy.log.getvalue().splitlines()),
-            sorted(['worker/{} starting'.format(number) for number in range(4)] + ['worker/{} stopping'.format(number) for number in range(4)]),
-        )
-
</del><span class="cx">     def test_callback(self):
</span><span class="cx">         sequence = []
</span><span class="cx"> 
</span><span class="lines">@@ -106,17 +83,6 @@
</span><span class="cx">             ''.join(sorted(sequence)),
</span><span class="cx">         )
</span><span class="cx"> 
</span><del>-    def test_exception(self):
-        with OutputCapture(level=logging.INFO) as captured:
-            with self.assertRaises(RuntimeError):
-                with TaskPool(workers=1, force_fork=True) as pool:
-                    pool.do(exception, 'Testing exception')
-                    pool.wait()
-        self.assertEqual(
-            captured.webkitcorepy.log.getvalue().splitlines(),
-            ['worker/0 starting', 'worker/0 stopping'],
-        )
-
</del><span class="cx">     def test_exception_no_fork(self):
</span><span class="cx">         with OutputCapture(level=logging.INFO) as captured:
</span><span class="cx">             with self.assertRaises(RuntimeError):
</span><span class="lines">@@ -125,46 +91,82 @@
</span><span class="cx">                     pool.wait()
</span><span class="cx">         self.assertEqual(captured.webkitcorepy.log.getvalue(), '')
</span><span class="cx"> 
</span><del>-    def test_setup(self):
-        with OutputCapture() as captured:
-            with TaskPool(workers=4, setup=setup) as pool:
-                for character in self.alphabet:
-                    pool.do(action, character)
-                pool.wait()
-        self.assertEqual(
-            sorted(captured.webkitcorepy.log.getvalue().splitlines()),
-            ['worker/{} Setting up'.format(x) for x in range(4)],
-        )
</del><ins>+    if sys.platform != 'cygwin':
+        def test_single(self):
+            with OutputCapture(level=logging.WARNING) as captured:
+                with TaskPool(workers=1, force_fork=True) as pool:
+                    pool.do(action, 'a')
+                    pool.do(log, logging.WARNING, '1')
+                    pool.wait()
</ins><span class="cx"> 
</span><del>-    def test_setup_arguments(self):
-        with OutputCapture() as captured:
-            with TaskPool(workers=4, setup=setup, setupargs=['Setup argument']) as pool:
-                for character in self.alphabet:
-                    pool.do(action, character)
-                pool.wait()
-        self.assertEqual(
-            sorted(captured.webkitcorepy.log.getvalue().splitlines()),
-            ['worker/{} Setup argument'.format(x) for x in range(4)],
-        )
</del><ins>+            self.assertEqual(captured.stdout.getvalue(), 'action(a)\n')
+            self.assertEqual(captured.webkitcorepy.log.getvalue(), 'worker/0 1\n')
</ins><span class="cx"> 
</span><del>-    def test_teardown(self):
-        with OutputCapture() as captured:
-            with TaskPool(workers=4, teardown=teardown) as pool:
-                for character in self.alphabet:
-                    pool.do(action, character)
-                pool.wait()
-        self.assertEqual(
-            sorted(captured.webkitcorepy.log.getvalue().splitlines()),
-            ['worker/{} Tearing down'.format(x) for x in range(4)],
-        )
</del><ins>+        def test_multiple(self):
+            with OutputCapture(level=logging.INFO) as captured:
+                with TaskPool(workers=4) as pool:
+                    for character in self.alphabet:
+                        pool.do(action, character)
+                    pool.wait()
</ins><span class="cx"> 
</span><del>-    def test_teardown_arguments(self):
-        with OutputCapture() as captured:
-            with TaskPool(workers=4, teardown=teardown, teardownargs=['Teardown argument']) as pool:
-                for character in self.alphabet:
-                    pool.do(action, character)
-                pool.wait()
-        self.assertEqual(
-            sorted(captured.webkitcorepy.log.getvalue().splitlines()),
-            ['worker/{} Teardown argument'.format(x) for x in range(4)],
-        )
</del><ins>+            lines = captured.stdout.getvalue().splitlines()
+            self.assertEquals(sorted(lines), ['action({})'.format(character) for character in self.alphabet])
+            self.assertEqual(
+                sorted(captured.webkitcorepy.log.getvalue().splitlines()),
+                sorted(['worker/{} starting'.format(number) for number in range(4)] + ['worker/{} stopping'.format(number) for number in range(4)]),
+            )
+
+        def test_exception(self):
+            with OutputCapture(level=logging.INFO) as captured:
+                with self.assertRaises(RuntimeError):
+                    with TaskPool(workers=1, force_fork=True) as pool:
+                        pool.do(exception, 'Testing exception')
+                        pool.wait()
+            self.assertEqual(
+                captured.webkitcorepy.log.getvalue().splitlines(),
+                ['worker/0 starting', 'worker/0 stopping'],
+            )
+
+        def test_setup(self):
+            with OutputCapture() as captured:
+                with TaskPool(workers=4, setup=setup) as pool:
+                    for character in self.alphabet:
+                        pool.do(action, character)
+                    pool.wait()
+            self.assertEqual(
+                sorted(captured.webkitcorepy.log.getvalue().splitlines()),
+                ['worker/{} Setting up'.format(x) for x in range(4)],
+            )
+
+        def test_setup_arguments(self):
+            with OutputCapture() as captured:
+                with TaskPool(workers=4, setup=setup, setupargs=['Setup argument']) as pool:
+                    for character in self.alphabet:
+                        pool.do(action, character)
+                    pool.wait()
+            self.assertEqual(
+                sorted(captured.webkitcorepy.log.getvalue().splitlines()),
+                ['worker/{} Setup argument'.format(x) for x in range(4)],
+            )
+
+        def test_teardown(self):
+            with OutputCapture() as captured:
+                with TaskPool(workers=4, teardown=teardown) as pool:
+                    for character in self.alphabet:
+                        pool.do(action, character)
+                    pool.wait()
+            self.assertEqual(
+                sorted(captured.webkitcorepy.log.getvalue().splitlines()),
+                ['worker/{} Tearing down'.format(x) for x in range(4)],
+            )
+
+        def test_teardown_arguments(self):
+            with OutputCapture() as captured:
+                with TaskPool(workers=4, teardown=teardown, teardownargs=['Teardown argument']) as pool:
+                    for character in self.alphabet:
+                        pool.do(action, character)
+                    pool.wait()
+            self.assertEqual(
+                sorted(captured.webkitcorepy.log.getvalue().splitlines()),
+                ['worker/{} Teardown argument'.format(x) for x in range(4)],
+            )
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemabstractexecutivepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/abstractexecutive.py (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/abstractexecutive.py  2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/Scripts/webkitpy/common/system/abstractexecutive.py     2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -107,8 +107,8 @@
</span><span class="cx">     def command_for_printing(self, args):
</span><span class="cx">         """Returns a print-ready string representing command args.
</span><span class="cx">         The string should be copy/paste ready for execution in a shell."""
</span><del>-        args = self._stringify_args(args)
-        return string_utils.decode(string_utils.encode(' '.join(args), encoding='unicode_escape'))
</del><ins>+        args = [elm for elm in self._stringify_args(args)]
+        return string_utils.decode(string_utils.encode((b' ' if isinstance(args[0], bytes) else ' ').join(args), encoding='unicode_escape'))
</ins><span class="cx"> 
</span><span class="cx">     def run_command(self, args, cwd=None, env=None, input=None, stdout=None, error_handler=None, ignore_errors=False,
</span><span class="cx">         return_exit_code=False, return_stderr=True, decode_output=True):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystempathpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/path.py (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/path.py       2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/Scripts/webkitpy/common/system/path.py  2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -36,6 +36,8 @@
</span><span class="cx"> import logging
</span><span class="cx"> import threading
</span><span class="cx"> 
</span><ins>+from webkitcorepy import string_utils
+
</ins><span class="cx"> if sys.version_info > (3, 0):
</span><span class="cx">     from urllib.parse import quote as urllib_quote
</span><span class="cx"> else:
</span><span class="lines">@@ -110,14 +112,15 @@
</span><span class="cx">     def convert(self, path):
</span><span class="cx">         if not self.is_running():
</span><span class="cx">             self.start()
</span><del>-        self._child_process.stdin.write("%s\r\n" % path)
</del><ins>+        self._child_process.stdin.write(string_utils.encode(path))
+        self._child_process.stdin.write(b'\r\n')
</ins><span class="cx">         self._child_process.stdin.flush()
</span><span class="cx"> 
</span><del>-        windows_path = self._child_process.stdout.readline().rstrip()
</del><ins>+        windows_path = string_utils.decode(self._child_process.stdout.readline().rstrip())
</ins><span class="cx">         if windows_path == "":
</span><span class="cx">             self._child_process.stdin.close()
</span><span class="cx">             self._child_process.wait()
</span><del>-            windows_path = self._child_process.stdout.readline().rstrip()
</del><ins>+            windows_path = string_utils.decode(self._child_process.stdout.readline().rstrip())
</ins><span class="cx">             self._child_process = None
</span><span class="cx">         # Some versions of cygpath use lowercase drive letters while others
</span><span class="cx">         # use uppercase. We always convert to uppercase for consistency.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemplatforminfopy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py (281447 => 281448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py       2021-08-23 16:01:29 UTC (rev 281447)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py  2021-08-23 16:33:58 UTC (rev 281448)
</span><span class="lines">@@ -251,4 +251,4 @@
</span><span class="cx">         if version:
</span><span class="cx">             return version
</span><span class="cx">         # Note that this should only ever be called on windows, so this should always work.
</span><del>-        return self._executive.run_command(['cmd', '/c', 'ver'], decode_output=False)
</del><ins>+        return self._executive.run_command(['cmd', '/c', 'ver'], decode_output=True)
</ins></span></pre>
</div>
</div>

</body>
</html>