mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 12:41:50 +01:00
Use the python found by meson as the interpreter for installed scripts
The python interpreter found by `/usr/bin/env python3` is not necessarily the same installation as the one that's found by meson's `pymod.find_installation('python')`. This means that even though meson is checking that the python installation it found includes the 'packaging' module, the scripts might not have access to that module when run. For distribution packaging, it's usually desirable to have python script interpreters be fully specified paths, rather than use `/usr/bin/env`, to ensure the scripts run using the expected python installation (i.e. the one where the python 'packaging' dependency is installed). The easiest way to fix this is to set the script interpreter to the `full_path()` of the python interpreter found by meson. The specific python interpreter that will be used can be selected through the use of a meson machine file by overriding the "python" program. Many distributions already have this set up using meson packaging helpers.
This commit is contained in:
parent
0888d8d5f2
commit
013980d839
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env @PYTHON@
|
#!@PYTHON@
|
||||||
|
|
||||||
# GDBus - GLib D-Bus Library
|
# GDBus - GLib D-Bus Library
|
||||||
#
|
#
|
||||||
|
@ -14,7 +14,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_name)
|
gdbus_codegen_conf.set('PYTHON', python.full_path())
|
||||||
gdbus_codegen_conf.set('DATADIR', glib_datadir)
|
gdbus_codegen_conf.set('DATADIR', glib_datadir)
|
||||||
|
|
||||||
# Install gdbus-codegen executable
|
# Install gdbus-codegen executable
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env @PYTHON@
|
#!@PYTHON@
|
||||||
# GLib Testing Framework Utility -*- Mode: python; -*-
|
# GLib Testing Framework Utility -*- Mode: python; -*-
|
||||||
# Copyright (C) 2007 Imendio AB
|
# Copyright (C) 2007 Imendio AB
|
||||||
# Authors: Tim Janik
|
# Authors: Tim Janik
|
||||||
|
@ -501,7 +501,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_name)
|
report_conf.set('PYTHON', python.full_path())
|
||||||
configure_file(
|
configure_file(
|
||||||
input: 'gtester-report.in',
|
input: 'gtester-report.in',
|
||||||
output: 'gtester-report',
|
output: 'gtester-report',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env @PYTHON@
|
#!@PYTHON@
|
||||||
|
|
||||||
# pylint: disable=too-many-lines, missing-docstring, invalid-name
|
# pylint: disable=too-many-lines, missing-docstring, invalid-name
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env @PYTHON@
|
#!@PYTHON@
|
||||||
|
|
||||||
# If the code below looks horrible and unpythonic, do not panic.
|
# If the code below looks horrible and unpythonic, do not panic.
|
||||||
#
|
#
|
||||||
|
@ -87,7 +87,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_name)
|
python_tools_conf.set('PYTHON', python.full_path())
|
||||||
|
|
||||||
foreach tool: python_tools
|
foreach tool: python_tools
|
||||||
tool_bin = configure_file(
|
tool_bin = configure_file(
|
||||||
|
@ -2433,8 +2433,6 @@ endif
|
|||||||
glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline)
|
glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline)
|
||||||
|
|
||||||
python = import('python').find_installation(modules: ['packaging'])
|
python = import('python').find_installation(modules: ['packaging'])
|
||||||
# used for '#!/usr/bin/env <name>'
|
|
||||||
python_name = 'python3'
|
|
||||||
|
|
||||||
python_version = python.language_version()
|
python_version = python.language_version()
|
||||||
python_version_req = '>=3.7'
|
python_version_req = '>=3.7'
|
||||||
|
Loading…
Reference in New Issue
Block a user