I have the following code which works until Python 3.12 due to the removal of distutils. Is the relevant information available in any other way (i.e., where compiled module artifacts should go for wheels to find)? Note that the project is way too complicated for any setup.py-driven build; CMake has to drive things on its own and generates setup.py (knowing what is supposed to be available from a set of -D flags is not feasible).
import setuptools # importing this suppresses deprecation methods
# XXX(python-3.12): figure out what replaces this kind of access after
# `distutils` is removed.
from distutils.dist import Distribution
from distutils.command import build
d = Distribution()
b = build.build(d)
b.finalize_options()
print(b.build_platlib)
distutils and setuptools use a combination of plat_name (which is not exactly sysconfig.get_platform()) and sys.implementation.cache_tag to derive the name of the build directory.
The project is built by CMake. I’m just trying to put the build artifacts in a place that bdist_wheel can find them.
Yeah, I saw some nt-only conditionals in there…the comments didn’t help say why, but this at least agrees across the versions I’m testing (3.6+).
I’m not customizing any command object; I’m completely skipping the build_lib command because I need to run CMake before I can provide all of the information to setup() (e.g., what [xyz] bits will be available). I suppose I could instantiate a bdist_wheel object, but that’s a new configure-time dependency (currently we are stdlib only until you actually make a wheel).