Skip to content

Python: Improve build process for Windows builds

Chun-wei Fan requested to merge python3-windows into master

Hi,

This attempts to improve the build experience for the Python bindings for Windows, by:

  • Replacing ssize_t with Py_ssize_t, since ssize_t is a POSIX type which may not be supported by all Windows compilers. For instance, Visual Studio does not support ssize_t out-of-the-box.
  • Compensate for the lack of XML_POP_WARNINGS and XML_IGNORE_FPTR_CAST_WARNINGS macros being defined, since these two macros were only added to libxml2 quite recently.
  • Ease the CMake checks for building against Python 3.x on Windows, since the platform support code is already applied from the one that is in libxml2.
  • Add a distutils build for the Python bits like the one in libxml2, so that one can build it in conjunction with the NMake-based build system in win32/. This makes it easier for one to build wheels as well, where the wheel will depend on the libxml2 python bindings, and will allow one to quickly build libxslt Python bindings for multiple versions of Python where needed, for instance, for building against Python 3.5.x and later against a single binary build of libxslt done with Visual Studio 2015 or later. I am only able to test this distutils-based build system seriously on Visual Studio builds with Python 2.7.x and Python 3.6.x and later.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports