From a94cfee5ba587143dccf3079bcb522dff42a2b4a Mon Sep 17 00:00:00 2001 From: Mattias Ellert Date: Oct 25 2018 11:33:20 +0000 Subject: Don't build Python 2 package for Fedora >= 30 Add Python 3.6 package for EPEL 7 Use empty .egg-info files instead of empty .dist-info files to make virtualenv happy --- diff --git a/pythia8.spec b/pythia8.spec index 7cf6428..591cb9f 100644 --- a/pythia8.spec +++ b/pythia8.spec @@ -1,4 +1,13 @@ %if %{?rhel}%{!?rhel:0} == 6 +%filter_provides_in %{python2_sitearch}/.*\.so$ +%filter_setup +%endif + +%if %{?fedora}%{!?fedora:0} >= 30 +# Don't build Python 2 package for Fedora >= 30 +%global buildpy2 0 +%else +%if %{?rhel}%{!?rhel:0} == 6 %ifarch ppc64 # The Python 2 bindings can not be built on ppc64 for EPEL 6 # Error: operand out of range @@ -9,10 +18,11 @@ %else %global buildpy2 1 %endif +%endif Name: pythia8 Version: 8.2.35 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Pythia Event Generator for High Energy Physics License: GPLv2+ @@ -36,6 +46,7 @@ BuildRequires: python3-devel %endif %if %{?rhel}%{!?rhel:0} == 7 BuildRequires: python34-devel +BuildRequires: python36-devel %endif BuildRequires: rsync BuildRequires: dos2unix @@ -85,6 +96,16 @@ Requires: %{name}%{?_isa} = %{version}-%{release} This package provides the Python 3 bindings for Pythia 8. %endif +%if %{?rhel}%{!?rhel:0} == 7 +%package -n python%{python3_other_pkgversion}-%{name} +Summary: Pythia 8 Python 3 bindings +%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{name}} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n python%{python3_other_pkgversion}-%{name} +This package provides the Python 3 bindings for Pythia 8. +%endif + %package data Summary: Pythia 8 Data Files BuildArch: noarch @@ -162,6 +183,17 @@ g++ py3/PythonWrapper.o -Llib -lpythia8 -o py3/_pythia8.${PY3SOABI}.so \ ${PY3LIB} -ldl %{?__global_ldflags} -Wl,-z,defs -shared %endif +%if %{?rhel}%{!?rhel:0} == 7 +mkdir py3oth +PY3INC=$(pkg-config --cflags python-%{python3_other_version}) +PY3LIB=$(pkg-config --libs python-%{python3_other_version}) +PY3SOABI=$(%{__python3_other} -c "from distutils import sysconfig; print(sysconfig.get_config_vars().get('SOABI'))") +g++ -x c++ include/Pythia8Plugins/PythonWrapper.h -c -o py3oth/PythonWrapper.o \ + ${PY3INC} -Iinclude %{optflags} -fPIC -DGZIPSUPPORT +g++ py3oth/PythonWrapper.o -Llib -lpythia8 -o py3oth/_pythia8.${PY3SOABI}.so \ + ${PY3LIB} -ldl %{?__global_ldflags} -Wl,-z,defs -shared +%endif + %install make %{?_smp_mflags} install \ PREFIX_BIN=%{buildroot}%{_bindir} \ @@ -186,14 +218,21 @@ rm %{buildroot}%{_datadir}/Pythia8/examples/runmains mkdir -p %{buildroot}%{python2_sitearch} install -p -m 644 pythia8.py %{buildroot}%{python2_sitearch} install -p -m 755 py2/_pythia8.so %{buildroot}%{python2_sitearch} -touch %{buildroot}%{python2_sitearch}/%{name}-%{version}.dist-info +touch %{buildroot}%{python2_sitearch}/%{name}-%{version}.egg-info %endif %if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 7 mkdir -p %{buildroot}%{python3_sitearch} install -p -m 644 pythia8.py %{buildroot}%{python3_sitearch} install -p -m 755 py3/_pythia8.*.so %{buildroot}%{python3_sitearch} -touch %{buildroot}%{python3_sitearch}/%{name}-%{version}.dist-info +touch %{buildroot}%{python3_sitearch}/%{name}-%{version}.egg-info +%endif + +%if %{?rhel}%{!?rhel:0} == 7 +mkdir -p %{buildroot}%{python3_other_sitearch} +install -p -m 644 pythia8.py %{buildroot}%{python3_other_sitearch} +install -p -m 755 py3oth/_pythia8.*.so %{buildroot}%{python3_other_sitearch} +touch %{buildroot}%{python3_other_sitearch}/%{name}-%{version}.egg-info %endif %ldconfig_scriptlets @@ -216,19 +255,27 @@ touch %{buildroot}%{python3_sitearch}/%{name}-%{version}.dist-info %if %{buildpy2} %files -n python2-%{name} -%{python2_sitearch}/%{name}-%{version}.dist-info +%{python2_sitearch}/%{name}-%{version}.egg-info %{python2_sitearch}/_pythia8.so %{python2_sitearch}/pythia8.py* %endif %if %{?fedora}%{!?fedora:0} || %{?rhel}%{!?rhel:0} >= 7 %files -n python%{python3_pkgversion}-%{name} -%{python3_sitearch}/%{name}-%{version}.dist-info +%{python3_sitearch}/%{name}-%{version}.egg-info %{python3_sitearch}/_pythia8.*.so %{python3_sitearch}/pythia8.py %{python3_sitearch}/__pycache__/pythia8.* %endif +%if %{?rhel}%{!?rhel:0} == 7 +%files -n python%{python3_other_pkgversion}-%{name} +%{python3_other_sitearch}/%{name}-%{version}.egg-info +%{python3_other_sitearch}/_pythia8.*.so +%{python3_other_sitearch}/pythia8.py +%{python3_other_sitearch}/__pycache__/pythia8.* +%endif + %files data %dir %{_datadir}/Pythia8 %{_datadir}/Pythia8/xmldoc @@ -246,6 +293,12 @@ touch %{buildroot}%{python3_sitearch}/%{name}-%{version}.dist-info %license COPYING %changelog +* Thu Oct 25 2018 Mattias Ellert - 8.2.35-5 +- Don't build Python 2 package for Fedora >= 30 +- Add Python 3.6 package for EPEL 7 +- Use empty .egg-info files instead of empty .dist-info files to make + virtualenv happy + * Tue Jul 31 2018 Mattias Ellert - 8.2.35-4 - Don't own toplevel __pycache__ directory