at master 2.1 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 python, 6 pythonOlder, 7 8 # build 9 meson, 10 meson-python, 11 ninja, 12 nukeReferences, 13 pybind11, 14 15 # propagates 16 numpy, 17 18 # optionals 19 bokeh, 20 chromedriver, 21 selenium, 22 23 # tests 24 matplotlib, 25 pillow, 26 pytest-xdist, 27 pytestCheckHook, 28 wurlitzer, 29}: 30 31let 32 contourpy = buildPythonPackage rec { 33 pname = "contourpy"; 34 version = "1.3.3"; 35 format = "pyproject"; 36 37 disabled = pythonOlder "3.8"; 38 39 src = fetchFromGitHub { 40 owner = "contourpy"; 41 repo = "contourpy"; 42 tag = "v${version}"; 43 hash = "sha256-/tE+F1wH7YkqfgenXwtcfkjxUR5FwfgoS4NYC6n+/2M="; 44 }; 45 46 # prevent unnecessary references to the build python when cross compiling 47 postPatch = '' 48 substituteInPlace lib/contourpy/util/_build_config.py.in \ 49 --replace-fail '@python_path@' "${python.interpreter}" 50 ''; 51 52 nativeBuildInputs = [ 53 meson 54 ninja 55 nukeReferences 56 pybind11 57 ]; 58 59 build-system = [ meson-python ]; 60 61 dependencies = [ numpy ]; 62 63 passthru.optional-depdendencies = { 64 bokeh = [ 65 bokeh 66 chromedriver 67 selenium 68 ]; 69 }; 70 71 doCheck = false; # infinite recursion with matplotlib, tests in passthru 72 73 nativeCheckInputs = [ 74 matplotlib 75 pillow 76 pytestCheckHook 77 pytest-xdist 78 wurlitzer 79 ]; 80 81 passthru.tests = { 82 check = contourpy.overridePythonAttrs (_: { 83 doCheck = true; 84 }); 85 }; 86 87 pythonImportsCheck = [ "contourpy" ]; 88 89 # remove references to buildPackages.python3, which is not allowed for cross builds. 90 preFixup = '' 91 nuke-refs $out/${python.sitePackages}/contourpy/util/{_build_config.py,__pycache__/_build_config.*} 92 ''; 93 94 meta = with lib; { 95 changelog = "https://github.com/contourpy/contourpy/releases/tag/${src.tag}"; 96 description = "Python library for calculating contours in 2D quadrilateral grids"; 97 homepage = "https://github.com/contourpy/contourpy"; 98 license = licenses.bsd3; 99 maintainers = [ ]; 100 }; 101 }; 102in 103contourpy