]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cmake/modules: add PythonPackage.cmake
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 13 Apr 2026 21:24:24 +0000 (17:24 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 6 May 2026 13:32:25 +0000 (09:32 -0400)
commit42ddb5eafd51e2a9f306322d836a3d2f7388f027
treea1790d731b472183096daede0acb7d651e5d2c3a
parent03bed028a9cbbf494967b950ab57c96f67fccf1e
cmake/modules: add PythonPackage.cmake

Time is marching on and the state of the art with python packaging has
not stood still. In Python 3.12, distutils has been removed after being
deprecated for a couple of versions. According to the Python Packaging
User Guide [1]: "However, `python setup.py` and the use of `setup.py` as a
command line tool are deprecated."

Currently, ceph provides a decent sized and growing library of python
code in `src/python-common/ceph`. It currently relies on `setup.py` and
the deprecated `python setup.py install` command. This change aims to be
the first step in moving toward a more contemporary approach so that we
don't get caught late when the older approaches really stop working.

Because ceph's primary diver of "build stuff" is CMake, there was an
existing `cmake/modules/Distutils.cmake` that invokes a `python setup.py
install` command. Rather than risk breaking older distros we add a new
`cmake/modules/PythonPackage.cmake` file that uses the PEP 517/518
[2][3] style

of packaging. I could not find some existing CMake support for this
so unfortunately I had to write this.

The approach taken is loosely based on what the rpm build process does.
It invokes pip's wheel subcommand to build a wheel (during the build
phase) and then uses pip to install the wheel to install the content
to the system.

A future commit will add conditional support for using this approach
in src/python-common.

[1] https://packaging.python.org/en/latest/discussions/setup-py-deprecated/
[2] https://peps.python.org/pep-0517/
[3] https://peps.python.org/pep-0518/

Signed-off-by: John Mulligan <jmulligan@redhat.com>
cmake/modules/PythonPackage.cmake [new file with mode: 0644]