nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, poetry-core
6, shapely
7, pytestCheckHook
8}:
9
10buildPythonPackage rec {
11 pname = "preprocess-cancellation";
12 version = "0.2.0";
13 disabled = pythonOlder "3.6"; # >= 3.6
14 format = "pyproject";
15
16 # No tests in PyPI
17 src = fetchFromGitHub {
18 owner = "kageurufu";
19 repo = "cancelobject-preprocessor";
20 rev = version;
21 hash = "sha256-mn3/etXA5dkL+IsyxwD4/XjU/t4/roYFVyqQxlLOoOI=";
22 };
23
24 patches = [
25 ./pep-621.patch
26 ];
27
28 postPatch = ''
29 sed -i "/^addopts/d" pyproject.toml
30
31 # setuptools 61 compatibility
32 # error: Multiple top-level packages discovered in a flat-layout: ['STLs', 'GCode'].
33 mkdir tests
34 mv GCode STLs test_* tests
35 substituteInPlace tests/test_preprocessor.py \
36 --replace "./GCode" "./tests/GCode"
37 substituteInPlace tests/test_preprocessor_with_shapely.py \
38 --replace "./GCode" "./tests/GCode"
39 '';
40
41 nativeBuildInputs = [
42 poetry-core
43 ];
44
45 propagatedBuildInputs = [
46 shapely
47 ];
48
49 checkInputs = [
50 pytestCheckHook
51 ];
52
53 pythonImportsCheck = [ "preprocess_cancellation" ];
54
55 meta = with lib; {
56 description = "Klipper GCode Preprocessor for Object Cancellation";
57 homepage = "https://github.com/kageurufu/cancelobject-preprocessor";
58 license = licenses.gpl3Only;
59 maintainers = with maintainers; [ zhaofengli ];
60 };
61}