diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-01-31 16:33:05 +0100 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-03-06 17:05:02 +0100 |
| commit | 7526d9c4aa884a9d03700a76751158fd9c8bfece (patch) | |
| tree | df4b3136e4b9175c768b17ee152a5c299380f2be /sources/pyside-tools/deploy.py | |
| parent | fe62a95fe11cf2b4904fa09c57996089505a9438 (diff) | |
Deployment: Find dependent modules
- Based on the desktop platform, find all the Qt module dependencies
of the application just like Android. These dependencies can help
in optimizing the plugins packaged with the application.
- Desktop deployment has new cl arguments: --extra-ignore-dirs
and --extra-modules that further complements finding the Qt
modules used by the application.
- Since the Qt dependencies are also required for desktop deployment,
'modules' field in pysidedeploy.spec is moved from under 'buildozer'
key to 'qt' key.
- dependency finding code moved to dependency_util.py. This also
helps in list the imports without conflicts in deploy_lib/__init__.py.
- Fix tests. Skip the deploy tests for macOS 11 as the CI does not
include dyld_info either via XCode or CommandLineTools.
Task-number: PYSIDE-1612
Change-Id: I3524e1996bfec76c5635d1b35ccbc4ecd6ba7b8d
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy.py')
| -rw-r--r-- | sources/pyside-tools/deploy.py | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/sources/pyside-tools/deploy.py b/sources/pyside-tools/deploy.py index 576c01f9d..6cb6d4d9c 100644 --- a/sources/pyside-tools/deploy.py +++ b/sources/pyside-tools/deploy.py @@ -34,13 +34,14 @@ import traceback from pathlib import Path from textwrap import dedent -from deploy_lib import (MAJOR_VERSION, Config, cleanup, config_option_exists, - finalize, create_config_file, PythonExecutable, Nuitka) +from deploy_lib import (MAJOR_VERSION, DesktopConfig, cleanup, config_option_exists, + finalize, create_config_file, PythonExecutable, Nuitka, + HELP_EXTRA_MODULES, HELP_EXTRA_IGNORE_DIRS) def main(main_file: Path = None, name: str = None, config_file: Path = None, init: bool = False, loglevel=logging.WARNING, dry_run: bool = False, keep_deployment_files: bool = False, - force: bool = False): + force: bool = False, extra_ignore_dirs: str = None, extra_modules_grouped: str = None): logging.basicConfig(level=loglevel) if config_file and not config_file.exists() and not main_file.exists(): @@ -56,6 +57,18 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini config = None logging.info("[DEPLOY] Start") + if extra_ignore_dirs: + extra_ignore_dirs = extra_ignore_dirs.split(",") + + extra_modules = [] + if extra_modules_grouped: + tmp_extra_modules = extra_modules_grouped.split(",") + for extra_module in tmp_extra_modules: + if extra_module.startswith("Qt"): + extra_modules.append(extra_module[2:]) + else: + extra_modules.append(extra_module) + python = PythonExecutable(dry_run=dry_run, init=init, force=force) config_file_exists = config_file and Path(config_file).exists() @@ -65,8 +78,9 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini config_file = create_config_file(dry_run=dry_run, config_file=config_file, main_file=main_file) - config = Config(config_file=config_file, source_file=main_file, python_exe=python.exe, - dry_run=dry_run, existing_config_file=config_file_exists) + config = DesktopConfig(config_file=config_file, source_file=main_file, python_exe=python.exe, + dry_run=dry_run, existing_config_file=config_file_exists, + extra_ignore_dirs=extra_ignore_dirs) # set application name if name: @@ -81,6 +95,8 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini if python.is_pyenv_python() and add_arg not in config.extra_args: config.extra_args += add_arg + config.modules += list(set(extra_modules).difference(set(config.modules))) + # writing config file # in the case of --dry-run, we use default.spec as reference. Do not save the changes # for --dry-run @@ -153,7 +169,11 @@ if __name__ == "__main__": parser.add_argument("--name", type=str, help="Application name") + parser.add_argument("--extra-ignore-dirs", type=str, help=HELP_EXTRA_IGNORE_DIRS) + + parser.add_argument("--extra-modules", type=str, help=HELP_EXTRA_MODULES) + args = parser.parse_args() main(args.main_file, args.name, args.config_file, args.init, args.loglevel, args.dry_run, - args.keep_deployment_files, args.force) + args.keep_deployment_files, args.force, args.extra_ignore_dirs, args.extra_modules) |
