Compare commits

4 Commits

Author SHA256 Message Date
96d39abc09 Accepting request 1241520 from devel:languages:python:numeric
- Add mayavi-pr1329-vtk9.4.patch gh#enthought/mayavi#1329
  + gh#enthought/mayavi#1330
- Drop suse-update-desktop-files

OBS-URL: https://build.opensuse.org/request/show/1241520
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mayavi?expand=0&rev=11
2025-01-31 15:04:43 +00:00
967fa72f92 - Add mayavi-pr1329-vtk9.4.patch gh#enthought/mayavi#1329
+ gh#enthought/mayavi#1330
- Drop suse-update-desktop-files

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/mayavi?expand=0&rev=23
2025-01-30 19:55:22 +00:00
96059b5442 Accepting request 1198163 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1198163
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mayavi?expand=0&rev=10
2024-09-02 11:15:10 +00:00
661749a56c Accepting request 1197938 from home:bnavigator:branches:devel:languages:python:numeric
- Update to 4.8.2
  * This is a bugfix release to work correctly with traitsui-8,
    Python-3.12, VTK-9.3 and above, and PyQt6. 18 PRs were merged.
  * Port changes from upstream QVTKRenderWindowInteractor.
  * ENH: Add support for PyQt6
  * Fix bug with latest VTK
  * Improve compatibility with traitsui 8
  * Fix issue with `mlab.process_ui_events`
  * ENH: Add support for Python 3.11
  * Just exclude the zip file so the sdist does not ship it. This
    way the file on pypi is much smaller.
- Unpin numpy 2
  * add mayavi-pr1303-cython-np2.patch gh#enthought/mayavi#1303
  * add mayavi-pr1315-np2tests.patch gh#enthought/mayavi#1315
- Drop patches merged upstream
  * mayavi-pr1290-vtk-9.3.patch
  * python-311-support.patch

OBS-URL: https://build.opensuse.org/request/show/1197938
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/mayavi?expand=0&rev=21
2024-09-01 13:25:40 +00:00
9 changed files with 2970 additions and 6597 deletions

View File

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

3
mayavi-4.8.2.tar.gz Normal file
View File

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

View File

@@ -1,98 +0,0 @@
diff --git a/mayavi/filters/threshold.py b/mayavi/filters/threshold.py
index b9329e7c..4c648297 100644
--- a/mayavi/filters/threshold.py
+++ b/mayavi/filters/threshold.py
@@ -14,6 +14,7 @@ from traits.api import Instance, Range, Float, Bool, \
Property, Enum
from traitsui.api import View, Group, Item
from tvtk.api import tvtk
+from tvtk.common import vtk_major_version, vtk_minor_version
# Local imports
from mayavi.core.filter import Filter
@@ -165,13 +166,19 @@ class Threshold(Filter):
######################################################################
def _lower_threshold_changed(self, new_value):
fil = self.threshold_filter
- fil.threshold_between(new_value, self.upper_threshold)
+ if (vtk_major_version, vtk_minor_version) >= (9, 1):
+ fil.lower_threshold = new_value
+ else:
+ fil.threshold_between(new_value, self.upper_threshold)
fil.update()
self.data_changed = True
def _upper_threshold_changed(self, new_value):
fil = self.threshold_filter
- fil.threshold_between(self.lower_threshold, new_value)
+ if (vtk_major_version, vtk_minor_version) >= (9, 1):
+ fil.upper_threshold = new_value
+ else:
+ fil.threshold_between(self.lower_threshold, new_value)
fil.update()
self.data_changed = True
@@ -270,8 +277,12 @@ class Threshold(Filter):
return
fil = new
self.configure_connection(fil, self.inputs[0].outputs[0])
- fil.threshold_between(self.lower_threshold,
- self.upper_threshold)
+ if (vtk_major_version, vtk_minor_version) >= (9, 1):
+ fil.lower_threshold = self.lower_threshold
+ fil.upper_threshold = self.upper_threshold
+ else:
+ fil.threshold_between(self.lower_threshold,
+ self.upper_threshold)
fil.update()
self._set_outputs([fil])
diff --git a/mayavi/tests/test_set_active_attribute.py b/mayavi/tests/test_set_active_attribute.py
index d46357c7..7b01dee6 100644
--- a/mayavi/tests/test_set_active_attribute.py
+++ b/mayavi/tests/test_set_active_attribute.py
@@ -64,8 +64,8 @@ class TestSetActiveAttribute(unittest.TestCase):
c = src.children[1]
sc = get_output(c.outputs[0]).point_data.scalars
self.assertEqual(sc.name,'temperature')
- # It is an iso-contour!
- self.assertEqual(sc.range[0],sc.range[1])
+ # It is an iso-contour! Allow rounding differences
+ self.assertAlmostEqual(sc.range[0], sc.range[1], places=5)
aa = c.children[0].children[0]
self.assertEqual(aa.point_scalars_name,'pressure')
sc = get_output(aa.outputs[0]).point_data.scalars
diff --git a/tvtk/common.py b/tvtk/common.py
index b5413583..e79f8de1 100644
--- a/tvtk/common.py
+++ b/tvtk/common.py
@@ -10,6 +10,7 @@ import re
import vtk
vtk_major_version = vtk.vtkVersion.GetVTKMajorVersion()
+vtk_minor_version = vtk.vtkVersion.GetVTKMinorVersion()
######################################################################
diff --git a/tvtk/tests/test_vtk_parser.py b/tvtk/tests/test_vtk_parser.py
index ceab86b7..c97635f5 100644
--- a/tvtk/tests/test_vtk_parser.py
+++ b/tvtk/tests/test_vtk_parser.py
@@ -127,7 +127,7 @@ class TestVTKParser(unittest.TestCase):
res['NormalScale'] = (1., None)
res['OcclusionStrength'] = (1., float_max)
res['Roughness'] = (0.5, float_max)
- if vtk_major_version >= 9 and vtk_minor_version > 0:
+ if (vtk_major_version, vtk_minor_version) >= (9, 1):
res['Anisotropy'] = (0.0, (0.0, 1.0))
res['AnisotropyRotation'] = (0.0, (0.0, 1.0))
res['BaseIOR'] = (1.5, (1.0, 9.999999680285692e+37))
@@ -140,6 +140,8 @@ class TestVTKParser(unittest.TestCase):
res['SelectionColor'] = ((1.0, 0.0, 0.0, 1.0), None)
res['SelectionLineWidth'] = (2.0, None)
res['SelectionPointSize'] = (2.0, None)
+ if (vtk_major_version, vtk_minor_version) >= (9, 3):
+ res['EdgeOpacity'] = (1.0, None)
result = list(p.get_get_set_methods().keys())
if hasattr(obj, 'GetTexture'):

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,137 @@
From 1d444b67e90335b860430cba2c2360d09e8eff66 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Fri, 30 Aug 2024 19:46:20 +0200
Subject: [PATCH 1/4] simplify assert all true
---
tvtk/tests/test_array_handler.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tvtk/tests/test_array_handler.py b/tvtk/tests/test_array_handler.py
index 556ad048..b34e30f6 100644
--- a/tvtk/tests/test_array_handler.py
+++ b/tvtk/tests/test_array_handler.py
@@ -201,8 +201,7 @@ class TestArrayHandler(unittest.TestCase):
cells = array_handler.array2vtkCellArray(a)
arr = array_handler.vtk2array(cells.GetData())
expect = numpy.array([3, 0, 1, 2]*3, int)
- self.assertEqual(numpy.alltrue(numpy.equal(arr, expect)),
- True)
+ self.assertTrue(numpy.all(numpy.equal(arr, expect)))
self.assertEqual(cells.GetNumberOfCells(), N)
# Test if a list of Numeric arrays of different cell lengths works.
@@ -210,8 +209,7 @@ class TestArrayHandler(unittest.TestCase):
cells = array_handler.array2vtkCellArray(l_a)
arr = array_handler.vtk2array(cells.GetData())
expect = numpy.array([1, 0]*3 + [3, 0, 1, 2]*3 + [2, 0,1]*2, int)
- self.assertEqual(numpy.alltrue(numpy.equal(arr, expect)),
- True)
+ self.assertTrue(numpy.all(numpy.equal(arr, expect)))
self.assertEqual(cells.GetNumberOfCells(), N*2 + 2)
# This should not take a long while. This merely tests if a
--
2.46.0
From 3e6036e7839b00ba3e4de994bb90c89a4f1bcfd1 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Fri, 30 Aug 2024 20:17:37 +0200
Subject: [PATCH 2/4] remove numpy.sctypes
---
tvtk/tests/test_array_handler.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/tvtk/tests/test_array_handler.py b/tvtk/tests/test_array_handler.py
index b34e30f6..92975880 100644
--- a/tvtk/tests/test_array_handler.py
+++ b/tvtk/tests/test_array_handler.py
@@ -160,13 +160,16 @@ class TestArrayHandler(unittest.TestCase):
self.assertEqual(vtk_arr.GetValue(2), 0)
self.assertEqual(vtk_arr.GetValue(3), 1)
- # Make sure the code at least runs for all the non-complex
- # numerical dtypes in numpy.
- float_types = [x for x in numpy.sctypes['float']
- if x().dtype.name not in ('float16', 'float128')]
- for dtype in (numpy.sctypes['int'] + numpy.sctypes['uint'] +
- float_types):
- array_handler.array2vtk(numpy.zeros((1,), dtype=dtype))
+ # Make sure the code at least runs for all
+ # numerical dtypes in numpy
+ # except for half, longdouble and complexfloating
+ int_types = ['byte', 'short', 'intc', 'int_', 'long', 'longlong']
+ uint_types = ['ubyte', 'ushort', 'uintc', 'uint', 'ulong',
+ 'ulonglong']
+ float_types = ['single', 'double']
+ for dtype in int_types + uint_types + float_types:
+ array_handler.array2vtk(numpy.zeros((1,),
+ dtype=numpy.dtype(dtype)))
def test_arr2cell_array(self):
"""Test Numeric array to vtkCellArray conversion."""
--
2.46.0
From ddf9be4e816dcaaa599f4b8d90e24199b377f9f9 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Fri, 30 Aug 2024 20:25:17 +0200
Subject: [PATCH 3/4] replace complex_
---
mayavi/tools/data_wizards/loadtxt.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mayavi/tools/data_wizards/loadtxt.py b/mayavi/tools/data_wizards/loadtxt.py
index 80702b0e..5278c368 100644
--- a/mayavi/tools/data_wizards/loadtxt.py
+++ b/mayavi/tools/data_wizards/loadtxt.py
@@ -23,7 +23,7 @@ def _getconv(dtype):
return lambda x: int(float(x))
elif issubclass(typ, np.floating):
return float
- elif issubclass(typ, np.complex_):
+ elif issubclass(typ, np.complex128):
return complex
else:
return str
--
2.46.0
From 668cbfbaac8e380b603501ebe0b7f90bbbb9551b Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Fri, 30 Aug 2024 20:39:45 +0200
Subject: [PATCH 4/4] handle new numpy2 nan repr
---
mayavi/tests/test_csv_sniff.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mayavi/tests/test_csv_sniff.py b/mayavi/tests/test_csv_sniff.py
index 30e2802d..f50a573f 100644
--- a/mayavi/tests/test_csv_sniff.py
+++ b/mayavi/tests/test_csv_sniff.py
@@ -12,7 +12,7 @@ import unittest
import tempfile
from unittest import SkipTest
-from numpy import array, ndarray
+from numpy import array, ndarray, isnan
from mayavi.tools.data_wizards.csv_sniff import \
Sniff, loadtxt, loadtxt_unknown, array2dict
@@ -33,8 +33,8 @@ class Util(unittest.TestCase):
def assertClose(self, a, b):
if isinstance(a, (int, float)):
- if repr(a) == 'nan':
- self.assertTrue(repr(b) == 'nan')
+ if isnan(a):
+ self.assertTrue(isnan(b), '%r != %r' % (a ,b))
else:
self.assertTrue(abs(a - b) < 1e-6 * max(1, abs(a)),
'%r != %r %r' % (a, b, abs(a - b)))
--
2.46.0

365
mayavi-pr1329-vtk9.4.patch Normal file
View File

@@ -0,0 +1,365 @@
From a405de160dd951b77064b92f0b434f4ea3a3143d Mon Sep 17 00:00:00 2001
From: Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Date: Tue, 17 Dec 2024 15:31:20 +0530
Subject: [PATCH 1/3] BUG: Fix issue with vtkGenericCell.GetCellFaces.
Calling this on an uninitialized object segfaults on Linux.
---
tvtk/vtk_parser.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tvtk/vtk_parser.py b/tvtk/vtk_parser.py
index 031af8f3..58efcc63 100644
--- a/tvtk/vtk_parser.py
+++ b/tvtk/vtk_parser.py
@@ -654,6 +654,9 @@ def _find_get_set_methods(self, klass, methods):
# These hang on Windows (and maybe Fedora 34)
elif (klass_name in ('vtkDataEncoder', 'vtkWebApplication')):
continue
+ # This crashes on VTK version 9.4.0
+ elif (klass_name == 'vtkGenericCell' and method[3:] == 'CellFaces'):
+ continue
# we can actually process it
elif ('Get' + method[3:]) in methods:
key = method[3:]
From 74837909d4f6a287080309457d8edf8348e7a163 Mon Sep 17 00:00:00 2001
From: Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Date: Thu, 19 Dec 2024 00:21:36 +0530
Subject: [PATCH 2/3] MAINT: Fix various VTK-9.4 related issues.
This fixes TVTK build and test issues.
---
docs/source/tvtk/README.txt | 18 ++++++++----------
tvtk/code_gen.py | 7 ++++---
tvtk/messenger.py | 10 +++++-----
tvtk/pipeline/browser.py | 4 ++--
tvtk/tests/test_messenger.py | 4 ++--
tvtk/tests/test_tvtk.py | 27 ++++++++++++++++-----------
tvtk/vtk_module.py | 10 +++++++++-
tvtk/wrapper_gen.py | 18 ++++++++++++++++++
8 files changed, 64 insertions(+), 34 deletions(-)
diff --git a/docs/source/tvtk/README.txt b/docs/source/tvtk/README.txt
index 8d71456d..0aa39ee5 100644
--- a/docs/source/tvtk/README.txt
+++ b/docs/source/tvtk/README.txt
@@ -260,19 +260,17 @@ tvtk wrapper object is created. The following illustrates this::
>>> cs = tvtk.ConeSource()
>>> o = cs.output
>>> m = tvtk.PolyDataMapper()
- >>> m.input = o
- >>> print(hash(o))
- 1109012188
- >>> print(hash(m.input))
- 1109012188
+ >>> m.input_connection = cs.output_port
+ >>> print(id(o))
+ 126526931186080
+ >>> print(id(m.input))
+ 126526931186080
>>> del o
- >>> print(hash(m.input))
- 1119694156
+ >>> print(id(m.input))
+ 126526931186080
Thus, after `o` is garbage collected `m.input` no longer refers to the
-original tvtk object and a new one is created. This is very similar
-to VTK's behaviour. Changing this behaviour is tricky and there are no
-plans currently to change this.
+original tvtk object the old one is cached and returned.
tvtk and traits
diff --git a/tvtk/code_gen.py b/tvtk/code_gen.py
index 03f7fc8f..e3a16e58 100644
--- a/tvtk/code_gen.py
+++ b/tvtk/code_gen.py
@@ -110,7 +110,7 @@ def generate_code(self):
# Write the wrapper files.
tree = wrap_gen.get_tree().tree
- classes = []
+ classes = ['vtkObjectBase']
# This is another class we should not wrap and exists
# in version 8.1.0.
ignore = ['vtkOpenGLGL2PSHelperImpl'] + [
@@ -124,11 +124,12 @@ def generate_code(self):
if (name not in include and not name.startswith('vtk')) or \
name.startswith('vtkQt'):
continue
- if not hasattr(vtk, name) or not hasattr(getattr(vtk, name), 'IsA'): # noqa
+ if not hasattr(vtk, name) or \
+ not hasattr(getattr(vtk, name), 'AddObserver'): # noqa
# We need to wrap VTK classes that are derived
# from vtkObjectBase, the others are
# straightforward VTK classes that can be used as
- # such. All of these have an 'IsA' method so we
+ # such. All of these have an 'AddObserver' method so we
# check for that. Only the vtkObjectBase
# subclasses support observers etc. and hence only
# those make sense to wrap into TVTK.
diff --git a/tvtk/messenger.py b/tvtk/messenger.py
index a11f8472..63f49525 100644
--- a/tvtk/messenger.py
+++ b/tvtk/messenger.py
@@ -145,7 +145,7 @@ def connect(self, obj, event, callback):
"""
typ = type(callback)
- key = hash(obj)
+ key = id(obj)
if not key in self._signals:
self._signals[key] = {}
signals = self._signals[key]
@@ -200,7 +200,7 @@ def disconnect(self, obj, event=None, callback=None, obj_is_hash=False):
if obj_is_hash:
key = obj
else:
- key = hash(obj)
+ key = id(obj)
if not key in signals:
return
if callback is None:
@@ -282,11 +282,11 @@ def _get_signals(self, obj):
object.
"""
- ret = self._signals.get(hash(obj))
+ ret = self._signals.get(id(obj))
if ret is None:
raise MessengerError(
- "No such object: %s, has registered itself "\
- "with the messenger."%obj
+ "No such object: %s, has registered itself "
+ "with the messenger." % obj
)
else:
return ret
diff --git a/tvtk/pipeline/browser.py b/tvtk/pipeline/browser.py
index d2afb5b4..5c8c8a42 100644
--- a/tvtk/pipeline/browser.py
+++ b/tvtk/pipeline/browser.py
@@ -447,7 +447,7 @@ class TVTKLeafNode(TreeNodeObject):
__ = Python
def __hash__(self):
- return hash(tvtk.to_vtk(self.object))
+ return id(tvtk.to_vtk(self.object))
def _get_name(self):
return self.object.__class__.__name__
@@ -496,7 +496,7 @@ def __del__(self):
pass
def __hash__(self):
- return hash(tvtk.to_vtk(self.object))
+ return id(tvtk.to_vtk(self.object))
def _get_children_from_cache(self):
return [x for x in self.children_cache.values() if x is not None]
diff --git a/tvtk/tests/test_messenger.py b/tvtk/tests/test_messenger.py
index 66d49795..a92f2344 100644
--- a/tvtk/tests/test_messenger.py
+++ b/tvtk/tests/test_messenger.py
@@ -133,12 +133,12 @@ def foo(self, o, e):
# Test if things behave sanely if a message was sent and one
# of the callbacks has been gc'd.
m = messenger.Messenger()
- l1 = len(m._signals[hash(c1)]['foo'])
+ l1 = len(m._signals[id(c1)]['foo'])
#
del c
messenger.send(c1, 'foo')
#
- l2 = len(m._signals[hash(c1)]['foo'])
+ l2 = len(m._signals[id(c1)]['foo'])
# Since 'c' is gc'd this callback should have been cleared
# out.
self.assertEqual(l2, l1 - 1)
diff --git a/tvtk/tests/test_tvtk.py b/tvtk/tests/test_tvtk.py
index 3cba92c5..bb37bee2 100644
--- a/tvtk/tests/test_tvtk.py
+++ b/tvtk/tests/test_tvtk.py
@@ -202,22 +202,22 @@ def test_help_trait(self):
def test_object_cache(self):
"""Test if object cache works."""
cs = tvtk.ConeSource()
- hash1 = hash(cs)
+ hash1 = id(cs)
o = cs.output
if hasattr(o, 'producer_port'):
src = o.producer_port.producer
else:
src = cs.executive.algorithm
self.assertEqual(src, cs)
- self.assertEqual(hash1, hash(src))
+ self.assertEqual(hash1, id(src))
del cs, src
gc.collect()
# The test sometimes fails as VTK seems to generate objects with the
- # same memory address and hash, we try to force it to allocate more
- # objects so as to not end up reusing the same address and hash.
+ # same memory address and hash/id, we try to force it to allocate more
+ # objects so as to not end up reusing the same address and id.
junk = [tvtk.ConeSource() for i in range(50)]
- # Now get another ConeSource and ensure the hash is different.
+ # Now get another ConeSource and ensure the id is different.
cs = tvtk.ConeSource()
o = cs.output
if hasattr(o, 'producer_port'):
@@ -230,8 +230,8 @@ def test_object_cache(self):
# For VTK 5.x this test is inconsistent, hence skipeed for 5.x
# See http://review.source.kitware.com/#/c/15095/
##############################################################
- self.assertEqual(hash1 != hash(src), True)
- self.assertEqual(hash(cs), hash(src))
+ self.assertEqual(hash1 != id(src), True)
+ self.assertEqual(id(cs), id(src))
# Test for a bug with collections and the object cache.
r = tvtk.Renderer()
@@ -565,7 +565,7 @@ def test_information_keys(self):
s = tvtk.StructuredPoints()
x = s.FIELD_ARRAY_TYPE()
y = tvtk.Information()
- x.get(y)
+ y.get(x)
def test_parent_child_bounds(self):
"""CubeAxesActor2D's bounds should be writable."""
@@ -858,7 +858,13 @@ def get_min_max_value(vtk_klass, vtk_attr_name):
for name in self.names:
vtk_klass = getattr(vtk, name)
tvtk_klass_name = get_tvtk_name(name)
-
+ if vtk.vtk_version in [ '9.4.0', '9.4.1' ]:
+ if tvtk_klass_name.endswith('View'):
+ continue
+ if tvtk_klass_name in ['ImageViewer', 'ImageViewer2',
+ 'OpenGLRenderWindow',
+ 'RenderWindow']:
+ continue
try:
obj = getattr(tvtk, tvtk_klass_name)()
except Exception:
@@ -882,8 +888,7 @@ def get_min_max_value(vtk_klass, vtk_attr_name):
# tvtk.tvtk_classes.open_gl_cell_grid_render_request.shapes_to_draw
# uses strings
if isinstance(min_value, str):
- name = "tvtk.tvtk_classes.open_gl_cell_grid_render_request"
- assert name in repr(obj), (obj, trait_name)
+ assert 'cell_grid_render_request' in repr(obj), (obj, trait_name)
continue
with self.assertRaises(TraitError):
setattr(obj, trait_name, (min_value-1, max_value))
diff --git a/tvtk/vtk_module.py b/tvtk/vtk_module.py
index 69dad0eb..36aaa524 100644
--- a/tvtk/vtk_module.py
+++ b/tvtk/vtk_module.py
@@ -52,4 +52,12 @@
try:
del vtkDGBoundsResponder, vtkDGOpenGLRenderer, vtkDGSidesResponder
except NameError:
- pass
\ No newline at end of file
+ pass
+
+if vtk_version in [ '9.4.0', '9.4.1' ]:
+ # Instantiating these using TVTK causes a crash on VTK 9.4.0 so skipping.
+ SKIP = ['vtkIOSSReader', 'vtkIOSSCellGridReader']
+ try:
+ del vtkIOSSReader, vtkIOSSCellGridReader
+ except NameError:
+ pass
diff --git a/tvtk/wrapper_gen.py b/tvtk/wrapper_gen.py
index 7b3afe02..47cffa08 100644
--- a/tvtk/wrapper_gen.py
+++ b/tvtk/wrapper_gen.py
@@ -1654,6 +1654,11 @@ def _write_trait_with_range(self, klass, out, vtk_attr_name):
'vtkLineIntegralConvolution2D.MaxNoiseValue$': (
True, True, '_write_line_integral_conv_2d_max_noise_value'
),
+ # In VTK 9.4, CellGridSidesQuery's Get/OutputDimensionControl is initialized
+ # to some random value this happens mostly on MacOS.
+ 'vtkCellGridSidesQuery.OutputDimensionControl$': (
+ True, True, '_write_cell_grid_sides_query_od_control'
+ ),
# In VTK 9.3, vtkCylinderSource's GetLatLongTesselation gives random values
# https://gitlab.kitware.com/vtk/vtk/-/issues/19252
'vtkCylinderSource.LatLongTessellation$': (
@@ -1927,6 +1932,19 @@ def _write_line_integral_conv_2d_max_noise_value(
vtk_set_meth = getattr(klass, 'Set' + vtk_attr_name)
self._write_trait(out, name, t_def, vtk_set_meth, mapped=False)
+ def _write_cell_grid_sides_query_od_control(self, klass, out, vtk_attr_name):
+ if vtk_attr_name != 'OutputDimensionControl':
+ raise RuntimeError(f"Wrong attribute name: {vtk_attr_name}")
+ if vtk_major_version >= 9:
+ message = ("vtkCellGridSidesQuery: "
+ "OutputDimensionControl not updatable "
+ "(VTK 9.4 bug - value not properly initialized)")
+ print(message)
+ t_def = 'tvtk_base.true_bool_trait'
+ name = self._reform_name(vtk_attr_name)
+ vtk_set_meth = getattr(klass, 'Set' + vtk_attr_name)
+ self._write_trait(out, name, t_def, vtk_set_meth, mapped=True)
+
def _write_cylinder_source_lat_long_tessellation(
self, klass, out, vtk_attr_name
):
From 8d8a9ff96b6de99583e1ee2e861b4daec56d95dd Mon Sep 17 00:00:00 2001
From: Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Date: Thu, 19 Dec 2024 00:52:51 +0530
Subject: [PATCH 3/3] More fixes to get builds working.
---
mayavi/components/actor.py | 9 +--------
tvtk/wrapper_gen.py | 4 ++--
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/mayavi/components/actor.py b/mayavi/components/actor.py
index 97bc0632..6fc43c8f 100644
--- a/mayavi/components/actor.py
+++ b/mayavi/components/actor.py
@@ -115,14 +115,7 @@ def update_data(self):
sends a `data_changed` event.
"""
# Invoke render to update any changes.
- from mayavi.modules.outline import Outline
- from mayavi.components.glyph import Glyph
- #FIXME: A bad hack, but without these checks results in seg fault
- input = self.inputs[0]
- if isinstance(input, Outline) or isinstance(input, Glyph):
- self.mapper.update(0)
- else:
- self.mapper.update()
+ self.mapper.update()
self.render()
######################################################################
diff --git a/tvtk/wrapper_gen.py b/tvtk/wrapper_gen.py
index 47cffa08..b9314e4e 100644
--- a/tvtk/wrapper_gen.py
+++ b/tvtk/wrapper_gen.py
@@ -54,7 +54,7 @@ def get_trait_def(value, **kwargs):
Example
-------
>>> get_trait_def([100., 200.], enter_set=True, auto_set=False)
- ('traits.Array', '', 'auto_set=False, enter_set=True, shape=(2,), dtype=float, value=[100.0, 200.0], cols=2')
+ ('traits.Array', '', 'auto_set=False, enter_set=True, shape=(None,), dtype=float, value=[100.0, 200.0], cols=2')
>>> get_trait_def(100, enter_set=True, auto_set=False)
('traits.Int', '100', 'auto_set=False, enter_set=True')
>>> get_trait_def(u'something', enter_set=True, auto_set=False)
@@ -80,7 +80,7 @@ def get_trait_def(value, **kwargs):
return 'traits.String', '{!r}'.format(value), kwargs_code
elif type_ in (tuple, list):
- shape = (len(value),)
+ shape = (None,)
dtypes = set(type(element) for element in value)
dtype = dtypes.pop().__name__ if len(dtypes) == 1 else None
if dtype == 'int' and sys.platform.startswith('win'):

View File

@@ -1,3 +1,31 @@
-------------------------------------------------------------------
Thu Jan 30 19:34:52 UTC 2025 - Ben Greiner <code@bnavigator.de>
- Add mayavi-pr1329-vtk9.4.patch gh#enthought/mayavi#1329
+ gh#enthought/mayavi#1330
- Drop suse-update-desktop-files
-------------------------------------------------------------------
Fri Aug 30 17:30:47 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Update to 4.8.2
* This is a bugfix release to work correctly with traitsui-8,
Python-3.12, VTK-9.3 and above, and PyQt6. 18 PRs were merged.
* Port changes from upstream QVTKRenderWindowInteractor.
* ENH: Add support for PyQt6
* Fix bug with latest VTK
* Improve compatibility with traitsui 8
* Fix issue with `mlab.process_ui_events`
* ENH: Add support for Python 3.11
* Just exclude the zip file so the sdist does not ship it. This
way the file on pypi is much smaller.
- Unpin numpy 2
* add mayavi-pr1303-cython-np2.patch gh#enthought/mayavi#1303
* add mayavi-pr1315-np2tests.patch gh#enthought/mayavi#1315
- Drop patches merged upstream
* mayavi-pr1290-vtk-9.3.patch
* python-311-support.patch
-------------------------------------------------------------------
Sat Apr 20 14:20:07 UTC 2024 - Benjamin Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package mayavi
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
# vtk only for python3 flavor
%define pythons python3
Name: mayavi
Version: 4.8.1
Version: 4.8.2
Release: 0
Summary: 3D visualization of scientific data in Python
License: BSD-3-Clause AND EPL-1.0 AND LGPL-2.0-or-later AND LGPL-3.0-or-later
@@ -28,19 +28,20 @@ URL: https://github.com/enthought/mayavi
Source0: https://files.pythonhosted.org/packages/source/m/mayavi/mayavi-%{version}.tar.gz
Source1: mayavi.desktop
Source2: tvtk_doc.desktop
# PATCH-FIX-UPSTREAM Based on gh#enthought/mayavi#1199
Patch0: python-311-support.patch
# PATCH-FIX-UPSTREAM mayavi-pr1290-vtk-9.3.patch gh#enthought/mayavi#1290
Patch1: mayavi-pr1290-vtk-9.3.patch
# PATCH-FIX-UPSTREAM mayavi-pr1303-cython-np2.patch gh#enthought/mayavi#1303
Patch0: mayavi-pr1303-cython-np2.patch
# PATCH-FIX-UPSTREAM mayavi-pr1315-np2tests.patch gh#enthought/mayavi#1315
Patch1: mayavi-pr1315-np2tests.patch
# PATCH-FIX-UPSTREAM mayavi-pr1329-vtk9.4.patch gh#enthought/mayavi#1329 + gh#enthought/mayavi#1330
Patch2: mayavi-pr1329-vtk9.4.patch
BuildRequires: fdupes
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
BuildRequires: python3-Pygments
BuildRequires: python3-apptools
BuildRequires: python3-devel >= 3.7
BuildRequires: python3-devel >= 3.8
BuildRequires: python3-envisage
# fails to build for 4.8.1, unpin on next release : gh#enthought/mayavi#1294
BuildRequires: python3-numpy-devel < 2
BuildRequires: python3-numpy-devel
BuildRequires: python3-packaging
BuildRequires: python3-pip
BuildRequires: python3-pyface >= 6.1.1
@@ -50,14 +51,12 @@ BuildRequires: python3-traits >= 6.0.0
BuildRequires: python3-traitsui >= 7.0.0
BuildRequires: python3-vtk
BuildRequires: python3-wheel
BuildRequires: update-desktop-files
BuildRequires: vtk-devel
# see mayavi/__init__.py
Requires: python3-Pygments
Requires: python3-apptools
Requires: python3-envisage
# keep in sync with numpy-devel above
Requires: python3-numpy < 2
Requires: python3-numpy
Requires: python3-packaging
Requires: python3-pyface >= 6.1.1
Requires: python3-traits >= 6.0.0
@@ -115,11 +114,12 @@ chmod -x mayavi/tests/data/cellsnd.ascii.inp
sed -i -e '/^#!\//, 1d' integrationtests/mayavi/*.py
sed -i -e '/^#!\//, 1d' mayavi/tests/*.py
sed -i -e '/^#!\//, 1d' mayavi/scripts/*.py
sed -i -e '/^#!\//, 1d' tvtk/setup.py
sed -i -e '/^#!\//, 1d' tvtk/_setup.py
# env-script-interpreter
find . -name \*py -exec \
sed -i -e '1s@#!\s*%{_bindir}/env\s*python@#!%{__python3}@' '{}' \;
sed -i -e '1s@#!\s*%{_bindir}/env\s*python@#!%{__python3}@' mayavi/scripts/mayavi2
%build
export CFLAGS="%{optflags}"
@@ -127,7 +127,6 @@ export CFLAGS="%{optflags}"
%install
%python3_pyproject_install
mkdir -p %{buildroot}/%{_mandir}/man1/
mv docs/mayavi2.man %{buildroot}/%{_mandir}/man1/mayavi2.1
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/
@@ -135,15 +134,14 @@ install -p -m 644 ./docs/source/mayavi/images/mayavi2-48x48.png \
%{buildroot}%{_datadir}/icons/hicolor/48x48/apps/mayavi2.png
install -p -m 644 ./docs/source/mayavi/images/mayavi2-48x48.png \
%{buildroot}%{_datadir}/icons/hicolor/48x48/apps/tvtk_doc.png
%suse_update_desktop_file -i mayavi
%suse_update_desktop_file -i tvtk_doc
rm -r %{buildroot}%{python3_sitearch}/tvtk/src
sed -i '/tvtk\/src/d' %{buildroot}%{python3_sitearch}/mayavi-%{version}.dist-info/RECORD
install -p -m 644 -D -t %{buildroot}%{_datadir}/applications/ %{SOURCE1} %{SOURCE2}
%fdupes %{buildroot}%{python3_sitearch}
%fdupes %{buildroot}%{_datadir}/icons
%ifnarch %ix86 %arm32
%check
%ifnarch %ix86 %arm32
# see .gitub/workflows/headless-tests.yml
export ETS_TOOLKIT=null
%pytest_arch -v --pyargs tvtk
@@ -163,7 +161,7 @@ donttest="$donttest or test_volume_works_with_probe"
%{_datadir}/applications/tvtk_doc.desktop
%{_datadir}/icons/hicolor/
%{python3_sitearch}/mayavi/
%{python3_sitearch}/mayavi-%{version}*-info
%{python3_sitearch}/mayavi-%{version}.dist-info
%{python3_sitearch}/tvtk/
%files jupyter

File diff suppressed because it is too large Load Diff