python3-ydiff: Build the package with Python 3.12 on RHEL 9 & 8 and Python 3.11 on...
authorDevrim Gunduz <devrim@gunduz.org>
Mon, 19 May 2025 15:11:29 +0000 (18:11 +0300)
committerDevrim Gunduz <devrim@gunduz.org>
Mon, 19 May 2025 15:11:29 +0000 (18:11 +0300)
rpm/redhat/main/common/python3-ydiff/main/python3-ydiff.spec

index 7ff4d048945fb473578105dba6fee32e1ba471e3..2927274e327c82f3b375f4773ac07c5e940d1f6e 100644 (file)
@@ -1,20 +1,27 @@
-%global __ospython %{_bindir}/python3
+%if 0%{?fedora} && 0%{?fedora} <= 42
+%global        __ospython %{_bindir}/python3.13
+%global        python3_pkgversion 3.13
+%endif
+%if 0%{?rhel} && 0%{?rhel} < 10
+%global        __ospython %{_bindir}/python3.12
+%global        python3_pkgversion 3.12
+%endif
+%if 0%{?suse_version} >= 1500
+%global        __ospython %{_bindir}/python3.11
+%global        python3_pkgversion 311
+%endif
 
-%if 0%{?fedora} >= 40 || 0%{?suse_version} >= 1500 || 0%{?rhel} >= 10
 %{expand: %%global py3ver %(echo `%{__ospython} -c "import sys; sys.stdout.write(sys.version[:4])"`)}
-%else
-%{expand: %%global py3ver %(echo `%{__ospython} -c "import sys; sys.stdout.write(sys.version[:3])"`)}
-%endif
 %global python3_sitelib %(%{__ospython} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
 
 Name:          ydiff
 Version:       1.4.2
-Release:       43PGDG%{?dist}
+Release:       44PGDG%{?dist}
 Summary:       View colored, incremental diff
-URL:           https://github.com/ymattw/ydiff
+URL:           https://github.com/ymattw/%{name}
 License:       BSD
-Source0:       https://github.com/ymattw/ydiff/archive/%{version}/%{name}-%{version}.tar.gz
-BuildRequires: python3-devel
+Source0:       https://github.com/ymattw/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
+BuildRequires: python%{python3_pkgversion}-devel
 BuildArch:     noarch
 
 Requires:      less
@@ -34,7 +41,7 @@ Python library that implements API used by ydiff tool.
 
 %prep
 %autosetup -n %{name}-%{version}
-/usr/bin/sed -i '/#!\/usr\/bin\/env python/d' ydiff.py
+%{_bindir}/sed -i '/#!\/usr\/bin\/env python/d' ydiff.py
 
 %build
 %{__ospython} setup.py build
@@ -46,7 +53,7 @@ Python library that implements API used by ydiff tool.
 %files
 %doc README.rst
 %license LICENSE
-%{_bindir}/ydiff
+%{_bindir}/%{name}
 
 %files -n python3-%{name}
 %{python3_sitelib}/__pycache__/*
@@ -54,6 +61,12 @@ Python library that implements API used by ydiff tool.
 %{python3_sitelib}/%{name}-%{version}-py%{py3ver}.egg-info
 
 %changelog
+* Sat Apr 19 2025 Devrim Gündüz <devrim@gunduz.org> - 1.4.2-44PGDG
+- Build the package with Python 3.12 on RHEL 9 & 8 and Python 3.11 on SLES
+  15. For the other distros (Fedora and RHEL 10) use OS'd default Python
+  version.
+  https://github.com/pgdg-packaging/pgdg-rpms/issues/16
+
 * Sat Apr 19 2025 Devrim Gündüz <devrim@gunduz.org> - 1.4.2-43PGDG
 - Rebuild on RHEL 8 because of an issue on the build instance