These two examples show building a meson-python package
in editable (-e
) mode without the --no-build-isolation
flag.
The package in question is my meson-python-cffi-example.
It requires fontconfig libraries and headers to be present, along with at least a couple of fonts. It depends on cffi
both at build time and runtime.
The example Dockerfiles are based on buildpack-deps, a Debian-based container. The only difference between them is whether meson and ninja are installed using the system package tool.
$ docker build -f Dockerfile.working -t example:working .
$ docker build -f Dockerfile.not-working -t example:not-working .
docker run --rm -it example:working
['/usr/share/texmf/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf']
docker run --rm -it example:not-working
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1080, in _find_spec
File "/home/builder/myvenv/lib/python3.11/site-packages/_meson_python_cffi_example_editable_loader.py", line 310, in find_spec
tree = self._rebuild()
^^^^^^^^^^^^^^^
File "/home/builder/myvenv/lib/python3.11/site-packages/_meson_python_cffi_example_editable_loader.py", line 343, in _rebuild
subprocess.run(self._build_cmd, cwd=self._build_path, env=env, stdout=subprocess.DEVNULL)
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-env-yfxix8xz/normal/bin/ninja'