Blob Blame Raw
%global srcname pyopencl
# POCL arches
%ifarch aarch64 ppc64 ppc64le s390 s390x
%bcond_with tests
%else
%bcond_without tests
%endif

Name:           python-%{srcname}
Version:        2017.2
Release:        1%{?dist}
Summary:        Python wrapper for OpenCL

# https://bugzilla.redhat.com/show_bug.cgi?id=1219819#c16
# Boost (boost):
# pyopencl/cl/pyopencl-bessel-j.cl
# pyopencl/cl/pyopencl-bessel-y.cl
# pyopencl/cl/pyopencl-eval-tbl.cl
# GPLv2 (cephes):
# pyopencl/cl/pyopencl-airy.cl
# ASL 2.0 (ranluxcl), will be removed in 2018.x:
# pyopencl/cl/pyopencl-ranluxcl.cl
# ASL 2.0:
# pyopencl/scan.py
# BSD (random123):
# pyopencl/cl/pyopencl-random123/array.h
# pyopencl/cl/pyopencl-random123/openclfeatures.h
# pyopencl/cl/pyopencl-random123/philox.cl
# pyopencl/cl/pyopencl-random123/threefry.cl
# BSD:
# pyopencl/bitonic_sort.py
# pyopencl/bitonic_sort_templates.py

License:        MIT and Boost and ASL 2.0 and GPLv2 and BSD
URL:            http://mathema.tician.de/software/pyopencl
Source0:        https://github.com/pyopencl/pyopencl/archive/v%{version}/%{srcname}-%{version}.tar.gz
# https://github.com/inducer/compyte/pull/24
# Upstream maintainer not interested to unbundle compyte
Patch0:         0001-use-system-compyte.patch
Patch1:         0002-disable-executing-git-submodule.patch
# Have not asked upstream, but they want to enforce CFLAGS/LDFLAGS
Patch2:         0003-don-t-hack-distutils-with-C-LDFLAGS.patch

# pyopencl/cl/pyopencl-bessel-[j,y].cl and
# pyopencl/cl/pyopencl-eval-tbl.cl contain snippets taken from boost
# and cephes. pyopencl/cl/pyopencl-airy.cl contains code taken from
# cephes.
Provides:       bundled(boost-math)
Provides:       bundled(cephes) = 2.8
# pyopencl/cl/pyopencl-ranluxcl.cl contains a modified version of the
# ranluxcl library
Provides:       bundled(ranluxcl) = 1.3.1

BuildRequires:  boost-devel
BuildRequires:  opencl-headers ocl-icd-devel
BuildRequires:  atlas-devel blas-devel
BuildRequires:  pkgconfig(libffi)
BuildRequires:  pkgconfig(gl)
%if %{with tests}
BuildRequires:  pocl
%endif

%global _description \
PyOpenCL makes it possible to access GPUs and other massively\
parallel compute devices from Python. Specifically, PyOpenCL\
provides Pythonic access to the OpenCL parallel computation\
API in a manner similar to the sister project `PyCUDA`.

%description %{_description}

%package -n python2-%{srcname}
Summary:        Python 2 wrapper for OpenCL
%{?python_provide:%python_provide python2-%{srcname}}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-numpy
BuildRequires:  python2-cffi
%if %{with tests}
BuildRequires:  python2-pytest
BuildRequires:  python2-compyte
BuildRequires:  python2-pytools >= 2017.2
BuildRequires:  python2-decorator
BuildRequires:  python2-appdirs
BuildRequires:  python2-six
BuildRequires:  python-mako
BuildRequires:  python2-scipy
%endif
Requires:       python2-compyte
Requires:       python2-numpy
Requires:       python2-pytools >= 2017.2
Requires:       python2-decorator
Requires:       python2-cffi
Requires:       python2-appdirs
Requires:       python2-six
Requires:       python-mako

%description -n python2-%{srcname} %{_description}

Python 2 version.

%package -n python3-%{srcname}
Summary:        Python 3 wrapper for OpenCL
%{?python_provide:%python_provide python3-%{srcname}}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-numpy
BuildRequires:  python3-cffi
%if %{with tests}
BuildRequires:  python3-pytest
BuildRequires:  python3-compyte
BuildRequires:  python3-pytools >= 2017.2
BuildRequires:  python3-decorator
BuildRequires:  python3-appdirs
BuildRequires:  python3-six
BuildRequires:  python3-mako
BuildRequires:  python3-scipy
%endif
Requires:       python3-compyte
Requires:       python3-numpy
Requires:       python3-pytools >= 2017.2
Requires:       python3-decorator
Requires:       python3-cffi
Requires:       python3-appdirs
Requires:       python3-six
Requires:       python3-mako

%description -n python3-%{srcname} %{_description}

Python 3 version.

%prep
%autosetup -n %{srcname}-%{version} -p1

rm -f examples/{.gitignore,download-examples-from-wiki.py}

# generate html docs 
#sphinx-build doc/source html
# remove the sphinx-build leftovers
#rm -rf html/.{doctrees,buildinfo}

%build
%{__python} configure.py --cl-enable-gl
%py2_build
%py3_build

%install
%py2_install
%py3_install

find %{buildroot}%{python2_sitearch}/%{srcname} -name '*.so' -exec chmod 755 {} ';'
find %{buildroot}%{python3_sitearch}/%{srcname} -name '*.so' -exec chmod 755 {} ';'

%if %{with tests}
%check
pushd test/
  export PYTHONPATH=%{buildroot}%{python2_sitearch}
  find -name '*.py' -exec py.test-%{python2_version} -v {} ';'

  export PYTHONPATH=%{buildroot}%{python3_sitearch}
  find -name '*.py' -exec py.test-%{python3_version} -v {} ';'
popd
%endif

%files -n python2-%{srcname}
%license LICENSE
%doc examples
%{python2_sitearch}/%{srcname}/
%{python2_sitearch}/%{srcname}-*.egg-info/

%files -n python3-%{srcname}
%license LICENSE
%doc examples
%{python3_sitearch}/%{srcname}/
%{python3_sitearch}/%{srcname}-*.egg-info/

%changelog
* Sat Jul 15 2017 Igor Gnatenko <ignatenko@redhat.com> - 2017.2-1
- Update to 2017.2

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2016.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Jan 19 2017 Igor Gnatenko <ignatenko@redhat.com> - 2016.2.1-1
- Upate to 2016.2.1

* Tue Jan 17 2017 Than Ngo <than@redhat.com> - 2016.1-6
- fix the conditionalize tests support
- switching to gnu++11 to fix the build failure on ppc64le

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2016.1-5
- Rebuild for Python 3.6

* Wed Aug 31 2016 Igor Gnatenko <ignatenko@redhat.com> - 2016.1-4
- Update to 2016.1
- Cleanups in packaging

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2015.2-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2015.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Nov 15 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2015.2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Nov 05 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2015.2-1
- Update to 2015.2
- Add some description to bundled libs providing
- Provide exact version of bundled cephes
- Force tests passed
- Fixed dependencies list

* Wed Nov 04 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2015.1-4
- Fixed license tag
- Run tests
- Add license

* Sat Oct 24 2015 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2015.1-3
- Fix errors during review

* Sat Oct 24 2015 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2015.1-2
- Trivial fixes in spec

* Fri May 08 2015 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2015.1-1
- Initial package