From b65bd966149e791036fa5a4b06a024fdce9b3a93 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 3 Jan 2023 13:53:05 +0000 Subject: [PATCH] Upstream fix for Python 3.12 removal of distutils (RHBZ#2155013) Unconditionally run autoreconf. --- ...eplace-Python-distutils-by-sysconfig.patch | 69 +++++++++++++++++++ hivex.spec | 16 ++++- 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 0001-build-Replace-Python-distutils-by-sysconfig.patch diff --git a/0001-build-Replace-Python-distutils-by-sysconfig.patch b/0001-build-Replace-Python-distutils-by-sysconfig.patch new file mode 100644 index 0000000..310abc9 --- /dev/null +++ b/0001-build-Replace-Python-distutils-by-sysconfig.patch @@ -0,0 +1,69 @@ +From 068ce21cee3d726aaf19d0b3a706bda66dd521b2 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 18 Oct 2022 10:55:22 +0100 +Subject: [PATCH] build: Replace Python distutils by sysconfig +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This module has been deprecated in Python >= 3.10 +(https://peps.python.org/pep-0632/). Replace distutils.sysconfig with +sysconfig which is not quite a drop-in replacement. + +This fix is incomplete as we still reference distutils in +python/setup.py.in. However that is only used for PIP-style +distributions (make -C python sdist) which we don't really use or +recommend. + +Thanks: Miro HronĨok +See-also: https://peps.python.org/pep-0632/ +See-also: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/N6ITYHLRWIDNYNXGPYG2ZHF3ZLQWZN7L/ + +Cherry picked from libguestfs commit 26940f64a7406761 +--- + configure.ac | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/configure.ac b/configure.ac +index e65d4a0..b540df7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -271,10 +271,10 @@ AS_IF([test "x$enable_python" != "xno"], + + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CFLAGS"; then +- python_path=`$PYTHON -c "import distutils.sysconfig; \ +- print (distutils.sysconfig.get_python_inc ());"` +- python_platpath=`$PYTHON -c "import distutils.sysconfig; \ +- print (distutils.sysconfig.get_python_inc (plat_specific=1));"` ++ python_path=`$PYTHON -c "import sysconfig; \ ++ print (sysconfig.get_path('include'));"` ++ python_platpath=`$PYTHON -c "import sysconfig; \ ++ print (sysconfig.get_path('platinclude'));"` + if test "$python_path" = "$python_platpath"; then + PYTHON_CFLAGS=-I$python_path + else +@@ -294,16 +294,16 @@ AS_IF([test "x$enable_python" != "xno"], + PYTHON_INSTALLDIR= + AC_MSG_CHECKING([for Python site-packages path]) + if test -z "$PYTHON_INSTALLDIR"; then +- PYTHON_INSTALLDIR=`$PYTHON -c "import distutils.sysconfig; \ +- print (distutils.sysconfig.get_python_lib(1,0));"` ++ PYTHON_INSTALLDIR=`$PYTHON -c "import sysconfig; \ ++ print (sysconfig.get_path('platlib'));"` + fi + AC_MSG_RESULT([$PYTHON_INSTALLDIR]) + fi + + AC_MSG_CHECKING([for Python extension suffix (PEP-3149)]) + if test -z "$PYTHON_EXT_SUFFIX"; then +- python_ext_suffix=`$PYTHON -c "import distutils.sysconfig; \ +- print (distutils.sysconfig.get_config_var('EXT_SUFFIX') or distutils.sysconfig.get_config_var('SO'))"` ++ python_ext_suffix=`$PYTHON -c "import sysconfig; \ ++ print (sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"` + PYTHON_EXT_SUFFIX=$python_ext_suffix + fi + AC_MSG_RESULT([$PYTHON_EXT_SUFFIX]) +-- +2.37.3 + diff --git a/hivex.spec b/hivex.spec index ac2b4d1..a4937c5 100644 --- a/hivex.spec +++ b/hivex.spec @@ -11,7 +11,7 @@ Name: hivex Version: 1.3.21 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Read and write Windows Registry binary hive files License: LGPLv2 @@ -27,6 +27,11 @@ Source1: http://libguestfs.org/download/hivex/%{name}-%{version}.tar.gz.s Source2: libguestfs.keyring %endif +# Upstream Python removal of distutils (RHBZ#2155013) +Patch: 0001-build-Replace-Python-distutils-by-sysconfig.patch + +BuildRequires: make +BuildRequires: autoconf, automake, libtool BuildRequires: perl-interpreter BuildRequires: perl-devel BuildRequires: perl-generators @@ -61,9 +66,8 @@ BuildRequires: rubygem(rdoc) BuildRequires: readline-devel BuildRequires: libxml2-devel %if 0%{verify_tarball_signature} -BuildRequires: gnupg2 +BuildRequires: gnupg2 %endif -BuildRequires: make Requires: %{name}-libs = %{version}-%{release} @@ -199,6 +203,8 @@ ruby-%{name} contains Ruby bindings for %{name}. %setup -q %autopatch -p1 +autoreconf -fi + %build %configure \ @@ -324,6 +330,10 @@ fi %changelog +* Tue Jan 03 2023 Richard W.M. Jones - 1.3.21-12 +- Upstream fix for Python 3.12 removal of distutils (RHBZ#2155013) +- Unconditionally run autoreconf. + * Thu Jul 21 2022 Fedora Release Engineering - 1.3.21-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild