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