2022-01-25 08:19:24 +01:00
#
2022-03-15 16:51:14 +01:00
# spec file
2022-01-25 08:19:24 +01:00
#
2023-01-25 11:23:22 +01:00
# Copyright (c) 2023 SUSE LLC
2022-01-25 08:19:24 +01:00
#
# 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/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test-py39"
%define psuffix -test-py39
%define skip_python38 1
%define skip_python310 1
2023-05-15 17:49:14 +02:00
%define skip_python311 1
2022-01-25 08:19:24 +01:00
%endif
%if "%{flavor}" == "test-py310"
%define psuffix -test-py310
%define skip_python38 1
%define skip_python39 1
2023-05-15 17:49:14 +02:00
%define skip_python311 1
%endif
%if "%{flavor}" == "test-py311"
%define psuffix -test-py311
%define skip_python38 1
%define skip_python39 1
%define skip_python310 1
2022-01-25 08:19:24 +01:00
%endif
%if "%{flavor}" == ""
%define psuffix %{nil}
%bcond_with test
2023-05-15 18:13:49 +02:00
%else
%bcond_without test
ExclusiveArch : x86_64
2022-01-25 08:19:24 +01:00
%endif
2023-06-11 13:31:28 +02:00
%{?sle15_python_module_pythons}
2022-01-25 08:19:24 +01:00
Name : python-pythran%{psuffix}
2023-05-15 17:24:30 +02:00
Version : 0.13.1
2022-01-25 08:19:24 +01:00
Release : 0
Summary : Ahead of Time compiler for numeric kernels
License : BSD-3-Clause
URL : https://github.com/serge-sans-paille/pythran
# Tests are only availble in github archive
2022-01-30 02:20:23 +01:00
Source0 : https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version} .tar.gz#/pythran-%{version}-gh.tar.gz
Source99 : python-pythran-rpmlintrc
2023-07-27 14:18:23 +02:00
#PATCH-FIX-UPSTREAM https://github.com/serge-sans-paille/pythran/commit/339fb5dcdf28f40311b5051925fd8a2c86286ac6 Introduce pythran/pythonic/include/types/longdouble.hpp et cie
Patch : numpy-longdouble.patch
#PATCH-FIX-UPSTREAM https://github.com/serge-sans-paille/pythran/commit/a49dc44076f7068205c22f532975c50cc4c03958 Use npy_creal/npy_cimag from npy_math in from_python::convert
2023-08-12 15:54:02 +02:00
Patch1 : numpy-complex.patch
2022-01-25 08:19:24 +01:00
BuildRequires : %{python_module setuptools}
BuildRequires : fdupes
BuildRequires : python-rpm-macros
Requires : python-beniget >= 0.4.0
Requires : python-gast >= 0.5.0
Requires : python-ply >= 3.4
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
# SECTION This is a package that compiles code, the runtime requires devel packages, inspired by fedora package
Requires : boost-devel
Requires : gcc-c++
Requires : openblas-devel
Requires : python-devel
Requires : python-numpy-devel
# Not available, use bundled
# Requires: xsimd-devel >= 8
# /SECTION
%if %{with test}
BuildRequires : %{python_module ipython}
2022-07-18 20:46:41 +02:00
BuildRequires : %{python_module pip}
2022-01-25 08:19:24 +01:00
BuildRequires : %{python_module pytest-xdist}
BuildRequires : %{python_module pytest}
BuildRequires : %{python_module pythran = %{version} }
BuildRequires : %{python_module wheel}
BuildRequires : gcc-c++
2022-03-15 16:51:14 +01:00
BuildRequires : unzip
2022-01-25 08:19:24 +01:00
%endif
2022-01-30 02:20:23 +01:00
BuildArch : noarch
2022-01-25 08:19:24 +01:00
%python_subpackages
%description
Ahead of Time compiler for numeric kernels
%prep
2022-07-18 20:46:41 +02:00
%autosetup -p1 -n pythran-%{version}
2022-01-25 08:19:24 +01:00
find -name '*.hpp' -exec chmod -x {} +
sed -i '1{/env python/d}' pythran/run.py
# Remove bundled header libs and use the ones from system
rm -r third_party/boost
cat >> setup.cfg << EOF
[build_py]
no_boost=True
EOF
2022-07-18 20:46:41 +02:00
# Register pytest.mark.module
cat >> pytest.ini << EOF
# https://github.com/serge-sans-paille/pythran/pull/286
[pytest]
markers =
module: execute module annotate class
EOF
2022-01-25 08:19:24 +01:00
# The tests have some cflags in them
# We need to adapt the flags to play nicely with other obs flags
# E.g. fortify source implies at least -O1
sed -i -e 's/-O0/-O1/g' -e 's/-Werror/-w/g' pythran/tests/__init__.py
%build
%python_build
%if !%{with test}
%install
%python_install
%python_clone -a %{buildroot} %{_bindir} /pythran
%python_clone -a %{buildroot} %{_bindir} /pythran-config
%python_expand %fdupes %{buildroot} %{$python_sitelib}
%endif
%if %{with test}
2022-01-30 02:20:23 +01:00
%check
2022-01-25 08:19:24 +01:00
export CFLAGS=" %{optflags} "
# crashes the xdist workers
donttest=" t e s t _ o p e r a t o r _ i n t e r s e c t i o n "
2022-12-27 15:31:44 +01:00
# gh#serge-sans-paille/pythran#2044 NOT FIXED by gh#serge-sans-paille/pythran#2046
donttest=" $ d o n t t e s t o r t e s t _ t o o l c h a i n o r t e s t _ c l i "
2023-05-15 17:49:14 +02:00
%pytest %{?jobs:-n %jobs} -k " n o t ( $ d o n t t e s t ) " -m " n o t m o d u l e "
2022-01-25 08:19:24 +01:00
%endif
%if !%{with test}
%post
%python_install_alternative pythran pythran-config
%postun
%python_uninstall_alternative pythran
%files %{python_files}
%doc AUTHORS Changelog README.rst
%license LICENSE
%python_alternative %{_bindir} /pythran
%python_alternative %{_bindir} /pythran-config
%{python_sitelib} /pythran
%{python_sitelib} /omp
%{python_sitelib} /pythran-%{version} *-info
%endif
%changelog