commit:     d276b232bbefd7de4f3bba2c8db624e632f90fa3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 17 18:45:17 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Feb 17 19:03:07 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d276b232

dev-python/pybind11: Bump to 2.9.1

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pybind11/Manifest                       |   1 +
 .../pybind11/files/pybind11-2.9.1-numpy-1.22.patch | 173 +++++++++++++++++++++
 dev-python/pybind11/pybind11-2.9.1.ebuild          |  57 +++++++
 3 files changed, 231 insertions(+)

diff --git a/dev-python/pybind11/Manifest b/dev-python/pybind11/Manifest
index 552d3e34ffb8..042de689a969 100644
--- a/dev-python/pybind11/Manifest
+++ b/dev-python/pybind11/Manifest
@@ -1 +1,2 @@
 DIST pybind11-2.9.0.tar.gz 698784 BLAKE2B 
bfbe173d580131e445d759bd9b1a8929ceb9fc357a1ed8873aa8024fb9226a37bb97293dc0189a67ae61a232f3790ca6f635a30d0a0401c867cde98f1010438c
 SHA512 
87184c9e09e1340f2d34786a66560fe77684a3629b517f78321073a1f0dfdb766365d3698dcf6f08e5141b1f4da50ec917e61b36538e5a1ec9fd1b68f29cd396
+DIST pybind11-2.9.1.tar.gz 703882 BLAKE2B 
cc162332b637f81ea5d3098a2e9882f16a9c889e83e6ccd36d2a2da2f90361d8d188abd559f2313b45ff1de7d9ee56ee198c1193b47829d1fdf6d8871ce35b0c
 SHA512 
1f268cc6df1f572658bfc3e60f7f010bec9b9444d6a6d6c95f7b26f7b4b7dd42846e65ae5a611c01c0341335fdfa84b01272b5c1b2cc11a418f64fecabfa0588

diff --git a/dev-python/pybind11/files/pybind11-2.9.1-numpy-1.22.patch 
b/dev-python/pybind11/files/pybind11-2.9.1-numpy-1.22.patch
new file mode 100644
index 000000000000..c7f16fb53364
--- /dev/null
+++ b/dev-python/pybind11/files/pybind11-2.9.1-numpy-1.22.patch
@@ -0,0 +1,173 @@
+From 116f8c7db5a11d0e1e7830de3f2bbf3e5ed1316c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Thu, 3 Feb 2022 17:41:45 +0100
+Subject: [PATCH 1/2] test: Strip whitespace when comparing numpy dtypes for
+ 1.22 compat
+
+Strip whitespace when comparing numpy dtype str() in order to preserve
+test compatibility with both numpy 1.22 and older versions whose output
+differ by whitespace.
+
+Fixes #3680
+---
+ tests/test_numpy_dtypes.py | 44 +++++++++++++++++++-------------------
+ 1 file changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/tests/test_numpy_dtypes.py b/tests/test_numpy_dtypes.py
+index 06e578329e..43480334aa 100644
+--- a/tests/test_numpy_dtypes.py
++++ b/tests/test_numpy_dtypes.py
+@@ -32,8 +32,8 @@ def dt_fmt():
+     e = "<" if byteorder == "little" else ">"
+     return (
+         "{{'names':['bool_','uint_','float_','ldbl_'],"
+-        " 'formats':['?','" + e + "u4','" + e + "f4','" + e + "f{}'],"
+-        " 'offsets':[0,4,8,{}], 'itemsize':{}}}"
++        "'formats':['?','" + e + "u4','" + e + "f4','" + e + "f{}'],"
++        "'offsets':[0,4,8,{}],'itemsize':{}}}"
+     )
+ 
+ 
+@@ -46,7 +46,7 @@ def simple_dtype_fmt():
+ def packed_dtype_fmt():
+     from sys import byteorder
+ 
+-    return "[('bool_', '?'), ('uint_', '{e}u4'), ('float_', '{e}f4'), 
('ldbl_', '{e}f{}')]".format(
++    return 
"[('bool_','?'),('uint_','{e}u4'),('float_','{e}f4'),('ldbl_','{e}f{}')]".format(
+         np.dtype("longdouble").itemsize, e="<" if byteorder == "little" else 
">"
+     )
+ 
+@@ -77,7 +77,7 @@ def partial_nested_fmt():
+     partial_size = partial_ld_off + ld.itemsize
+     partial_end_padding = partial_size % np.dtype("uint64").alignment
+     partial_nested_size = partial_nested_off * 2 + partial_size + 
partial_end_padding
+-    return "{{'names':['a'], 'formats':[{}], 'offsets':[{}], 
'itemsize':{}}}".format(
++    return 
"{{'names':['a'],'formats':[{}],'offsets':[{}],'itemsize':{}}}".format(
+         partial_dtype_fmt(), partial_nested_off, partial_nested_size
+     )
+ 
+@@ -123,25 +123,25 @@ def test_dtype(simple_dtype):
+ 
+     e = "<" if byteorder == "little" else ">"
+ 
+-    assert m.print_dtypes() == [
++    assert [x.replace(' ', '') for x in m.print_dtypes()] == [
+         simple_dtype_fmt(),
+         packed_dtype_fmt(),
+-        "[('a', {}), ('b', {})]".format(simple_dtype_fmt(), 
packed_dtype_fmt()),
++        "[('a',{}),('b',{})]".format(simple_dtype_fmt(), packed_dtype_fmt()),
+         partial_dtype_fmt(),
+         partial_nested_fmt(),
+-        "[('a', 'S3'), ('b', 'S3')]",
++        "[('a','S3'),('b','S3')]",
+         (
+-            "{{'names':['a','b','c','d'], "
+-            + "'formats':[('S4', (3,)),('"
++            "{{'names':['a','b','c','d'],"
++            + "'formats':[('S4',(3,)),('"
+             + e
+-            + "i4', (2,)),('u1', (3,)),('"
++            + "i4',(2,)),('u1',(3,)),('"
+             + e
+-            + "f4', (4, 2))], "
+-            + "'offsets':[0,12,20,24], 'itemsize':56}}"
++            + "f4',(4,2))],"
++            + "'offsets':[0,12,20,24],'itemsize':56}}"
+         ).format(e=e),
+-        "[('e1', '" + e + "i8'), ('e2', 'u1')]",
+-        "[('x', 'i1'), ('y', '" + e + "u8')]",
+-        "[('cflt', '" + e + "c8'), ('cdbl', '" + e + "c16')]",
++        "[('e1','" + e + "i8'),('e2','u1')]",
++        "[('x','i1'),('y','" + e + "u8')]",
++        "[('cflt','" + e + "c8'),('cdbl','" + e + "c16')]",
+     ]
+ 
+     d1 = np.dtype(
+@@ -238,7 +238,7 @@ def test_recarray(simple_dtype, packed_dtype):
+     ]
+ 
+     arr = m.create_rec_partial(3)
+-    assert str(arr.dtype) == partial_dtype_fmt()
++    assert str(arr.dtype).replace(' ', '') == partial_dtype_fmt()
+     partial_dtype = arr.dtype
+     assert "" not in arr.dtype.fields
+     assert partial_dtype.itemsize > simple_dtype.itemsize
+@@ -246,7 +246,7 @@ def test_recarray(simple_dtype, packed_dtype):
+     assert_equal(arr, elements, packed_dtype)
+ 
+     arr = m.create_rec_partial_nested(3)
+-    assert str(arr.dtype) == partial_nested_fmt()
++    assert str(arr.dtype).replace(' ', '') == partial_nested_fmt()
+     assert "" not in arr.dtype.fields
+     assert "" not in arr.dtype.fields["a"][0].fields
+     assert arr.dtype.itemsize > partial_dtype.itemsize
+@@ -285,12 +285,12 @@ def test_array_array():
+     e = "<" if byteorder == "little" else ">"
+ 
+     arr = m.create_array_array(3)
+-    assert str(arr.dtype) == (
+-        "{{'names':['a','b','c','d'], "
+-        + "'formats':[('S4', (3,)),('"
++    assert str(arr.dtype).replace(' ', '') == (
++        "{{'names':['a','b','c','d'],"
++        + "'formats':[('S4',(3,)),('"
+         + e
+-        + "i4', (2,)),('u1', (3,)),('{e}f4', (4, 2))], "
+-        + "'offsets':[0,12,20,24], 'itemsize':56}}"
++        + "i4',(2,)),('u1',(3,)),('{e}f4',(4,2))],"
++        + "'offsets':[0,12,20,24],'itemsize':56}}"
+     ).format(e=e)
+     assert m.print_array_array(arr) == [
+         "a={{A,B,C,D},{K,L,M,N},{U,V,W,X}},b={0,1},"
+
+From 2c4a1e98e56a257fbc8dd0e8644181acd6d7e5a7 Mon Sep 17 00:00:00 2001
+From: "pre-commit-ci[bot]"
+ <66853113+pre-commit-ci[bot]@users.noreply.github.com>
+Date: Thu, 3 Feb 2022 16:45:33 +0000
+Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks
+
+for more information, see https://pre-commit.ci
+---
+ tests/test_numpy_dtypes.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tests/test_numpy_dtypes.py b/tests/test_numpy_dtypes.py
+index 43480334aa..0098eccb87 100644
+--- a/tests/test_numpy_dtypes.py
++++ b/tests/test_numpy_dtypes.py
+@@ -123,7 +123,7 @@ def test_dtype(simple_dtype):
+ 
+     e = "<" if byteorder == "little" else ">"
+ 
+-    assert [x.replace(' ', '') for x in m.print_dtypes()] == [
++    assert [x.replace(" ", "") for x in m.print_dtypes()] == [
+         simple_dtype_fmt(),
+         packed_dtype_fmt(),
+         "[('a',{}),('b',{})]".format(simple_dtype_fmt(), packed_dtype_fmt()),
+@@ -238,7 +238,7 @@ def test_recarray(simple_dtype, packed_dtype):
+     ]
+ 
+     arr = m.create_rec_partial(3)
+-    assert str(arr.dtype).replace(' ', '') == partial_dtype_fmt()
++    assert str(arr.dtype).replace(" ", "") == partial_dtype_fmt()
+     partial_dtype = arr.dtype
+     assert "" not in arr.dtype.fields
+     assert partial_dtype.itemsize > simple_dtype.itemsize
+@@ -246,7 +246,7 @@ def test_recarray(simple_dtype, packed_dtype):
+     assert_equal(arr, elements, packed_dtype)
+ 
+     arr = m.create_rec_partial_nested(3)
+-    assert str(arr.dtype).replace(' ', '') == partial_nested_fmt()
++    assert str(arr.dtype).replace(" ", "") == partial_nested_fmt()
+     assert "" not in arr.dtype.fields
+     assert "" not in arr.dtype.fields["a"][0].fields
+     assert arr.dtype.itemsize > partial_dtype.itemsize
+@@ -285,7 +285,7 @@ def test_array_array():
+     e = "<" if byteorder == "little" else ">"
+ 
+     arr = m.create_array_array(3)
+-    assert str(arr.dtype).replace(' ', '') == (
++    assert str(arr.dtype).replace(" ", "") == (
+         "{{'names':['a','b','c','d'],"
+         + "'formats':[('S4',(3,)),('"
+         + e

diff --git a/dev-python/pybind11/pybind11-2.9.1.ebuild 
b/dev-python/pybind11/pybind11-2.9.1.ebuild
new file mode 100644
index 000000000000..f93c74dafdd7
--- /dev/null
+++ b/dev-python/pybind11/pybind11-2.9.1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit cmake distutils-r1
+
+DESCRIPTION="AST-based Python refactoring library"
+HOMEPAGE="https://pybind11.readthedocs.io/en/stable/";
+SRC_URI="https://github.com/pybind/pybind11/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+
+RDEPEND="
+       dev-cpp/eigen:3
+"
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+       export PYBIND11_USE_CMAKE=1
+       cmake_src_prepare
+
+       local PATCHES=(
+               # https://github.com/pybind/pybind11/pull/3682
+               "${FILESDIR}"/${P}-numpy-1.22.patch
+       )
+       distutils-r1_python_prepare_all
+}
+
+python_configure() {
+       local mycmakeargs=(
+               # disable forced lto
+               -DPYBIND11_LTO_CXX_FLAGS=
+               -DPYBIND11_INSTALL=ON
+               -DPYBIND11_TEST=$(usex test)
+       )
+       cmake_src_configure
+}
+
+python_compile() {
+       distutils-r1_python_compile
+       # Compilation only does anything for tests
+       use test && cmake_src_compile
+}
+
+python_test() {
+       cmake_build check
+}
+
+python_install() {
+       distutils-r1_python_install
+       cmake_src_install
+}

Reply via email to