summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/bwapy/default.nix
blob: 6de156ff9d2eb4a5a998045b58479b9de67fdfce (plain)
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
{
  lib,
  buildPythonPackage,
  pythonAtLeast,
  fetchPypi,
  bwa,
  cffi,
  zlib,
}:

buildPythonPackage rec {
  pname = "bwapy";
  version = "0.1.4";
  format = "setuptools";

  # uses the removed imp module
  disabled = pythonAtLeast "3.12";

  src = fetchPypi {
    inherit pname version;
    sha256 = "090qwx3vl729zn3a7sksbviyg04kc71gpbm3nd8dalqp673x1npw";
  };
  postPatch = ''
    # replace bundled bwa
    rm -r bwa/*
    cp ${bwa}/lib/*.a ${bwa}/include/*.h bwa/

    substituteInPlace setup.py \
      --replace 'setuptools>=49.2.0' 'setuptools'
  '';

  buildInputs = [
    zlib
    bwa
  ];

  propagatedBuildInputs = [ cffi ];

  # no tests
  doCheck = false;
  pythonImportsCheck = [ "bwapy" ];

  meta = {
    homepage = "https://github.com/ACEnglish/bwapy";
    description = "Python bindings to bwa mem aligner";
    mainProgram = "bwamempy";
    license = lib.licenses.mpl20;
    maintainers = with lib.maintainers; [ ris ];
  };
}