summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-11-23 11:11:19 +0100
committerEike Ziller <eike.ziller@qt.io>2020-11-24 09:36:56 +0000
commit07128078b9a61e709ecf20c4345b0a655a58fcd8 (patch)
treec7d55af3a372f328ab7df863b8dad56b2d67a4a8 /scripts
parent1c244bd6231d09d0f79c7e59cf389d27563d2307 (diff)
downloadqt-creator-07128078b9a61e709ecf20c4345b0a655a58fcd8.tar.gz
Integrate deployqtHelp_mac.sh into deployqt.py
For now this is a dummy integration by just calling the former from the latter, which has the advantage that - only one script needs to be used for all platforms - passing just qmake instead of individual install paths is enough also on macOS Change-Id: Ie05077ada950addd287b87d88045605d3bddb48f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.py33
-rw-r--r--scripts/common.py4
-rwxr-xr-xscripts/deployqt.py64
3 files changed, 56 insertions, 45 deletions
diff --git a/scripts/build.py b/scripts/build.py
index 5a0ad99607..c9a6a2ce1b 100755
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -216,30 +216,15 @@ def build_qtcreatorcdbext(args, paths):
paths.build)
def deploy_qt(args, paths):
- if common.is_mac_platform():
- script = os.path.join(paths.src, 'scripts', 'deployqtHelper_mac.sh')
- app = os.path.join(paths.install, args.app_target)
- # TODO this is wrong if Qt is set up non-standard
- # TODO integrate deployqtHelper_mac.sh into deployqt.py, finally
- qt_bins = os.path.join(paths.qt, 'bin')
- qt_translations = os.path.join(paths.qt, 'translations')
- qt_plugins = os.path.join(paths.qt, 'plugins')
- qt_qml = os.path.join(paths.qt, 'qml')
- env = dict(os.environ)
- if paths.llvm:
- env['LLVM_INSTALL_DIR'] = paths.llvm
- common.check_print_call([script, app, qt_bins, qt_translations, qt_plugins, qt_qml],
- paths.build,
- env=env)
- else:
- cmd_args = ['python', '-u', os.path.join(paths.src, 'scripts', 'deployqt.py'), '-i']
- if paths.elfutils:
- cmd_args.extend(['--elfutils-path', paths.elfutils])
- if paths.llvm:
- cmd_args.extend(['--llvm-path', paths.llvm])
- exe = os.path.join(paths.install, 'bin', args.app_target)
- common.check_print_call(cmd_args + [exe, os.path.join(paths.qt, 'bin', 'qmake')],
- paths.build)
+ cmd_args = ['python', '-u', os.path.join(paths.src, 'scripts', 'deployqt.py'), '-i']
+ if paths.elfutils:
+ cmd_args.extend(['--elfutils-path', paths.elfutils])
+ if paths.llvm:
+ cmd_args.extend(['--llvm-path', paths.llvm])
+ app = (os.path.join(paths.install, args.app_target) if common.is_mac_platform()
+ else os.path.join(paths.install, 'bin', args.app_target))
+ common.check_print_call(cmd_args + [app, os.path.join(paths.qt, 'bin', 'qmake')],
+ paths.build)
def package_qtcreator(args, paths):
if not args.no_zip:
diff --git a/scripts/common.py b/scripts/common.py
index df025cf839..d530afdb72 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -46,11 +46,11 @@ def to_posix_path(path):
return path.replace('\\', '/')
return path
-def check_print_call(command, workdir, env=None):
+def check_print_call(command, workdir=None, env=None):
print('------------------------------------------')
print('COMMAND:')
print(' '.join(['"' + c.replace('"', '\\"') + '"' for c in command]))
- print('PWD: "' + workdir + '"')
+ print('PWD: "' + (workdir if workdir else os.getcwd()) + '"')
print('------------------------------------------')
subprocess.check_call(command, cwd=workdir, env=env)
diff --git a/scripts/deployqt.py b/scripts/deployqt.py
index e0c8c7cdf5..5347c16585 100755
--- a/scripts/deployqt.py
+++ b/scripts/deployqt.py
@@ -28,6 +28,7 @@
################################################################################
import argparse
+import collections
import os
import locale
import sys
@@ -51,15 +52,22 @@ def get_args():
parser.add_argument('--llvm-path',
help='Path to LLVM installation',
default=os.environ.get('LLVM_INSTALL_DIR'))
- parser.add_argument('qtcreator_binary', help='Path to Qt Creator binary')
+ parser.add_argument('qtcreator_binary', help='Path to Qt Creator binary (or the app bundle on macOS)')
parser.add_argument('qmake_binary', help='Path to qmake binary')
args = parser.parse_args()
args.qtcreator_binary = os.path.abspath(args.qtcreator_binary)
- if common.is_windows_platform() and not args.qtcreator_binary.lower().endswith(".exe"):
- args.qtcreator_binary = args.qtcreator_binary + ".exe"
- if not os.path.isfile(args.qtcreator_binary):
+ if common.is_mac_platform():
+ if not args.qtcreator_binary.lower().endswith(".app"):
+ args.qtcreator_binary = args.qtcreator_binary + ".app"
+ check = os.path.isdir
+ else:
+ check = os.path.isfile
+ if common.is_windows_platform() and not args.qtcreator_binary.lower().endswith(".exe"):
+ args.qtcreator_binary = args.qtcreator_binary + ".exe"
+
+ if not check(args.qtcreator_binary):
print('Cannot find Qt Creator binary.')
sys.exit(1)
@@ -333,8 +341,37 @@ def deploy_elfutils(qtc_install_dir, chrpath_bin, args):
print(file, '->', backends_install_path)
shutil.copy(file, backends_install_path)
+def deploy_mac(args):
+ (_, qt_install) = get_qt_install_info(args.qmake_binary)
+
+ env = dict(os.environ)
+ if args.llvm_path:
+ env['LLVM_INSTALL_DIR'] = args.llvm_path
+
+ script_path = os.path.dirname(os.path.realpath(__file__))
+ deployqtHelper_mac = os.path.join(script_path, 'deployqtHelper_mac.sh')
+ common.check_print_call([deployqtHelper_mac, args.qtcreator_binary, qt_install.bin,
+ qt_install.translations, qt_install.plugins, qt_install.qml],
+ env=env)
+
+def get_qt_install_info(qmake_binary):
+ qt_install_info = common.get_qt_install_info(qmake_binary)
+ QtInstallInfo = collections.namedtuple('QtInstallInfo', ['bin', 'lib', 'plugins',
+ 'qml', 'translations'])
+ return (qt_install_info,
+ QtInstallInfo(bin=qt_install_info['QT_INSTALL_BINS'],
+ lib=qt_install_info['QT_INSTALL_LIBS'],
+ plugins=qt_install_info['QT_INSTALL_PLUGINS'],
+ qml=qt_install_info['QT_INSTALL_QML'],
+ translations=qt_install_info['QT_INSTALL_TRANSLATIONS']))
+
def main():
args = get_args()
+ if common.is_mac_platform():
+ deploy_mac(args)
+ return
+
+ (qt_install_info, qt_install) = get_qt_install_info(args.qmake_binary)
qtcreator_binary_path = os.path.dirname(args.qtcreator_binary)
install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
@@ -350,13 +387,6 @@ def main():
print("Cannot find required binary 'chrpath'.")
sys.exit(2)
- qt_install_info = common.get_qt_install_info(args.qmake_binary)
- QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
- QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
- QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
- QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']
- QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']
-
plugins = ['assetimporters', 'accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes',
'platforminputcontexts', 'platforms', 'printsupport', 'qmltooling', 'sqldrivers', 'styles',
'xcbglintegrations',
@@ -370,10 +400,10 @@ def main():
debug_build = is_debug(args.qtcreator_binary)
if common.is_windows_platform():
- copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_BINS, QT_INSTALL_PLUGINS, QT_INSTALL_QML, plugins)
+ copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib, qt_install.plugins, qt_install.qml, plugins)
else:
- copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS, QT_INSTALL_QML, plugins)
- copy_translations(install_dir, QT_INSTALL_TRANSLATIONS)
+ copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib, qt_install.plugins, qt_install.qml, plugins)
+ copy_translations(install_dir, qt_install.translations)
if args.llvm_path:
deploy_libclang(install_dir, args.llvm_path, chrpath_bin)
@@ -387,8 +417,4 @@ def main():
add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)
if __name__ == "__main__":
- if common.is_mac_platform():
- print("macOS is not supported by this script, please use macqtdeploy!")
- sys.exit(2)
- else:
- main()
+ main()