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