commit:     f32add667f864933c413bdf414322c0e2726c8f4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 17 11:22:37 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 17 11:22:37 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f32add66

dev-python/meshio: Fix numpy-2 and enable py3.13

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

 dev-python/meshio/files/meshio-5.3.5-numpy-2.patch | 52 ++++++++++++++++++++++
 ...{meshio-5.3.5.ebuild => meshio-5.3.5-r1.ebuild} |  9 +++-
 2 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/dev-python/meshio/files/meshio-5.3.5-numpy-2.patch 
b/dev-python/meshio/files/meshio-5.3.5-numpy-2.patch
new file mode 100644
index 000000000000..dc7662c3042f
--- /dev/null
+++ b/dev-python/meshio/files/meshio-5.3.5-numpy-2.patch
@@ -0,0 +1,52 @@
+diff --git a/src/meshio/dolfin/_dolfin.py b/src/meshio/dolfin/_dolfin.py
+index e43dbd54..0a2c1eaa 100644
+--- a/src/meshio/dolfin/_dolfin.py
++++ b/src/meshio/dolfin/_dolfin.py
+@@ -207,7 +207,7 @@ def _write_cell_data(filename, dim, cell_data):
+     )
+ 
+     for k, value in enumerate(cell_data):
+-        ET.SubElement(mesh_function, "entity", index=str(k), 
value=repr(value))
++        ET.SubElement(mesh_function, "entity", index=str(k), value=str(value))
+ 
+     tree = ET.ElementTree(dolfin)
+     tree.write(filename)
+diff --git a/src/meshio/gmsh/common.py b/src/meshio/gmsh/common.py
+index 717e82ee..adcae241 100644
+--- a/src/meshio/gmsh/common.py
++++ b/src/meshio/gmsh/common.py
+@@ -273,7 +273,7 @@ def _write_data(fh, tag, name, data, binary):
+         tmp.tofile(fh)
+         fh.write(b"\n")
+     else:
+-        fmt = " ".join(["{}"] + ["{!r}"] * num_components) + "\n"
++        fmt = " ".join(["{}"] * (num_components + 1)) + "\n"
+         # TODO unify
+         if num_components == 1:
+             for k, x in enumerate(data):
+diff --git a/src/meshio/mdpa/_mdpa.py b/src/meshio/mdpa/_mdpa.py
+index afa39eca..e49358af 100644
+--- a/src/meshio/mdpa/_mdpa.py
++++ b/src/meshio/mdpa/_mdpa.py
+@@ -418,7 +418,7 @@ def _write_data(fh, tag, name, data, binary):
+         data = data[:, 0]
+ 
+     # Actually write the data
+-    fmt = " ".join(["{}"] + ["{!r}"] * num_components) + "\n"
++    fmt = " ".join(["{}"] * (num_components + 1)) + "\n"
+     # TODO unify
+     if num_components == 1:
+         for k, x in enumerate(data):
+diff --git a/src/meshio/ugrid/_ugrid.py b/src/meshio/ugrid/_ugrid.py
+index 6fa57c09..f1d5818d 100644
+--- a/src/meshio/ugrid/_ugrid.py
++++ b/src/meshio/ugrid/_ugrid.py
+@@ -145,7 +145,7 @@ def read_buffer(f, file_type):
+ def _write_section(f, file_type, array, dtype):
+     if file_type["type"] == "ascii":
+         ncols = array.shape[1]
+-        fmt = " ".join(["%r"] * ncols)
++        fmt = " ".join(["%s"] * ncols)
+         np.savetxt(f, array, fmt=fmt)
+     else:
+         array.astype(dtype).tofile(f)

diff --git a/dev-python/meshio/meshio-5.3.5.ebuild 
b/dev-python/meshio/meshio-5.3.5-r1.ebuild
similarity index 78%
rename from dev-python/meshio/meshio-5.3.5.ebuild
rename to dev-python/meshio/meshio-5.3.5-r1.ebuild
index 8bb43bf2183b..5a1ea9faf150 100644
--- a/dev-python/meshio/meshio-5.3.5.ebuild
+++ b/dev-python/meshio/meshio-5.3.5-r1.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
 
 inherit distutils-r1 pypi
 
@@ -30,3 +30,8 @@ BDEPEND="
 "
 
 distutils_enable_tests pytest
+
+PATCHES=(
+       # https://github.com/nschloe/meshio/pull/1513
+       "${FILESDIR}/${P}-numpy-2.patch"
+)

Reply via email to