kumquat-buildroot/package/nut/0002-m4-nut_check_python.m4-allow-overriding-of-PYTHON-2-.patch
Fabrice Fontaine 7ccbe5f598 package/nut: fix python build
Fix the following build failure raised since bump to version 2.8.1 in
commit 9c874557aa and
cada4bc8c4
and
902ce1327e:

checking python3 site-packages location... /home/thomas/autobuild/instance-3/output-1/host/lib/python3.11/site-packages
[...]
 /usr/bin/install -c -m 644 module/PyNUT.py '/home/thomas/autobuild/instance-3/output-1/host/powerpc64le-buildroot-linux-gnu/sysroot/home/thomas/autobuild/instance-3/output-1/host/lib/python3.11/site-packages'
[...]
nut: installs files in /home/thomas/autobuild/instance-3/output-1/host/powerpc64le-buildroot-linux-gnu/sysroot//home/thomas/autobuild/instance-3/output-1

Fixes:
 - http://autobuild.buildroot.org/results/0b2d0e292a9872f7ab7c2eeccbb7bb12e4afe36c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-11-06 22:40:35 +01:00

107 lines
5.5 KiB
Diff

From 511ee899ee687216fa8fcf2231a60941b9e4cf81 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Fri, 3 Nov 2023 14:34:54 +0100
Subject: [PATCH] m4/nut_check_python.m4: allow overriding of
PYTHON{2,3}_SITE_PACKAGES
Allow the end-user to override PYTHON{2,3}_SITE_PACKAGES as this can be
useful when cross-compiling
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Upstream: https://github.com/networkupstools/nut/pull/2147
---
m4/nut_check_python.m4 | 60 +++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4
index 995a3e7c..7f29558e 100644
--- a/m4/nut_check_python.m4
+++ b/m4/nut_check_python.m4
@@ -116,17 +116,17 @@ AC_DEFUN([NUT_CHECK_PYTHON],
AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"])
AS_IF([test -n "${PYTHON}" && test "${PYTHON}" != "no"], [
export PYTHON
- AC_MSG_CHECKING([python site-packages location])
- PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import site; print(site.getsitepackages().pop(0))'`"
- AS_CASE(["$PYTHON_SITE_PACKAGES"],
- [*:*], [
- dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584]
- PYTHON_SITE_PACKAGES="`cd "$PYTHON_SITE_PACKAGES" && pwd`"
- ]
- )
- AC_MSG_RESULT([${PYTHON_SITE_PACKAGES}])
+ AC_CACHE_CHECK([python site-packages location], [nut_cv_PYTHON_SITE_PACKAGES], [
+ nut_cv_PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import site; print(site.getsitepackages().pop(0))'`"
+ AS_CASE(["$nut_cv_PYTHON_SITE_PACKAGES"],
+ [*:*], [
+ dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584]
+ nut_cv_PYTHON_SITE_PACKAGES="`cd "$nut_cv_PYTHON_SITE_PACKAGES" && pwd`"
+ ]
+ )
+ ])
])
- AC_SUBST([PYTHON_SITE_PACKAGES], [${PYTHON_SITE_PACKAGES}])
+ AC_SUBST([PYTHON_SITE_PACKAGES], [${nut_cv_PYTHON_SITE_PACKAGES}])
AM_CONDITIONAL([HAVE_PYTHON_SITE_PACKAGES], [test x"${PYTHON_SITE_PACKAGES}" != "x"])
])
])
@@ -228,17 +228,17 @@ AC_DEFUN([NUT_CHECK_PYTHON2],
AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"])
AS_IF([test -n "${PYTHON2}" && test "${PYTHON2}" != "no"], [
export PYTHON2
- AC_MSG_CHECKING([python2 site-packages location])
- PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import site; print(site.getsitepackages().pop(0))'`"
- AS_CASE(["$PYTHON2_SITE_PACKAGES"],
- [*:*], [
- dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584]
- PYTHON2_SITE_PACKAGES="`cd "$PYTHON2_SITE_PACKAGES" && pwd`"
- ]
- )
- AC_MSG_RESULT([${PYTHON2_SITE_PACKAGES}])
+ AC_CACHE_CHECK([python2 site-packages location], [nut_cv_PYTHON2_SITE_PACKAGES], [
+ nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import site; print(site.getsitepackages().pop(0))'`"
+ AS_CASE(["$nut_cv_PYTHON2_SITE_PACKAGES"],
+ [*:*], [
+ dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584]
+ nut_cv_PYTHON2_SITE_PACKAGES="`cd "$nut_cv_PYTHON2_SITE_PACKAGES" && pwd`"
+ ]
+ )
+ ])
])
- AC_SUBST([PYTHON2_SITE_PACKAGES], [${PYTHON2_SITE_PACKAGES}])
+ AC_SUBST([PYTHON2_SITE_PACKAGES], [${nut_cv_PYTHON2_SITE_PACKAGES}])
AM_CONDITIONAL([HAVE_PYTHON2_SITE_PACKAGES], [test x"${PYTHON2_SITE_PACKAGES}" != "x"])
])
])
@@ -340,17 +340,17 @@ AC_DEFUN([NUT_CHECK_PYTHON3],
AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"])
AS_IF([test -n "${PYTHON3}" && test "${PYTHON3}" != "no"], [
export PYTHON3
- AC_MSG_CHECKING([python3 site-packages location])
- PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import site; print(site.getsitepackages().pop(0))'`"
- AS_CASE(["$PYTHON3_SITE_PACKAGES"],
- [*:*], [
- dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584]
- PYTHON3_SITE_PACKAGES="`cd "$PYTHON3_SITE_PACKAGES" && pwd`"
- ]
- )
- AC_MSG_RESULT([${PYTHON3_SITE_PACKAGES}])
+ AC_CACHE_CHECK([python3 site-packages location], [nut_cv_PYTHON3_SITE_PACKAGES], [
+ nut_cv_PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import site; print(site.getsitepackages().pop(0))'`"
+ AS_CASE(["$nut_cv_PYTHON3_SITE_PACKAGES"],
+ [*:*], [
+ dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584]
+ nut_cv_PYTHON3_SITE_PACKAGES="`cd "$nut_cv_PYTHON3_SITE_PACKAGES" && pwd`"
+ ]
+ )
+ ])
])
- AC_SUBST([PYTHON3_SITE_PACKAGES], [${PYTHON3_SITE_PACKAGES}])
+ AC_SUBST([PYTHON3_SITE_PACKAGES], [${nut_cv_PYTHON3_SITE_PACKAGES}])
AM_CONDITIONAL([HAVE_PYTHON3_SITE_PACKAGES], [test x"${PYTHON3_SITE_PACKAGES}" != "x"])
])
])
--
2.42.0