Title: [224685] trunk/Tools
Revision
224685
Author
jbed...@apple.com
Date
2017-11-10 09:02:56 -0800 (Fri, 10 Nov 2017)

Log Message

[webkitpy] Fix PlatformInfo._win_version since r224657
https://bugs.webkit.org/show_bug.cgi?id=179520

Patch by Fujii Hironori <hironori.fu...@sony.com> on 2017-11-10
Reviewed by Aakash Jain.

There are two problems.

The return value of sys.getwindowsversion() doesn't match with
Version.__init__ expects. Truncate the 4th and 5th of it.

_win_version_tuple_from_cmd was deleted in r224657. But, it is
still needed for Cygwin Python.

* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo._win_version): Return [0:3] of getwindowsversion().
Call _win_version_from_cmd for Cygwin Python.
(PlatformInfo._win_version_from_cmd): Restored.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (224684 => 224685)


--- trunk/Tools/ChangeLog	2017-11-10 16:41:03 UTC (rev 224684)
+++ trunk/Tools/ChangeLog	2017-11-10 17:02:56 UTC (rev 224685)
@@ -1,3 +1,23 @@
+2017-11-10  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [webkitpy] Fix PlatformInfo._win_version since r224657
+        https://bugs.webkit.org/show_bug.cgi?id=179520
+
+        Reviewed by Aakash Jain.
+
+        There are two problems.
+
+        The return value of sys.getwindowsversion() doesn't match with
+        Version.__init__ expects. Truncate the 4th and 5th of it.
+
+        _win_version_tuple_from_cmd was deleted in r224657. But, it is
+        still needed for Cygwin Python.
+
+        * Scripts/webkitpy/common/system/platforminfo.py:
+        (PlatformInfo._win_version): Return [0:3] of getwindowsversion().
+        Call _win_version_from_cmd for Cygwin Python.
+        (PlatformInfo._win_version_from_cmd): Restored.
+
 2017-11-10  Guillaume Emont  <guijem...@igalia.com>
 
         build-jsc: build testmasm for all platforms using cmake

Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py (224684 => 224685)


--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py	2017-11-10 16:41:03 UTC (rev 224684)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py	2017-11-10 17:02:56 UTC (rev 224685)
@@ -193,5 +193,12 @@
 
     def _win_version(self, sys_module):
         if hasattr(sys_module, 'getwindowsversion'):
-            return Version(sys_module.getwindowsversion())
-        return Version(self._executive.run_command(['cmd', '/c', 'ver'], decode_output=False))
+            return Version(sys_module.getwindowsversion()[0:3])
+        return Version(self._win_version_from_cmd())
+
+    def _win_version_from_cmd(self):
+        # Note that this should only ever be called on windows, so this should always work.
+        ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_output=False)
+        match_object = re.search(r'(?P<major>\d)\.(?P<minor>\d)\.(?P<build>\d+)', ver_output)
+        assert match_object, 'cmd returned an unexpected version string: ' + ver_output
+        return match_object.groups()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to