|
6 | 6 | from .. import knobs |
7 | 7 |
|
8 | 8 |
|
9 | | -def _build(name, src, srcdir, library_dirs, include_dirs, libraries): |
| 9 | +def _build(name: str, src: str, srcdir: str, library_dirs: list[str], include_dirs: list[str], |
| 10 | + libraries: list[str]) -> str: |
| 11 | + if impl := knobs.build.impl: |
| 12 | + return impl(name, src, srcdir, library_dirs, include_dirs, libraries) |
10 | 13 | suffix = sysconfig.get_config_var('EXT_SUFFIX') |
11 | 14 | so = os.path.join(srcdir, '{name}{suffix}'.format(name=name, suffix=suffix)) |
12 | 15 | # try to avoid setuptools if possible |
13 | 16 | cc = os.environ.get("CC") |
14 | 17 | if cc is None: |
15 | | - # TODO: support more things here. |
16 | 18 | clang = shutil.which("clang") |
17 | 19 | gcc = shutil.which("gcc") |
18 | 20 | cc = gcc if gcc is not None else clang |
19 | 21 | if cc is None: |
20 | | - raise RuntimeError("Failed to find C compiler. Please specify via CC environment variable.") |
| 22 | + raise RuntimeError( |
| 23 | + "Failed to find C compiler. Please specify via CC environment variable or set triton.knobs.build.impl.") |
21 | 24 | # This function was renamed and made public in Python 3.10 |
22 | 25 | if hasattr(sysconfig, 'get_default_scheme'): |
23 | 26 | scheme = sysconfig.get_default_scheme() |
24 | 27 | else: |
25 | | - scheme = sysconfig._get_default_scheme() |
| 28 | + scheme = sysconfig._get_default_scheme() # type: ignore |
26 | 29 | # 'posix_local' is a custom scheme on Debian. However, starting Python 3.10, the default install |
27 | 30 | # path changes to include 'local'. This change is required to use triton with system-wide python. |
28 | 31 | if scheme == 'posix_local': |
|
0 commit comments