summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/py-libnuma/default.nix
blob: 90310b81b4c33efe33c364498d3af91b02c02939 (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
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  setuptools,
  numactl,
}:

buildPythonPackage {
  pname = "py-libnuma";
  version = "1.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "eedalong";
    repo = "pynuma";
    rev = "66cab0e008b850a04cfec5c4fb3f50bf28e3d488";
    hash = "sha256-ALYCcdN5eXrVWsTRwkHCwo4xsLMs/du3mUl1xSlo5iU=";
  };

  postPatch = ''
    substituteInPlace numa/__init__.py \
      --replace-fail \
        'LIBNUMA = CDLL(find_library("numa"))' \
        'LIBNUMA = CDLL("${numactl}/lib/libnuma${stdenv.hostPlatform.extensions.sharedLibrary}")'
  '';

  build-system = [ setuptools ];

  dependencies = [
    numactl
  ];

  # Tests write NUMA configuration, which may be persistent until reboot.
  doCheck = false;

  pythonImportsCheck = [ "numa" ];

  meta = {
    description = "Python3 Interface to numa Linux library";
    homepage = "https://github.com/eedalong/pynuma";
    platforms = lib.platforms.linux;
    license = lib.licenses.mit;
  };
}