diff --git a/lhapdf-cython-configure.patch b/lhapdf-cython-configure.patch new file mode 100644 index 0000000..1f3cfa0 --- /dev/null +++ b/lhapdf-cython-configure.patch @@ -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 diff --git a/lhapdf.spec b/lhapdf.spec index 00d94e7..9397d1a 100644 --- a/lhapdf.spec +++ b/lhapdf.spec @@ -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 - 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 - 6.2.1-4 - Rebuild with fixed binutils