Commits (3)
  • Eli Schwartz's avatar
    * meson.build: Check the return value of `run_command`. · e342f83c
    Eli Schwartz authored and Werner Lemberg's avatar Werner Lemberg committed
    By default, errors are not checked and a command that is somehow broken will
    just capture incorrect output (likely an empty string).  Current development
    versions of meson now raise a warning for this implicit behavior, and advise
    explicitly setting the `check:` keyword argumend to determine whether a
    failing return code should be considered an error.
    
    Since none of the commands in this project are expected to fail, mark them
    as required to succeed.
    e342f83c
  • Eli Schwartz's avatar
    * builds/meson/*.py: Fix name of python executable for auxiliary scripts. · 57fd6180
    Eli Schwartz authored and Werner Lemberg's avatar Werner Lemberg committed
    The previous change to check the return code of `run_command` invocations
    caused the CI to fail.  Although most scripts used `python_exe` as the
    program command, the script to determine the project version did not.
    
    But, all scripts used `python` as the shebang, and this is not available on
    all systems.  Particularly Debian does not provide a `python` command,
    though `python3` does exist.  This meant that formerly the version number
    was lacking, and now the build simply fails.
    
    Instead, rely on `python3` since it is guaranteed to exist when running
    meson, and `python2` is end of life anyway.
    57fd6180
  • Eli Schwartz's avatar
    * meson.build: Optimize lookup for `python3` program. · d6a5c577
    Eli Schwartz authored and Werner Lemberg's avatar Werner Lemberg committed
    The python module's `find_installation` method is intended to provide
    routines for compiling and installing python modules into the
    `site-packages` directory.  It does a couple of slow things, including run
    an introspection command to scrape sysconfig info from the detected
    interpreter, which are not needed for the sole use case of invoking the
    found installation as an executable.
    
    Furthermore, when invoked without the name or path of a python binary, it is
    hardcoded to always look for `python3` corresponding to the interpreter
    meson itself uses to run.  So using `find_installation` did not even allow
    detecting `python2` as a fallback.
    
    Instead, switch to a simple `find_program` lookup that finishes as soon as
    the program is found.
    d6a5c577
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
......
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
......
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
......
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
......
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
......
......@@ -27,7 +27,8 @@ project('freetype2', 'c',
meson_version: '>= 0.55.0',
default_options: ['default_library=both'],
version: run_command('builds/meson/extract_freetype_version.py',
'include/freetype/freetype.h').stdout().strip(),
'include/freetype/freetype.h',
check: true).stdout().strip(),
)
......@@ -35,17 +36,18 @@ project('freetype2', 'c',
# variable; we thus use an external command to have this functionality
# with older versions, too.
python = import('python')
python_exe = python.find_installation(required: true)
python_exe = find_program('python3')
ft2_so_version = run_command(python_exe,
files('builds/meson/extract_libtool_version.py'),
'--soversion',
files('builds/unix/configure.raw')).stdout().strip()
files('builds/unix/configure.raw'),
check: true).stdout().strip()
ft2_pkgconfig_version = run_command(python_exe,
files('builds/meson/extract_libtool_version.py'),
files('builds/unix/configure.raw')).stdout().strip()
files('builds/unix/configure.raw'),
check: true).stdout().strip()
ft2_includes = include_directories('include')
......@@ -70,7 +72,8 @@ ft2_sources = [ftmodule_h]
ft_main_modules = run_command(python_exe,
files('builds/meson/parse_modules_cfg.py'),
'--format=main-modules',
files('modules.cfg')).stdout().strip().split()
files('modules.cfg'),
check: true).stdout().strip().split()
ft2_sources += files([
'src/base/ftbase.c',
......@@ -91,7 +94,8 @@ endforeach
ft_aux_modules = run_command(python_exe,
files('builds/meson/parse_modules_cfg.py'),
'--format=aux-modules',
files('modules.cfg')).stdout().strip().split()
files('modules.cfg'),
check: true).stdout().strip().split()
foreach auxmod: ft_aux_modules
source = auxmod
......@@ -117,7 +121,8 @@ endforeach
base_extensions = run_command(python_exe,
files('builds/meson/parse_modules_cfg.py'),
'--format=base-extensions-list',
files('modules.cfg')).stdout().split()
files('modules.cfg'),
check: true).stdout().split()
foreach ext: base_extensions
ft2_sources += files('src/base/' + ext)
......