aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2022-06-27 19:56:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-06 08:54:32 +0000
commit9f1ae0c903dcd853b28516c8216a32ffee4760cc (patch)
tree18eeeec77ed33c045e7cf2cf361779f637c73908
parentae20c5fb6c52d4baf4aa5fb71e4ef44fe3a8a140 (diff)
build: rename our rmtree to avoid shutil conflict
There is an implementation in the 'utils' module that implements a 'rmtree' function to handle removing readonly files from a directory. To avoid confusion with shutil.rmtree we rename it to 'remove_tree'. Change-Id: I3548ea81f36c87ba51fd984fcf7b1cd4cafd54d6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit ea9ac28cc215289ae46b1679c58a3acfc66883fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--build_scripts/main.py10
-rw-r--r--build_scripts/utils.py4
-rw-r--r--coin_build_instructions.py4
-rw-r--r--coin_test_instructions.py4
-rw-r--r--testing/wheel_tester.py6
5 files changed, 14 insertions, 14 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index bdc24ad05..ff3957347 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -45,7 +45,7 @@ import sys
import time
from packaging.version import parse as parse_version
from pathlib import Path
-from shutil import which, copytree, rmtree
+from shutil import which, copytree
from textwrap import dedent
# PYSIDE-1760: Pre-load setuptools modules early to avoid racing conditions.
@@ -77,7 +77,7 @@ from .qtinfo import QtInfo
from .utils import (copydir, copyfile, detect_clang, filter_match,
get_numpy_location, get_python_dict, init_msvc_env,
linux_fix_rpaths_for_library, macos_fix_rpaths_for_library,
- platform_cmake_options, rmtree, run_process,
+ platform_cmake_options, remove_tree, run_process,
run_process_output, update_env_path)
from .versions import PYSIDE, PYSIDE_MODULE, SHIBOKEN
from .wheel_override import get_bdist_wheel_override, wheel_module_exists
@@ -481,7 +481,7 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin):
# and 'pyside6' inside the 'package_for_wheels' directory.
if _dst.exists():
log.warn(f'***** Found directory "{_dst}", removing it first.')
- rmtree(_dst)
+ remove_tree(_dst)
try:
# This should be copied because the package directory
@@ -589,7 +589,7 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin):
if not OPTION["REUSE_BUILD"]:
log.info(f"Deleting module build folder {module_build_dir}...")
try:
- rmtree(module_build_dir)
+ remove_tree(module_build_dir)
except Exception as e:
log.error(f'***** problem removing "{module_build_dir}"')
log.error(f'ignored error: {e}')
@@ -951,7 +951,7 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin):
if os.path.isdir(self.st_build_dir):
log.info(f"Removing {self.st_build_dir}")
try:
- rmtree(self.st_build_dir)
+ remove_tree(self.st_build_dir)
except Exception as e:
log.warn(f'***** problem removing "{self.st_build_dir}"')
log.warn(f'ignored error: {e}')
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index fb400b755..77e78bf3e 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -402,7 +402,7 @@ def make_file_writable_by_owner(path):
os.chmod(path, current_permissions | stat.S_IWUSR)
-def rmtree(dirname, ignore=False):
+def remove_tree(dirname, ignore=False):
def handle_remove_readonly(func, path, exc):
excvalue = exc[1]
if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES:
@@ -1318,7 +1318,7 @@ def configure_cmake_project(project_path,
f"Configure args were:\n {cmd_string}")
if clean_temp_dir:
- rmtree(build_path)
+ remove_tree(build_path)
return output
diff --git a/coin_build_instructions.py b/coin_build_instructions.py
index 42f09cfce..97c6e4f98 100644
--- a/coin_build_instructions.py
+++ b/coin_build_instructions.py
@@ -46,7 +46,7 @@ import sys
from build_scripts.options import has_option, log, option_value
from build_scripts.utils import (expand_clang_variables, get_ci_qtpaths_path,
get_qtci_virtualEnv,
- parse_cmake_conf_assignments_by_key, rmtree,
+ parse_cmake_conf_assignments_by_key, remove_tree,
run_instruction)
log.set_verbosity(log.INFO)
@@ -112,7 +112,7 @@ def call_setup(python_ver, phase):
_pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH)
if phase in ["BUILD"]:
- rmtree(_env, True)
+ remove_tree(_env, True)
# Pinning the virtualenv before creating one
# Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS
python3 = "python3"
diff --git a/coin_test_instructions.py b/coin_test_instructions.py
index ebf4cd184..8c8838b71 100644
--- a/coin_test_instructions.py
+++ b/coin_test_instructions.py
@@ -42,7 +42,7 @@ import sys
from build_scripts.options import has_option, log, option_value
from build_scripts.utils import (expand_clang_variables, get_ci_qmake_path,
- get_qtci_virtualEnv, rmtree, run_instruction)
+ get_qtci_virtualEnv, remove_tree, run_instruction)
log.set_verbosity(log.INFO)
@@ -65,7 +65,7 @@ CI_RELEASE_CONF = has_option("packaging")
def call_testrunner(python_ver, buildnro):
_pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH)
- rmtree(_env, True)
+ remove_tree(_env, True)
# Pinning the virtualenv before creating one
# Use pip3 if possible while pip seems to install the virtualenv to wrong dir in some OS
python3 = "python3"
diff --git a/testing/wheel_tester.py b/testing/wheel_tester.py
index 8fd43cd5b..c1552a9de 100644
--- a/testing/wheel_tester.py
+++ b/testing/wheel_tester.py
@@ -71,7 +71,7 @@ sys.path.append(setup_script_dir)
from setuptools._distutils import log
from build_scripts.utils import (find_files_using_glob, find_glob_in_path,
- rmtree, run_process, run_process_output)
+ remove_tree, run_process, run_process_output)
log.set_verbosity(1)
@@ -132,7 +132,7 @@ def clean_egg_info():
paths = find_files_using_glob(setup_script_dir, "*.egg-info")
for p in paths:
log.info(f"Removing {p}")
- rmtree(p)
+ remove_tree(p)
def install_wheel(wheel_path):
@@ -277,7 +277,7 @@ def prepare_build_folder(src_path, build_folder_name):
# preparing a build folder should clean any previous existing build.
if os.path.exists(build_path):
log.info(f"Removing {build_path}")
- rmtree(build_path)
+ remove_tree(build_path)
log.info(f"Creating {build_path}")
os.makedirs(build_path)