Drop Python 2 bindings for Fedora 29+

Make Cython checking script usable with Python3 (backport)
Add Python 3.6 package for EPEL 7
This commit is contained in:
Mattias Ellert 2018-11-10 20:50:29 +01:00
commit ccc2ee7165
2 changed files with 64 additions and 6 deletions

View file

@ -0,0 +1,12 @@
diff -ur LHAPDF-6.2.1.orig/configure LHAPDF-6.2.1/configure
--- LHAPDF-6.2.1.orig/configure 2017-08-11 11:27:33.000000000 +0200
+++ LHAPDF-6.2.1/configure 2018-11-10 19:44:51.928926070 +0100
@@ -17109,7 +17109,7 @@
else
-prog="import Cython.Compiler.Version; print Cython.Compiler.Version.version"
+prog="from __future__ import print_function; import Cython.Compiler.Version; print(Cython.Compiler.Version.version)"
CYTHON_VERSION=`$PYTHON -c "$prog" 2>&5`
py_cv_cython=no

View file

@ -6,7 +6,7 @@
Name: lhapdf
Version: 6.2.1
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Les Houches Accord PDF Interface
License: GPLv3+
@ -14,21 +14,30 @@ URL: https://lhapdf.hepforge.org/
Source0: https://www.hepforge.org/archive/lhapdf/LHAPDF-6.2.1.tar.gz
# Add soname to the shared library, cf. SuSE's spec file.
Patch0: %{name}-soname.patch
# Make Cython checking script usable with Python3 (backport)
# https://phab.hepforge.org/rLHAPDFHGedf5d6cc4adbbcaac712f8a6b094b7f572bb4966
Patch1: %{name}-cython-configure.patch
BuildRequires: gcc-c++
BuildRequires: /usr/bin/cython
%if ! %{py3default}
BuildRequires: python2-devel
%endif
%if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 8
BuildRequires: python3-devel
%endif
%if %{?rhel}%{!?rhel:0} == 7
BuildRequires: python34-devel
BuildRequires: python36-devel
%endif
BuildRequires: doxygen
# Obsolete LHAPDF5 packages not provided by LHAPDF6
Obsoletes: octave-lhapdf < 6
Obsoletes: lhapdf-pdfsets-minimal < 6
%if %{py3default}
Obsoletes: python2-lhapdf < %{version}-%{release}
%endif
%description
LHAPDF is a general purpose C++ interpolator, used for evaluating PDFs
@ -62,6 +71,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
This package provides development files of LHAPDF, including C++ bindings.
%if ! %{py3default}
%package -n python2-%{name}
Summary: Les Houches Accord PDF Interface - Python 2 module
%{?python_provide:%python_provide python2-%{name}}
@ -69,7 +79,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{name}
This package provides Python 2 bindings for LHAPDF.
%if ! %{py3default}
This package also provides a script called "lhapdf" which can be used
to query the catalog of PDF sets and to install and update them from
the command line. It accepts commands "list", "update", "install" and
@ -90,6 +100,16 @@ the command line. It accepts commands "list", "update", "install" and
"upgrade". Please run "lhapdf help" for full usage instructions.
%endif
%if %{?rhel}%{!?rhel:0} == 7
%package -n python%{python3_other_pkgversion}-%{name}
Summary: Les Houches Accord PDF Interface - Python 3 module
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{name}}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python%{python3_other_pkgversion}-%{name}
This package provides Python 3 bindings for LHAPDF.
%endif
%package doc
Summary: Les Houches Accord PDF Interface - documentation
BuildArch: noarch
@ -100,6 +120,7 @@ This package provides API documentation and examples for LHAPDF.
%prep
%setup -q -n LHAPDF-%{version}
%patch0 -p1
%patch1 -p1
# Remove cython generated file
rm wrappers/python/lhapdf.cpp
@ -113,13 +134,22 @@ sed 's!/usr/bin/env python!%{__python2}!' -i bin/lhapdf.in examples/*.py
sed 's!/usr/bin/env bash!/bin/bash!' -i bin/lhapdf-config.in
%build
%if %{py3default}
export PYTHON=%{__python3}
%else
export PYTHON=%{__python2}
%endif
%configure --disable-static --disable-silent-rules
%make_build
# Python 3 module
%if ! %{py3default}
( cd wrappers/python ; %make_build PYTHON=%{__python3} )
%endif
%if %{?rhel}%{!?rhel:0} == 7
( cd wrappers/python ; %make_build PYTHON=%{__python3_other} )
%endif
# Build doxygen documentation
%make_build doxy
@ -127,8 +157,13 @@ export PYTHON=%{__python2}
%install
%make_install
# Python 3 module
%if ! %{py3default}
( cd wrappers/python ; %make_install PYTHON=%{__python3} )
%endif
%if %{?rhel}%{!?rhel:0} == 7
( cd wrappers/python ; %make_install PYTHON=%{__python3_other} )
%endif
rm %{buildroot}%{_libdir}/libLHAPDF.la
@ -151,12 +186,12 @@ rm examples/Makefile*
%{_libdir}/libLHAPDF.so
%{_libdir}/pkgconfig/%{name}.pc
%files -n python2-%{name}
%if ! %{py3default}
%files -n python2-%{name}
%{_bindir}/%{name}
%endif
%{python2_sitearch}/LHAPDF-*.egg-info
%{python2_sitearch}/%{name}.so
%endif
%files -n python%{python3_pkgversion}-%{name}
%if %{py3default}
@ -165,12 +200,23 @@ rm examples/Makefile*
%{python3_sitearch}/LHAPDF-*.egg-info
%{python3_sitearch}/%{name}.*.so
%if %{?rhel}%{!?rhel:0} == 7
%files -n python%{python3_other_pkgversion}-%{name}
%{python3_other_sitearch}/LHAPDF-*.egg-info
%{python3_other_sitearch}/%{name}.*.so
%endif
%files doc
%doc doc/doxygen
%doc examples
%license COPYING
%changelog
* Sat Nov 10 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 6.2.1-5
- Drop Python 2 bindings for Fedora 29+
- Make Cython checking script usable with Python3 (backport)
- Add Python 3.6 package for EPEL 7
* Tue Jul 31 2018 Florian Weimer <fweimer@redhat.com> - 6.2.1-4
- Rebuild with fixed binutils