aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/main.py
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2022-04-07 11:26:59 +0200
committerCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2022-06-01 11:47:37 +0200
commitcbc7d2a21b63f58144da0d5a42048b7b9dee1eb0 (patch)
tree60d27779b4ec28aab3a9f362af62518f8111861c /build_scripts/main.py
parent41de0c478794a7cd67a9e118d6be600ecc15e5e8 (diff)
build: remove directories in 'package_for_wheels/' on re-run
The 'package_for_wheels' directory remains populated on a second build, so to make sure that there are no conflicts, we remove the directories inside in case it exists. This means that 'shiboken6', 'shiboken6_generator', and 'pyside6' directories inside 'package_for_wheels' will be removed when found. Pick-to: 6.3 Change-Id: Idccbf1d2ab67e046e7d6288c8daa4e0a264ad08c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'build_scripts/main.py')
-rw-r--r--build_scripts/main.py43
1 files changed, 30 insertions, 13 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index ed3f60622..1617141d8 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -9,7 +9,7 @@ import sys
import time
from packaging.version import parse as parse_version
from pathlib import Path
-from shutil import which, copytree
+from shutil import which, copytree, rmtree
from textwrap import dedent
# PYSIDE-1760: Pre-load setuptools modules early to avoid racing conditions.
@@ -424,18 +424,35 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin):
# a wheel.
_path = Path(self.st_build_dir)
_wheel_path = _path.parent / "package_for_wheels"
- if not _wheel_path.exists():
- _wheel_path.mkdir()
- _package_name = os.listdir(_path)[0]
- _src = Path(_path / _package_name)
- _dst = Path(_wheel_path / _package_name)
- try:
- # This should be copied because the package directory
- # is used when using the 'install' setup.py instruction.
- copytree(_src, _dst)
- except Exception as e:
- log.warn(f'***** problem renaming "{self.st_build_dir}"')
- log.warn(f'ignored error: {type(e).__name__}: {e}')
+
+ _project = None
+
+ if config.is_internal_shiboken_module_build():
+ _project = "shiboken6"
+ elif config.is_internal_shiboken_generator_build():
+ _project = "shiboken6_generator"
+ elif config.is_internal_pyside_build():
+ _project = "PySide6"
+
+ if _project is not None:
+ if not _wheel_path.exists():
+ _wheel_path.mkdir()
+ _src = Path(_path / _project)
+ _dst = Path(_wheel_path / _project)
+ # Remove the directory in case it exists.
+ # This applies to 'shiboken6', 'shiboken6_generator',
+ # and 'pyside6' inside the 'package_for_wheels' directory.
+ if _dst.exists():
+ log.warn(f'***** Found directory "{_dst}", removing it first.')
+ rmtree(_dst)
+
+ try:
+ # This should be copied because the package directory
+ # is used when using the 'install' setup.py instruction.
+ copytree(_src, _dst)
+ except Exception as e:
+ log.warn(f'***** problem renaming "{self.st_build_dir}"')
+ log.warn(f'ignored error: {type(e).__name__}: {e}')
else:
log.info("Skipped preparing and building packages.")
log.info(f"--- Build completed ({elapsed()}s)")