diff options
| author | Eike Ziller <eike.ziller@qt.io> | 2023-07-26 16:06:41 +0200 |
|---|---|---|
| committer | Eike Ziller <eike.ziller@qt.io> | 2023-08-28 10:13:25 +0000 |
| commit | 1555ab3094a4a4f778e6fcd95511f5bf325fa6f3 (patch) | |
| tree | f83006c3fc8ea460250208cfbefa866f04019675 /scripts/deploy.py | |
| parent | db4d424b43378717f517929cab02e4b598971ac9 (diff) | |
Build/deploy: Move qt.conf creation to deploy.py
Moving things away from deployqtHelper_mac.sh
Change-Id: I41810ac060bde63f3b11af852bb2e2f37d822bf4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'scripts/deploy.py')
| -rwxr-xr-x | scripts/deploy.py | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/scripts/deploy.py b/scripts/deploy.py index 17460930bf8..92f068ddfb0 100755 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -197,19 +197,59 @@ def deploy_imports(qtc_binary_path, qt_install): common.copytree(qt_install.qml, destdir, ignore=ignored_qt_lib_files, symlinks=True) +def qt_conf_contents(): + if common.is_linux_platform(): + return '''[Paths] +Prefix={0} +Binaries=bin +Libraries=lib +Plugins=plugins +Qml2Imports=qml +''' + if common.is_windows_platform(): + return '''[Paths] +Prefix={0} +Binaries=. +Libraries=. +Plugins=plugins +Qml2Imports=qml +''' + return '''[Paths] +Prefix={0} +Binaries=MacOS +Libraries=Frameworks +Plugins=PlugIns +Qml2Imports=Imports/qtquick2 +''' + + def add_qt_conf(target_path, qt_prefix_path): qtconf_filepath = os.path.join(target_path, 'qt.conf') prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/') print('Creating qt.conf in "{0}":'.format(qtconf_filepath)) f = open(qtconf_filepath, 'w') - f.write('[Paths]\n') - f.write('Prefix={0}\n'.format(prefix_path)) - f.write('Binaries={0}\n'.format('bin' if common.is_linux_platform() else '.')) - f.write('Libraries={0}\n'.format('lib' if common.is_linux_platform() else '.')) - f.write('Plugins=plugins\n') - f.write('Qml2Imports=qml\n') + f.write(qt_conf_contents().format(prefix_path)) f.close() + +def deploy_qt_conf_files(qtc_binary_path): + if common.is_linux_platform(): + qt_prefix_path = os.path.join(qtc_binary_path, '..', 'lib', 'Qt') + add_qt_conf(os.path.join(qtc_binary_path, '..', 'libexec', 'qtcreator'), qt_prefix_path) + add_qt_conf(os.path.join(qtc_binary_path, '..', 'lib', 'Qt', 'bin'), qt_prefix_path) # qtdiag + add_qt_conf(qtc_binary_path, qt_prefix_path) # QtC itself + if common.is_windows_platform(): + add_qt_conf(qtc_binary_path, qtc_binary_path) # QtC itself, libexec, and qtdiag etc + if common.is_mac_platform(): + qt_prefix_path = os.path.join(qtc_binary_path, 'Contents') + qtc_resources_path = os.path.join(qtc_binary_path, 'Contents', 'Resources') + add_qt_conf(os.path.join(qtc_resources_path, 'libexec'), qt_prefix_path) + add_qt_conf(os.path.join(qtc_resources_path, 'libexec', 'ios'), qt_prefix_path) + # The Prefix path for a qt.conf in Contents/Resources/ is handled specially/funny by Qt, + # relative paths are resolved relative to Contents/, so we must enforces Prefix=. + add_qt_conf(qtc_resources_path, qtc_resources_path) # QtC itself + + def deploy_translations(qtc_binary_path, qt_install): print("Copying translations...") translations = glob(os.path.join(qt_install.translations, '*.qm')) @@ -387,6 +427,7 @@ def main(): deploy_plugins(qtcreator_binary_path, qt_install) deploy_imports(qtcreator_binary_path, qt_install) deploy_translations(qtcreator_binary_path, qt_install) + deploy_qt_conf_files(qtcreator_binary_path) if common.is_mac_platform(): deploy_mac(args) @@ -411,9 +452,6 @@ def main(): if not common.is_windows_platform(): print("fixing rpaths...") common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin) - add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'), qt_deploy_prefix) # e.g. for qml2puppet - add_qt_conf(os.path.join(qt_deploy_prefix, 'bin'), qt_deploy_prefix) # e.g. qtdiag - add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix) if __name__ == "__main__": main() |
