# # spec file # # Copyright (c) 2021 SUSE LLC # # 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 https://bugs.opensuse.org/ # # %if 0%{?suse_version} > 1500 %bcond_without libalternatives %else %bcond_with libalternatives %endif %global flavor @BUILD_FLAVOR@%{nil} %define ver 1.21.2 %define _ver 1_21_2 %define pname python-numpy %define hpc_upcase_trans_hyph() %(echo %{**} | tr [a-z] [A-Z] | tr '-' '_') %if "%{flavor}" == "" %bcond_with hpc %bcond_with openblas %endif %if "%{flavor}" == "gnu-hpc" %bcond_without hpc %endif %if "%{flavor}" == "gnu7-hpc" %define c_f_ver 7 %bcond_without hpc %endif %if %{with hpc} %bcond_without openblas %endif %if 0%{?sle_version} == 120300 %{?with_openblas:ExclusiveArch: do_not_build} %endif %ifarch s390 s390x %{?with_openblas:ExclusiveArch: do_not_build} %endif %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 %define skip_python36 1 %{?with_hpc:%{hpc_requires}} %bcond_with ringdisabled %if %{without hpc} %define package_name %{pname} %define p_python_sitearch %{python_sitearch} %define p_prefix %{_prefix} %define p_bindir %{_bindir} %else %{!?compiler_family:%global compiler_family gnu} %{hpc_init -c %{compiler_family} %{?c_f_ver:-v %{c_f_ver}} %{?mpi_ver:-V %{mpi_ver}}} %define package_name %{hpc_package_name %{_ver}} %define p_python_sitearch %{hpc_python_sitearch} %define p_prefix %{hpc_prefix} %define p_bindir %{hpc_bindir} # Magic for OBS Staging. Only build the flavors required by # other packages in the ring. %if %{with ringdisabled} ExclusiveArch: do_not_build %endif %endif Name: %{package_name} # set %%ver and %%_ver instead above Version: %ver Release: 0 Summary: NumPy array processing for numbers, strings, records and objects License: BSD-3-Clause URL: http://www.numpy.org/ Source: https://files.pythonhosted.org/packages/source/n/numpy/numpy-%{version}.zip Source99: python-numpy-rpmlintrc # PATCH-FIX-OPENSUSE numpy-buildfix.patch -- openSUSE-specific build fixes Patch0: numpy-buildfix.patch # PATCH-FIX-OPENSUSE numpy-1.9.0-remove-__declspec.patch -- fix for spurious compiler warnings that cause build failure Patch1: numpy-1.9.0-remove-__declspec.patch BuildConflicts: gcc11 < 11.2 BuildRequires: %{python_module Cython >= 0.29.24} BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module devel} BuildRequires: %{python_module hypothesis >= 6.12.0} BuildRequires: %{python_module pytest >= 6.2.4} BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module testsuite} BuildRequires: python-rpm-macros >= 20210929 BuildRequires: unzip %if 0%{?suse_version} BuildRequires: fdupes %endif %if %{without hpc} %if 0%{?suse_version} BuildRequires: gcc-fortran %else BuildRequires: gcc-gfortran %endif %if %{with openblas} BuildRequires: openblas-devel > 0.3.4 %else BuildRequires: blas-devel BuildRequires: cblas-devel BuildRequires: lapack-devel # openblas has significantly better performance for some operations Recommends: libopenblas_pthreads0 %endif # Last version which packaged %%{_bindir}/f2py without update-alternatives # Protect it from substitution %define oldpy_numpy python-numpy Conflicts: %{oldpy_numpy} <= 1.12.0 %if %{with libalternatives} BuildRequires: alts Requires: alts %else Requires(post): update-alternatives Requires(postun):update-alternatives %endif %else BuildRequires: %{compiler_family}%{?c_f_ver}-compilers-hpc-macros-devel BuildRequires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc-devel BuildRequires: lua-lmod BuildRequires: suse-hpc Requires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc %endif %python_subpackages %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. %{?with_hpc:%{hpc_python_master_package -L -a }} %package devel Summary: Development files for numpy applications Requires: %{name} = %{version} Requires: python-devel %if %{without hpc} %if %{with openblas} Requires: openblas-devel %else Requires: blas-devel Requires: cblas-devel Requires: lapack-devel %endif %else Requires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc-devel %{hpc_requires_devel} %endif %description devel This package contains files for developing applications using numpy. %{?with_hpc:%{hpc_python_master_package devel -a }} %prep %autosetup -p1 -n numpy-%{version} # Fix non-executable scripts sed -i '1s/^#!.*$//' numpy/{compat/setup,random/_examples/cython/setup,distutils/{conv_template,cpuinfo,exec_command,from_template,setup,system_info},f2py/{__init__,auxfuncs,capi_maps,cb_rules,cfuncs,common_rules,crackfortran,diagnose,f2py2e,f90mod_rules,func2subr,rules,setup,use_rules},ma/{setup,bench},matrixlib/setup,setup,testing/{print_coercion_tables,setup}}.py sed -i '1s/^#!.*$//' numpy/random/_examples/cython/*.pyx # force cythonization rm PKG-INFO %build %define _lto_cflags %{nil} %if %{with hpc} %hpc_setup module load openblas export CFLAGS="$(pkg-config --cflags openblas) %{optflags} -fno-strict-aliasing" LIBS="$(pkg-config --libs openblas)" cat > site.cfg <