commit 03e910182883a2f99e54ca6b3b83d86b84f48f72
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Fri Dec 14 10:05:17 2018 +0100
Rework for python2/3
tvheadend.spec | 49 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 40 insertions(+), 9 deletions(-)
---
diff --git a/tvheadend.spec b/tvheadend.spec
index 530bc7b..ffaf996 100644
--- a/tvheadend.spec
+++ b/tvheadend.spec
@@ -1,6 +1,23 @@
%global tvheadend_user %{name}
%global tvheadend_group video
+%if 0%{?fedora} || 0%{?rhel} > 7
+%global _with_python3 1
+%global __python %{__python3}
+%global python_sitearch %{python3_sitearch}
+%else
+%global __python %{__python2}
+%global python_sitearch %{python2_sitearch}
+%endif
+
+%if 0%{?fedora} && 0%{?fedora} < 30
+%global _with_python2 1
+%endif
+
+%if 0%{?rhel} && 0%{?rhel} < 8
+%global _with_python2 1
+%endif
+
Name: tvheadend
Version: 4.2.7
Release: 3%{?dist}
@@ -44,12 +61,19 @@ BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(liburiparser)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
-%if 0%{?fedora} < 30
-BuildRequires: python2-devel
-%endif
+%if 0%{?_with_python3}
BuildRequires: python3-devel
BuildRequires: python3-rcssmin
BuildRequires: python3-rjsmin
+%else
+# Needed on EL7 (python2-only)
+BuildRequires: python2-rcssmin
+BuildRequires: python2-rjsmin
+%endif
+%if 0%{?_with_python2}
+# Needed everwhere but in f30+
+BuildRequires: python2-devel
+%endif
BuildRequires: systemd
Requires: bzip2
%if 0%{?fedora}
@@ -74,7 +98,7 @@ version, the pipe:// source (in IPTV network) might be used to obtain
the
MPEG-TS stream generated by ffmpeg/libav from a V4L device.
-%if 0%{?fedora} < 30
+%if 0%{?_with_python2}
%package -n python2-tvh
Summary: HTSP client for Python
BuildArch: noarch
@@ -84,12 +108,14 @@ BuildArch: noarch
%endif
+%if 0%{?_with_python3}
%package -n python3-tvh
Summary: HTSP client for Python
BuildArch: noarch
%description -n python3-tvh
%{summary}.
+%endif
%prep
@@ -128,11 +154,12 @@ echo "%{version}-%{release}" >rpm/version
--enable-dvbcsa \
--enable-hdhomerun_client \
--enable-libsystemd_daemon \
- --python=%{__python3}
+ --python=%{__python}
+
%make_build \
V=1 \
- RUN_CSS="%{__python3} %{python3_sitearch}/rcssmin.py" \
- RUN_JS="%{__python3} %{python3_sitearch}/rjsmin.py"
+ RUN_CSS="%{__python} %{python_sitearch}/rcssmin.py" \
+ RUN_JS="%{__python} %{python_sitearch}/rjsmin.py"
%install
@@ -144,12 +171,14 @@ install -Dpm 0644 rpm/%{name}.sysconfig
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
install -dm 0755 $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/
# Install Python bindings
-%if 0%{?fedora} < 30
+%if 0%{?_with_python2}
install -dm 0755 $RPM_BUILD_ROOT%{python2_sitelib}/
cp -a lib/py/tvh/ $RPM_BUILD_ROOT%{python2_sitelib}/
%endif
+%if 0%{?_with_python3}
install -dm 0755 $RPM_BUILD_ROOT%{python3_sitelib}/
cp -a lib/py/tvh/ $RPM_BUILD_ROOT%{python3_sitelib}/
+%endif
# Fix permissions
chmod 0644 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
@@ -184,16 +213,18 @@ exit 0
%{_mandir}/man1/*.1.*
-%if 0%{?fedora} < 30
+%if 0%{?_with_python2}
%files -n python2-tvh
%license LICENSE.md licenses/gpl-3.0.txt
%{python2_sitelib}/tvh/
%endif
+%if 0%{?_with_python3}
%files -n python3-tvh
%license LICENSE.md licenses/gpl-3.0.txt
%{python3_sitelib}/tvh/
+%endif
%changelog
Show replies by date