From 99702c372ab8cc44ce21ca62a20c3d99d1eb691abe6b3f0fe650af4a4fc2e93a Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 3 Apr 2023 06:00:13 +0000 Subject: [PATCH] - Stop skipping Python 3.6. - Add patch support-numpy-124.patch: * Support numpy >= 1.24 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-geomdl?expand=0&rev=7 --- python-geomdl.changes | 7 ++ python-geomdl.spec | 8 +-- support-numpy-124.patch | 141 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 support-numpy-124.patch diff --git a/python-geomdl.changes b/python-geomdl.changes index 45b1d56..d75e4f0 100644 --- a/python-geomdl.changes +++ b/python-geomdl.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Apr 3 05:59:40 UTC 2023 - Steve Kowalik + +- Stop skipping Python 3.6. +- Add patch support-numpy-124.patch: + * Support numpy >= 1.24 + ------------------------------------------------------------------- Sun Feb 21 18:19:09 UTC 2021 - andy great diff --git a/python-geomdl.spec b/python-geomdl.spec index cb3a4b0..ac4b6a2 100644 --- a/python-geomdl.spec +++ b/python-geomdl.spec @@ -1,7 +1,7 @@ # # spec file for package python-geomdl # -# Copyright (c) 2021 SUSE LLC +# 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 @@ -18,8 +18,6 @@ %define archivename NURBS-Python %define packagename geomdl -%define skip_python36 1 -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-geomdl Version: 5.3.1 Release: 0 @@ -27,6 +25,8 @@ Summary: Object-oriented B-Spline and NURBS evaluation library License: MIT URL: https://github.com/orbingol/NURBS-Python Source: https://github.com/orbingol/NURBS-Python/archive/v%{version}.tar.gz#/%{archivename}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#orbingol/NURBS-Python#163 +Patch0: support-numpy-124.patch BuildRequires: %{python_module matplotlib >= 2.2.3} BuildRequires: %{python_module numpy >= 1.15.4} BuildRequires: %{python_module plotly} @@ -45,7 +45,7 @@ NURBS-Python (geomdl) is a pure Python, self-contained, object-oriented B-Spline and NURBS spline library. %prep -%setup -q -n %{archivename}-%{version} +%autosetup -p1 -n %{archivename}-%{version} %build %python_build diff --git a/support-numpy-124.patch b/support-numpy-124.patch new file mode 100644 index 0000000..bdd2878 --- /dev/null +++ b/support-numpy-124.patch @@ -0,0 +1,141 @@ +From 71923eeb8e8ec8e057b253a744c89d7dfa1cf89d Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Sat, 4 Mar 2023 13:37:41 -0500 +Subject: [PATCH] Stop using deprecated/removed np.float/np.int + +See: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations +--- + geomdl/visualization/VisMPL.py | 2 +- + geomdl/visualization/VisPlotly.py | 2 +- + geomdl/visualization/VisVTK.py | 26 +++++++++++++------------- + 3 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/geomdl/visualization/VisMPL.py b/geomdl/visualization/VisMPL.py +index a23dbba7..2dba037c 100644 +--- a/geomdl/visualization/VisMPL.py ++++ b/geomdl/visualization/VisMPL.py +@@ -68,7 +68,7 @@ class VisConfig(vis.VisConfigAbstract): + + def __init__(self, **kwargs): + super(VisConfig, self).__init__(**kwargs) +- self.dtype = np.float ++ self.dtype = np.float64 + self.display_ctrlpts = kwargs.get('ctrlpts', True) + self.display_evalpts = kwargs.get('evalpts', True) + self.display_bbox = kwargs.get('bbox', False) +diff --git a/geomdl/visualization/VisPlotly.py b/geomdl/visualization/VisPlotly.py +index 8dfce642..c5073410 100644 +--- a/geomdl/visualization/VisPlotly.py ++++ b/geomdl/visualization/VisPlotly.py +@@ -58,7 +58,7 @@ class VisConfig(vis.VisConfigAbstract): + """ + def __init__(self, **kwargs): + super(VisConfig, self).__init__(**kwargs) +- self.dtype = np.float ++ self.dtype = np.float64 + # Set Plotly custom variables + self.figure_image_filename = "temp-plot.html" + self.use_renderer = kwargs.get("use_renderer", False) +diff --git a/geomdl/visualization/VisVTK.py b/geomdl/visualization/VisVTK.py +index 9d75ec99..ae44163d 100644 +--- a/geomdl/visualization/VisVTK.py ++++ b/geomdl/visualization/VisVTK.py +@@ -132,10 +132,10 @@ def render(self, **kwargs): + # Plot control points + if plot['type'] == 'ctrlpts' and self.vconf.display_ctrlpts: + # Points as spheres +- pts = np.array(plot['ptsarr'], dtype=np.float) ++ pts = np.array(plot['ptsarr'], dtype=np.float64) + # Handle 2-dimensional data + if pts.shape[1] == 2: +- pts = np.c_[pts, np.zeros(pts.shape[0], dtype=np.float)] ++ pts = np.c_[pts, np.zeros(pts.shape[0], dtype=np.float64)] + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + actor1 = vtkh.create_actor_pts(pts=vtkpts, color=vtkh.create_color(plot['color']), +@@ -148,10 +148,10 @@ def render(self, **kwargs): + + # Plot evaluated points + if plot['type'] == 'evalpts' and self.vconf.display_evalpts: +- pts = np.array(plot['ptsarr'], dtype=np.float) ++ pts = np.array(plot['ptsarr'], dtype=np.float64) + # Handle 2-dimensional data + if pts.shape[1] == 2: +- pts = np.c_[pts, np.zeros(pts.shape[0], dtype=np.float)] ++ pts = np.c_[pts, np.zeros(pts.shape[0], dtype=np.float64)] + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + actor1 = vtkh.create_actor_polygon(pts=vtkpts, color=vtkh.create_color(plot['color']), +@@ -200,14 +200,14 @@ def render(self, **kwargs): + vertices = [v.data for v in plot['ptsarr'][0]] + faces = [q.data for q in plot['ptsarr'][1]] + # Points as spheres +- pts = np.array(vertices, dtype=np.float) ++ pts = np.array(vertices, dtype=np.float64) + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + actor1 = vtkh.create_actor_pts(pts=vtkpts, color=vtkh.create_color(plot['color']), + name=plot['name'], index=plot['idx']) + vtk_actors.append(actor1) + # Quad mesh +- lines = np.array(faces, dtype=np.int) ++ lines = np.array(faces, dtype=int) + actor2 = vtkh.create_actor_mesh(pts=vtkpts, lines=lines, color=vtkh.create_color(plot['color']), + name=plot['name'], index=plot['idx'], size=self.vconf.line_width) + vtk_actors.append(actor2) +@@ -218,7 +218,7 @@ def render(self, **kwargs): + vtkpts = numpy_to_vtk(vertices, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + faces = [t.data for t in plot['ptsarr'][1]] +- tris = np.array(faces, dtype=np.int) ++ tris = np.array(faces, dtype=int) + actor1 = vtkh.create_actor_tri(pts=vtkpts, tris=tris, color=vtkh.create_color(plot['color']), + name=plot['name'], index=plot['idx']) + vtk_actors.append(actor1) +@@ -226,7 +226,7 @@ def render(self, **kwargs): + # Plot trim curves + if self.vconf.display_trims: + if plot['type'] == 'trimcurve': +- pts = np.array(plot['ptsarr'], dtype=np.float) ++ pts = np.array(plot['ptsarr'], dtype=np.float64) + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + actor1 = vtkh.create_actor_polygon(pts=vtkpts, color=vtkh.create_color(plot['color']), +@@ -269,7 +269,7 @@ def render(self, **kwargs): + # Plot control points + if plot['type'] == 'ctrlpts' and self.vconf.display_ctrlpts: + # Points as spheres +- pts = np.array(plot['ptsarr'], dtype=np.float) ++ pts = np.array(plot['ptsarr'], dtype=np.float64) + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + temp_actor = vtkh.create_actor_pts(pts=vtkpts, color=vtkh.create_color(plot['color']), +@@ -278,7 +278,7 @@ def render(self, **kwargs): + + # Plot evaluated points + if plot['type'] == 'evalpts' and self.vconf.display_evalpts: +- pts = np.array(plot['ptsarr'], dtype=np.float) ++ pts = np.array(plot['ptsarr'], dtype=np.float64) + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + temp_actor = vtkh.create_actor_pts(pts=vtkpts, color=vtkh.create_color(plot['color']), +@@ -321,7 +321,7 @@ def render(self, **kwargs): + # Plot control points + if plot['type'] == 'ctrlpts' and self.vconf.display_ctrlpts: + # Points as spheres +- pts = np.array(plot['ptsarr'], dtype=np.float) ++ pts = np.array(plot['ptsarr'], dtype=np.float64) + vtkpts = numpy_to_vtk(pts, deep=False, array_type=VTK_FLOAT) + vtkpts.SetName(plot['name']) + temp_actor = vtkh.create_actor_pts(pts=vtkpts, color=vtkh.create_color(plot['color']), +@@ -330,8 +330,8 @@ def render(self, **kwargs): + + # Plot evaluated points + if plot['type'] == 'evalpts' and self.vconf.display_evalpts: +- faces = np.array(plot['ptsarr'][1], dtype=np.float) +- filled = np.array(plot['ptsarr'][2], dtype=np.int) ++ faces = np.array(plot['ptsarr'][1], dtype=np.float64) ++ filled = np.array(plot['ptsarr'][2], dtype=int) + grid_filled = faces[filled == 1] + temp_actor = vtkh.create_actor_hexahedron(grid=grid_filled, color=vtkh.create_color(plot['color']), + name=plot['name'], index=plot['idx'])