From 82a41eb6b954aed625b1c048708c4beab373d183 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 30 Jan 2026 17:38:06 +0800 Subject: [PATCH] pybind: remove compile_time_env parameter from setup.py files Cython's IF statement for conditional compilation has been deprecated in Cython 3.0 as documented at: https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#deprecation-of-def-if The compile_time_env parameter was used to pass compile-time constants (BUILD_DOC and UNAME_SYSNAME) to Cython's IF statements. Since we have migrated away from Cython's IF statements, this parameter is no longer needed: - Platform-specific code now uses C preprocessor conditionals (#if defined(__FreeBSD__)) directly in cdef extern blocks - BUILD_DOC conditionals are handled via Tempita template processing for .pyx files, not Cython's compile-time IF statements Remove the compile_time_env parameter from all pybind setup.py files (cephfs, rados, rbd, rgw) as it serves no purpose after the migration to Cython 3.0-compatible approaches. Also, take this opportunity to completely drop `compiler_directives` which should have been removed in 0423b771. Signed-off-by: Kefu Chai --- src/pybind/cephfs/setup.py | 5 ++--- src/pybind/rados/setup.py | 3 --- src/pybind/rbd/setup.py | 5 ++--- src/pybind/rgw/setup.py | 6 ++---- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/pybind/cephfs/setup.py b/src/pybind/cephfs/setup.py index a44d4708faa..d41d9d63a24 100755 --- a/src/pybind/cephfs/setup.py +++ b/src/pybind/cephfs/setup.py @@ -145,13 +145,12 @@ def check_sanity(): if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: ext_args = {} cython_constants = dict(BUILD_DOC=True) - cythonize_args = dict(compile_time_env=cython_constants) + cythonize_args = dict() elif check_sanity(): ext_args = get_python_flags(['cephfs']) cython_constants = dict(BUILD_DOC=False) include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")] - cythonize_args = dict(compile_time_env=cython_constants, - include_path=include_path) + cythonize_args = dict(include_path=include_path) else: sys.exit(1) diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py index 27570bf9d52..bf3802953ba 100755 --- a/src/pybind/rados/setup.py +++ b/src/pybind/rados/setup.py @@ -216,9 +216,6 @@ setup( **ext_args ) ], - # use "3str" when Cython 3.0 is available - compiler_directives={'language_level': sys.version_info.major}, - compile_time_env=cython_constants, build_dir=os.environ.get("CYTHON_BUILD_DIR", None), ), classifiers=[ diff --git a/src/pybind/rbd/setup.py b/src/pybind/rbd/setup.py index 0f615fa0ab1..69cfa06a122 100755 --- a/src/pybind/rbd/setup.py +++ b/src/pybind/rbd/setup.py @@ -143,13 +143,12 @@ def check_sanity(): if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: ext_args = {} cython_constants = dict(BUILD_DOC=True) - cythonize_args = dict(compile_time_env=cython_constants) + cythonize_args = dict() elif check_sanity(): ext_args = get_python_flags(['rados', 'rbd']) cython_constants = dict(BUILD_DOC=False) include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")] - cythonize_args = dict(compile_time_env=cython_constants, - include_path=include_path) + cythonize_args = dict(include_path=include_path) else: sys.exit(1) diff --git a/src/pybind/rgw/setup.py b/src/pybind/rgw/setup.py index 224342a10e5..29b66243140 100755 --- a/src/pybind/rgw/setup.py +++ b/src/pybind/rgw/setup.py @@ -145,13 +145,12 @@ def check_sanity(): if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: ext_args = {} cython_constants = dict(BUILD_DOC=True) - cythonize_args = dict(compile_time_env=cython_constants) + cythonize_args = dict() elif check_sanity(): ext_args = get_python_flags(['rados', 'rgw']) cython_constants = dict(BUILD_DOC=False) include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")] - cythonize_args = dict(compile_time_env=cython_constants, - include_path=include_path) + cythonize_args = dict(include_path=include_path) else: sys.exit(1) @@ -225,7 +224,6 @@ setup( **ext_args ) ], - compiler_directives={'language_level': sys.version_info.major}, build_dir=os.environ.get("CYTHON_BUILD_DIR", None), **cythonize_args ), -- 2.47.3