1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, fetchpatch 5, substituteAll 6, isPyPy 7, python 8, pillow 9, pycairo 10, pkg-config 11, boost 12, cairo 13, harfbuzz 14, icu 15, libjpeg 16, libpng 17, libtiff 18, libwebp 19, mapnik 20, proj 21, zlib 22, libxml2 23, sqlite 24, nose 25, pytestCheckHook 26}: 27 28buildPythonPackage rec { 29 pname = "python-mapnik"; 30 version = "unstable-2020-09-08"; 31 32 src = fetchFromGitHub { 33 owner = "mapnik"; 34 repo = "python-mapnik"; 35 rev = "a2c2a86eec954b42d7f00093da03807d0834b1b4"; 36 hash = "sha256-GwDdrutJOHtW7pIWiUAiu1xucmRvp7YFYB3YSCrDsrY="; 37 # Only needed for test data 38 fetchSubmodules = true; 39 }; 40 41 patches = [ 42 # https://github.com/mapnik/python-mapnik/issues/239 43 (fetchpatch { 44 url = "https://github.com/koordinates/python-mapnik/commit/318b1edac16f48a7f21902c192c1dd86f6210a44.patch"; 45 sha256 = "sha256-cfU8ZqPPGCqoHEyGvJ8Xy/bGpbN2vSDct6A3N5+I8xM="; 46 }) 47 ./find-pycairo-with-pkg-config.patch 48 # python-mapnik seems to depend on having the mapnik src directory 49 # structure available at build time. We just hardcode the paths. 50 (substituteAll { 51 src = ./find-libmapnik.patch; 52 libmapnik = "${mapnik}/lib"; 53 }) 54 ]; 55 56 nativeBuildInputs = [ 57 mapnik # for mapnik_config 58 pkg-config 59 ]; 60 61 buildInputs = [ 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 ]; 76 77 propagatedBuildInputs = [ pillow pycairo ]; 78 79 configureFlags = [ 80 "XMLPARSER=libxml2" 81 ]; 82 83 disabled = isPyPy; 84 85 preBuild = '' 86 export BOOST_PYTHON_LIB="boost_python${"${lib.versions.major python.version}${lib.versions.minor python.version}"}" 87 export BOOST_THREAD_LIB="boost_thread" 88 export BOOST_SYSTEM_LIB="boost_system" 89 export PYCAIRO=true 90 export XMLPARSER=libxml2 91 ''; 92 93 checkInputs = [ 94 nose 95 pytestCheckHook 96 ]; 97 98 preCheck = '' 99 # import from $out 100 rm -r mapnik 101 ''; 102 103 # https://github.com/mapnik/python-mapnik/issues/255 104 disabledTests = [ 105 "test_adding_datasource_to_layer" 106 "test_compare_map" 107 "test_dataraster_coloring" 108 "test_dataraster_query_point" 109 "test_good_files" 110 "test_layer_init" 111 "test_load_save_map" 112 "test_loading_fontset_from_map" 113 "test_normalizing_definition" 114 "test_pdf_printing" 115 "test_proj_antimeridian_bbox" 116 "test_proj_transform_between_init_and_literal" 117 "test_pycairo_pdf_surface1" 118 "test_pycairo_svg_surface1" 119 "test_query_tolerance" 120 "test_raster_warping" 121 "test_raster_warping_does_not_overclip_source" 122 "test_render_points" 123 "test_render_with_scale_factor" 124 "test_style_level_image_filter" 125 "test_that_coordinates_do_not_overflow_and_polygon_is_rendered_csv" 126 "test_that_coordinates_do_not_overflow_and_polygon_is_rendered_memory" 127 "test_transparency_levels" 128 "test_visual_zoom_all_rendering1" 129 "test_visual_zoom_all_rendering2" 130 "test_wgs84_inverse_forward" 131 ]; 132 133 pythonImportsCheck = [ "mapnik" ]; 134 135 meta = with lib; { 136 description = "Python bindings for Mapnik"; 137 maintainers = with maintainers; [ erictapen ]; 138 homepage = "https://mapnik.org"; 139 license = licenses.lgpl21Plus; 140 }; 141}