glib/gio/gdbus-2.0/codegen/meson.build
Calvin Walton 013980d839 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.
2024-03-25 15:17:59 -04:00

48 lines
1.8 KiB
Meson

gdbus_codegen_files = [
'__init__.py',
'codegen.py',
'codegen_main.py',
'codegen_docbook.py',
'codegen_md.py',
'codegen_rst.py',
'dbustypes.py',
'parser.py',
'utils.py',
]
gdbus_codegen_conf = configuration_data()
gdbus_codegen_conf.set('VERSION', glib_version)
gdbus_codegen_conf.set('MAJOR_VERSION', major_version)
gdbus_codegen_conf.set('MINOR_VERSION', minor_version)
gdbus_codegen_conf.set('PYTHON', python.full_path())
gdbus_codegen_conf.set('DATADIR', glib_datadir)
# Install gdbus-codegen executable
gdbus_codegen = configure_file(input : 'gdbus-codegen.in',
output : 'gdbus-codegen',
install_dir : get_option('bindir'),
install_tag : 'bin-devel',
configuration : gdbus_codegen_conf
)
# Provide tools for others when we're a subproject and they use the Meson GNOME module
meson.override_find_program('gdbus-codegen', gdbus_codegen)
codegen_dir = join_paths(glib_datadir, 'glib-2.0', 'codegen')
gdbus_codegen_built_files = []
gdbus_codegen_built_targets = []
gdbus_codegen_built_files += configure_file(input : 'config.py.in',
output : 'config.py',
install_dir : codegen_dir,
install_tag : 'bin-devel',
configuration : gdbus_codegen_conf)
foreach f : gdbus_codegen_files
# Copy these into the builddir so that gdbus-codegen can be used uninstalled
# and then install it too so that it can be used after installation
gdbus_codegen_built_targets += fs.copyfile(f, f,
install : true,
install_dir : codegen_dir,
install_tag : 'bin-devel')
endforeach