-
Let's jump right in to an XY problem: I think I want to be able to override When mixing venv and system packages, we often call the system cython to build an extension module inside a venv. But this will fail if the extension module needs pxd files from some other package that was installed to the venv: cython gets its search path from python, but the shebang on This is the wrong way to go about all this, but in a project with one pyx file, I'd like to just change the pyx compiler from |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
Meson detects cython from $PATH, so if you have activated the venv rather than calling it via Your other option is using https://mesonbuild.com/Machine-files.html to define: [binaries]
cython = '/path/to/cython' There is no need to specify python anywhere there. You could also do this: [constants]
venv = '/path/to/venv/bin'
[binaries]
python = venv / 'python'
cython = venv / 'cython' Thereby forcing meson to respect both python and cython (while running meson as a system tool using some unidentified different version of python). |
Beta Was this translation helpful? Give feedback.
-
Despite all the talk about overriding the cython command, I wonder why cython |
Beta Was this translation helpful? Give feedback.
-
One final hurdle in that meson adds its own quoting around arguments with spaces in them (even if they are already quoted), but I think we have a winner: cython_include_args = run_command(
py,
[
'-c',
'''
import sys
for p in sys.path:
if p:
print("--include-dir")
print(p)
'''.strip()
],
check: true
).stdout().splitlines()
py.extension_module(
...,
cython_args : cython_include_args
) Thanks for the assist. |
Beta Was this translation helpful? Give feedback.
One final hurdle in that meson adds its own quoting around arguments with spaces in them (even if they are already quoted), but I think we have a winner:
Thanks for the assist.