about summary refs log tree commit diff
path: root/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix
blob: fb7fd1ece0e65256b0389c52e70112b8ea218759 (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
{ lib
, buildPythonPackage
, autodock-vina
, boost
, swig
, setuptools
, numpy
}:

buildPythonPackage {
  inherit (autodock-vina) pname version src meta;

  format = "pyproject";

  sourceRoot = "${autodock-vina.src.name}/build/python";

  postPatch = ''
    # wildcards are not allowed
    # https://github.com/ccsb-scripps/AutoDock-Vina/issues/176
    substituteInPlace setup.py \
      --replace "python_requires='>=3.5.*'" "python_requires='>=3.5'"

    # setupPyBuildFlags are not applied with `format = "pyproject"`
    substituteInPlace setup.py \
      --replace "= locate_boost()" "= '${lib.getDev boost}/include', '${boost}/lib'"

    # this line attempts to delete the source code
    substituteInPlace setup.py \
      --replace "shutil.rmtree('src')" "..."

    # np.int is deprecated
    # https://github.com/ccsb-scripps/AutoDock-Vina/pull/167 and so on
    substituteInPlace vina/vina.py \
      --replace "np.int" "int"
  '';

  nativeBuildInputs = [
    setuptools
    swig
  ];

  buildInputs = [
    boost
  ];

  propagatedBuildInputs = [
    numpy
  ];

  # upstrem has no tests
  doCheck = false;

  pythonImportsCheck = [
    "vina"
  ];
}