Added support for python3
This commit is contained in:
parent
41ca52fcea
commit
c912e98772
91
rrdtool.spec
91
rrdtool.spec
@ -1,4 +1,10 @@
|
||||
%global with_python %{?_without_python: 0} %{?!_without_python: 1}
|
||||
%if 0%{?rhel} > 7
|
||||
%global with_python2 %{?_without_python2: 0} %{?!_without_python2: 0}
|
||||
%else
|
||||
%global with_python2 %{?_without_python2: 0} %{?!_without_python2: 1}
|
||||
%endif
|
||||
|
||||
%global with_python3 %{?_without_python3: 0} %{?!_without_python3: 1}
|
||||
%global with_php %{?_without_php: 0} %{?!_without_php: 0}
|
||||
%global with_tcl %{?_without_tcl: 0} %{?!_without_tcl: 1}
|
||||
%global with_ruby %{?_without_ruby: 0} %{?!_without_ruby: 1}
|
||||
@ -18,7 +24,7 @@
|
||||
Summary: Round Robin Database Tool to store and display time-series data
|
||||
Name: rrdtool
|
||||
Version: 1.7.0
|
||||
Release: 12%{?dist}
|
||||
Release: 13%{?dist}
|
||||
License: GPLv2+ with exceptions
|
||||
Group: Applications/Databases
|
||||
URL: http://oss.oetiker.ch/rrdtool/
|
||||
@ -40,7 +46,7 @@ Requires(postun): systemd
|
||||
BuildRequires: gcc-c++, openssl-devel, freetype-devel
|
||||
BuildRequires: libpng-devel, zlib-devel, intltool >= 0.35.0
|
||||
BuildRequires: cairo-devel >= 1.4.6, pango-devel >= 1.17
|
||||
BuildRequires: libtool, groff, python2-setuptools
|
||||
BuildRequires: libtool, groff
|
||||
BuildRequires: gettext, libxml2-devel, systemd
|
||||
%if %{with_dbi}
|
||||
BuildRequires: libdbi-devel
|
||||
@ -88,10 +94,10 @@ Provides: perl-%{name} = %{version}-%{release}
|
||||
%description perl
|
||||
The Perl RRDtool bindings
|
||||
|
||||
%if %{with_python}
|
||||
%if %{with_python2}
|
||||
# Make sure the runtime python is newer than the build one;
|
||||
# give a default value to handle parsing in cases when python is not present:
|
||||
%{!?rrd_python_version: %global rrd_python_version %(%{__python} -c 'import sys; print sys.version.split(" ")[0]' || echo "3.14")}
|
||||
%{!?rrd_python_version: %global rrd_python_version %(%{__python2} -c 'import sys; print sys.version.split(" ")[0]' || echo "3.14")}
|
||||
|
||||
%package -n python2-rrdtool
|
||||
%{?python_provide:%python_provide python2-rrdtool}
|
||||
@ -101,7 +107,7 @@ Provides: %{name}-python%{?_isa} = %{version}-%{release}
|
||||
Obsoletes: %{name}-python < %{version}-%{release}
|
||||
Summary: Python RRDtool bindings
|
||||
Group: Development/Languages
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-devel, python2-setuptools
|
||||
Requires: python2 >= %{rrd_python_version}
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Obsoletes: python-%{name} < %{version}-%{release}
|
||||
@ -111,6 +117,23 @@ Provides: python-%{name} = %{version}-%{release}
|
||||
Python RRDtool bindings.
|
||||
%endif
|
||||
|
||||
%if %{with_python3}
|
||||
# Make sure the runtime python is newer than the build one;
|
||||
# give a default value to handle parsing in cases when python is not present:
|
||||
%{!?rrd_python3_version: %global rrd_python3_version %(%{__python3} -c 'import sys; print(sys.version.split(" ")[0])' || echo "3.14")}
|
||||
|
||||
%package -n python3-rrdtool
|
||||
%{?python_provide:%python_provide python3-rrdtool}
|
||||
Summary: Python RRDtool bindings
|
||||
Group: Development/Languages
|
||||
BuildRequires: python3-devel, python3-setuptools
|
||||
Requires: python3 >= %{rrd_python3_version}
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description -n python3-rrdtool
|
||||
Python RRDtool bindings.
|
||||
%endif
|
||||
|
||||
%if %{with_php}
|
||||
%package php
|
||||
Summary: PHP RRDtool bindings
|
||||
@ -217,7 +240,7 @@ cp -p /usr/lib/rpm/config.{guess,sub} php4/
|
||||
%else
|
||||
--disable-tcl \
|
||||
%endif
|
||||
%if %{with_python}
|
||||
%if %{with_python2} || %{with_python3}
|
||||
--enable-python \
|
||||
%else
|
||||
--disable-python \
|
||||
@ -261,11 +284,19 @@ make
|
||||
%global rrdtmp %{_tmppath}/%{name}-%{version}-tmpinstall
|
||||
make install DESTDIR="%{rrdtmp}"
|
||||
pushd php4/
|
||||
|
||||
%if %{with_python2}
|
||||
export PYTHON=%{__python2}
|
||||
%endif
|
||||
%if %{with_python3}
|
||||
export PYTHON=%{__python3}
|
||||
%endif
|
||||
|
||||
%configure \
|
||||
--with-rrdtool="%{rrdtmp}%{_prefix}" \
|
||||
--disable-static
|
||||
#{__make} %{?_smp_mflags}
|
||||
make
|
||||
make PYTHON="$PYTHON"
|
||||
popd
|
||||
rm -rf %{rrdtmp}
|
||||
%endif
|
||||
@ -276,8 +307,24 @@ find examples/ -type f \
|
||||
find examples/ -name "*.pl" \
|
||||
-exec perl -pi -e 's|\015||gi' {} \;
|
||||
|
||||
# Rebuild python
|
||||
pushd bindings/python
|
||||
%if %{with_python2}
|
||||
%py2_build
|
||||
%endif
|
||||
%if %{with_python3}
|
||||
%py3_build
|
||||
%endif
|
||||
popd
|
||||
|
||||
%install
|
||||
make DESTDIR="$RPM_BUILD_ROOT" install
|
||||
%if %{with_python2}
|
||||
export PYTHON=%{__python2}
|
||||
%endif
|
||||
%if %{with_python3}
|
||||
export PYTHON=%{__python3}
|
||||
%endif
|
||||
make DESTDIR="$RPM_BUILD_ROOT" PYTHON="$PYTHON" install
|
||||
|
||||
# Install the php module
|
||||
%if %{with_php}
|
||||
@ -314,6 +361,16 @@ rm -f examples/Makefile* examples/*.in
|
||||
# This is so rpm doesn't pick up perl module dependencies automatically
|
||||
find examples/ -type f -exec chmod 0644 {} \;
|
||||
|
||||
# Reinstall python
|
||||
pushd bindings/python
|
||||
%if %{with_python2}
|
||||
%py2_install
|
||||
%endif
|
||||
%if %{with_python3}
|
||||
%py3_install
|
||||
%endif
|
||||
popd
|
||||
|
||||
# Clean up the buildroot
|
||||
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-* \
|
||||
$RPM_BUILD_ROOT%{perl_vendorarch}/ntmake.pl \
|
||||
@ -370,11 +427,18 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} php -n \
|
||||
%{perl_vendorarch}/*.pm
|
||||
%attr(0755,root,root) %{perl_vendorarch}/auto/RRDs/
|
||||
|
||||
%if %{with_python}
|
||||
%if %{with_python2}
|
||||
%files -n python2-rrdtool
|
||||
%doc bindings/python/COPYING bindings/python/README.md
|
||||
%{python_sitearch}/rrdtool.so
|
||||
%{python_sitearch}/rrdtool-*.egg-info
|
||||
%{python2_sitearch}/rrdtool.so
|
||||
%{python2_sitearch}/rrdtool-*.egg-info
|
||||
%endif
|
||||
|
||||
%if %{with_python3}
|
||||
%files -n python3-rrdtool
|
||||
%doc bindings/python/COPYING bindings/python/README.md
|
||||
%{python3_sitearch}/rrdtool*.so
|
||||
%{python3_sitearch}/rrdtool-*.egg-info
|
||||
%endif
|
||||
|
||||
%if %{with_php}
|
||||
@ -405,6 +469,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} php -n \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Jun 19 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 1.7.0-13
|
||||
- Added support for python3
|
||||
|
||||
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.7.0-12
|
||||
- Update Python 2 dependency declarations to new packaging standards
|
||||
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
|
||||
|
Loading…
Reference in New Issue
Block a user