Skip to content

Commit 4fdd0ff

Browse files
committed
Merge bitcoin#22199: macdeploy: minor fixups and simplifications
0a5723b macdeploy: cleanup .temp.dmg if present (fanquake) ecffe86 macdeploy: remove qt4 related code (fanquake) 639f064 macdeploy: select the plugins we need, rather than excluding those we don't (fanquake) 3d26b6b macdeploy: fix framework printing when passing -verbose (fanquake) dca6c90 macdeploy: remove unused plistlib import (fanquake) Pull request description: This includes [one followup](bitcoin#20422 (comment)) and [one bug fix](bitcoin@3d26b6b) from bitcoin#20422, as well as some simplifications to the `macdeployqtplus` code. ACKs for top commit: hebasto: ACK 0a5723b, tested on macOS Big Sur 11.4 (20F71, x86_64) + Homebrew's Qt 5.15.2. Tree-SHA512: cfad9505eacd32fe3a9d06eb13b2de0b6d2cad7b17778e90b503501cbf922e53d4e7f7f74952d1aed58410bdae9b0bb3248098583ef5b85689cb27d4dc06c029
2 parents e7441a6 + 0a5723b commit 4fdd0ff

File tree

1 file changed

+10
-111
lines changed

1 file changed

+10
-111
lines changed

contrib/macdeploy/macdeployqtplus

Lines changed: 10 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
#
1818

19-
import plistlib
2019
import sys, re, os, shutil, stat, os.path
2120
from argparse import ArgumentParser
2221
from ds_store import DSStore
@@ -53,7 +52,7 @@ class FrameworkInfo(object):
5352
return False
5453

5554
def __str__(self):
56-
return f""" Framework name: {frameworkName}
55+
return f""" Framework name: {self.frameworkName}
5756
Framework directory: {self.frameworkDirectory}
5857
Framework path: {self.frameworkPath}
5958
Binary name: {self.binaryName}
@@ -85,8 +84,8 @@ class FrameworkInfo(object):
8584
if line == "":
8685
return None
8786

88-
# Don't deploy system libraries (exception for libQtuitools and libQtlucene).
89-
if line.startswith("/System/Library/") or line.startswith("@executable_path") or (line.startswith("/usr/lib/") and "libQt" not in line):
87+
# Don't deploy system libraries
88+
if line.startswith("/System/Library/") or line.startswith("@executable_path") or line.startswith("/usr/lib/"):
9089
return None
9190

9291
m = cls.reOLine.match(line)
@@ -287,14 +286,6 @@ def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional
287286
if verbose:
288287
print("Copied Contents:", fromContentsDir)
289288
print(" to:", toContentsDir)
290-
elif framework.frameworkName.startswith("libQtGui"): # Copy qt_menu.nib (applies to non-framework layout)
291-
qtMenuNibSourcePath = os.path.join(framework.frameworkDirectory, "Resources", "qt_menu.nib")
292-
qtMenuNibDestinationPath = os.path.join(path, "Contents", "Resources", "qt_menu.nib")
293-
if os.path.exists(qtMenuNibSourcePath) and not os.path.exists(qtMenuNibDestinationPath):
294-
shutil.copytree(qtMenuNibSourcePath, qtMenuNibDestinationPath, symlinks=True)
295-
if verbose:
296-
print("Copied for libQtGui:", qtMenuNibSourcePath)
297-
print(" to:", qtMenuNibDestinationPath)
298289

299290
return toPath
300291

@@ -351,115 +342,20 @@ def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip
351342
return deployFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, strip, verbose)
352343

353344
def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: DeploymentInfo, strip: bool, verbose: int):
354-
# Lookup available plugins, exclude unneeded
355345
plugins = []
356346
if deploymentInfo.pluginPath is None:
357347
return
358348
for dirpath, dirnames, filenames in os.walk(deploymentInfo.pluginPath):
359349
pluginDirectory = os.path.relpath(dirpath, deploymentInfo.pluginPath)
360-
if pluginDirectory == "designer":
361-
# Skip designer plugins
362-
continue
363-
elif pluginDirectory == "printsupport":
364-
# Skip printsupport plugins
365-
continue
366-
elif pluginDirectory == "imageformats":
367-
# Skip imageformats plugins
350+
351+
if pluginDirectory not in ['styles', 'platforms']:
368352
continue
369-
elif pluginDirectory == "sqldrivers":
370-
# Deploy the sql plugins only if QtSql is in use
371-
if not deploymentInfo.usesFramework("QtSql"):
372-
continue
373-
elif pluginDirectory == "script":
374-
# Deploy the script plugins only if QtScript is in use
375-
if not deploymentInfo.usesFramework("QtScript"):
376-
continue
377-
elif pluginDirectory == "qmltooling" or pluginDirectory == "qml1tooling":
378-
# Deploy the qml plugins only if QtDeclarative is in use
379-
if not deploymentInfo.usesFramework("QtDeclarative"):
380-
continue
381-
elif pluginDirectory == "bearer":
382-
# Deploy the bearer plugins only if QtNetwork is in use
383-
if not deploymentInfo.usesFramework("QtNetwork"):
384-
continue
385-
elif pluginDirectory == "position":
386-
# Deploy the position plugins only if QtPositioning is in use
387-
if not deploymentInfo.usesFramework("QtPositioning"):
388-
continue
389-
elif pluginDirectory == "sensors" or pluginDirectory == "sensorgestures":
390-
# Deploy the sensor plugins only if QtSensors is in use
391-
if not deploymentInfo.usesFramework("QtSensors"):
392-
continue
393-
elif pluginDirectory == "audio" or pluginDirectory == "playlistformats":
394-
# Deploy the audio plugins only if QtMultimedia is in use
395-
if not deploymentInfo.usesFramework("QtMultimedia"):
396-
continue
397-
elif pluginDirectory == "mediaservice":
398-
# Deploy the mediaservice plugins only if QtMultimediaWidgets is in use
399-
if not deploymentInfo.usesFramework("QtMultimediaWidgets"):
400-
continue
401-
elif pluginDirectory == "canbus":
402-
# Deploy the canbus plugins only if QtSerialBus is in use
403-
if not deploymentInfo.usesFramework("QtSerialBus"):
404-
continue
405-
elif pluginDirectory == "webview":
406-
# Deploy the webview plugins only if QtWebView is in use
407-
if not deploymentInfo.usesFramework("QtWebView"):
408-
continue
409-
elif pluginDirectory == "gamepads":
410-
# Deploy the webview plugins only if QtGamepad is in use
411-
if not deploymentInfo.usesFramework("QtGamepad"):
412-
continue
413-
elif pluginDirectory == "geoservices":
414-
# Deploy the webview plugins only if QtLocation is in use
415-
if not deploymentInfo.usesFramework("QtLocation"):
416-
continue
417-
elif pluginDirectory == "texttospeech":
418-
# Deploy the texttospeech plugins only if QtTextToSpeech is in use
419-
if not deploymentInfo.usesFramework("QtTextToSpeech"):
420-
continue
421-
elif pluginDirectory == "virtualkeyboard":
422-
# Deploy the virtualkeyboard plugins only if QtVirtualKeyboard is in use
423-
if not deploymentInfo.usesFramework("QtVirtualKeyboard"):
424-
continue
425-
elif pluginDirectory == "sceneparsers":
426-
# Deploy the virtualkeyboard plugins only if Qt3DCore is in use
427-
if not deploymentInfo.usesFramework("Qt3DCore"):
428-
continue
429-
elif pluginDirectory == "renderplugins":
430-
# Deploy the renderplugins plugins only if Qt3DCore is in use
431-
if not deploymentInfo.usesFramework("Qt3DCore"):
432-
continue
433-
elif pluginDirectory == "geometryloaders":
434-
# Deploy the geometryloaders plugins only if Qt3DCore is in use
435-
if not deploymentInfo.usesFramework("Qt3DCore"):
436-
continue
437353

438354
for pluginName in filenames:
439355
pluginPath = os.path.join(pluginDirectory, pluginName)
440-
if pluginName.endswith("_debug.dylib"):
441-
# Skip debug plugins
356+
357+
if pluginName.split('.')[0] not in ['libqminimal', 'libqcocoa', 'libqmacstyle']:
442358
continue
443-
elif pluginPath == "imageformats/libqsvg.dylib" or pluginPath == "iconengines/libqsvgicon.dylib":
444-
# Deploy the svg plugins only if QtSvg is in use
445-
if not deploymentInfo.usesFramework("QtSvg"):
446-
continue
447-
elif pluginPath == "accessible/libqtaccessiblecompatwidgets.dylib":
448-
# Deploy accessibility for Qt3Support only if the Qt3Support is in use
449-
if not deploymentInfo.usesFramework("Qt3Support"):
450-
continue
451-
elif pluginPath == "graphicssystems/libqglgraphicssystem.dylib":
452-
# Deploy the opengl graphicssystem plugin only if QtOpenGL is in use
453-
if not deploymentInfo.usesFramework("QtOpenGL"):
454-
continue
455-
elif pluginPath == "accessible/libqtaccessiblequick.dylib":
456-
# Deploy the accessible qtquick plugin only if QtQuick is in use
457-
if not deploymentInfo.usesFramework("QtQuick"):
458-
continue
459-
elif pluginPath == "platforminputcontexts/libqtvirtualkeyboardplugin.dylib":
460-
# Deploy the virtualkeyboardplugin plugin only if QtVirtualKeyboard is in use
461-
if not deploymentInfo.usesFramework("QtVirtualKeyboard"):
462-
continue
463359

464360
plugins.append((pluginDirectory, pluginName))
465361

@@ -527,6 +423,9 @@ if os.path.exists(appname + ".dmg"):
527423
print("+ Removing existing DMG +")
528424
os.unlink(appname + ".dmg")
529425

426+
if os.path.exists(appname + ".temp.dmg"):
427+
os.unlink(appname + ".temp.dmg")
428+
530429
# ------------------------------------------------
531430

532431
target = os.path.join("dist", "Bitcoin-Qt.app")

0 commit comments

Comments
 (0)