Skip to content

Reduce use of distutils (in preparation for its removal from stdlib)

Chun-wei Fan requested to merge reduce-distutils-usage into main

Hi,

Since during compiling the dumper binary using distutils had some issues at points, especially when we have C++ items in the mix, this attempts to reduce the use on distutils by doing the following, and to resolve incompatibilities between the stock/stdlib version of distutils vs the distutils that comes with SetupTools, which will totally replace the stdlib version of distutils in Python-3.12.x and later:

  • Make sure we get the distutils(-derived) CCompiler instance in a consistent way across the board.
  • Manually construct the command lines for preprocessing the sources and compiling the dumper program, as we previously did for linking. The reason is that there are more quirks in the distutils that are shipped with SetupTools as well as in Python-3.8.x+ stdlib version of distutils in regards to handling C++ files when running g-ir-scanner when we compile the dumper program.

So, we now use distutils in the following ways after this MR:

  • Setup our compiler instance for the introspection build.
  • Run the preprocessor and compiler commands manually while supporting dry-runs needed for the testsuite.

This fixed building the introspection files for GJS on Windows builds on Python-3.11.x with the distutils that shipped with Python's stdlib and the one shipped with SetupTools.

This will now not cover !335 (closed), as it's of an issue of its own.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports