diff options
author | Shyamnath Premnadh <shyamnath.premnadh@qt.io> | 2023-04-04 16:18:47 +0200 |
---|---|---|
committer | Shyamnath Premnadh <shyamnath.premnadh@qt.io> | 2023-04-17 11:12:55 +0200 |
commit | 0e40c7af91df19a2ac20d88b55d4ef4d71845c55 (patch) | |
tree | b1002ad68cba00384ea0ee5c390c088ea630afe1 /sources/pyside-tools/deploy.py | |
parent | b80c7822c61b70d9704b42db64db0d9637fa7079 (diff) |
Deployment: Refactoring
- Fix --dry-run in Android deployment
- Add option to control raising a warning when adding new entries
to config file
- Remove unnecessary code and comments
Pick-to: 6.5
Task-number: PYSIDE-1612
Change-Id: I5975d76024d6289fe6b9af1caeca374acb81e8cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy.py')
-rw-r--r-- | sources/pyside-tools/deploy.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/sources/pyside-tools/deploy.py b/sources/pyside-tools/deploy.py index 904d4a2a4..51c10664b 100644 --- a/sources/pyside-tools/deploy.py +++ b/sources/pyside-tools/deploy.py @@ -3,21 +3,20 @@ """ pyside6-deploy deployment tool - Deployment tool that uses Nuitka to deploy PySide6 applications to various Desktop (Windows, + Deployment tool that uses Nuitka to deploy PySide6 applications to various desktop (Windows, Linux, macOS) platforms. How does it work? - Desktop Deployment: - Command: pyside6-deploy path/to/main_file - pyside6-deploy (incase main file is called main.py) - pyside6-deploy -c /path/to/config_file + Command: pyside6-deploy path/to/main_file + pyside6-deploy (incase main file is called main.py) + pyside6-deploy -c /path/to/config_file - Platforms Supported: Linux, Windows, macOS - Module Binary inclusion: - 1. for non-QML cases, only required modules are included - 2. for QML cases, all modules are included because of all QML plugins getting included - with nuitka + Platforms supported: Linux, Windows, macOS + Module binary inclusion: + 1. for non-QML cases, only required modules are included + 2. for QML cases, all modules are included because of all QML plugins getting included + with nuitka Config file: On the first run of the tool, it creates a config file called pysidedeploy.spec which @@ -31,8 +30,8 @@ import argparse import logging -from pathlib import Path import traceback +from pathlib import Path from textwrap import dedent from deploy_lib import (setup_python, get_config, cleanup, install_python_dependencies, finalize, @@ -45,9 +44,6 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini logging.basicConfig(level=loglevel) - if config_file and Path(config_file).exists(): - config_file = Path(config_file).resolve() - if not config_file and not main_file.exists(): print(dedent(""" Directory does not contain main.py file. @@ -80,6 +76,8 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini packages="packages") # writing config file + # in the case of --dry-run, we use default.spec as reference. Do not save the changes + # for --dry-run if not dry_run: config.update_config() @@ -112,12 +110,13 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini if __name__ == "__main__": parser = argparse.ArgumentParser( - description=(f"This tool deploys PySide{MAJOR_VERSION} to Desktop (Windows, Linux, macOS)" + description=(f"This tool deploys PySide{MAJOR_VERSION} to desktop (Windows, Linux, macOS)" "platforms"), formatter_class=argparse.RawTextHelpFormatter, ) - parser.add_argument("-c", "--config-file", type=str, help="Path to the .spec config file") + parser.add_argument("-c", "--config-file", type=lambda p: Path(p).absolute(), + help="Path to the .spec config file") parser.add_argument( type=lambda p: Path(p).absolute(), |