From 17e934442bcf070a479d0787e08123f913c1b24c Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 6 Sep 2024 12:28:18 -0400 Subject: [PATCH] FIX: configobj --- .github/workflows/run-mayavi-tests.yml | 2 +- .gitignore | 1 + mayavi/tools/data_wizards/loadtxt.py | 2 +- tvtk/code_gen.py | 4 ++-- tvtk/tests/test_array_ext.py | 6 +++++- tvtk/wrapper_gen.py | 14 +++++++------- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-mayavi-tests.yml b/.github/workflows/run-mayavi-tests.yml index 8d4553fca..2539e32e7 100644 --- a/.github/workflows/run-mayavi-tests.yml +++ b/.github/workflows/run-mayavi-tests.yml @@ -73,7 +73,7 @@ jobs: run: | set -exo pipefail python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade "${{ matrix.qt-api }}" numpy "${{ matrix.vtk }}" pillow pytest traits traitsui + python -m pip install --upgrade "${{ matrix.qt-api }}" numpy "${{ matrix.vtk }}" pillow pytest traits traitsui configobj - name: Install mayavi and tvtk run: python -um pip install -ve .[app] - name: Test Mayavi package diff --git a/.gitignore b/.gitignore index a57949113..3b903dad4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ docs/build/ docs/html.zip tvtk/tvtk_classes.zip +tvtk/tvtk_classes/ mayavi/images/m2_about.jpg diff --git a/mayavi/tools/data_wizards/loadtxt.py b/mayavi/tools/data_wizards/loadtxt.py index 5278c368b..b4677dee8 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.complex128): + elif issubclass(typ, np.complexfloating): return complex else: return str diff --git a/tvtk/code_gen.py b/tvtk/code_gen.py index 8ad3ab6a9..264a2e9be 100644 --- a/tvtk/code_gen.py +++ b/tvtk/code_gen.py @@ -1,10 +1,10 @@ """This module generates tvtk (Traited VTK) classes from the VTK-Python API. -This can be evoked for example by: +This can be evoked for example by running from the ``mayavi`` root: ..code-block:: console - $ python -ic "from tvtk.code_gen import main; main()" -szv + $ python -m tvtk.code_gen -szvno $PWD/tvtk On failures you can then for example do ``import pdb; pdb.pm()`` to do post-mortem debugging. diff --git a/tvtk/tests/test_array_ext.py b/tvtk/tests/test_array_ext.py index cbb03c743..4320267e8 100644 --- a/tvtk/tests/test_array_ext.py +++ b/tvtk/tests/test_array_ext.py @@ -5,12 +5,16 @@ # Copyright (c) 2005, Enthought, Inc. # License: BSD Style. +import pytest import unittest import numpy from tvtk.array_handler import ID_TYPE_CODE, set_id_type_array_py -from tvtk.array_ext import set_id_type_array +try: + from tvtk.array_ext import set_id_type_array +except ModuleNotFoundError: # not compiled + pytest.skip("array_ext not found", allow_module_level=True) class TestArrayExt(unittest.TestCase): diff --git a/tvtk/wrapper_gen.py b/tvtk/wrapper_gen.py index 95b9810ed..1cf9f8b28 100644 --- a/tvtk/wrapper_gen.py +++ b/tvtk/wrapper_gen.py @@ -1591,22 +1591,22 @@ def _write_trait_with_range(self, klass, out, vtk_attr_name): # the code for this trait, # i.e. getattr(self, name_of_method)(...) special_traits = { - '[a-zA-Z0-9]+\.Output$': ( + r'[a-zA-Z0-9]+\.Output$': ( False, False, '_write_any_output'), - '[a-zA-Z0-9]+\.Source$': ( + r'[a-zA-Z0-9]+\.Source$': ( False, False, '_write_any_source'), - '[a-zA-Z0-9]+\.ScalarType$': ( + r'[a-zA-Z0-9]+\.ScalarType$': ( False, False, '_write_any_scalar_type'), # In VTK > 4.5, Set/GetInput have multiple signatures - '[a-zA-Z0-9]+\.Input$': ( + r'[a-zA-Z0-9]+\.Input$': ( False, False, '_write_any_input'), - '[a-zA-Z0-9]+\.InputConnection$': ( + r'[a-zA-Z0-9]+\.InputConnection$': ( False, False, '_write_any_input_connection'), - '[a-zA-Z0-9\.]+FileName$': ( + r'[a-zA-Z0-9\.]+FileName$': ( True, False, '_write_any_something_file_name'), - '[a-zA-Z0-9\.]+FilePrefix$': ( + r'[a-zA-Z0-9\.]+FilePrefix$': ( True, False, '_write_any_something_file_prefix'), 'vtkImageReader2.HeaderSize$': ( True, False, '_write_image_reader2_header_size'),