File pypy-numpy.spec of Package pypy3

#
# spec file for package 
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           pypy-numpy
Version:        0.0.0+git20131121.c0ebca2
Release:        0
License:        BSD-3-Clause
Summary:        NumPy array processing for numbers, strings, records and objects
Url:            https://bitbucket.org/pypy/numpy/src
Group:          Development/Libraries/Python
# tar --exclude-vcs -cJf numpy-%{version}.tar.xz numpy/
Source0:        numpy-%{version}.tar.xz
BuildRequires:  xz
BuildRequires:  pypy-devel
BuildRequires:  blas-devel
BuildRequires:  lapack-devel
BuildRequires:  gcc-fortran
BuildRequires:  fdupes
#TODO: mvyskocil: it is unclear if missing declarations are problem or not
#      asked upstream and masked errors
BuildRequires:  -post-build-checks
Requires:       pypy >= 2.2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
NumPy is a general-purpose array-processing package designed to
efficiently manipulate large multi-dimensional arrays of arbitrary
records without sacrificing too much speed for small multi-dimensional
arrays.  NumPy is built on the Numeric code base and adds features
introduced by numarray as well as an extended C-API and the ability to
create arrays of arbitrary type which also makes NumPy suitable for
interfacing with general-purpose data-base applications.

There are also basic facilities for discrete fourier transform,
basic linear algebra and random number generation.

This package contain specific pypy fork of numpy.

%package devel
Summary:        Development files for numpy applications
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Requires:       blas-devel
Requires:       lapack-devel
Requires:       python-devel >= %{py_ver}
Requires:       gcc-fortran
%requires_eq    pypy-devel

%description devel
This package contains files for developing applications
using numpy.

%prep
%setup -q -n numpy

#no shebang
find . -name '*.py' | xargs sed -i -e '/^#!.usr.bin.*/d'

%build
CFLAGS="%{optflags} -fno-strict-aliasing" %{__pypy} setup.py build

%install
%{__pypy} setup.py install --root="%{buildroot}" --prefix="%{_prefix}"
#XXX: This is a bug in pypy distutils, which points to /usr/site-packages
#     asked upstream https://mail.python.org/pipermail/pypy-dev/2013-November/011938.html
#     lets workaround it once it will be resolved
mkdir -p %{buildroot}/%{pypy_sitearch}/site-packages/
mv %{buildroot}/%{_prefix}/site-packages/* %{buildroot}/%{pypy_sitearch}/
rm -rf %{buildroot}%{pypy_sitearch}/numpy/{,core,distutils,f2py,fft,ma,matrixlib,oldnumeric,polynomial,random,testing}/tests # Don't package testsuite
%fdupes -s %{buildroot}%{_prefix}
#TODO: update-alternatives
mv %{buildroot}/%{_bindir}/f2py %{buildroot}/%{_bindir}/f2py-pypy

# split devel files out
find %{buildroot}/%{pypy_sitearch}/numpy -name '*.c' -or -name '*.h' -or -name '*.a' | \
sed 's@%{buildroot}/%{pypy_sitearch}@%%{pypy_sitearch}@' > devel-files

#FIXME: why such sed does not work?
#sed 's/.*/%%exclude &/' > exclude-devel-files
cat <<EOF > mkexcludes.py
#!/usr/bin/pypy

with open("devel-files", "rt") as fp:
 for line in fp:
  print("%exclude {}".format(line.rstrip()))
EOF

pypy mkexcludes.py > exclude-devel-files

%files -f exclude-devel-files
%defattr(-,root,root)
%doc COMPATIBILITY LICENSE.txt README.txt THANKS.txt
%{_bindir}/f2py-pypy
%{pypy_sitearch}/numpy/
%{pypy_sitearch}/numpy-1.8.0.dev_Unknown-py2.7.egg-info

%files devel -f devel-files
%defattr(-,root,root)
%{pypy_sitearch}/numpy/*/*/*.c
%{pypy_sitearch}/numpy/*/*.h
%{pypy_sitearch}/numpy/*/*/*.h
%{pypy_sitearch}/numpy/*/*/*/*.h
%{pypy_sitearch}/numpy/core/lib/libnpymath.a

%changelog

openSUSE Build Service is sponsored by