about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix')
-rw-r--r--nixpkgs/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix b/nixpkgs/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix
new file mode 100644
index 000000000000..fb7fd1ece0e6
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix
@@ -0,0 +1,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"
+  ];
+}