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_lib/deploy_util.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_lib/deploy_util.py')
| -rw-r--r-- | sources/pyside-tools/deploy_lib/deploy_util.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sources/pyside-tools/deploy_lib/deploy_util.py b/sources/pyside-tools/deploy_lib/deploy_util.py index de545e3a5..bb986344c 100644 --- a/sources/pyside-tools/deploy_lib/deploy_util.py +++ b/sources/pyside-tools/deploy_lib/deploy_util.py @@ -42,16 +42,31 @@ def cleanup(generated_files_path: Path, config: Config, is_android: bool = False def get_config(python_exe: Path, dry_run: bool = False, config_file: Path = None, main_file: - Path = None, android_data = None, is_android: bool = False): + Path = None, android_data=None, is_android: bool = False): """ - Sets up a new deployment configuration or use an existing config file + Sets up a new pysidedeploy.spec or use an existing config file """ - if main_file and not config_file: + + config_file_exists = config_file and Path(config_file).exists() + + if main_file and not config_file_exists: if main_file.parent != Path.cwd(): config_file = main_file.parent / "pysidedeploy.spec" else: config_file = Path.cwd() / "pysidedeploy.spec" + if config_file_exists: + logging.info(f"[DEPLOY] Using existing config file {config_file}") + else: + logging.info(f"[DEPLOY] Creating config file {config_file}") + if not dry_run: + shutil.copy(Path(__file__).parent / "default.spec", config_file) + + # the config parser needs a reference to parse. So, in the case of --dry-run + # use the default.spec file. + if dry_run and not config_file_exists: + config_file = Path(__file__).parent / "default.spec" + config = Config(config_file=config_file, source_file=main_file, python_exe=python_exe, dry_run=dry_run, android_data=android_data, is_android=is_android) |
