From 95a5bb9dd3b5d3fa86f2ed0868e2b821256a6028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Thu, 2 Sep 2021 13:44:17 +0200 Subject: Move from distutils to setuptools This is motivated by the deprecation of distutils, and removal in future versions https://github.com/pypa/packaging-problems/issues/127 Pick-to: 6.2 Change-Id: I16448b69f98df6dc1d9a904b69eb69ed5f1093f5 Reviewed-by: Christian Tismer --- build_scripts/options.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'build_scripts/options.py') diff --git a/build_scripts/options.py b/build_scripts/options.py index 068bd62ab..ff1260586 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -37,8 +37,14 @@ ## ############################################################################# -import distutils.log as log -from distutils.spawn import find_executable +try: + from setuptools._distutils import log +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 import log +from shutil import which import sys import os import warnings @@ -334,7 +340,7 @@ class DistUtilsCommandMixin(object): def _determine_defaults_and_check(self): if not self.cmake: - self.cmake = find_executable("cmake") + self.cmake = which("cmake") if not self.cmake: log.error("cmake could not be found.") return False @@ -343,14 +349,14 @@ class DistUtilsCommandMixin(object): return False if not self.qtpaths: - self.qtpaths = find_executable("qtpaths") + self.qtpaths = which("qtpaths") if not self.qtpaths: self.qtpaths = find_executable("qtpaths6") if self.qmake: self.has_qmake_option = True else: - self.qmake = find_executable("qmake") + self.qmake = which("qmake") if not self.qmake: self.qmake = find_executable("qmake6") if not self.qmake: -- cgit v1.2.3