diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-12-01 00:31:44 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-02-10 02:16:53 -0500 |
commit | 84dd78e80d7e9db1febf6a0016730e2ab6f7a352 (patch) | |
tree | 104c4e9f25aa2f92698999cf9fabe84851281d2b /mesonbuild/compilers | |
parent | 6ea24ee9e29a03c42665be8f1ec2f9c635fb985a (diff) | |
download | meson-84dd78e80d7e9db1febf6a0016730e2ab6f7a352.zip meson-84dd78e80d7e9db1febf6a0016730e2ab6f7a352.tar.gz meson-84dd78e80d7e9db1febf6a0016730e2ab6f7a352.tar.bz2 |
cython: wire up support for emitting and using depfiles
This solves rebuild issues when e.g. importing a .pxd header from a .pyx
file, just like C/C++ source headers. The transpiler needs to run again
in this case.
This functionality is present in the 3.0.0 alphas of cython, and is also
backported to 0.29.33.
Fixes #9049
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/cython.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/compilers/cython.py b/mesonbuild/compilers/cython.py index 763279e..9bbfebe 100644 --- a/mesonbuild/compilers/cython.py +++ b/mesonbuild/compilers/cython.py @@ -7,7 +7,7 @@ from __future__ import annotations import typing as T from .. import coredata -from ..mesonlib import EnvironmentException, OptionKey +from ..mesonlib import EnvironmentException, OptionKey, version_compare from .compilers import Compiler if T.TYPE_CHECKING: @@ -40,6 +40,14 @@ class CythonCompiler(Compiler): # compiler might though return [] + def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]: + if version_compare(self.version, '>=0.29.33'): + return ['-M'] + return [] + + def get_depfile_suffix(self) -> str: + return 'dep' + def sanity_check(self, work_dir: str, environment: 'Environment') -> None: code = 'print("hello world")' with self.cached_compile(code, environment.coredata) as p: |