Accepting request 1009791 from devel:languages:python:numeric

OBS-URL: https://build.opensuse.org/request/show/1009791
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pythran?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2022-10-22 12:11:56 +00:00 committed by Git OBS Bridge
commit 579bd59446
6 changed files with 20 additions and 318 deletions

View File

@ -1,148 +0,0 @@
The patch contains 2 upstream changes needed for building with GCC 12.
From e06d2c95bf88f84f9e570eeece5c3408fd8f24fe Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Mon, 14 Mar 2022 16:10:12 +0100
Subject: [PATCH] Move mult operator for str to the appropriate ns
---
pythran/pythonic/include/types/str.hpp | 11 +++--
pythran/pythonic/types/str.hpp | 64 +++++++++++++-------------
2 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
index 329de1c1d..5aa526692 100644
--- a/pythran/pythonic/include/types/str.hpp
+++ b/pythran/pythonic/include/types/str.hpp
@@ -318,6 +318,12 @@ namespace types
std::ostream &operator<<(std::ostream &os, chr const &s);
std::ostream &operator<<(std::ostream &os, str const &s);
+
+ str operator*(str const &s, long n);
+ str operator*(long t, str const &s);
+ str operator*(chr const &s, long n);
+ str operator*(long t, chr const &s);
+
}
namespace operator_
@@ -356,11 +362,6 @@ struct assignable<char const[N]> {
};
PYTHONIC_NS_END
-pythonic::types::str operator*(pythonic::types::str const &s, long n);
-pythonic::types::str operator*(long t, pythonic::types::str const &s);
-pythonic::types::str operator*(pythonic::types::chr const &s, long n);
-pythonic::types::str operator*(long t, pythonic::types::chr const &s);
-
namespace std
{
template <>
diff --git a/pythran/pythonic/types/str.hpp b/pythran/pythonic/types/str.hpp
index 6e9bc241f..ee540a73b 100644
--- a/pythran/pythonic/types/str.hpp
+++ b/pythran/pythonic/types/str.hpp
@@ -655,6 +655,38 @@ namespace types
{
return os << s.c_str();
}
+
+ str operator*(str const &s, long n)
+ {
+ if (n <= 0)
+ return str();
+ str other;
+ other.resize(s.size() * n);
+ auto where = other.chars().begin();
+ for (long i = 0; i < n; i++, where += s.size())
+ std::copy(s.chars().begin(), s.chars().end(), where);
+ return other;
+ }
+
+ str operator*(long t, str const &s)
+ {
+ return s * t;
+ }
+
+ str operator*(chr const &s, long n)
+ {
+ if (n <= 0)
+ return str();
+ str other;
+ other.resize(n);
+ std::fill(other.chars().begin(), other.chars().end(), s.c);
+ return other;
+ }
+
+ str operator*(long t, chr const &c)
+ {
+ return c * t;
+ }
}
namespace operator_
@@ -686,38 +718,6 @@ namespace operator_
}
PYTHONIC_NS_END
-pythonic::types::str operator*(pythonic::types::str const &s, long n)
-{
- if (n <= 0)
- return pythonic::types::str();
- pythonic::types::str other;
- other.resize(s.size() * n);
- auto where = other.chars().begin();
- for (long i = 0; i < n; i++, where += s.size())
- std::copy(s.chars().begin(), s.chars().end(), where);
- return other;
-}
-
-pythonic::types::str operator*(long t, pythonic::types::str const &s)
-{
- return s * t;
-}
-
-pythonic::types::str operator*(pythonic::types::chr const &s, long n)
-{
- if (n <= 0)
- return pythonic::types::str();
- pythonic::types::str other;
- other.resize(n);
- std::fill(other.chars().begin(), other.chars().end(), s.c);
- return other;
-}
-
-pythonic::types::str operator*(long t, pythonic::types::chr const &c)
-{
- return c * t;
-}
-
namespace std
{
From 343cb724d857fe8adcef071ab088df2c02ba0d4c Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Mon, 14 Mar 2022 10:11:00 +0000
Subject: [PATCH] Add default constructor to string_iterator
A type must be default constructible to meet the forward iterator requirements.
GCC 12 won't compile `std::reverse_iterator<string_iterator>` without
this change.
---
pythran/pythonic/include/types/str.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
index 329de1c1d..a0df45905 100644
--- a/pythran/pythonic/include/types/str.hpp
+++ b/pythran/pythonic/include/types/str.hpp
@@ -231,6 +231,7 @@ namespace types
struct string_iterator : std::iterator<std::random_access_iterator_tag, str,
std::ptrdiff_t, str *, str> {
std::string::const_iterator curr;
+ string_iterator() = default;
string_iterator(std::string::const_iterator iter) : curr(iter)
{
}

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
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>

View File

@ -45,7 +45,7 @@ ExclusiveArch: x86_64
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-pythran%{psuffix}
Version: 0.11.0
Version: 0.12.0
Release: 0
Summary: Ahead of Time compiler for numeric kernels
License: BSD-3-Clause
@ -53,9 +53,6 @@ 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
Patch0: gcc12-fixes.patch
# PATCH-FIX-UPSTREAM pythran-pr1984-fixdistutils.patch gh#serge-sans-paille/pythran#1984
Patch1: pythran-pr1984-fixdistutils.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e095a1e984f8f44cfdccb8dd797aec4f38d98a9026611235f55e6d5d3c300f08
size 3582011

3
pythran-0.12.0-gh.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a8f59dd0de0e50e4f8f18c901baf19270615c6c79cc987b9b2cfa740bf81edb4
size 3589256

View File

@ -1,163 +0,0 @@
From 934e31d86a6721c378598d4000c3ee39c59a154f Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Sun, 3 Apr 2022 11:22:17 +0200
Subject: [PATCH] Harden distutils tests
Use correct executable when running import tests.
Use pip install instead of setup.py install to test install.
Should fix #1981
---
pythran/tests/test_distutils.py | 53 ++++++++++++++++++---------------
1 file changed, 29 insertions(+), 24 deletions(-)
Index: pythran-0.11.0/pythran/tests/test_distutils.py
===================================================================
--- pythran-0.11.0.orig/pythran/tests/test_distutils.py
+++ pythran-0.11.0/pythran/tests/test_distutils.py
@@ -10,6 +10,8 @@ cwd = os.path.dirname(__file__)
python_version = "python{}.{}".format(sys.version_info.major,
sys.version_info.minor)
+python = sys.executable
+
def find_so(name, path):
for root, dirs, files in os.walk(path):
for filename in files:
@@ -19,33 +21,35 @@ def find_so(name, path):
class TestDistutils(unittest.TestCase):
def test_setup_build(self):
- check_call(['python', 'setup.py', 'build'],
+ check_call([python, 'setup.py', 'build'],
cwd=os.path.join(cwd, 'test_distutils'))
- check_call(['python', 'setup.py', 'install', '--prefix=demo_install'],
+ check_call([python, '-m', 'pip', 'install', '.', '--prefix=demo_install'],
cwd=os.path.join(cwd, 'test_distutils'))
base = os.path.join(cwd, 'test_distutils', 'demo_install',)
libdir = os.path.join(base, 'lib')
if not os.path.isdir(libdir):
libdir = os.path.join(base, 'lib64')
- check_call(['python', '-c', 'import demo'],
- cwd=os.path.join(libdir, python_version, 'site-packages'))
- check_call(['python', 'setup.py', 'clean'],
+
+ local_env = os.environ.copy()
+ local_env['PYTHONPATH'] = os.path.join(libdir, python_version, 'site-packages')
+ check_call([python, '-c', 'import demo'], env=local_env)
+ check_call([python, 'setup.py', 'clean'],
cwd=os.path.join(cwd, 'test_distutils'))
shutil.rmtree(os.path.join(cwd, 'test_distutils', 'demo_install'))
shutil.rmtree(os.path.join(cwd, 'test_distutils', 'build'))
def test_setup_sdist_install(self):
- check_call(['python', 'setup.py', 'sdist', "--dist-dir=sdist"],
+ check_call([python, 'setup.py', 'sdist', "--dist-dir=sdist"],
cwd=os.path.join(cwd, 'test_distutils'))
check_call(['tar', 'xzf', 'demo-1.0.tar.gz'],
cwd=os.path.join(cwd, 'test_distutils', 'sdist'))
- check_call(['python', 'setup.py', 'install', '--prefix=demo_install'],
+ check_call([python, 'setup.py', 'install', '--prefix=demo_install'],
cwd=os.path.join(cwd, 'test_distutils', 'sdist', 'demo-1.0'))
shutil.rmtree(os.path.join(cwd, 'test_distutils', 'sdist'))
def test_setup_bdist_install(self):
- check_call(['python', 'setup.py', 'bdist', "--dist-dir=bdist"],
+ check_call([python, 'setup.py', 'bdist', "--dist-dir=bdist"],
cwd=os.path.join(cwd, 'test_distutils'))
dist_path = os.path.join(cwd, 'test_distutils', 'bdist')
tgz = [f for f in os.listdir(dist_path) if f.endswith(".tar.gz")][0]
@@ -56,7 +60,7 @@ class TestDistutils(unittest.TestCase):
shutil.rmtree(dist_path)
def test_setup_wheel_install(self):
- check_call(['python', 'setup.py', 'bdist_wheel', "--dist-dir=bdist_wheel"],
+ check_call([python, 'setup.py', 'bdist_wheel', "--dist-dir=bdist_wheel"],
cwd=os.path.join(cwd, 'test_distutils_setuptools'))
dist_path = os.path.join(cwd, 'test_distutils_setuptools', 'bdist_wheel')
wheel_dir = 'wheeeeeeel'
@@ -69,33 +73,34 @@ class TestDistutils(unittest.TestCase):
def test_setup_build2(self):
- check_call(['python', 'setup.py', 'build'],
+ check_call([python, 'setup.py', 'build'],
cwd=os.path.join(cwd, 'test_distutils_packaged'))
- check_call(['python', 'setup.py', 'install', '--prefix=demo_install2'],
+ check_call([python, '-m', 'pip', 'install', '.', '--prefix=demo_install2'],
cwd=os.path.join(cwd, 'test_distutils_packaged'))
base = os.path.join(cwd, 'test_distutils_packaged', 'demo_install2',)
libdir = os.path.join(base, 'lib')
if not os.path.isdir(libdir):
libdir = os.path.join(base, 'lib64')
- check_call(['python', '-c', 'import demo2.a'],
- cwd=os.path.join(libdir, python_version, 'site-packages'))
- check_call(['python', 'setup.py', 'clean'],
+ local_env = os.environ.copy()
+ local_env['PYTHONPATH'] = os.path.join(libdir, python_version, 'site-packages')
+ check_call([python, '-c', 'import demo2.a'], env=local_env)
+ check_call([python, 'setup.py', 'clean'],
cwd=os.path.join(cwd, 'test_distutils_packaged'))
shutil.rmtree(os.path.join(cwd, 'test_distutils_packaged', 'demo_install2'))
shutil.rmtree(os.path.join(cwd, 'test_distutils_packaged', 'build'))
def test_setup_sdist_install2(self):
- check_call(['python', 'setup.py', 'sdist', "--dist-dir=sdist2"],
+ check_call([python, 'setup.py', 'sdist', "--dist-dir=sdist2"],
cwd=os.path.join(cwd, 'test_distutils_packaged'))
check_call(['tar', 'xzf', 'demo2-1.0.tar.gz'],
cwd=os.path.join(cwd, 'test_distutils_packaged', 'sdist2'))
- check_call(['python', 'setup.py', 'install', '--prefix=demo_install2'],
+ check_call([python, 'setup.py', 'install', '--prefix=demo_install2'],
cwd=os.path.join(cwd, 'test_distutils_packaged', 'sdist2', 'demo2-1.0'))
shutil.rmtree(os.path.join(cwd, 'test_distutils_packaged', 'sdist2'))
def test_setup_bdist_install2(self):
- check_call(['python', 'setup.py', 'bdist', "--dist-dir=bdist"],
+ check_call([python, 'setup.py', 'bdist', "--dist-dir=bdist"],
cwd=os.path.join(cwd, 'test_distutils_packaged'))
dist_path = os.path.join(cwd, 'test_distutils_packaged', 'bdist')
tgz = [f for f in os.listdir(dist_path) if f.endswith(".tar.gz")][0]
@@ -106,34 +111,34 @@ class TestDistutils(unittest.TestCase):
shutil.rmtree(dist_path)
def test_setup_build3(self):
- check_call(['python', 'setup.py', 'build'],
+ check_call([python, 'setup.py', 'build'],
cwd=os.path.join(cwd, 'test_distutils_numpy'))
- check_call(['python', 'setup.py', 'install', '--prefix=demo_install3'],
+ check_call([python, 'setup.py', 'install', '--prefix=demo_install3'],
cwd=os.path.join(cwd, 'test_distutils_numpy'))
base = os.path.join(cwd, 'test_distutils_numpy', 'demo_install3',)
libdir = os.path.join(base, 'lib')
if not os.path.isdir(libdir):
libdir = os.path.join(base, 'lib64')
- check_call(['python', '-c', 'import a'],
+ check_call([python, '-c', 'import a'],
cwd=os.path.join(libdir, python_version, 'site-packages',
'demo3'))
- check_call(['python', 'setup.py', 'clean'],
+ check_call([python, 'setup.py', 'clean'],
cwd=os.path.join(cwd, 'test_distutils_numpy'))
shutil.rmtree(os.path.join(cwd, 'test_distutils_numpy', 'demo_install3'))
shutil.rmtree(os.path.join(cwd, 'test_distutils_numpy', 'build'))
def test_setup_sdist_install3(self):
- check_call(['python', 'setup.py', 'sdist', "--dist-dir=sdist3"],
+ check_call([python, 'setup.py', 'sdist', "--dist-dir=sdist3"],
cwd=os.path.join(cwd, 'test_distutils_numpy'))
check_call(['tar', 'xzf', 'demo3-1.0.tar.gz'],
cwd=os.path.join(cwd, 'test_distutils_numpy', 'sdist3'))
- check_call(['python', 'setup.py', 'install', '--prefix=demo_install3'],
+ check_call([python, 'setup.py', 'install', '--prefix=demo_install3'],
cwd=os.path.join(cwd, 'test_distutils_numpy', 'sdist3', 'demo3-1.0'))
shutil.rmtree(os.path.join(cwd, 'test_distutils_numpy', 'sdist3'))
def test_setup_bdist_install3(self):
- check_call(['python', 'setup.py', 'bdist', "--dist-dir=bdist"],
+ check_call([python, 'setup.py', 'bdist', "--dist-dir=bdist"],
cwd=os.path.join(cwd, 'test_distutils_numpy'))
dist_path = os.path.join(cwd, 'test_distutils_numpy', 'bdist')
tgz = [f for f in os.listdir(dist_path) if f.endswith(".tar.gz")][0]