First working version on EPEL 7 with Python

This commit is contained in:
Denis Arnaud 2019-02-23 21:01:13 +01:00
parent ac9e63630c
commit 734648437a

View File

@ -1,11 +1,12 @@
#
%global mydocs __tmp_docdir
# Build -python subpackage
%bcond_without python
# Build -pythonN subpackage
%bcond_with python2
%bcond_without python3
# See also http://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering#Private_Libraries
%if %{with python}
%if %{with python2} || %{with python3}
%global _privatelibs libpy%{name}[.]so.*
%global __provides_exclude ^(%{_privatelibs})$
%global __requires_exclude ^(%{_privatelibs})$
@ -27,10 +28,18 @@ Source0: %{url}/archive/%{name}-%{version}.tar.gz
Requires: %{name}-data = %{version}-%{release}
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: python3-devel
BuildRequires: cmake, cmake3
BuildRequires: boost-devel
BuildRequires: boost-python3-devel
%if %{with python2}
BuildRequires: python-setuptools
BuildRequires: python-devel
BuildRequires: boost-python-devel
%endif
%if %{with python3}
BuildRequires: python34-setuptools
BuildRequires: python34-devel
BuildRequires: boost-python34-devel
%endif
BuildRequires: readline-devel
BuildRequires: soci-mysql-devel
BuildRequires: soci-sqlite3-devel
@ -105,6 +114,50 @@ the OpenTravelData project (http://github.com/opentraveldata/opentraveldata):
http://github.com/opentraveldata/opentraveldata/tree/trunk/opentraveldata
%if %{with python2}
%package -n python2-%{name}
Summary: Python bindings for %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: protobuf-python
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
This package contains Python libraries for %{name}
%package -n python2-%{name}-devel
Summary: Shared object symbolic links for OpenTREP Python 2
Requires: %{name}-python2%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description -n python2-%{name}-devel
Shared object symbolic links for Python 2 variant of OpenTREP.
%endif
%if %{with python3}
%package -n python3-%{name}
Summary: Python bindings for %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python3-%{name}
This package contains Python libraries for %{name}
%package -n python3-%{name}-devel
Summary: Shared object symbolic links for OpenTREP Python 3
Requires: %{name}-python3%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description -n python3-%{name}-devel
Shared object symbolic links for Python 3 variant of OpenTREP.
%endif
%package doc
Summary: HTML documentation for the %{name} library
Group: Documentation
@ -123,26 +176,12 @@ Note that the PDF form of the reference manual is mainly available online
package is usually corrupted: it depends on the building conditions,
and it is therefore not reliable.
%if %{with python}
%package -n python3-%{name}
Summary: Python bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Requires: python3-protobuf
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
This package contains Python libraries for %{name}
%endif
%prep
%setup -q -n %{name}-%{name}-%{version}
%build
%cmake .
%cmake3 .
%make_build
%install
@ -159,7 +198,15 @@ rm -f %{mydocs}/html/installdox
# in the project top directory)
rm -f %{buildroot}%{_docdir}/%{name}/{NEWS,README.md,AUTHORS}
%if %{with python}
%if %{with python2}
# (Pure) Python OpenTREP executable
install -d %{buildroot}%{python2_sitearch}/py%{name}
install -pm 0755 %{buildroot}%{_bindir}/py%{name} %{buildroot}%{python2_sitearch}/py%{name}/
rm -f %{buildroot}%{_bindir}/py%{name}
chmod a-x %{buildroot}%{python2_sitearch}/py%{name}/Travel_pb2.py
%endif
%if %{with python3}
# (Pure) Python OpenTREP executable
install -d %{buildroot}%{python3_sitearch}/py%{name}
install -pm 0755 %{buildroot}%{_bindir}/py%{name} %{buildroot}%{python3_sitearch}/py%{name}/
@ -171,7 +218,21 @@ chmod a-x %{buildroot}%{python3_sitearch}/py%{name}/Travel_pb2.py
#check
#ctest
%if %{with python}
%if %{with python2}
%post -n python2-%{name}
ln -s -f %{python2_sitearch}/py%{name}/py%{name} %{_bindir}/py%{name}
%postun -n python2-%{name}
rm -f %{_bindir}/py%{name}
%endif
%if 0%{?rhel}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif
%if %{with python3}
%post -n python3-%{name}
ln -s -f %{python3_sitearch}/py%{name}/py%{name} %{_bindir}/py%{name}
@ -218,13 +279,17 @@ rm -f %{_bindir}/py%{name}
%doc %{mydocs}/html
%license COPYING
%if %{with python}
%files -n python3-%{name}
#%%{_bindir}/py%%{name}
%{python3_sitearch}/py%{name}/
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/py%{name}/
%{_mandir}/man1/py%{name}.1.*
%endif
%if %{with python3}
%files -n python3-%{name}
%{python3_sitearch}/py%{name}/
%{_mandir}/man1/py%{name}.1.*
%endif
%changelog
* Sun Feb 17 2019 Denis Arnaud <denis.arnaud_fedora@m4x.org> 0.07.1-2