Modified: trunk/Tools/ChangeLog (284905 => 284906)
--- trunk/Tools/ChangeLog 2021-10-26 22:12:50 UTC (rev 284905)
+++ trunk/Tools/ChangeLog 2021-10-26 22:27:43 UTC (rev 284906)
@@ -1,3 +1,15 @@
+2021-10-26 Roy Reapor <[email protected]>
+
+ webkitpy/autoinstalled/pyobjc_frameworks.py should not autoinstall frameworks if they can be imported without exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=232331
+
+ Reviewed by Jonathan Bedard.
+
+ Avoid autointalling pyobjc frameworks if the installed frameworks can be imported without generating an exception.
+
+ * Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py:
+ (_import_modules):
+
2021-10-26 Tim Horton <[email protected]>
[GPU Process] `DisplayList::Recorder::getCTM` should include the device scale factor
Modified: trunk/Tools/Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py (284905 => 284906)
--- trunk/Tools/Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py 2021-10-26 22:12:50 UTC (rev 284905)
+++ trunk/Tools/Scripts/webkitpy/autoinstalled/pyobjc_frameworks.py 2021-10-26 22:27:43 UTC (rev 284906)
@@ -24,17 +24,26 @@
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', wheel=True))
-AutoInstall.register(Package('Quartz', pyobjc_core_version, pypi_name='pyobjc-framework-Quartz', wheel=True))
-# 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')
+def _import_modules():
+ # Modules from pyobjc-framework-Cocoa and pyobjc-framework-Quartz
+ # Note, the module (`import_name`) provided to `Package()`
+ # must be imported first. This triggers the package install if necessary.
+ return (
+ __import__('Cocoa'),
+ __import__('AppKit'),
+ __import__('CoreFoundation'),
+ __import__('Foundation'),
+ __import__('Quartz')
+ )
-# Module from pyobjc-framework-Quartz
-Quartz = __import__('Quartz')
+
+try:
+ Cocoa, AppKit, CoreFoundation, Foundation, Quartz = _import_modules()
+except Exception as e:
+ AutoInstall.log('Import failed with exception {}'.format(e))
+ AutoInstall.log('Autoinstalling...')
+ pyobjc_core_version = Version.from_string(objc.__version__)
+ AutoInstall.register(Package('Cocoa', pyobjc_core_version, pypi_name='pyobjc-framework-Cocoa', wheel=True))
+ AutoInstall.register(Package('Quartz', pyobjc_core_version, pypi_name='pyobjc-framework-Quartz', wheel=True))
+ Cocoa, AppKit, CoreFoundation, Foundation, Quartz = _import_modules()