PEP 632 - Deprecate distutils module

I wouldn’t judge Fedora’s “hacked” patch too harshly — there’s something to be said for the simpler approach. Debian’s patch is far more comprehensive, yes, but that’s exactly what gets it into trouble.

When third-party install scripts/tools go to install Python modules, many use the path returned by distutils.sysconfig.get_python_lib(prefix="/usr/local/") as their target path (if building for the default /usr/local install prefix).

  • On Fedora, that call returns /usr/local/lib/python3.x/site-packages, which will be in the default sys.path if the directory exists. All is well.
  • Debian’s patched distutils will instead return /usr/local/lib/python3/dist-packages, a path that is not added to sys.path under any circumstances (except manually). That path is also incorrect based on their own documentation. (As you say, the path should be /usr/local/lib/python3.x/dist-packages.)

This has occasionally been a source of some consternation among maintainers and distributors of Python software.

(setuptools on Debian-based systems uses correct paths, though. So in a roundabout way this is just another point in favor of deprecating broken distutils, and instead using the better-maintained setuptools wherever possible.)