nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 134 lines 2.7 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 replaceVars, 6 isPyPy, 7 python, 8 stdenv, 9 setuptools, 10 pillow, 11 pycairo, 12 pkg-config, 13 boost, 14 cairo, 15 harfbuzz, 16 icu, 17 libjpeg, 18 libpng, 19 libtiff, 20 libwebp, 21 mapnik, 22 proj, 23 zlib, 24 libxml2, 25 sqlite, 26 pytestCheckHook, 27 sparsehash, 28 pybind11, 29}: 30 31buildPythonPackage { 32 pname = "python-mapnik"; 33 version = "4.1.3.unstable-2025-09-25"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "mapnik"; 38 repo = "python-mapnik"; 39 rev = "4b51d57911dc6a1a9f35c62c681fbdeb56fc69d4"; 40 hash = "sha256-oXxfLvmptW1v19vaUj11nGEcTHOrneBIea2+GB6uK48="; 41 # Only needed for test data 42 fetchSubmodules = true; 43 }; 44 45 patches = [ 46 # python-mapnik seems to depend on having the mapnik src directory 47 # structure available at build time. We just hardcode the paths. 48 (replaceVars ./find-libmapnik.patch { 49 libmapnik = "${mapnik}/lib"; 50 }) 51 ]; 52 53 build-system = [ setuptools ]; 54 55 nativeBuildInputs = [ 56 mapnik # for mapnik_config 57 pkg-config 58 pybind11 59 ]; 60 61 dependencies = [ 62 mapnik 63 boost 64 cairo 65 harfbuzz 66 icu 67 libjpeg 68 libpng 69 libtiff 70 libwebp 71 proj 72 zlib 73 libxml2 74 sqlite 75 sparsehash 76 ]; 77 78 propagatedBuildInputs = [ 79 pillow 80 pycairo 81 ]; 82 83 configureFlags = [ "XMLPARSER=libxml2" ]; 84 85 disabled = isPyPy; 86 87 preBuild = '' 88 export BOOST_PYTHON_LIB="boost_python${"${lib.versions.major python.version}${lib.versions.minor python.version}"}" 89 export BOOST_THREAD_LIB="boost_thread" 90 export BOOST_SYSTEM_LIB="boost_system" 91 export PYCAIRO=true 92 export XMLPARSER=libxml2 93 ''; 94 95 nativeCheckInputs = [ pytestCheckHook ]; 96 97 preCheck = '' 98 # import from $out 99 rm -r mapnik 100 '' 101 + lib.optionalString stdenv.hostPlatform.isDarwin '' 102 # Replace the hardcoded /tmp references with $TMPDIR 103 sed -i "s,/tmp,$TMPDIR,g" test/python_tests/*.py 104 ''; 105 106 # https://github.com/mapnik/python-mapnik/issues/255 107 disabledTests = [ 108 "test_geometry_type" 109 "test_passing_pycairo_context_pdf" 110 "test_pdf_printing" 111 "test_render_with_scale_factor" 112 "test_raster_warping" 113 "test_pycairo_svg_surface1" 114 ] 115 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 116 "test_passing_pycairo_context_png" 117 "test_passing_pycairo_context_svg" 118 "test_pycairo_pdf_surface1" 119 "test_pycairo_pdf_surface2" 120 "test_pycairo_pdf_surface3" 121 "test_pycairo_svg_surface2" 122 "test_pycairo_svg_surface3" 123 ]; 124 125 pythonImportsCheck = [ "mapnik" ]; 126 127 meta = { 128 description = "Python bindings for Mapnik"; 129 homepage = "https://mapnik.org"; 130 license = lib.licenses.lgpl21Plus; 131 teams = [ lib.teams.geospatial ]; 132 broken = true; 133 }; 134}