summary refs log tree commit diff
path: root/pkgs/development/python-modules/bpycv/default.nix
blob: 5052cf2eb173c9664dd7a2a62d94d5e66474aaa8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ lib
, buildPythonPackage
, fetchPypi
, fetchFromGitHub
, fetchurl
, writeText
, blender
, minexr
, beautifulsoup4
, zcs
, requests
, opencv3
, boxx
}:

buildPythonPackage rec {
  pname = "bpycv";
  version = "0.2.43";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-6LXhKuNkX3yKeZARLXmOVNAUQhJghtzKhnszJ1G/a8U=";
  };

  propagatedBuildInputs = [
    beautifulsoup4
    minexr
    zcs
    requests
    opencv3
    boxx
  ];

  postPatch = ''
    sed -i 's/opencv-python//g' requirements.txt
  '';

  # pythonImportsCheck = [ "bpycv" ]; # this import depends on bpy that is only available inside blender
  nativeCheckInputs = [ blender ];
  checkPhase = let
    bpycv_example_data = fetchFromGitHub {
      owner = "DIYer22";
      repo = "bpycv_example_data";
      sha256 = "sha256-dGb6KvbXTGTu5f4AqhA+i4AwTqBoR5SdXk0vsMEcD3Q=";
      rev = "6ce0e65c107d572011394da16ffdf851e988dbb4";
    };
  in ''
    TEMPDIR=$(mktemp -d)
    pushd $TEMPDIR
      cp -r ${bpycv_example_data} example_data
      chmod +w -R example_data
      BPY_EXAMPLE_DATA=${bpycv_example_data} blender -b -P ${./bpycv-test.py}
    popd
  '';

  meta = with lib; {
    description = "Computer vision utils for Blender";
    homepage = "https://github.com/DIYer22/bpycv";
    license = licenses.mit;
    maintainers = with maintainers; [ lucasew ];
  };
}