2
0
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-29 09:04:17 +00:00
nixpkgs/pkgs/development/python-modules/dlib/default.nix
Daniel Nagy 7db40fa5d5
python3Packages.dlib: support sse4 instructions
My understanding of the line that is removed is, that the logic is
wrong. According to the setup.py file[0] it says that:

> To exclude certain options in the cmake config use --no:
>     for example:
>     --no USE_AVX_INSTRUCTIONS: will set -DUSE_AVX_INSTRUCTIONS=no

This means, that a true value of `avxSupport` will deactivate it in the
setup, which is not what we want.

[0]: https://github.com/davisking/dlib/blob/v19.21/setup.py#L22
2021-02-25 22:49:08 +01:00

33 lines
978 B
Nix

{ buildPythonPackage, stdenv, lib, dlib, python, pytest, more-itertools
, sse4Support ? stdenv.hostPlatform.sse4_1Support
, avxSupport ? stdenv.hostPlatform.avxSupport
}:
buildPythonPackage {
inherit (dlib) name src nativeBuildInputs buildInputs meta;
# although AVX can be enabled, we never test with it. Some Hydra machines
# fail because of this, however their build results are probably used on hardware
# with AVX support.
checkPhase = ''
${python.interpreter} nix_run_setup test --no USE_AVX_INSTRUCTIONS
'';
setupPyBuildFlags = [
"--set USE_SSE4_INSTRUCTIONS=${if sse4Support then "yes" else "no"}"
"--set USE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}"
];
patches = [ ./build-cores.patch ];
postPatch = ''
substituteInPlace setup.py \
--replace "more-itertools<6.0.0" "more-itertools" \
--replace "pytest==3.8" "pytest"
'';
checkInputs = [ pytest more-itertools ];
dontUseCmakeConfigure = true;
}