aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2023-06-08 16:59:50 +0200
committerCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2023-09-06 11:19:30 +0200
commitcb0a195932585fcf747fe91d5dea15054df3be38 (patch)
treefb5df70214c8e4f39b9d9d0a7ec5ce4015eaeded
parent34b6a09a7a5270f5c0805723174615a018ac775a (diff)
build: remove traces of distutils
Removed mentions, comments, and fallback usages in some sections of the build scripts and documentation. On the CI, we upgrade setuptools in order to avoid having missing functionality, so it shouldn't be an issue. For Shiboken and CMake, there is still a helper that relies on distutils in case people is using python < 3.8.2 Change-Id: Ic33abe9fa8bd8564e9d44c8714b7fedd4e50434a Reviewed-by: Simo Fält <simo.falt@qt.io> (cherry picked from commit 709c3f0b8a7a597e531506d6024ead26b3a8f08a) Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--build_scripts/build_info_collector.py2
-rw-r--r--build_scripts/config.py2
-rw-r--r--build_scripts/main.py15
-rw-r--r--build_scripts/options.py10
-rw-r--r--build_scripts/utils.py9
-rw-r--r--coin/instructions/common_environment.yaml15
-rw-r--r--coin/instructions/execute_build_instructions.yaml22
-rw-r--r--coin/instructions/execute_test_instructions.yaml22
-rw-r--r--setup.py2
-rw-r--r--sources/pyside6/doc/gettingstarted/linux.rst2
-rw-r--r--sources/pyside6/doc/gettingstarted/macOS.rst2
11 files changed, 71 insertions, 32 deletions
diff --git a/build_scripts/build_info_collector.py b/build_scripts/build_info_collector.py
index 62b56b5f8..a073fb707 100644
--- a/build_scripts/build_info_collector.py
+++ b/build_scripts/build_info_collector.py
@@ -187,7 +187,7 @@ class BuildInfoCollectorMixin(object):
py_version = f"{_major}.{_minor}"
py_include_dir = get_config_var("INCLUDEPY")
py_libdir = get_config_var("LIBDIR")
- # distutils.sysconfig.get_config_var('prefix') returned the
+ # sysconfig.get_config_var('prefix') returned the
# virtual environment base directory, but
# sysconfig.get_config_var returns the system's prefix.
# We use 'base' instead (although, platbase points to the
diff --git a/build_scripts/config.py b/build_scripts/config.py
index 1f2f0b25c..c4db97430 100644
--- a/build_scripts/config.py
+++ b/build_scripts/config.py
@@ -119,7 +119,7 @@ class Config(object):
setup_kwargs['python_requires'] = ">=3.7, <3.12"
if log_level == LogLevel.QUIET:
- # Tells distutils / setuptools to be quiet, and only print warnings or errors.
+ # Tells setuptools to be quiet, and only print warnings or errors.
# Makes way less noise in the terminal when building.
setup_kwargs['verbose'] = 0
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 2b2635741..730673e01 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -14,7 +14,6 @@ from shutil import copytree
from textwrap import dedent
# PYSIDE-1760: Pre-load setuptools modules early to avoid racing conditions.
-# Please be careful: All setuptools modules must be loaded before _distutils
# may be touched (should be avoided anyway, btw.)
# Note: This bug is only visible when tools like pyenv are not used. They have some
# pre-loading effect so that setuptools is already in the cache, hiding the problem.
@@ -179,12 +178,12 @@ class PysideInstall(_install, CommandMixin):
if sys.platform == 'darwin' or self.is_cross_compile:
# Because we change the plat_name to include a correct
- # deployment target on macOS distutils thinks we are
+ # deployment target on macOS setuptools thinks we are
# cross-compiling, and throws an exception when trying to
# execute setup.py install. The check looks like this
# if self.warn_dir and build_plat != get_platform():
- # raise DistutilsPlatformError("Can't install when "
- # "cross-compiling")
+ # raise PlatformError("Can't install when "
+ # "cross-compiling")
# Obviously get_platform will return the old deployment
# target. The fix is to disable the warn_dir flag, which
# was created for bdist_* derived classes to override, for
@@ -236,7 +235,7 @@ class PysideBuildPy(_build_py):
# _install_lib is reimplemented to preserve
-# symlinks when distutils / setuptools copy files to various
+# symlinks when setuptools copy files to various
# directories from the setup tools build dir to the install dir.
class PysideInstallLib(_install_lib):
@@ -283,7 +282,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin):
if use_os_name_hack:
# This is a hack to circumvent the dubious check in
- # distutils.commands.build -> finalize_options, which only
+ # setuptool.commands.build -> finalize_options, which only
# allows setting the plat_name for windows NT.
# That is not the case for the wheel module though (which
# does allow setting plat_name), so we circumvent by faking
@@ -775,7 +774,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin):
# Set macOS minimum deployment target (version).
# This is required so that calling
- # run_process -> distutils.spawn()
+ # run_process -> subprocess.call()
# does not set its own minimum deployment target
# environment variable which is based on the python
# interpreter sysconfig value.
@@ -890,7 +889,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin):
def prepare_packages(self):
"""
This will copy all relevant files from the various locations in the "cmake install dir",
- to the setup tools build dir (which is read from self.build_lib provided by distutils).
+ to the setup tools build dir (which is read from self.build_lib provided by setuptools).
After that setuptools.command.build_py is smart enough to copy everything
from the build dir to the install dir (the virtualenv site-packages for example).
diff --git a/build_scripts/options.py b/build_scripts/options.py
index 5d4c44203..e49dd61cc 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -1,13 +1,7 @@
# Copyright (C) 2018 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
-try:
- from setuptools import Command
-except ModuleNotFoundError:
- # This is motivated by our CI using an old version of setuptools
- # so then the coin_build_instructions.py script is executed, and
- # import from this file, it was failing.
- from distutils.cmd import Command # TODO: remove
+from setuptools import Command
import sys
import logging
@@ -166,7 +160,7 @@ OPTION = {
"SNAPSHOT_BUILD": has_option("snapshot-build"),
"LIMITED_API": option_value("limited-api"),
"PACKAGE_TIMESTAMP": option_value("package-timestamp"),
- # This is used automatically by distutils.command.install object, to
+ # This is used automatically by setuptools.command.install object, to
# specify the final installation location.
"FINAL_INSTALL_PREFIX": option_value("prefix", remove=False),
"CMAKE_TOOLCHAIN_FILE": option_value("cmake-toolchain-file"),
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index ef23b0f71..1ee3e39aa 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -20,14 +20,7 @@ from .log import log
from . import (PYSIDE_PYTHON_TOOLS, PYSIDE_LINUX_BIN_TOOLS, PYSIDE_UNIX_LIBEXEC_TOOLS,
PYSIDE_WINDOWS_BIN_TOOLS, PYSIDE_UNIX_BIN_TOOLS, PYSIDE_UNIX_BUNDLED_TOOLS)
-try:
- # Using the distutils implementation within setuptools
- from setuptools.errors import SetupError
-except ModuleNotFoundError:
- # This is motivated by our CI using an old version of setuptools
- # so then the coin_build_instructions.py script is executed, and
- # import from this file, it was failing.
- from distutils.errors import DistutilsSetupError as SetupError
+from setuptools.errors import SetupError
try:
WindowsError
diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml
index cd5146ed0..387ae3327 100644
--- a/coin/instructions/common_environment.yaml
+++ b/coin/instructions/common_environment.yaml
@@ -248,4 +248,17 @@ instructions:
- condition: property
property: host.os
equals_value: Linux
-
+ - type: EnvironmentVariable
+ variableName: interpreter
+ variableValue: "python3.8"
+ enable_if:
+ condition: property
+ property: host.osVersion
+ equals_value: RHEL_8_4
+ - type: EnvironmentVariable
+ variableName: interpreter
+ variableValue: "python3"
+ disable_if: # we disable this, if in rhel 8.4
+ condition: property
+ property: target.osVersion
+ equals_value: RHEL_8_4
diff --git a/coin/instructions/execute_build_instructions.yaml b/coin/instructions/execute_build_instructions.yaml
index 36b432d98..b1981977f 100644
--- a/coin/instructions/execute_build_instructions.yaml
+++ b/coin/instructions/execute_build_instructions.yaml
@@ -55,7 +55,17 @@ instructions:
property: host.osVersion
contains_value: "Windows_10"
- type: ExecuteCommand
- command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch={{.Env.HOST_ARCH_COIN}} --targetArch={{.Env.TARGET_ARCH_COIN}}--phase=ALL"
+ command: "{{.Env.interpreter}} -m pip install -U pip setuptools==67.7.2 --user"
+ maxTimeInSeconds: 14400
+ maxTimeBetweenOutput: 1200
+ enable_if:
+ condition: property
+ property: host.os
+ equals_value: Linux
+ userMessageOnFailure: >
+ Failed to install setuptools on Linux
+ - type: ExecuteCommand
+ command: "{{.Env.interpreter}} -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch={{.Env.HOST_ARCH_COIN}} --targetArch={{.Env.TARGET_ARCH_COIN}}--phase=ALL"
maxTimeInSeconds: 14400
maxTimeBetweenOutput: 600
enable_if:
@@ -65,6 +75,16 @@ instructions:
userMessageOnFailure: >
Failed to execute build instructions on Linux
- type: ExecuteCommand
+ command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -m pip install -U setuptools==67.7.2"
+ maxTimeInSeconds: 14400
+ maxTimeBetweenOutput: 1200
+ enable_if:
+ condition: property
+ property: host.os
+ equals_value: Windows
+ userMessageOnFailure: >
+ Failed to install setuptools on Windows
+ - type: ExecuteCommand
command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=BUILD"
maxTimeInSeconds: 14400
maxTimeBetweenOutput: 600
diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml
index 2a483eb3d..23e975ce1 100644
--- a/coin/instructions/execute_test_instructions.yaml
+++ b/coin/instructions/execute_test_instructions.yaml
@@ -45,7 +45,17 @@ instructions:
userMessageOnFailure: >
Failed to execute test instructions on macOS
- type: ExecuteCommand
- command: "python3 -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
+ command: "{{.Env.interpreter}} -m pip install -U pip setuptools==67.7.2 --user"
+ maxTimeInSeconds: 14400
+ maxTimeBetweenOutput: 1200
+ enable_if:
+ condition: property
+ property: host.os
+ equals_value: Linux
+ userMessageOnFailure: >
+ Failed to install setuptools on Linux
+ - type: ExecuteCommand
+ command: "{{.Env.interpreter}} -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
maxTimeInSeconds: 14400
maxTimeBetweenOutput: 600
enable_if:
@@ -55,6 +65,16 @@ instructions:
userMessageOnFailure: >
Failed to execute test instructions on Linux
- type: ExecuteCommand
+ command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -m pip install -U pip setuptools==67.7.2 --user"
+ maxTimeInSeconds: 14400
+ maxTimeBetweenOutput: 1200
+ enable_if:
+ condition: property
+ property: host.os
+ equals_value: Windows
+ userMessageOnFailure: >
+ Failed to install setuptools on Windows
+ - type: ExecuteCommand
command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=c:\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
maxTimeInSeconds: 14400
maxTimeBetweenOutput: 600
diff --git a/setup.py b/setup.py
index 634b542fc..f63b59051 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
"""
-This is a distutils setup-script for the Qt for Python project.
+This is a setuptools setup-script for the Qt for Python project.
For more information see README.md
"""
diff --git a/sources/pyside6/doc/gettingstarted/linux.rst b/sources/pyside6/doc/gettingstarted/linux.rst
index f5036fe39..111085add 100644
--- a/sources/pyside6/doc/gettingstarted/linux.rst
+++ b/sources/pyside6/doc/gettingstarted/linux.rst
@@ -8,7 +8,7 @@ Requirements
* ``sphinx`` package for the documentation (optional).
* Depending on your linux distribution, the following dependencies might also be required:
- * ``libgl-dev``, ``python-dev``, ``python-distutils``, and ``python-setuptools``.
+ * ``libgl-dev``, ``python-dev``, and ``python-setuptools``.
* Check the platform dependencies of `Qt for Linux/X11`_.
Building from source
diff --git a/sources/pyside6/doc/gettingstarted/macOS.rst b/sources/pyside6/doc/gettingstarted/macOS.rst
index 675414288..ff457a4e2 100644
--- a/sources/pyside6/doc/gettingstarted/macOS.rst
+++ b/sources/pyside6/doc/gettingstarted/macOS.rst
@@ -8,7 +8,7 @@ Requirements
* ``sphinx`` package for the documentation (optional).
* Depending on your OS, the following dependencies might also be required:
- * ``libgl-dev``, ``python-dev``, ``python-distutils``, and ``python-setuptools``.
+ * ``libgl-dev``, ``python-dev``, and ``python-setuptools``.
* Check the platform dependencies of `Qt for macOS`_.