Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Support Python 3.12 #1281

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading