From 2b4732641bc571275aa9a7ba7379407346de26d2493f2dde21169b807c93cb49 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 1 Sep 2024 13:33:41 +0000 Subject: [PATCH 1/3] - Add patch numpy-2.1-support.patch: * Fix test suite failure with numpy 2.1 - prepare for python 3.13 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pythran?expand=0&rev=50 --- .gitattributes | 23 ++++ .gitignore | 1 + _multibuild | 5 + numpy-2.1-support.patch | 105 ++++++++++++++++++ python-pythran-rpmlintrc | 6 ++ python-pythran.changes | 228 +++++++++++++++++++++++++++++++++++++++ python-pythran.spec | 161 +++++++++++++++++++++++++++ pythran-0.16.1-gh.tar.gz | 3 + support-gast-0.6.patch | 76 +++++++++++++ 9 files changed, 608 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 numpy-2.1-support.patch create mode 100644 python-pythran-rpmlintrc create mode 100644 python-pythran.changes create mode 100644 python-pythran.spec create mode 100644 pythran-0.16.1-gh.tar.gz create mode 100644 support-gast-0.6.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..6d8cafe --- /dev/null +++ b/_multibuild @@ -0,0 +1,5 @@ + + test-py310 + test-py311 + test-py312 + diff --git a/numpy-2.1-support.patch b/numpy-2.1-support.patch new file mode 100644 index 0000000..ecd7d85 --- /dev/null +++ b/numpy-2.1-support.patch @@ -0,0 +1,105 @@ +From 9261d30aa9618cb2a5a698d39752263b076f2d4b Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Tue, 20 Aug 2024 23:50:55 +0200 +Subject: [PATCH] Fix numpy.fix output type + +This one changed with recent numpy upgrade, see +https://github.com/numpy/numpy/pull/26766 +--- + pythran/pythonic/include/numpy/fix.hpp | 17 ++++++++++++++--- + pythran/pythonic/numpy/fix.hpp | 6 +++--- + pythran/tests/test_numpy_func0.py | 5 +++++ + 3 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/pythran/pythonic/include/numpy/fix.hpp b/pythran/pythonic/include/numpy/fix.hpp +index 2708930d6c..e4a85a5049 100644 +--- a/pythran/pythonic/include/numpy/fix.hpp ++++ b/pythran/pythonic/include/numpy/fix.hpp +@@ -1,18 +1,29 @@ + #ifndef PYTHONIC_INCLUDE_NUMPY_FIX_HPP + #define PYTHONIC_INCLUDE_NUMPY_FIX_HPP + +-#include "pythonic/include/utils/functor.hpp" + #include "pythonic/include/types/ndarray.hpp" ++#include "pythonic/include/utils/functor.hpp" + #include "pythonic/include/utils/numpy_traits.hpp" + + PYTHONIC_NS_BEGIN + + namespace numpy + { ++ namespace wrapper ++ { ++ template ++ E fix(E const &e) ++ { ++ if (std::is_integral::value) ++ return e; ++ else ++ return std::trunc(e); ++ } ++ } // namespace wrapper + #define NUMPY_NARY_FUNC_NAME fix +-#define NUMPY_NARY_FUNC_SYM std::trunc ++#define NUMPY_NARY_FUNC_SYM wrapper::fix + #include "pythonic/include/types/numpy_nary_expr.hpp" +-} ++} // namespace numpy + PYTHONIC_NS_END + + #endif +diff --git a/pythran/pythonic/numpy/fix.hpp b/pythran/pythonic/numpy/fix.hpp +index 5b1b020dc2..84773b61cf 100644 +--- a/pythran/pythonic/numpy/fix.hpp ++++ b/pythran/pythonic/numpy/fix.hpp +@@ -3,8 +3,8 @@ + + #include "pythonic/include/numpy/fix.hpp" + +-#include "pythonic/utils/functor.hpp" + #include "pythonic/types/ndarray.hpp" ++#include "pythonic/utils/functor.hpp" + #include "pythonic/utils/numpy_traits.hpp" + + PYTHONIC_NS_BEGIN +@@ -13,9 +13,9 @@ namespace numpy + { + + #define NUMPY_NARY_FUNC_NAME fix +-#define NUMPY_NARY_FUNC_SYM std::trunc ++#define NUMPY_NARY_FUNC_SYM wrapper::fix + #include "pythonic/types/numpy_nary_expr.hpp" +-} ++} // namespace numpy + PYTHONIC_NS_END + + #endif +diff --git a/pythran/tests/test_numpy_func0.py b/pythran/tests/test_numpy_func0.py +index 3e11133fec..41f716d900 100644 +--- a/pythran/tests/test_numpy_func0.py ++++ b/pythran/tests/test_numpy_func0.py +@@ -1,12 +1,16 @@ + import unittest + from pythran.tests import TestEnv + import numpy ++from packaging import version + import tempfile + import os + + from pythran.typing import NDArray, List, Tuple + + ++np_version = version.parse(numpy.version.version) ++ ++ + class TestNumpyFunc0(TestEnv): + + def test_extended_sum0(self): +@@ -910,6 +914,7 @@ def test_flatnonzero1(self): + def test_fix0(self): + self.run_test("def np_fix0(x): from numpy import fix ; return fix(x)", 3.14, np_fix0=[float]) + ++ @unittest.skipIf(np_version <= version.Version("2.1"), reason="np.fix used to return float on integral input") + def test_fix1(self): + self.run_test("def np_fix1(x): from numpy import fix ; return fix(x)", 3, np_fix1=[int]) + diff --git a/python-pythran-rpmlintrc b/python-pythran-rpmlintrc new file mode 100644 index 0000000..e288f69 --- /dev/null +++ b/python-pythran-rpmlintrc @@ -0,0 +1,6 @@ +# 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 .*') +addFilter('python-leftover-require python.*-numpy-devel') +# these are "default" headers for packages +addFilter('hidden-file-or-dir .*/\.hpp') diff --git a/python-pythran.changes b/python-pythran.changes new file mode 100644 index 0000000..00f33be --- /dev/null +++ b/python-pythran.changes @@ -0,0 +1,228 @@ +------------------------------------------------------------------- +Sun Sep 1 13:28:40 UTC 2024 - Dirk Müller + +- Add patch numpy-2.1-support.patch: + * Fix test suite failure with numpy 2.1 +- prepare for python 3.13 + +------------------------------------------------------------------- +Wed Jul 31 04:32:03 UTC 2024 - Steve Kowalik + +- Add patch support-gast-0.6.patch: + * Support gast 0.6.0 changes, change Requires appropriately. + +------------------------------------------------------------------- +Sun Jun 30 20:49:58 UTC 2024 - Dirk Müller + +- limit to gast < 0.6.0 + +------------------------------------------------------------------- +Thu Jun 6 20:22:44 UTC 2024 - Dirk Müller + +- update to 0.16.1: + * Fix massive memory leakage in all ndarray + +------------------------------------------------------------------- +Sat May 25 10:35:26 UTC 2024 - Ben Greiner + +- Update to 0.16.0 + * Support numpy.vectorize, numpy.argsort's kind keyword, + real/imag on numpy_iexpr + * Add missing omp.set_num_thread descriptor + * Provide --trace-allocations switch + * Support empty PYTHRANRC for reproducible builds + * Improve compilation time + * Support ufunc creation through #pythran export ufunc + func_name(arg_types...) + * Fix memory leak when returing numpy_gexpr to Python + * Numpy 2.x support + * Upgrade xsimd to 13.0.0 + * Improve detection of non-overlapping memory area during gexpr + assignment + * Improve python 3.12 support (distutils removal) + * Support imatmul + * Only link blas when needed + +------------------------------------------------------------------- +Thu Apr 25 09:21:21 UTC 2024 - Ben Greiner + +- Refactor the multibuild test flavor logic +- Accomodate some 15.x intricacies for the failing tests: + * use netlib lapack/blas instead of openblas + +------------------------------------------------------------------- +Fri Feb 23 12:24:06 UTC 2024 - Dominique Leuenberger + +- Use newly supported shrink{} on OBS to exclude python flavors + will all python versions skipped. + +------------------------------------------------------------------- +Sat Feb 17 19:56:24 UTC 2024 - Ben Greiner + +- Yet another fix of the python39 test skip + +------------------------------------------------------------------- +Wed Feb 7 13:53:21 UTC 2024 - Ben Greiner + +- Fix python312 tests: Force linking to openblas with custom + pythranrc +- Remove test skips no longer needed +- Make test flavors future proof: Don't fail on empty buildset +- Skip python39 for all test flavors: The test-py39 multibuild has + already been removed but it is still in the build set, so don't + test it in the other multibuilds. +- Debundle xsimd + +------------------------------------------------------------------- +Tue Feb 6 11:05:29 UTC 2024 - Dirk Müller + +- update to 0.15.0: + * Use pyproject.toml to store setup and build configuration + * Upgrade xsimd to a48ab430d4b84ecd5449180ee1c6d2eed67c4191 + * Improve detection of non-overlapping memory area during gexpr + assignment + * Support python 3.12 + * Support list.clear + * Improve detection of methods uses as functions + +------------------------------------------------------------------- +Tue Feb 6 09:05:01 UTC 2024 - Dirk Müller + +- drop python39 from testing, add python312 + +------------------------------------------------------------------- +Wed Nov 29 04:27:01 UTC 2023 - Steve Kowalik + +- Prepare for Python 3.12, by skipping it for the other test flavors, and + adding one for it. + +------------------------------------------------------------------- +Tue Nov 21 06:35:39 UTC 2023 - Steve Kowalik + +- Update to 0.14.0: + * Numpy compatibility - update signatures, complex number handling, long + double support + * Lazyly import top-level modules and submodules + * Improve array indexing by an array + * Require at least clang 7 or gcc 8 + * Make pythran compilation reproducible + * Support np.roll with multiple axis + * Support numpy.ndarray.view + * Improve list resizing speed + * Fix bug when filtering an empty sequence +- Drop patches, now included upstream: + * numpy-longdouble.patch + * numpy-complex.patch +- Switch to pyproject macros. + +------------------------------------------------------------------- +Tue Aug 8 16:00:58 UTC 2023 - ecsos + +- Fix build error in Leap, because it must not be two "Patch:" lines. + +------------------------------------------------------------------- +Thu Jul 27 10:10:55 UTC 2023 - Markéta Machová + +- Add upstream numpy-longdouble.patch and numpy-complex.patch to support new numpy + +------------------------------------------------------------------- +Sat Jun 10 17:53:22 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Mon May 15 15:19:41 UTC 2023 - Dirk Müller + +- 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 + +- 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 + +- 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 + +- 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 + +- 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 + +- 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 + +- 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 + +- Add gcc12-fixes.patch in order to fix GCC 12 building issues. + +------------------------------------------------------------------- +Fri Jan 28 18:47:52 UTC 2022 - Ben Greiner + +- 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 + +- 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 diff --git a/python-pythran.spec b/python-pythran.spec new file mode 100644 index 0000000..2b440f1 --- /dev/null +++ b/python-pythran.spec @@ -0,0 +1,161 @@ +# +# spec file for package python-pythran +# +# Copyright (c) 2024 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} +%{?sle15_python_module_pythons} + +%if "%{flavor}" == "" +%define psuffix %{nil} +%bcond_with test +%else +%define psuffix -%{flavor} +%bcond_without test +%if "%{flavor}" != "test-py310" +%define skip_python310 1 +%endif +%if "%{flavor}" != "test-py311" +%define skip_python311 1 +%endif +%if "%{flavor}" != "test-py312" +%define skip_python312 1 +%endif +%if "%{flavor}" != "test-py313" +%define skip_python313 1 +%endif +# Skip empty buildsets, last one is for sle15_python_module_pythons +%if "%{shrink:%{pythons}}" == "" || ("%pythons" == "python311" && 0%{?skip_python311}) +ExclusiveArch: donotbuild +%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version} +%else +ExclusiveArch: x86_64 +%endif +%endif + +Name: python-pythran%{psuffix} +Version: 0.16.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 from the 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 gh#serge-sans-paille/pythran#840a0e706ec39963aec6bcd1f118bf33177c20b4 +Patch0: support-gast-0.6.patch +Patch1: https://github.com/serge-sans-paille/pythran/pull/2231/commits/9261d30aa9618cb2a5a698d39752263b076f2d4b.patch#/numpy-2.1-support.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-beniget >= 0.4.0 +Requires: python-numpy < 2 +Requires: python-ply >= 3.4 +Requires: python-setuptools +Requires: (python-gast >= 0.6.0 with python-gast < 0.7.0) +Requires(post): update-alternatives +Requires(postun): update-alternatives +# SECTION This is a package that compiles code, the runtime requires devel packages +Requires: boost-devel +Requires: gcc-c++ +Requires: python-devel +Requires: python-numpy-devel +Requires: xsimd-devel >= 13.0.0 +# /SECTION +%if %{with test} +BuildRequires: %{python_module ipython} +BuildRequires: %{python_module packaging} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest-xdist} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module pythran = %{version}} +BuildRequires: %{python_module wheel} +%if 0%{?suse_version} > 1500 +BuildRequires: openblas-devel +%else +BuildRequires: cblas-devel +BuildRequires: lapack-devel +%endif +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 embedded VIM swap files +find -type f -name "*.swp" -delete + +# Remove bundled header libs and use the ones from system +rm -r pythran/boost pythran/xsimd + +%build +%if !%{with test} +%pyproject_wheel +%endif + +%install +%if !%{with test} +%pyproject_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}" +%if 0%{?suse_version} > 1500 +# 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 < +Date: Sat, 29 Jun 2024 19:13:02 +0200 +Subject: [PATCH] Bump gast requirement to 0.6.0 + +This mostly helps for harmonious behavior wrt. gast.dump +--- + docs/TUTORIAL.rst | 8 ++++---- + pythran/utils.py | 2 +- + requirements.txt | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/docs/TUTORIAL.rst b/docs/TUTORIAL.rst +index 09f6902f9..7692547eb 100644 +--- a/docs/TUTORIAL.rst ++++ b/docs/TUTORIAL.rst +@@ -20,7 +20,7 @@ Python ships a standard module, ``ast`` to turn Python code into an AST. For ins + >>> code = "a=1" + >>> tree = ast.parse(code) # turn the code into an AST + >>> print(ast.dump(tree)) # view it as a string +- Module(body=[Assign(targets=[Name(id='a', ctx=Store(), annotation=None, type_comment=None)], value=Constant(value=1, kind=None), type_comment=None)], type_ignores=[]) ++ Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Constant(value=1, kind=None))]) + + Deciphering the above line, one learns that the single assignment is parsed as + a module containing a single statement, which is an assignment to a single +@@ -33,7 +33,7 @@ Eventually, one needs to parse more complex codes, and things get a bit more cry + ... return n if n< 2 else fib(n-1) + fib(n-2)""" + >>> tree = ast.parse(fib_src) + >>> print(ast.dump(tree)) +- Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param(), annotation=None, type_comment=None)], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load(), annotation=None, type_comment=None), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=1, kind=None))], keywords=[]), op=Add(), right=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=2, kind=None))], keywords=[]))))], decorator_list=[], returns=None, type_comment=None)], type_ignores=[]) ++ Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param())]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load()), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load()), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=1, kind=None))]), op=Add(), right=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=2, kind=None))]))))])]) + + The idea remains the same. The whole Python syntax is described in + http://docs.python.org/2/library/ast.html and is worth a glance, otherwise +@@ -199,7 +199,7 @@ constant expressions. In the previous code, there is only two constant + + >>> ce = pm.gather(analyses.ConstantExpressions, tree) + >>> sorted(map(ast.dump, ce)) +- ["Attribute(value=Name(id='math', ctx=Load(), annotation=None, type_comment=None), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)'] ++ ["Attribute(value=Name(id='math', ctx=Load()), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)'] + + One of the most critical analyse of Pythran is the points-to analysis. There + are two flavors of this analyse, one that computes an over-set of the aliased +@@ -210,7 +210,7 @@ variable, and one that computes an under set. ``Aliases`` computes an over-set:: + >>> al = pm.gather(analyses.Aliases, tree) + >>> returned = tree.body[-1].body[-1].value + >>> print(ast.dump(returned)) +- Name(id='b', ctx=Load(), annotation=None, type_comment=None) ++ Name(id='b', ctx=Load()) + >>> sorted(a.id for a in al[returned]) + ['c', 'd'] + +diff --git a/pythran/utils.py b/pythran/utils.py +index 2d7a67327..55a7e8ad6 100644 +--- a/pythran/utils.py ++++ b/pythran/utils.py +@@ -106,7 +106,7 @@ def get_variable(assignable): + ... slice=ast.Name('j', ast.Load(), None, None), + ... ctx=ast.Load()) + >>> ast.dump(get_variable(ref)) +- "Name(id='a', ctx=Load(), annotation=None, type_comment=None)" ++ "Name(id='a', ctx=Load())" + """ + msg = "Only name and subscript can be assigned." + assert isinstance(assignable, (ast.Name, ast.Subscript)), msg +diff --git a/requirements.txt b/requirements.txt +index fd6a738e5..c7a25c52a 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,5 +1,5 @@ + ply>=3.4 + setuptools +-gast~=0.5.0 ++gast~=0.6.0 + numpy + beniget~=0.4.0 From c6c155c7658d66d0b481b550849e1cf2b2f10e470388545ae7dc13c0168ec2b7 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 1 Sep 2024 13:43:52 +0000 Subject: [PATCH 2/3] OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pythran?expand=0&rev=51 --- python-pythran.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-pythran.spec b/python-pythran.spec index 2b440f1..dece249 100644 --- a/python-pythran.spec +++ b/python-pythran.spec @@ -64,7 +64,7 @@ BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-beniget >= 0.4.0 -Requires: python-numpy < 2 +Requires: python-numpy Requires: python-ply >= 3.4 Requires: python-setuptools Requires: (python-gast >= 0.6.0 with python-gast < 0.7.0) From b256864458cd4e9eeacf0d5f66d7da0327b77b8f406b126d7f90f639469cf08b Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 1 Sep 2024 16:48:59 +0000 Subject: [PATCH 3/3] - Add patch numpy-2.1-support.patch, numpy-2.1-interval.patch: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pythran?expand=0&rev=52 --- numpy-2.1-interval.patch | 33 +++++++++++++++++++++++++++++++++ python-pythran.changes | 2 +- python-pythran.spec | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 numpy-2.1-interval.patch diff --git a/numpy-2.1-interval.patch b/numpy-2.1-interval.patch new file mode 100644 index 0000000..54b9062 --- /dev/null +++ b/numpy-2.1-interval.patch @@ -0,0 +1,33 @@ +From 6b61e8a6b3dddab13b88e51309cbdf2f28247960 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 22 Aug 2024 08:20:25 +0200 +Subject: [PATCH] Fix docstring and implementation of Interval.power + +This makes the code more resilient to future numpy changes. +--- + pythran/interval.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/pythran/interval.py b/pythran/interval.py +index 4e5dff8fd..b8ef42e69 100644 +--- a/pythran/interval.py ++++ b/pythran/interval.py +@@ -196,13 +196,15 @@ def __pow__(range1, range2): + >>> Interval(1, 5) ** Interval(-5, -4) + Interval(low=1.0, high=1.0) + >>> Interval(-1, 5) ** Interval(-5, 3) +- Interval(low=-1.0, high=125.0) ++ Interval(low=-1.0, high=125) + >>> Interval(1, 5) ** Interval(3, 8) +- Interval(low=1.0, high=390625.0) ++ Interval(low=1, high=390625) + """ + res = [v1 ** v2 for v1, v2 in + itertools.product(range1.bounds(), range2.bounds())] +- return Interval(numpy.ceil(min(res)), numpy.floor(max(res))) ++ minres, maxres = min(res), max(res) ++ return Interval(type(minres)(numpy.ceil(minres)), ++ type(maxres)(numpy.floor(maxres))) + + def __lshift__(range1, range2): + """ diff --git a/python-pythran.changes b/python-pythran.changes index 00f33be..76ea3f9 100644 --- a/python-pythran.changes +++ b/python-pythran.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Sun Sep 1 13:28:40 UTC 2024 - Dirk Müller -- Add patch numpy-2.1-support.patch: +- Add patch numpy-2.1-support.patch, numpy-2.1-interval.patch: * Fix test suite failure with numpy 2.1 - prepare for python 3.13 diff --git a/python-pythran.spec b/python-pythran.spec index dece249..95fac3f 100644 --- a/python-pythran.spec +++ b/python-pythran.spec @@ -58,6 +58,7 @@ Source99: python-pythran-rpmlintrc # PATCH-FIX-UPSTREAM gh#serge-sans-paille/pythran#840a0e706ec39963aec6bcd1f118bf33177c20b4 Patch0: support-gast-0.6.patch Patch1: https://github.com/serge-sans-paille/pythran/pull/2231/commits/9261d30aa9618cb2a5a698d39752263b076f2d4b.patch#/numpy-2.1-support.patch +Patch2: https://github.com/serge-sans-paille/pythran/commit/6b61e8a6b3dddab13b88e51309cbdf2f28247960.patch#/numpy-2.1-interval.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel}