summaryrefslogtreecommitdiff
path: root/tools/meson.build
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2018-08-21 00:30:46 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2018-08-21 09:53:05 +0800
commit2c6b3b9a3593e9eeb5da0af54dfff3b0810dcea6 (patch)
tree053e6b785d818979378c2710c45c5ffda45ac819 /tools/meson.build
parent7378dedc564dbf7ba271853938ce0c58bff071b8 (diff)
downloadgobject-introspection-2c6b3b9a3593e9eeb5da0af54dfff3b0810dcea6.tar.gz
g-ir-tool-template.in: Don't hardcode /usr/bin/env
For Visual Studio builds, it is likely that we specify a specific Python installation as there may well be multiple Python installations, but _giscanner.pyd gets tied to the particular Python DLL that it was built with. So, we cannot just use /usr/bin/env python3 in such a case on Visual Studio, but instead we use the full path to the Python executable in the shebang so that the correct Python installation is used, when running the installed scripts. This is necessary as Meson could bump the Python version it requires but _giscanner.pyd could not be used on the newer Python that is required due to differences in the Python version and the CRT Python itself is linked to, for instance. We continue to use /usr/bin/env python[2|3] for other builds.
Diffstat (limited to 'tools/meson.build')
-rw-r--r--tools/meson.build9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/meson.build b/tools/meson.build
index 73472664..912eb6ba 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -9,13 +9,18 @@ if get_option('doctool')
tools += [['g-ir-doc-tool', 'docmain', 'doc_main']]
endif
-python_name = 'python@0@'.format(python.language_version().split('.')[0])
+if cc.get_id() == 'msvc'
+ python_cmd = python.get_variable('prefix') + '\\python.exe'
+else
+ python_cmd = '/usr/bin/env python@0@'.format(python.language_version().split('.')[0])
+endif
+
tool_output = []
foreach tool : tools
tools_conf = configuration_data()
tools_conf.set('libdir', libdir_abs)
tools_conf.set('datarootdir', datadir_abs)
- tools_conf.set('PYTHON', python_name)
+ tools_conf.set('PYTHON_CMD', python_cmd)
tools_conf.set('TOOL_MODULE', tool[1])
tools_conf.set('TOOL_FUNCTION', tool[2])