From 584169eb8533890ea8327dd07ca1a236b44aed2e Mon Sep 17 00:00:00 2001 From: janezd Date: Thu, 20 Jul 2023 18:11:06 +0200 Subject: [PATCH 1/4] Change setup.py for Cython 3.0 --- setup.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 86fafe34c99..ac3ed976215 100755 --- a/setup.py +++ b/setup.py @@ -30,6 +30,7 @@ try: from Cython.Distutils.build_ext import new_build_ext as build_ext + from Cython.Build import cythonize have_cython = True except ImportError: have_cython = False @@ -434,14 +435,7 @@ def ext_modules(): if os.name == 'posix': libraries.append("m") - return [ - # Cython extensions. Will be automatically cythonized. - Extension( - "*", - ["Orange/*/*.pyx"], - include_dirs=includes, - libraries=libraries, - ), + modules = [ Extension( "Orange.classification._simple_tree", sources=[ @@ -464,6 +458,16 @@ def ext_modules(): ), ] + if have_cython: + modules += cythonize(Extension( + "*", + ["Orange/*/*.pyx"], + include_dirs=includes, + libraries=libraries, + )) + + return modules + def setup_package(): write_version_py() From 3cd6be598afbe8a2160e80d831e243e39b1fec3d Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Fri, 21 Jul 2023 11:21:38 +0200 Subject: [PATCH 2/4] Require cython3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e17f44c6b43..822b2f1700e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ "setuptools>=41.0.0,<50.0", "wheel", - "cython<3.0", + "cython>=3.0", "oldest-supported-numpy", "sphinx", "recommonmark", From 83129bfe40bc6219e4566141d2942f13793e3c49 Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Fri, 21 Jul 2023 12:05:13 +0200 Subject: [PATCH 3/4] do not use build_ext from cython --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index ac3ed976215..eb4c0f02a2e 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,6 @@ have_sphinx = False try: - from Cython.Distutils.build_ext import new_build_ext as build_ext from Cython.Build import cythonize have_cython = True except ImportError: @@ -484,7 +483,6 @@ def setup_package(): } if have_numpy and have_cython: extra_args = {} - cmdclass["build_ext"] = build_ext else: # substitute a build_ext command with one that raises an error when # building. In order to fully support `pip install` we need to From c6b6d4e52a0876fa72bc65e0749a55d6f3adde6e Mon Sep 17 00:00:00 2001 From: janezd Date: Sat, 22 Jul 2023 10:54:44 +0200 Subject: [PATCH 4/4] setup.py: Simplify --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index eb4c0f02a2e..0c817fae202 100755 --- a/setup.py +++ b/setup.py @@ -481,16 +481,14 @@ def setup_package(): # numpy.distutils insist all data files are installed in site-packages 'install_data': install_data.install_data } - if have_numpy and have_cython: - extra_args = {} - else: + if not (have_numpy and have_cython): # substitute a build_ext command with one that raises an error when # building. In order to fully support `pip install` we need to # survive a `./setup egg_info` without numpy so pip can properly # query our install dependencies - extra_args = {} cmdclass["build_ext"] = build_ext_error + extra_args = {} setup( name=NAME, version=FULLVERSION,