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