]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/rados,rgw: replace Tempita errno checks with C preprocessor
authorKefu Chai <k.chai@proxmox.com>
Fri, 30 Jan 2026 08:57:34 +0000 (16:57 +0800)
committerKefu Chai <k.chai@proxmox.com>
Mon, 2 Feb 2026 03:14:44 +0000 (11:14 +0800)
commitd02c518eb3d9ecd1ae51a456a823eacc91c625d7
treef578834f8d5baae077f297d6fbf3522aa3a4ebd5
parentf0786a7497146944d39670a6c124e3392d84ea8a
pybind/rados,rgw: replace Tempita errno checks with C preprocessor

Replace Tempita-based platform-specific errno handling with C preprocessor
conditionals for the rados and rgw Python bindings, aligning with the
approach already used in cephfs.

Previously, rados and rgw used Tempita to generate platform-specific
errno_to_exception dictionaries, duplicating ~40 lines of code to choose
between ENOATTR (FreeBSD) and ENODATA (Linux) for the NoData exception.
This created an inconsistency with cephfs, which uses C preprocessor
conditionals for similar platform compatibility needs.

This commit introduces a CEPH_ENODATA macro that resolves to the
appropriate errno value at compile time:
  - ENOATTR on FreeBSD/Darwin
  - ENODATA on Linux

Changes:
- Add CEPH_ENODATA macro using #ifdef preprocessor conditionals
- Use single errno_to_exception dictionary with CEPH_ENODATA (~20 lines)
- Remove UNAME_SYSNAME variable and platform import from setup.py
- Retain Tempita processing for BUILD_DOC (still required)

Benefits:
- Eliminates runtime platform detection in setup.py
- Reduces code duplication (40 lines → 20 lines)
- Provides consistency across all pybind modules (rados, rgw, cephfs)

Follows the same pattern as DIRENT_D_OFF in cephfs bindings.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/pybind/rados/rados.pyx
src/pybind/rados/setup.py
src/pybind/rgw/rgw.pyx
src/pybind/rgw/setup.py