Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 07ea080

Browse files
committed
plugins: model: vowpalWabbit: Check for boost
Signed-off-by: John Andersen <[email protected]>
1 parent 63f0e33 commit 07ea080

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

dffml/plugins.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
"""
55
import os
66
import sys
7+
import pathlib
8+
import inspect
9+
import tempfile
710
import contextlib
11+
import subprocess
812
import importlib.util
913

1014

@@ -58,8 +62,39 @@ def check_daal4py():
5862
return bool(spec is not None)
5963

6064

65+
def check_boost():
66+
# TODO Implement check on Windows
67+
if os.name == "nt":
68+
return True
69+
with tempfile.TemporaryDirectory() as tempdir:
70+
c_file = pathlib.Path(tempdir, "main.c")
71+
c_file.write_text(
72+
inspect.cleandoc(
73+
r"""
74+
#include <boost/version.hpp>
75+
76+
int main() {
77+
return 0;
78+
}
79+
"""
80+
)
81+
)
82+
return bool(
83+
subprocess.call(
84+
["c++", str(c_file)],
85+
cwd=tempdir,
86+
stdout=subprocess.DEVNULL,
87+
stderr=subprocess.DEVNULL,
88+
)
89+
== 0
90+
)
91+
92+
6193
CORE_PLUGIN_DEPS = {
62-
("model", "vowpalWabbit"): {"cmake": lambda: inpath("cmake")},
94+
("model", "vowpalWabbit"): {
95+
"cmake": lambda: inpath("cmake"),
96+
"boost": check_boost,
97+
},
6398
("model", "autosklearn"): {
6499
"swig": lambda: inpath("swig"),
65100
"cython": lambda: inpath("cython"),

0 commit comments

Comments
 (0)