2022-01-25 07:19:24 +00:00
#
2024-02-06 09:05:17 +00:00
# spec file for package python-pythran
2022-01-25 07:19:24 +00:00
#
2025-05-30 10:58:41 +00:00
# Copyright (c) 2025 SUSE LLC
2022-01-25 07:19:24 +00: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}
2024-05-28 12:41:40 +00:00
%{?sle15_python_module_pythons}
2022-01-25 07:19:24 +00:00
%if "%{flavor}" == ""
%define psuffix %{nil}
%bcond_with test
2023-05-15 16:13:49 +00:00
%else
2024-05-28 12:41:40 +00:00
%define psuffix -%{flavor}
2023-05-15 16:13:49 +00:00
%bcond_without test
2024-05-28 12:41:40 +00:00
%if "%{flavor}" != "test-py311"
%define skip_python311 1
%endif
%if "%{flavor}" != "test-py312"
%define skip_python312 1
%endif
2024-09-01 13:33:41 +00:00
%if "%{flavor}" != "test-py313"
%define skip_python313 1
%endif
2025-07-07 18:31:37 +00:00
# Skip empty buildsets on tumbleweed, or non py311 flavors on sle15_python_module_pythons, or any testing on leap 16
%if "%{shrink:%{pythons}}" == "" || ("%pythons" == "python311" && 0%{?skip_python311}) || (0%{?is_opensuse} && 0%{?suse_version} == 1600)
2024-02-12 22:30:05 +00:00
ExclusiveArch : donotbuild
2024-05-28 12:41:40 +00:00
%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version}
2024-02-12 22:30:05 +00:00
%else
2023-05-15 16:13:49 +00:00
ExclusiveArch : x86_64
2022-01-25 07:19:24 +00:00
%endif
2024-02-12 22:30:05 +00:00
%endif
2024-05-28 12:41:40 +00:00
2022-01-25 07:19:24 +00:00
Name : python-pythran%{psuffix}
2025-05-30 10:58:41 +00:00
Version : 0.18.0
2022-01-25 07:19:24 +00:00
Release : 0
Summary : Ahead of Time compiler for numeric kernels
License : BSD-3-Clause
URL : https://github.com/serge-sans-paille/pythran
2024-02-12 22:30:05 +00:00
# Tests are only availble from the github archive
2022-01-30 01:20:23 +00:00
Source0 : https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version} .tar.gz#/pythran-%{version}-gh.tar.gz
Source99 : python-pythran-rpmlintrc
2025-06-13 20:05:09 +00:00
# PATCH-FIX-UPSTREAM: https://github.com/serge-sans-paille/pythran/commit/14b78f0db9cbd253414b751d14644843354e7557
Patch0 : GCC15_fix_Add-missing-operators-to-nditerator.patch
# PATCH-FIX-UPSTREAM: https://github.com/serge-sans-paille/pythran/commit/623fa5031df7ec5c3dfe6789bf608cf11ac95c36
Patch1 : GCC15_pythran-PR2325-missing-operators.patch
2025-08-14 08:42:32 +00:00
# PATCH-FIX-UPSTREAM https://github.com/serge-sans-paille/pythran/commit/2e4da862478a2c5b026a9066771da4dcd34a144b Do not test binary mode of numpy.fromstring for recent numpy version
Patch2 : np-fromstring.patch
2023-11-21 06:45:26 +00:00
BuildRequires : %{python_module pip}
2022-01-25 07:19:24 +00:00
BuildRequires : %{python_module setuptools}
2023-11-21 06:45:26 +00:00
BuildRequires : %{python_module wheel}
2022-01-25 07:19:24 +00:00
BuildRequires : fdupes
BuildRequires : python-rpm-macros
Requires : python-beniget >= 0.4.0
2024-09-01 13:43:52 +00:00
Requires : python-numpy
2022-01-25 07:19:24 +00:00
Requires : python-ply >= 3.4
2024-02-12 22:30:05 +00:00
Requires : python-setuptools
2024-07-31 04:35:31 +00:00
Requires : (python-gast >= 0.6.0 with python-gast < 0.7.0)
2022-01-25 07:19:24 +00:00
Requires(post) : update-alternatives
2024-02-06 09:05:17 +00:00
Requires(postun) : update-alternatives
2024-02-12 22:30:05 +00:00
# SECTION This is a package that compiles code, the runtime requires devel packages
2022-01-25 07:19:24 +00:00
Requires : boost-devel
Requires : gcc-c++
Requires : python-devel
Requires : python-numpy-devel
2024-05-28 12:41:40 +00:00
Requires : xsimd-devel >= 13.0.0
2022-01-25 07:19:24 +00:00
# /SECTION
%if %{with test}
BuildRequires : %{python_module ipython}
2024-05-28 12:41:40 +00:00
BuildRequires : %{python_module packaging}
2022-07-18 18:46:41 +00:00
BuildRequires : %{python_module pip}
2022-01-25 07:19:24 +00:00
BuildRequires : %{python_module pytest-xdist}
BuildRequires : %{python_module pytest}
BuildRequires : %{python_module pythran = %{version} }
BuildRequires : %{python_module wheel}
2024-05-28 12:41:40 +00:00
%if 0%{?suse_version} > 1500
2024-02-12 22:30:05 +00:00
BuildRequires : openblas-devel
2024-05-28 12:41:40 +00:00
%else
BuildRequires : cblas-devel
BuildRequires : lapack-devel
%endif
2022-03-15 15:51:14 +00:00
BuildRequires : unzip
2022-01-25 07:19:24 +00:00
%endif
2022-01-30 01:20:23 +00:00
BuildArch : noarch
2022-01-25 07:19:24 +00:00
%python_subpackages
%description
Ahead of Time compiler for numeric kernels
%prep
2022-07-18 18:46:41 +00:00
%autosetup -p1 -n pythran-%{version}
2022-01-25 07:19:24 +00:00
find -name '*.hpp' -exec chmod -x {} +
sed -i '1{/env python/d}' pythran/run.py
2024-02-06 11:27:16 +00:00
# remove embedded VIM swap files
find -type f -name " * . s w p " -delete
2022-01-25 07:19:24 +00:00
# Remove bundled header libs and use the ones from system
2024-02-12 22:30:05 +00:00
rm -r pythran/boost pythran/xsimd
2022-01-25 07:19:24 +00:00
%build
2024-02-12 22:30:05 +00:00
%if !%{with test}
2023-11-21 06:45:26 +00:00
%pyproject_wheel
2024-02-12 22:30:05 +00:00
%endif
2022-01-25 07:19:24 +00:00
%install
2024-02-12 22:30:05 +00:00
%if !%{with test}
2023-11-21 06:45:26 +00:00
%pyproject_install
2022-01-25 07:19:24 +00:00
%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 01:20:23 +00:00
%check
2022-01-25 07:19:24 +00:00
export CFLAGS=" %{optflags} "
2024-05-28 12:41:40 +00:00
%if 0%{?suse_version} > 1500
2024-02-12 22:30:05 +00:00
# Force to link against openblas during tests because the update-alternatives setup
# for lapack/cblas/openblas might be inconsistent inside obs builds
cat > config.pythranrc <<EOF
[compiler]
blas=openblas
libs=openblas
EOF
export PYTHRANRC=$PWD/config.pythranrc
2024-05-28 12:41:40 +00:00
%endif
2025-05-30 10:58:41 +00:00
# gh#serge-sans-paille/pythran#2317 -- changed AST in Py3.13
2025-06-18 12:26:00 +00:00
# gh#serge-sans-paille/pythran#2326
python313_skip_tests=(" - k " " n o t ( t e s t _ t u t o r i a l o r t e s t _ u t i l s ) " )
2024-02-12 22:30:05 +00:00
# pytest_extra_args is for debug builds with local defines on command line
2025-05-30 10:58:41 +00:00
%pytest %{?jobs:-n %jobs} %{?pytest_extra_args} " $ { $ p y t h o n _ s k i p _ t e s t s [ @ ] } "
2022-01-25 07:19:24 +00: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
2023-11-21 06:45:26 +00:00
%{python_sitelib} /pythran-%{version} .dist-info
2022-01-25 07:19:24 +00:00
%endif
%changelog