Sync from SUSE:ALP:Source:Standard:1.0 python-pythran revision 9dfd3b385b65337e5ab665cb5d7bc00f

This commit is contained in:
Adrian Schröter 2023-10-19 03:30:32 +02:00
commit ecaa564280
8 changed files with 461 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

5
_multibuild Normal file
View File

@ -0,0 +1,5 @@
<multibuild>
<package>test-py39</package>
<package>test-py310</package>
<package>test-py311</package>
</multibuild>

39
numpy-complex.patch Normal file
View File

@ -0,0 +1,39 @@
From a49dc44076f7068205c22f532975c50cc4c03958 Mon Sep 17 00:00:00 2001
From: Lysandros Nikolaou <lisandrosnik@gmail.com>
Date: Wed, 19 Jul 2023 13:03:41 +0200
Subject: [PATCH] Use npy_creal/npy_cimag from npy_math in from_python::convert
---
pythran/pythonic/types/complex.hpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pythran/pythonic/types/complex.hpp b/pythran/pythonic/types/complex.hpp
index 9b57f7384..929a3d200 100644
--- a/pythran/pythonic/types/complex.hpp
+++ b/pythran/pythonic/types/complex.hpp
@@ -177,6 +177,7 @@ PYTHONIC_NS_END
#ifdef ENABLE_PYTHON_MODULE
#include "numpy/arrayscalars.h"
+#include "numpy/npy_math.h"
#include "pythonic/python/core.hpp"
PYTHONIC_NS_BEGIN
@@ -228,7 +229,7 @@ inline std::complex<long double>
from_python<std::complex<long double>>::convert(PyObject *obj)
{
auto val = PyArrayScalar_VAL(obj, CLongDouble);
- return {val.real, val.imag};
+ return {npy_creall(val), npy_cimagl(val)};
}
template <>
@@ -243,7 +244,7 @@ inline std::complex<float>
from_python<std::complex<float>>::convert(PyObject *obj)
{
auto val = PyArrayScalar_VAL(obj, CFloat);
- return {val.real, val.imag};
+ return {npy_crealf(val), npy_cimagf(val)};
}
PYTHONIC_NS_END
#endif

122
numpy-longdouble.patch Normal file
View File

@ -0,0 +1,122 @@
From 339fb5dcdf28f40311b5051925fd8a2c86286ac6 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Thu, 6 Jul 2023 22:06:20 +0200
Subject: [PATCH] Introduce pythran/pythonic/include/types/longdouble.hpp et
cie
New numpy version alias np.float128 to np.longdouble, so we need these
headers too. Same for np.complex256 and np.clongdouble.
SLightly adjust notebook tests for portability to that respect.
---
pythran/pythonic/include/types/clongdouble.hpp | 6 ++++++
pythran/pythonic/include/types/longdouble.hpp | 4 ++++
pythran/pythonic/types/clongdouble.hpp | 7 +++++++
pythran/pythonic/types/float128.hpp | 2 +-
pythran/pythonic/types/longdouble.hpp | 6 ++++++
pythran/tests/notebooks/export.ipynb | 14 +++++++-------
6 files changed, 31 insertions(+), 8 deletions(-)
create mode 100644 pythran/pythonic/include/types/clongdouble.hpp
create mode 100644 pythran/pythonic/include/types/longdouble.hpp
create mode 100644 pythran/pythonic/types/clongdouble.hpp
create mode 100644 pythran/pythonic/types/longdouble.hpp
diff --git a/pythran/pythonic/include/types/clongdouble.hpp b/pythran/pythonic/include/types/clongdouble.hpp
new file mode 100644
index 0000000000..dd666a52f5
--- /dev/null
+++ b/pythran/pythonic/include/types/clongdouble.hpp
@@ -0,0 +1,6 @@
+#ifndef PYTHONIC_INCLUDE_TYPES_CLONGDOUBLE_HPP
+#define PYTHONIC_INCLUDE_TYPES_CLONGDOUBLE_HPP
+
+#include "pythonic/include/types/complex.hpp"
+
+#endif
diff --git a/pythran/pythonic/include/types/longdouble.hpp b/pythran/pythonic/include/types/longdouble.hpp
new file mode 100644
index 0000000000..1ee2fca96c
--- /dev/null
+++ b/pythran/pythonic/include/types/longdouble.hpp
@@ -0,0 +1,4 @@
+#ifndef PYTHONIC_INCLUDE_TYPES_LONGDOUBLE_HPP
+#define PYTHONIC_INCLUDE_TYPES_LONGDOUBLE_HPP
+
+#endif
diff --git a/pythran/pythonic/types/clongdouble.hpp b/pythran/pythonic/types/clongdouble.hpp
new file mode 100644
index 0000000000..057a2b9cb6
--- /dev/null
+++ b/pythran/pythonic/types/clongdouble.hpp
@@ -0,0 +1,7 @@
+#ifndef PYTHONIC_TYPES_CLONGDOUBLE_HPP
+#define PYTHONIC_TYPES_CLONGDOUBLE_HPP
+
+#include "pythonic/include/types/clongdouble.hpp"
+#include "pythonic/types/complex.hpp"
+
+#endif
diff --git a/pythran/pythonic/types/float128.hpp b/pythran/pythonic/types/float128.hpp
index bf67552447..0943827ff3 100644
--- a/pythran/pythonic/types/float128.hpp
+++ b/pythran/pythonic/types/float128.hpp
@@ -1,6 +1,6 @@
#ifndef PYTHONIC_TYPES_FLOAT128_HPP
#define PYTHONIC_TYPES_FLOAT128_HPP
-#include "pythonic/include/types/float64.hpp"
+#include "pythonic/include/types/float128.hpp"
#endif
diff --git a/pythran/pythonic/types/longdouble.hpp b/pythran/pythonic/types/longdouble.hpp
new file mode 100644
index 0000000000..b3944cea6a
--- /dev/null
+++ b/pythran/pythonic/types/longdouble.hpp
@@ -0,0 +1,6 @@
+#ifndef PYTHONIC_TYPES_LONGDOUBLE_HPP
+#define PYTHONIC_TYPES_LONGDOUBLE_HPP
+
+#include "pythonic/include/types/longdouble.hpp"
+
+#endif
diff --git a/pythran/tests/notebooks/export.ipynb b/pythran/tests/notebooks/export.ipynb
index aa2baadc06..3f390dc0f1 100644
--- a/pythran/tests/notebooks/export.ipynb
+++ b/pythran/tests/notebooks/export.ipynb
@@ -418,20 +418,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "(1.5, -1.5) <class 'numpy.float32'>\n",
- "(1.5, -1.5) <class 'float'>\n",
- "(1.5, -1.5) <class 'numpy.float128'>\n"
+ "(1.5, -1.5)\n",
+ "(1.5, -1.5)\n",
+ "(1.5, -1.5)\n"
]
}
],
"source": [
"import numpy as np\n",
"x64 = dtype(np.complex64(1.5 + -1.5j))\n",
- "print(x64, type(x64[0]))\n",
+ "print(x64)\n",
"x128 = dtype(np.complex128(1.5 + -1.5j))\n",
- "print(x128, type(x128[0]))\n",
+ "print(x128)\n",
"x256 = dtype(np.complex256(1.5 + -1.5j))\n",
- "print(x256, type(x256[0]))"
+ "print(x256)"
]
},
{
@@ -969,7 +969,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.9"
+ "version": "3.10.11"
}
},
"nbformat": 4,

3
python-pythran-rpmlintrc Normal file
View File

@ -0,0 +1,3 @@
# SECTION This is a package that compiles code, the runtime requires devel packages
addFilter('devel-file-in-non-devel-package .*/site-packages/pythran/.*')
addFilter('devel-dependency .*')

111
python-pythran.changes Normal file
View File

@ -0,0 +1,111 @@
-------------------------------------------------------------------
Tue Aug 8 16:00:58 UTC 2023 - ecsos <ecsos@opensuse.org>
- Fix build error in Leap, because it must not be two "Patch:" lines.
-------------------------------------------------------------------
Thu Jul 27 10:10:55 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Add upstream numpy-longdouble.patch and numpy-complex.patch to support new numpy
-------------------------------------------------------------------
Sat Jun 10 17:53:22 UTC 2023 - ecsos <ecsos@opensuse.org>
- Add %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Mon May 15 15:19:41 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.13.1:
* Bump xsimd dependency to 11.0.0, with a backported patch.
* Improve performance of functions revieving scalar arguments.
This changes the internal function call API.
* Improve performance of fix-stride slicing, using a new slice
representation.
* Improve numpy.copyto performance, and detect copyto pattern usage.
* Force internal linkage of generated functions, which gives more
optimization room to the C++ compiler.
* Provide entry points pythran.import_pythrancode and
pythran.import_pythranfile, as a poor man JIT option.
* Optimize numpy.argmax(cst * val) into numpy.argmax(val) when cst is
positive.
* Avoid copies upon numpy.array_split
* Get rid of unused functions C++ warnings
* Avoid generating a loop footer when the loop index is not used
outside of the loop.
- fix the test-flavor splitting for python311
-------------------------------------------------------------------
Wed Jan 25 10:22:53 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.12.1:
* Bump xsimd depdency to 10.0.0
* Correctly raise KeyError when getting an unset dict item
* Fix negative binomial implementation
* Correctly convert strided array with offset
* Support np.clip(v, None, x) and np.clip(v, x, None)
* Support scipy.special.ndtr, scipy.special.ndtri, scipy.special.gammaincinv
* Fix set intersection
* Support numpy.fft.fftn
* Support axis parameter in numpy.argsort
-------------------------------------------------------------------
Sun Dec 25 11:01:09 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Revert. 2046-fix-cli-doc-test.patch did not fix the tests.
gh#serge-sans-paille/pythran#2046
-------------------------------------------------------------------
Sat Dec 17 14:32:56 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add 2046-fix-cli-doc-test.patch to fix failing tests
(gh#serge-sans-paille/pythran#2046).
-------------------------------------------------------------------
Fri Nov 25 01:54:50 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Skip also failing test_toolchain and test_cli
(gh#serge-sans-paille/pythran#2044) tests.
-------------------------------------------------------------------
Tue Oct 11 08:41:50 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 0.12.0
* Improve numpy expression computation speed
* Decent ICC support (fixing an issue from 2018!)
* Much faster C++ code generation
* Complete rework of constant folder
* Support C++-time evaluation of numpy.ndarray.ndim
* Improved omp declare reduction support
* Allow indexing of ndarray by integers of mixed types
* A lot of small pesty bug fixes in the C++ headers
- Drop patches
* gcc12-fixes.patch
* pythran-pr1984-fixdistutils.patch
-------------------------------------------------------------------
Mon Jul 18 12:24:47 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Add pythran-pr1984-fixdistutils.patch
* gh#serge-sans-paille/pythran#1984
* Fixes gh#serge-sans-paille/pythran#1984 with setuptools >= 60
-------------------------------------------------------------------
Tue Mar 15 07:59:46 UTC 2022 - Martin Liška <mliska@suse.cz>
- Add gcc12-fixes.patch in order to fix GCC 12 building issues.
-------------------------------------------------------------------
Fri Jan 28 18:47:52 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Fix errors uncovered by staging:
* Mention python-pythran-rpmlintrc
* also make :test-py* noarch so that no debuginfo package fails
-------------------------------------------------------------------
Sun Jan 23 15:10:57 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Initial specfile for 0.11
* debundling inspired by Fedora package:
https://src.fedoraproject.org/rpms/pythran/blob/rawhide/f/pythran.spec
- Required by scipy 1.7

155
python-pythran.spec Normal file
View File

@ -0,0 +1,155 @@
#
# spec file
#
# Copyright (c) 2023 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/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test-py39"
%define psuffix -test-py39
%define skip_python38 1
%define skip_python310 1
%define skip_python311 1
%endif
%if "%{flavor}" == "test-py310"
%define psuffix -test-py310
%define skip_python38 1
%define skip_python39 1
%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
%endif
%if "%{flavor}" == ""
%define psuffix %{nil}
%bcond_with test
%else
%bcond_without test
ExclusiveArch: x86_64
%endif
%{?sle15_python_module_pythons}
Name: python-pythran%{psuffix}
Version: 0.13.1
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
Source0: https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version}.tar.gz#/pythran-%{version}-gh.tar.gz
Source99: python-pythran-rpmlintrc
#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
Patch1: numpy-complex.patch
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}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pythran = %{version}}
BuildRequires: %{python_module wheel}
BuildRequires: gcc-c++
BuildRequires: unzip
%endif
BuildArch: noarch
%python_subpackages
%description
Ahead of Time compiler for numeric kernels
%prep
%autosetup -p1 -n pythran-%{version}
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
# 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
# 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}
%check
export CFLAGS="%{optflags}"
# crashes the xdist workers
donttest="test_operator_intersection"
# gh#serge-sans-paille/pythran#2044 NOT FIXED by gh#serge-sans-paille/pythran#2046
donttest="$donttest or test_toolchain or test_cli"
%pytest %{?jobs:-n %jobs} -k "not ($donttest)" -m "not module"
%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

BIN
pythran-0.13.1-gh.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.