Windows: fix Python path cannot contain spaces

Move the shebang line from the full Python path of the build
machine to the first Python on the path during runtime. Set
the shebang in the main meson.build file so that it can be
overridden in one place if needed.

Fixes: #3331
This commit is contained in:
Dan Yeaw 2024-11-09 17:05:17 -05:00 committed by Philip Withnall
parent 0234f8e1b1
commit 160e55575e
4 changed files with 9 additions and 3 deletions

View File

@ -31,7 +31,7 @@ gdbus_codegen_conf = configuration_data()
gdbus_codegen_conf.set('VERSION', glib_version) gdbus_codegen_conf.set('VERSION', glib_version)
gdbus_codegen_conf.set('MAJOR_VERSION', major_version) gdbus_codegen_conf.set('MAJOR_VERSION', major_version)
gdbus_codegen_conf.set('MINOR_VERSION', minor_version) gdbus_codegen_conf.set('MINOR_VERSION', minor_version)
gdbus_codegen_conf.set('PYTHON', python.full_path()) gdbus_codegen_conf.set('PYTHON', python_shebang)
gdbus_codegen_conf.set('DATADIR', glib_datadir) gdbus_codegen_conf.set('DATADIR', glib_datadir)
# Install gdbus-codegen executable # Install gdbus-codegen executable

View File

@ -507,7 +507,7 @@ endif
report_conf = configuration_data() report_conf = configuration_data()
report_conf.set('GLIB_VERSION', glib_version) report_conf.set('GLIB_VERSION', glib_version)
report_conf.set('PYTHON', python.full_path()) report_conf.set('PYTHON', python_shebang)
configure_file( configure_file(
input: 'gtester-report.in', input: 'gtester-report.in',
output: 'gtester-report', output: 'gtester-report',

View File

@ -85,7 +85,7 @@ python_tools = [
python_tools_conf = configuration_data() python_tools_conf = configuration_data()
python_tools_conf.set('VERSION', glib_version) python_tools_conf.set('VERSION', glib_version)
python_tools_conf.set('PYTHON', python.full_path()) python_tools_conf.set('PYTHON', python_shebang)
foreach tool: python_tools foreach tool: python_tools
tool_bin = configure_file( tool_bin = configure_file(

View File

@ -2487,6 +2487,12 @@ glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline)
python = import('python').find_installation() python = import('python').find_installation()
# Sets the shebang on script files. This has been changed many times including
# using env, the absolute path to the Python executable, and using both python
# and python3 names. Please review the history here, prior to suggesting
# further changes: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/439
python_shebang = '/usr/bin/env python3'
python_version = python.language_version() python_version = python.language_version()
python_version_req = '>=3.7' python_version_req = '>=3.7'
if not python_version.version_compare(python_version_req) if not python_version.version_compare(python_version_req)