]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: remove compile_time_env parameter from setup.py files 67135/head
authorKefu Chai <k.chai@proxmox.com>
Fri, 30 Jan 2026 09:38:06 +0000 (17:38 +0800)
committerKefu Chai <k.chai@proxmox.com>
Mon, 2 Feb 2026 03:14:44 +0000 (11:14 +0800)
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 <k.chai@proxmox.com>
src/pybind/cephfs/setup.py
src/pybind/rados/setup.py
src/pybind/rbd/setup.py
src/pybind/rgw/setup.py

index a44d4708faa1364be8a642db1e92d846d78ca626..d41d9d63a245f85a7e24d2cd0e5bad5f07498d48 100755 (executable)
@@ -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)
 
index 27570bf9d524f51790b9bfbe3e4a4c9f57d148f6..bf3802953baaa2f23c36ca88d27c846c8250edd5 100755 (executable)
@@ -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=[
index 0f615fa0ab1704ac882c571071a8c7d1c2433d26..69cfa06a122dbcdff19219c1479302f0fb4b3278 100755 (executable)
@@ -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)
 
index 224342a10e5f142b5c32e546c0a0c41119ee32a5..29b662431409837f8c6213bfbc0398d8baf42b10 100755 (executable)
@@ -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
     ),