Title: [276935] trunk/Tools
- Revision
- 276935
- Author
- jbed...@apple.com
- Date
- 2021-05-03 16:41:50 -0700 (Mon, 03 May 2021)
Log Message
[webkitpy] Support pickling platforminfo
https://bugs.webkit.org/show_bug.cgi?id=225230
<rdar://problem/77384913>
Rubber-stamped by Aakash Jain.
* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo.__init__): Define default arguments.
(PlatformInfo.display_name): Use default platform module if platform_module undefined.
(PlatformInfo._win_version_str): Ditto.
* Scripts/webkitpy/common/system/platforminfo_unittest.py:
(TestPlatformInfo.test_real_code):
* Scripts/webkitpy/common/system/systemhost.py:
(SystemHost.__init__): Use default platforminfo sys and platform modules.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (276934 => 276935)
--- trunk/Tools/ChangeLog 2021-05-03 23:25:05 UTC (rev 276934)
+++ trunk/Tools/ChangeLog 2021-05-03 23:41:50 UTC (rev 276935)
@@ -1,3 +1,20 @@
+2021-05-03 Jonathan Bedard <jbed...@apple.com>
+
+ [webkitpy] Support pickling platforminfo
+ https://bugs.webkit.org/show_bug.cgi?id=225230
+ <rdar://problem/77384913>
+
+ Rubber-stamped by Aakash Jain.
+
+ * Scripts/webkitpy/common/system/platforminfo.py:
+ (PlatformInfo.__init__): Define default arguments.
+ (PlatformInfo.display_name): Use default platform module if platform_module undefined.
+ (PlatformInfo._win_version_str): Ditto.
+ * Scripts/webkitpy/common/system/platforminfo_unittest.py:
+ (TestPlatformInfo.test_real_code):
+ * Scripts/webkitpy/common/system/systemhost.py:
+ (SystemHost.__init__): Use default platforminfo sys and platform modules.
+
2021-05-03 Alex Christensen <achristen...@webkit.org>
WKWebView: WKURLSchemeHandler request don't have Range headers for custom scheme videos
Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py (276934 => 276935)
--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py 2021-05-03 23:25:05 UTC (rev 276934)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py 2021-05-03 23:41:50 UTC (rev 276935)
@@ -37,7 +37,7 @@
from webkitpy.common.memoized import memoized
from webkitpy.common.version_name_map import PUBLIC_TABLE, INTERNAL_TABLE, VersionNameMap
-from webkitpy.common.system.executive import ScriptError
+from webkitpy.common.system.executive import Executive, ScriptError
from webkitpy.port.config import apple_additions
@@ -59,8 +59,9 @@
newer than one known to the code.
"""
- def __init__(self, sys_module, platform_module, executive):
- self._executive = executive
+ def __init__(self, sys_module=None, platform_module=None, executive=None):
+ sys_module = sys_module or sys
+ self._executive = executive or Executive()
self._platform_module = platform_module
self.os_name = self._determine_os_name(sys_module.platform)
self.os_version = None
@@ -77,7 +78,7 @@
self.os_version = self._win_version()
else:
# Most other platforms (namely iOS) return conforming version strings.
- version = re.search(r'\d+.\d+(.\d+)?', platform_module.release())
+ version = re.search(r'\d+.\d+(.\d+)?', (platform_module or platform).release())
if version:
self.os_version = Version.from_string(version.group(0))
else:
@@ -134,12 +135,12 @@
def display_name(self):
# platform.platform() returns Darwin information for Mac, which is just confusing.
if self.is_mac():
- return "Mac OS X %s" % self._platform_module.mac_ver()[0]
+ return "Mac OS X %s" % (self._platform_module or platform).mac_ver()[0]
# Returns strings like:
# Linux-2.6.18-194.3.1.el5-i686-with-redhat-5.5-Final
# Windows-2008ServerR2-6.1.7600
- return self._platform_module.platform()
+ return (self._platform_module or platform).platform()
def os_version_name(self, table=None):
if not self.os_version:
@@ -246,7 +247,7 @@
return Version.from_iterable(match_object.groups())
def _win_version_str(self):
- version = self._platform_module.win32_ver()[1]
+ version = (self._platform_module or platform).win32_ver()[1]
if version:
return version
# Note that this should only ever be called on windows, so this should always work.
Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py (276934 => 276935)
--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py 2021-05-03 23:25:05 UTC (rev 276934)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py 2021-05-03 23:41:50 UTC (rev 276935)
@@ -75,7 +75,7 @@
# yet run by default and there's no reason not to run this everywhere by default.
def test_real_code(self):
# This test makes sure the real (unmocked) code actually works.
- info = PlatformInfo(sys, platform, Executive())
+ info = PlatformInfo(executive=Executive())
self.assertNotEqual(info.os_name, '')
if info.is_mac() or info.is_win():
self.assertIsNotNone(info.os_version)
Modified: trunk/Tools/Scripts/webkitpy/common/system/systemhost.py (276934 => 276935)
--- trunk/Tools/Scripts/webkitpy/common/system/systemhost.py 2021-05-03 23:25:05 UTC (rev 276934)
+++ trunk/Tools/Scripts/webkitpy/common/system/systemhost.py 2021-05-03 23:41:50 UTC (rev 276935)
@@ -38,7 +38,7 @@
def __init__(self):
self.executive = executive.Executive()
self.filesystem = filesystem.FileSystem()
- self.platform = platforminfo.PlatformInfo(sys, platform, self.executive)
+ self.platform = platforminfo.PlatformInfo(executive=self.executive)
self.user = user.User(self.platform)
self.workspace = workspace.Workspace(self.filesystem, self.executive)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes