Skip to content

MSVC builds: Further fix giscanner Python module and the Python scripts in tools/

Chun-wei Fan requested to merge tools.windows into master

Hi,

The current tools/g-ir-tool-template.in contains a shebang line that points to the Python installation that is used. Unfortunately that line will likely not work for Visual Studio builds where the configure option -Dpython=xxx is passed for the Meson build, as one may well have multiple Python 3.x installations on the system (and official CPython binary releases do not install a python2.exe or python3.exe for us). So, for the autotools and non-Visual Studio builds, we continue to use /usr/bin/env python[2|3] as we did before, but for Visual Studio builds, we use the full path to the python installation that we are building _giscanner.pyd against. This is so that the Meson build files for the other projects will pick up the correct Python interpreter to run items like g-ir-scanner. This is especially evident as Meson bumps up the required Python release series in order for it to function and run.

The other issue is that the hacks that are done for the MinGW builds are actually needed on Visual Studio builds as well, because:

-There are Visual Studio versions that do not have official Python binary releases that are linked to the CRTs that they target to (such as Visual Studio 2012 and 2013 (msvcr110.dll and msvcr120.dll))

-Again, the issue where Meson bumps up its Python requirement, also likely to cause the situation where the CRT targeted by the compiler differs from the CRT that Python itself is linked to.

-Due to these problems, g-ir-scanner et al will most likely crash on running.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports