about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/preprocess-cancellation/default.nix
blob: dc571f076fe307d36ed7f0014cfccebca4f88421 (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
61
62
63
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, poetry-core
, setuptools
, shapely
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "preprocess-cancellation";
  version = "0.2.0";
  disabled = pythonOlder "3.6"; # >= 3.6
  format = "pyproject";

  # No tests in PyPI
  src = fetchFromGitHub {
    owner = "kageurufu";
    repo = "cancelobject-preprocessor";
    rev = version;
    hash = "sha256-mn3/etXA5dkL+IsyxwD4/XjU/t4/roYFVyqQxlLOoOI=";
  };

  patches = [
    ./pep-621.patch
  ];

  postPatch = ''
    sed -i "/^addopts/d" pyproject.toml

    # setuptools 61 compatibility
    # error: Multiple top-level packages discovered in a flat-layout: ['STLs', 'GCode'].
    mkdir tests
    mv GCode STLs test_* tests
    substituteInPlace tests/test_preprocessor.py \
      --replace "./GCode" "./tests/GCode"
    substituteInPlace tests/test_preprocessor_with_shapely.py \
      --replace "./GCode" "./tests/GCode"
  '';

  nativeBuildInputs = [
    poetry-core
    setuptools
  ];

  propagatedBuildInputs = [
    shapely
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [ "preprocess_cancellation" ];

  meta = with lib; {
    description = "Klipper GCode Preprocessor for Object Cancellation";
    homepage = "https://github.com/kageurufu/cancelobject-preprocessor";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ zhaofengli ];
  };
}