From f9b494643ebda1bbdbcbe4aa5e3d77260f50f369 Mon Sep 17 00:00:00 2001 From: Evan Tang Date: Mon, 6 Nov 2023 13:32:19 -0600 Subject: [PATCH] Python 3.12 compatibility --- .github/workflows/ci_build.yml | 1 + scripts/build.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 5fb1476f1a..28fd4292de 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -143,6 +143,7 @@ jobs: run: .github/workflows/scripts/build-dependencies-macos.sh - name: Run build script run: | + pip3 install packaging python3 scripts/build.py --skip-check-code-style --skip-tests --config ${{ matrix.config.type }} --parallel --cmake-extra "CMAKE_PREFIX_PATH=$HOME/deps" --cmake-extra CMAKE_OSX_DEPLOYMENT_TARGET=10.13 - name: Prepare artifacts run: | diff --git a/scripts/build.py b/scripts/build.py index 3284729ce2..ab08dd4b07 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -25,7 +25,7 @@ ''' import argparse -import distutils.version +import packaging.version import os import platform import re @@ -53,10 +53,10 @@ def is_mac(): BUILD_ROOT = os.path.abspath( os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')) BUILD_CONFIGS = {'debug': 'dbuild', 'release': 'build'} -CMAKE_VERSION_3_13 = distutils.version.StrictVersion('3.13.0') +CMAKE_VERSION_3_13 = packaging.version.Version('3.13.0') CONFIGURATIONS = ['release', 'debug'] DEFAULT_CONFIGURATION = CONFIGURATIONS[0] -VERSION = distutils.version.StrictVersion('0.0.0') +VERSION = packaging.version.Version('0.0.0') class BuildError(Exception): @@ -194,7 +194,7 @@ def cmake_version(): r'cmake version (?P[\d\.]+)', cmake_version_output) if match is None: raise BuildError('failed to get CMake version') - cmake_version = distutils.version.StrictVersion(match.group('version')) + cmake_version = packaging.version.Version(match.group('version')) return cmake_version