From 4274a516197b1ebf080966bcd13767fd49ae0a3f Mon Sep 17 00:00:00 2001 From: Osmo Salomaa Date: Sat, 30 Mar 2024 20:35:18 +0200 Subject: [PATCH] Use distutils from setuptools if not otherwise found --- NEWS.md | 1 + setup.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 192e2684..853edc84 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ PENDING: Gaupol 1.14 * Change the icon for the toggle video player toolbar item to an action icon (not mimetype) that has a symbolic version available +* Fix installation on Python >= 3.12 by using distutils from setuptools 2023-10-08: Gaupol 1.13 ======================= diff --git a/setup.py b/setup.py index e4df603e..b09a05ed 100755 --- a/setup.py +++ b/setup.py @@ -30,14 +30,24 @@ extensions are not compiled either. """ -import distutils import glob +import logging import os import re import shutil import sys -from distutils import log +logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") +log = logging.getLogger(__name__) +log.setLevel(logging.INFO) + +try: + import distutils +except ImportError: + # Use distutils from setuptools, needed since Python 3.12. + # https://docs.python.org/3/whatsnew/3.12.html#distutils + import setuptools._distutils as distutils + from distutils.command.clean import clean from distutils.command.install import install from distutils.command.install_data import install_data