about summary refs log tree commit diff
path: root/pkgs/development/python-modules/soxr/default.nix
blob: 841ba83259f78df32d49109ce4d56f36b1311b1c (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  cython,
  numpy,
  oldest-supported-numpy,
  setuptools,
  setuptools-scm,
  gnutar,

  # native
  libsoxr,

  # tests
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "soxr";
  version = "0.3.7";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "dofuuz";
    repo = "python-soxr";
    rev = "refs/tags/v${version}";
    fetchSubmodules = true;
    hash = "sha256-HGtoMfMQ5/2iEIFtik7mCrSxFnLXkSSx2W8wBul0+jk=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "SYS_LIBSOXR = False" "SYS_LIBSOXR = True"
  '';

  nativeBuildInputs = [
    cython
    gnutar
    numpy
    oldest-supported-numpy
    setuptools
    setuptools-scm
  ];

  buildInputs = [ libsoxr ];

  pythonImportsCheck = [ "soxr" ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = with lib; {
    description = "High quality, one-dimensional sample-rate conversion library";
    homepage = "https://github.com/dofuuz/python-soxr/tree/main";
    license = licenses.lgpl21Plus;
    maintainers = with maintainers; [ hexa ];
  };
}