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