Title: [225721] trunk/Tools
Revision
225721
Author
[email protected]
Date
2017-12-08 21:40:02 -0800 (Fri, 08 Dec 2017)

Log Message

[WinCairo] Fix runtime error after r225229
https://bugs.webkit.org/show_bug.cgi?id=180614

Patch by Basuke Suzuki <[email protected]> on 2017-12-08
Reviewed by Alex Christensen.

The list of fallback versions doesn't match with version name mapping introduced recently.
It should be safe by creating the list automatically from the name map for consistency.

* Scripts/webkitpy/common/version_name_map.py:
(VersionNameMap.__init__):
(VersionNameMap.to_name):
(VersionNameMap.from_name):
(VersionNameMap):
(VersionNameMap.names):
(VersionNameMap.mapping_for_platform):
* Scripts/webkitpy/port/win.py:
(WinCairoPort):
(WinCairoPort.default_baseline_search_path):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (225720 => 225721)


--- trunk/Tools/ChangeLog	2017-12-09 05:36:37 UTC (rev 225720)
+++ trunk/Tools/ChangeLog	2017-12-09 05:40:02 UTC (rev 225721)
@@ -1,3 +1,24 @@
+2017-12-08  Basuke Suzuki  <[email protected]>
+
+        [WinCairo] Fix runtime error after r225229
+        https://bugs.webkit.org/show_bug.cgi?id=180614
+
+        Reviewed by Alex Christensen.
+
+        The list of fallback versions doesn't match with version name mapping introduced recently.
+        It should be safe by creating the list automatically from the name map for consistency.
+ 
+        * Scripts/webkitpy/common/version_name_map.py:
+        (VersionNameMap.__init__):
+        (VersionNameMap.to_name):
+        (VersionNameMap.from_name):
+        (VersionNameMap):
+        (VersionNameMap.names):
+        (VersionNameMap.mapping_for_platform):
+        * Scripts/webkitpy/port/win.py:
+        (WinCairoPort):
+        (WinCairoPort.default_baseline_search_path):
+
 2017-12-08  David Quesada  <[email protected]>
 
         ApplicationManifestParser should strip whitespace from the raw input

Modified: trunk/Tools/Scripts/webkitpy/common/version_name_map.py (225720 => 225721)


--- trunk/Tools/Scripts/webkitpy/common/version_name_map.py	2017-12-09 05:36:37 UTC (rev 225720)
+++ trunk/Tools/Scripts/webkitpy/common/version_name_map.py	2017-12-09 05:40:02 UTC (rev 225721)
@@ -26,6 +26,9 @@
 from webkitpy.common.version import Version
 
 
+PUBLIC_TABLE = 'public'
+
+
 class VersionNameMap(object):
 
     # Allows apple_additions to define a custom mapping
@@ -41,7 +44,7 @@
         self.mapping = {}
 
         self.default_system_platform = platform.os_name
-        self.mapping['public'] = {
+        self.mapping[PUBLIC_TABLE] = {
             'mac': {
                 'Leopard': Version(10, 5),
                 'Snow Leopard': Version(10, 6),
@@ -73,12 +76,9 @@
             result['{} {}'.format(prefix, str(Version(minimum.major + i)))] = Version(minimum.major + i)
         return result
 
-    def to_name(self, version, platform=None, table='public'):
-        platform = self.default_system_platform if platform is None else platform
-        assert table in self.mapping
-        assert platform in self.mapping[table]
+    def to_name(self, version, platform=None, table=PUBLIC_TABLE):
         closest_match = (None, None)
-        for os_name, os_version in self.mapping[table][platform].iteritems():
+        for os_name, os_version in self.mapping_for_platform(platform, table).iteritems():
             if version == os_version:
                 return os_name
             elif version.contained_in(os_version):
@@ -121,3 +121,16 @@
                     if self.strip_name_formatting(version_name) == unformatted:
                         return (os_name, version)
         return (None, None)
+
+    def names(self, platform=None, table=PUBLIC_TABLE):
+        """return list of os_name for platform"""
+        mapping = self.mapping_for_platform(platform, table)
+        names = [os_name for os_name in mapping]
+        return sorted(names, key=lambda os_name: mapping[os_name])
+
+    def mapping_for_platform(self, platform=None, table=PUBLIC_TABLE):
+        """return proper os_name: os_version mapping for platform"""
+        platform = self.default_system_platform if platform is None else platform
+        assert table in self.mapping
+        assert platform in self.mapping[table]
+        return self.mapping[table][platform]

Modified: trunk/Tools/Scripts/webkitpy/port/win.py (225720 => 225721)


--- trunk/Tools/Scripts/webkitpy/port/win.py	2017-12-09 05:36:37 UTC (rev 225720)
+++ trunk/Tools/Scripts/webkitpy/port/win.py	2017-12-09 05:40:02 UTC (rev 225721)
@@ -39,6 +39,7 @@
 from webkitpy.common.system.systemhost import SystemHost
 from webkitpy.common.system.executive import ScriptError, Executive
 from webkitpy.common.system.path import abspath_to_uri, cygpath
+from webkitpy.common.version_name_map import VersionNameMap
 from webkitpy.port.apple import ApplePort
 from webkitpy.port.config import apple_additions
 
@@ -435,16 +436,16 @@
 class WinCairoPort(WinPort):
     port_name = "wincairo"
 
-    VERSION_FALLBACK_ORDER = ["wincairo-xp", "wincairo-vista", "wincairo-7sp0", "wincairo-win10", "wincairo"]
+    VERSION_FALLBACK_ORDER = ["wincairo-" + os_name.lower() for os_name in VersionNameMap.map().names()]
 
     def default_baseline_search_path(self):
         name = self._name.replace('-wk2', '')
         if name.endswith(self.FUTURE_VERSION):
-            fallback_names = [self.port_name]
+            fallback_names = []
         else:
-            fallback_names = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(name):-1] + [self.port_name]
-        fallback_names.append('win')
-        fallback_names.append('mac')
+            assert name in self.VERSION_FALLBACK_ORDER
+            fallback_names = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(name):]
+        fallback_names.append(self.port_name)
         return map(self._webkit_baseline_path, fallback_names)
 
     def _future_port_name(self):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to