File 0001-make-sure-python-detects-package-build-mode.patch of Package debbuild-macros

From 8ffd85987c77ea3bd10b357935334569f99e5a8a Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@siemens.com>
Date: Tue, 12 Nov 2024 09:28:41 +0100
Subject: [PATCH] make sure python detects package build mode

The sysconfig module looks at the presence of
DEB_PYTHON_INSTALL_LAYOUT="deb" to decide whether to install to /usr or
/usr/local on Debian
---
 macros.python  | 6 +++---
 macros.python2 | 6 +++---
 macros.python3 | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/macros.python b/macros.python
index 1859b42..d0b9be0 100644
--- a/macros.python
+++ b/macros.python
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: MIT
 
 %__python /usr/bin/python
-%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
-%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
-%python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
+%python_sitelib %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
+%python_sitearch %DEB_PYTHON_INSTALL_LAYOUT="deb" (%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
+%python_version %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
 
 %py_setup setup.py
 
diff --git a/macros.python2 b/macros.python2
index 21c73da..0a4bcbf 100644
--- a/macros.python2
+++ b/macros.python2
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: MIT
 
 %__python2 /usr/bin/python2
-%python2_sitelib %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
-%python2_sitearch %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
-%python2_version %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
+%python2_sitelib %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
+%python2_sitearch %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
+%python2_version %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python2} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
 %python2_version_nodots %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
 %python2_pkgversion %{nil}
 
diff --git a/macros.python3 b/macros.python3
index 9450cff..fd51165 100644
--- a/macros.python3
+++ b/macros.python3
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: MIT
 
 %__python3 /usr/bin/python3
-%python3_sitelib %(%{__python3} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
-%python3_sitearch %(%{__python3} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
-%python3_version %(%{__python3} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
+%python3_sitelib %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python3} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
+%python3_sitearch %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python3} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
+%python3_version %(DEB_PYTHON_INSTALL_LAYOUT="deb" %{__python3} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
 %python3_version_nodots %(%{__python3} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
 %python3_pkgversion 3
 
-- 
2.34.1

openSUSE Build Service is sponsored by