Skip to content

Commit

Permalink
Merge pull request #1281 from larsoner/312
Browse files Browse the repository at this point in the history
MAINT: Support Python 3.12
  • Loading branch information
prabhuramachandran committed Dec 9, 2023
2 parents f4b6f2f + 6754cc0 commit 8ae6e5c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
import numpy
from numpy.distutils.command import build, install_data, build_src
from numpy.distutils.core import setup
my_build_src_super = build_src.build_src
build_src_run = build_src.build_src.run
del build_src
HAS_NUMPY = True
except ImportError:
HAS_NUMPY = False
from distutils.command import build, install_data
from distutils.core import setup
my_build_src_super = object
build_src_run = lambda *args, **kwargs: None
import io
import os
import time
Expand Down Expand Up @@ -124,8 +129,8 @@ def mlab_reference(self):
mlab_ref_dir = join(DEFAULT_INPUT_DIR, 'mayavi', 'auto')

source_path = 'mayavi'
sources = '(\.py)|(\.rst)$'
excluded_dirs = '^\.'
sources = r'(\.py)|(\.rst)$'
excluded_dirs = r'^\.'
target_path = mlab_ref_dir
target_time = self.latest_modified(target_path,
ignore_dirs=excluded_dirs)[0]
Expand Down Expand Up @@ -288,7 +293,7 @@ def run(self):
build.build.run(self)


class MyBuildSrc(build_src.build_src):
class MyBuildSrc(my_build_src_super):
"""Build hook to generate the TVTK ZIP files.
We do it here also because for editable installs, setup.py build is not
Expand All @@ -297,7 +302,7 @@ class MyBuildSrc(build_src.build_src):

def run(self):
build_tvtk_classes_zip()
build_src.build_src.run(self)
build_src_run(self)


class MyDevelop(develop.develop):
Expand Down Expand Up @@ -417,7 +422,7 @@ def configuration(parent_package=None, top_path=None):
config['packages'] += packages


if MODE != 'info' and not HAS_NUMPY:
if MODE != 'info' and not HAS_NUMPY and sys.version_info < (3, 12):
msg = '''
Numpy is required to build Mayavi correctly, please install it first.
'''
Expand Down

0 comments on commit 8ae6e5c

Please sign in to comment.