diff options
| author | Jaime Resano <Jaime.Resano-Aisa@qt.io> | 2024-11-29 16:58:05 +0100 |
|---|---|---|
| committer | Jaime Resano <Jaime.Resano-Aisa@qt.io> | 2025-01-22 10:03:01 +0100 |
| commit | 775d7bf2c6cb8b7b6b3abd12afd883e2dda1be50 (patch) | |
| tree | a39ababa60231ced1451d9d3755c6ff2461f339e /sources/pyside-tools/deploy_lib/design_studio.py | |
| parent | 8a1950f66da618d59e622411604e09c9817d3b33 (diff) | |
pyside6-deploy: 2. Improve deployment of Design Studio projects
Design Studio projects will specify the resources employed by the
project in the .qrc file. This way, the deployment process is way
simpler since all the file dependencies are stored compiled in a .py
file.
Task-number: PYSIDE-1612
Change-Id: Icc0047e9f9c183a4db51052a84743e5b095ec76a
Pick-to: 6.8
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/design_studio.py')
| -rw-r--r-- | sources/pyside-tools/deploy_lib/design_studio.py | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/sources/pyside-tools/deploy_lib/design_studio.py b/sources/pyside-tools/deploy_lib/design_studio.py deleted file mode 100644 index 1fc1a4cc8..000000000 --- a/sources/pyside-tools/deploy_lib/design_studio.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2024 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -import logging -import atexit -from pathlib import Path - -# FIXME: Remove this idea of creating main_patch.py once the corresponding changes are -# made in Design Studio main.py file: -# if '__compiled__' in globals(): #nuitka -# app_dir = Path(__file__).parent -# else: -# app_dir = Path(__file__).parent.parent - - -class DesignStudio: - """ - Class to handle Design Studio projects - """ - - def __init__(self, main_file: Path): - self.ds_project_dir = main_file.parent.parent - self.current_main_file = main_file - self.new_main_file = main_file.parent / 'main_patch.py' - self._create_new_main_file() - atexit.register(self._delete_main_patch_file) - - def _create_new_main_file(self): - # read the content of main file - content = "" - with open(self.current_main_file, 'r', encoding='utf-8') as main_file: - content = main_file.read() - - # replace app_dir - content = content.replace("app_dir = Path(__file__).parent.parent", # old value - "app_dir = Path(__file__).parent") # new value - - # write the content to new main file - with open(self.new_main_file, 'w', encoding="utf-8") as main_file: - main_file.write(content) - - def _delete_main_patch_file(self): - if self.new_main_file.exists(): - logging.info(f"[DEPLOY] Removing {self.new_main_file}") - self.new_main_file.unlink() - - @staticmethod - def isDSProject(main_file: Path) -> bool: - return (main_file.parent / 'autogen/settings.py').exists() - - @property - def project_dir(self) -> str: - return self.ds_project_dir - - @property - def ds_source_file(self) -> Path: - return self.new_main_file |
