From f8e7072c6bc9fc180c4bec20eea5f39644b3edb1 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Ayllon Date: Feb 20 2017 09:18:18 +0000 Subject: Merge branch 'master' into el5 --- diff --git a/gfal2-python.spec b/gfal2-python.spec index 2f2445d..45d0806 100644 --- a/gfal2-python.spec +++ b/gfal2-python.spec @@ -1,5 +1,8 @@ -%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} +# Use static linking against boost +%bcond_with static_boost_python +# Doc directory +%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} #include boost > 141 for EL5 %if 0%{?el5} @@ -8,9 +11,18 @@ %global boost_cmake_flags -DBOOST_INCLUDEDIR=/usr/include %endif +# Python 3 +%if 0%{?fedora} >= 23 +%global with_python3 0 +%endif + # python path discovery %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%if 0%{?with_python3} +%{!?python3_sitearch: %define python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + # python modules filtering %if 0%{?el6} || 0%{?el5} %{?filter_setup: @@ -18,7 +30,7 @@ %filter_setup } %else -%global __provides_exclude_from ^(%{python_sitearch}/.*\\.so)$ +%global __provides_exclude_from ^((%{python_sitearch})|(%{python3_sitearch})/.*\\.so)$ %endif Name: gfal2-python @@ -36,7 +48,11 @@ URL: http://dmc.web.cern.ch/ Source0: %{name}-%{version}.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildRequires: cmake +%if 0%{?el5} +BuildRequires: cmake28 +%else +BuildRequires: cmake +%endif BuildRequires: gfal2-devel >= 2.13.0 %if 0%{?el5} BuildRequires: boost141-devel @@ -48,6 +64,12 @@ BuildRequires: epydoc Requires: gfal2-core >= 2.13.0 +# Python 3 +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: boost-python3-devel +%endif + %description Python bindings for gfal2. GFAL2 offers an a single, simple and portable API @@ -61,7 +83,18 @@ BuildArch: noarch %endif %description doc -Documentation files for %{name} . +Documentation files for %{name}. + +%if 0%{?with_python3} +%package -n gfal2-python3 +Summary: gfal2 python birngins for Python 3 +Group: Applications/Internet + +%description -n gfal2-python3 +Python 3 bindings for gfal2. +GFAL2 offers an a single, simple and portable API +for the file operations in grids and cloud environments. +%endif %clean rm -rf %{buildroot}; @@ -71,16 +104,43 @@ make clean %setup -q %build -%cmake \ --DDOC_INSTALL_DIR=%{_pkgdocdir} \ - %{boost_cmake_flags} \ - -DUNIT_TESTS=TRUE . +# Make sure the version in the spec file and the version used +# for building matches +gfal2_python_cmake_ver=`sed -n 's/^set *(VERSION_\(MAJOR\|MINOR\|PATCH\) *\([0-9]\+\).*/\2/p' CMakeLists.txt | paste -sd '.'` +gfal2_python_spec_ver=`expr "%{version}" : '\([0-9]*\\.[0-9]*\\.[0-9]*\)'` +if [ "$gfal2_python_cmake_ver=" != "$gfal2_python_spec_ver=" ]; then + echo "The version in the spec file does not match the CMakeLists.txt version!" + echo "$gfal2_python_cmake_ver!= %{version}" + exit 1 +fi + +%if 0%{?el5} + %cmake28 \ + -DDOC_INSTALL_DIR=%{_pkgdocdir} \ + %{boost_cmake_flags} \ +%if 0%{?with_static_boost_python} + -DBoost_USE_STATIC_LIBS=ON \ +%endif + -DUNIT_TESTS=TRUE . +%else + %cmake \ + -DDOC_INSTALL_DIR=%{_pkgdocdir} \ + %{boost_cmake_flags} \ +%if 0%{?with_static_boost_python} + -DBoost_USE_STATIC_LIBS=ON \ +%endif + -DUNIT_TESTS=TRUE . +%endif make %{?_smp_mflags} make doc %check -ctest -V -T Test . +%if 0%{?el5} + ctest28 -V -T Test . +%else + ctest -V -T Test . +%endif %install rm -rf %{buildroot} @@ -101,6 +161,12 @@ make DESTDIR=%{buildroot} install %{_pkgdocdir}/html/* %{_pkgdocdir}/examples/* +%if 0%{?with_python3} +%files -n gfal2-python3 +%defattr (-,root,root) +%{python3_sitearch}/gfal2.so +%endif + %changelog * Mon Feb 20 2017 Alejandro Alvarez - 1.9.1-1 - Update for release 1.9.0