1{ stdenv, buildPythonPackage, dlib, python, pytest, more-itertools
2, sse4Support ? stdenv.hostPlatform.sse4_1Support
3, avxSupport ? stdenv.hostPlatform.avxSupport
4}:
5
6buildPythonPackage {
7 inherit (dlib) name src nativeBuildInputs buildInputs meta;
8
9 # although AVX can be enabled, we never test with it. Some Hydra machines
10 # fail because of this, however their build results are probably used on hardware
11 # with AVX support.
12 checkPhase = ''
13 ${python.interpreter} nix_run_setup test --no USE_AVX_INSTRUCTIONS
14 '';
15
16 setupPyBuildFlags = [
17 "--set USE_SSE4_INSTRUCTIONS=${if sse4Support then "yes" else "no"}"
18 "--set USE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}"
19 ];
20
21 patches = [ ./build-cores.patch ];
22
23 postPatch = ''
24 substituteInPlace setup.py \
25 --replace "more-itertools<6.0.0" "more-itertools" \
26 --replace "pytest==3.8" "pytest"
27 '';
28
29 checkInputs = [ pytest more-itertools ];
30
31 dontUseCmakeConfigure = true;
32}