From abefcb2f893a38bab3e99120daf18edc49ccdff3 Mon Sep 17 00:00:00 2001 From: Bet4 <0xbet4@gmail.com> Date: Wed, 12 Jun 2024 14:45:23 +0800 Subject: [PATCH] Remove using of distutils (#1964) * Remove using of distutils * Upgrade setuptools to fix CI * Use Python 3.7 in build_wheel.sh --- .github/workflows/PyPI-publishing.yml | 2 +- bindings/python/build_wheel.sh | 8 ++------ bindings/python/setup.py | 12 +++++++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/PyPI-publishing.yml b/.github/workflows/PyPI-publishing.yml index afb1a496..53df4c99 100644 --- a/.github/workflows/PyPI-publishing.yml +++ b/.github/workflows/PyPI-publishing.yml @@ -109,7 +109,7 @@ jobs: - name: '🛠️ pip dependencies' run: | - pip install setuptools wheel + pip install --upgrade setuptools wheel - name: '🚧 Build distribution' shell: bash diff --git a/bindings/python/build_wheel.sh b/bindings/python/build_wheel.sh index 05a28bf1..70ff3201 100755 --- a/bindings/python/build_wheel.sh +++ b/bindings/python/build_wheel.sh @@ -4,11 +4,7 @@ set -e -x cd bindings/python # Compile wheels -if [ -f /opt/python/cp36-cp36m/bin/python ];then - /opt/python/cp36-cp36m/bin/python setup.py bdist_wheel $@ -else - python3 setup.py bdist_wheel $@ -fi +python3.7 setup.py bdist_wheel $@ cd dist # We can't repair an aarch64 wheel on x64 hosts @@ -16,4 +12,4 @@ cd dist if [[ ! "$*" =~ "aarch64" ]];then auditwheel repair *.whl mv -f wheelhouse/*.whl . -fi \ No newline at end of file +fi diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 496b62e9..07807efc 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -3,6 +3,7 @@ from __future__ import print_function import glob +import logging import os import subprocess import shutil @@ -10,13 +11,14 @@ import sys import platform import setuptools -from distutils import log -from distutils.core import setup -from distutils.util import get_platform -from distutils.command.build import build -from distutils.command.sdist import sdist +from setuptools import setup +from sysconfig import get_platform +from setuptools.command.build import build +from setuptools.command.sdist import sdist from setuptools.command.bdist_egg import bdist_egg +log = logging.getLogger(__name__) + SYSTEM = sys.platform # sys.maxint is 2**31 - 1 on both 32 and 64 bit mingw