Title: [284556] trunk/Tools
Revision
284556
Author
commit-qu...@webkit.org
Date
2021-10-20 11:50:14 -0700 (Wed, 20 Oct 2021)

Log Message

Benchmarks harness could fail if pyobjc-core module is upgraded without upgrading other pyobjc-frameworks
https://bugs.webkit.org/show_bug.cgi?id=231983

Patch by Roy Reapor <rrea...@apple.com> on 2021-10-20
Reviewed by Jonathan Bedard.

* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver.prepare_env): Use autoinstalled Quartz module
(OSXBrowserDriver._terminate_processes):  Use autoinstalled AppKit module

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (284555 => 284556)


--- trunk/Tools/ChangeLog	2021-10-20 18:42:14 UTC (rev 284555)
+++ trunk/Tools/ChangeLog	2021-10-20 18:50:14 UTC (rev 284556)
@@ -1,3 +1,14 @@
+2021-10-20  Roy Reapor  <rrea...@apple.com>
+
+        Benchmarks harness could fail if pyobjc-core module is upgraded without upgrading other pyobjc-frameworks
+        https://bugs.webkit.org/show_bug.cgi?id=231983
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
+        (OSXBrowserDriver.prepare_env): Use autoinstalled Quartz module
+        (OSXBrowserDriver._terminate_processes):  Use autoinstalled AppKit module
+
 2021-10-20  Alex Christensen  <achristen...@webkit.org>
 
         Fix iOS build after r284539

Added: trunk/Tools/Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py (0 => 284556)


--- trunk/Tools/Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py	2021-10-20 18:50:14 UTC (rev 284556)
@@ -0,0 +1,40 @@
+# Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import objc
+
+from webkitscmpy import AutoInstall, Package, Version
+
+pyobjc_core_version = Version.from_string(objc.__version__)
+AutoInstall.register(Package('Cocoa', pyobjc_core_version, pypi_name='pyobjc-framework-Cocoa'))
+AutoInstall.register(Package('Quartz', pyobjc_core_version, pypi_name='pyobjc-framework-Quartz'))
+
+# Modules from pyobjc-framework-Cocoa
+# Note, the module (`import_name`) provided to `AutoInstall.register`
+# must be imported first. This triggers the package install if necessary.
+Cocoa = __import__('Cocoa')
+AppKit = __import__('AppKit')
+CoreFoundation = __import__('CoreFoundation')
+Foundation = __import__('Foundation')
+
+# Module from pyobjc-framework-Quartz
+Quartz = __import__('Quartz')

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py (284555 => 284556)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py	2021-10-20 18:42:14 UTC (rev 284555)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py	2021-10-20 18:50:14 UTC (rev 284556)
@@ -21,8 +21,8 @@
 
     def prepare_env(self, config):
         self.close_browsers()
-        from Quartz import CGWarpMouseCursorPosition
-        CGWarpMouseCursorPosition((10, 0))
+        from webkitpy.autoinstalled.pyobjc_frameworks import Quartz
+        Quartz.CGWarpMouseCursorPosition((10, 0))
         self.updated_dock_animation_defaults = write_defaults('com.apple.dock', 'launchanim', False)
         if self.updated_dock_animation_defaults:
             self._terminate_processes('Dock', 'com.apple.dock')
@@ -61,9 +61,9 @@
 
     @classmethod
     def _terminate_processes(cls, process_name, bundle_id):
-        from AppKit import NSRunningApplication
+        from webkitpy.autoinstalled.pyobjc_frameworks import AppKit
         _log.info('Closing all processes with name %s' % process_name)
-        for app in NSRunningApplication.runningApplicationsWithBundleIdentifier_(bundle_id):
+        for app in AppKit.NSRunningApplication.runningApplicationsWithBundleIdentifier_(bundle_id):
             app.terminate()
             # Give the app time to close
             time.sleep(2)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to