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