diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2025-07-29 13:38:36 +0200 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2025-08-04 12:00:08 +0200 |
| commit | 8f65a3a7990e6e0901aa2d6e5db30c26f64051fa (patch) | |
| tree | f19fb6eaa41a7a7652b3acb591ebc3a2ba3ab431 /sources/pyside-tools/deploy_lib/config.py | |
| parent | 6cfe97486665a7d9e6070c40b217fea709185bcc (diff) | |
Deployment: Use relative paths
- For input_file and project_dir, use relative paths instead of
absolute paths so that it can be checked in to version control.
- Fix tests accordingly.
Fixes: PYSIDE-3146
Pick-to: 6.9 6.8
Change-Id: I4260a4844edc71964d5c2ab907915e5fbbcf4e41
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/config.py')
| -rw-r--r-- | sources/pyside-tools/deploy_lib/config.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sources/pyside-tools/deploy_lib/config.py b/sources/pyside-tools/deploy_lib/config.py index 25e4cccd8..853f5f6a2 100644 --- a/sources/pyside-tools/deploy_lib/config.py +++ b/sources/pyside-tools/deploy_lib/config.py @@ -223,9 +223,14 @@ class Config(BaseConfig): return self._project_dir @project_dir.setter - def project_dir(self, project_dir: Path): + def project_dir(self, project_dir: Path) -> None: + rel_path = ( + project_dir.relative_to(self.config_file.parent) + if project_dir.is_relative_to(self.config_file.parent) + else project_dir + ) self._project_dir = project_dir - self.set_value("app", "project_dir", str(project_dir)) + self.set_value("app", "project_dir", str(rel_path)) @property def project_file(self) -> Path: @@ -258,9 +263,14 @@ class Config(BaseConfig): return self._source_file @source_file.setter - def source_file(self, source_file: Path): + def source_file(self, source_file: Path) -> None: + rel_path = ( + source_file.relative_to(self.config_file.parent) + if source_file.is_relative_to(self.config_file.parent) + else source_file + ) self._source_file = source_file - self.set_value("app", "input_file", str(source_file)) + self.set_value("app", "input_file", str(rel_path)) @property def python_path(self) -> Path: |
