summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/opencamlib/default.nix
blob: 101482b80711859022181b55aa21ed075e7a4bc2 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  scikit-build-core,
  cmake,
  ninja,
  stdenv,
  llvmPackages,
  boost,
  python,
}:

buildPythonPackage rec {
  pname = "opencamlib";
  version = "2023.01.11";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "aewallin";
    repo = "opencamlib";
    tag = version;
    hash = "sha256-pUj71PdWo902dqF9O6SLnpvFooFU2OfLBv8hAVsH/iA=";
  };

  build-system = [
    scikit-build-core
  ];

  buildInputs = [
    boost
  ]
  ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];

  nativeBuildInputs = [
    cmake
    ninja
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail 'version = "2022.12.18"' 'version = "${version}"'
  '';

  dontUseCmakeConfigure = true;
  env.CMAKE_ARGS = "-DVERSION_STRING=${version} -DBoost_USE_STATIC_LIBS=OFF";

  pythonImportsCheck = [ "opencamlib" ];

  checkPhase = ''
    runHook preCheck

    pushd examples/python
    # this produces a lot of non-actionalble lines on stdout
    ${python.interpreter} test.py > /dev/null
    popd

    runHook postCheck
  '';

  meta = {
    homepage = "https://github.com/aewallin/opencamlib";
    description = "Open source computer aided manufacturing algorithms library";
    # from src/deb/debian_copyright.txt
    license = lib.licenses.lgpl21Plus;
    maintainers = with lib.maintainers; [ tomjnixon ];
  };
}