1{
2 buildPythonPackage,
3 dlib,
4 pytestCheckHook,
5 more-itertools,
6}:
7
8buildPythonPackage {
9 inherit (dlib)
10 stdenv
11 pname
12 version
13 src
14 nativeBuildInputs
15 buildInputs
16 cmakeFlags
17 passthru
18 meta
19 ;
20
21 format = "setuptools";
22
23 patches = [ ./build-cores.patch ];
24
25 nativeCheckInputs = [
26 pytestCheckHook
27 more-itertools
28 ];
29
30 postPatch = ''
31 substituteInPlace setup.py \
32 --replace "more-itertools<6.0.0" "more-itertools" \
33 --replace "pytest==3.8" "pytest"
34 '';
35
36 # Pass CMake flags through to the build script
37 preConfigure = ''
38 for flag in $cmakeFlags; do
39 if [[ "$flag" == -D* ]]; then
40 setupPyBuildFlags+=" --set ''${flag#-D}"
41 fi
42 done
43 '';
44
45 dontUseCmakeConfigure = true;
46
47 doCheck =
48 !(
49 # The tests attempt to use CUDA on the build platform.
50 # https://github.com/NixOS/nixpkgs/issues/225912
51 dlib.cudaSupport
52
53 # although AVX can be enabled, we never test with it. Some Hydra machines
54 # fail because of this, however their build results are probably used on hardware
55 # with AVX support.
56 || dlib.avxSupport
57 );
58}