[gobject-introspection/tools.windows] g-ir-tool-template.in: Don't hardcode /usr/bin/env
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/tools.windows] g-ir-tool-template.in: Don't hardcode /usr/bin/env
- Date: Mon, 20 Aug 2018 16:38:17 +0000 (UTC)
commit 0da5d92ad30c37dbedb5b3a8b98e436006961f9e
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Aug 21 00:30:46 2018 +0800
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 get 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 CRTs being used
for the builds and the CRT that CPython, for instance, is linked to.
We continue to use /usr/bin/env python[2|3] for other builds.
Makefile-tools.am | 2 +-
tools/g-ir-tool-template.in | 2 +-
tools/meson.build | 10 +++++++++-
3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/Makefile-tools.am b/Makefile-tools.am
index 8c4a069b..ccf0ec13 100644
--- a/Makefile-tools.am
+++ b/Makefile-tools.am
@@ -9,7 +9,7 @@ EXTRA_DIST += \
tools/g-ir-tool-template.in \
tools/meson.build
-TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON\@,$(PYTHON),
+TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e
s,@PYTHON_ENV\@,\/usr\/bin\/env, -e s,@PYTHON\@,$(PYTHON),
g-ir-scanner: tools/g-ir-tool-template.in _giscanner.la Makefile
$(AM_V_GEN) sed $(TOOL_SUBSTITUTIONS) -e s,@TOOL_MODULE\@,scannermain, -e
s,@TOOL_FUNCTION\@,scanner_main, $< > $@.tmp && mv $@.tmp $@
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index 83279bd4..0fcd440c 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env @PYTHON@
+#!@PYTHON_ENV@ @PYTHON@
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2008 Johan Dahlin
diff --git a/tools/meson.build b/tools/meson.build
index 73472664..ffa2d2eb 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -9,12 +9,20 @@ 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_env = ''
+ python_name = python.get_variable('prefix') + '\\python'
+else
+ python_env = '/usr/bin/env'
+ python_name = '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_ENV', python_env)
tools_conf.set('PYTHON', python_name)
tools_conf.set('TOOL_MODULE', tool[1])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]