30 buildPythonPackage rec {
31 pname = "python-mapnik";
32 version = "3.0.16-unstable-2024-02-22";
35 src = fetchFromGitHub {
37 repo = "python-mapnik";
38 rev = "5ab32f0209909cc98c26e1d86ce0c8ef29a9bf3d";
39 hash = "sha256-OqijA1WcyBcyWO8gntqp+xNIaV1Jqa0n1eMDip2OCvY=";
40 # Only needed for test data
41 fetchSubmodules = true;
45 # python-mapnik seems to depend on having the mapnik src directory
46 # structure available at build time. We just hardcode the paths.
48 src = ./find-libmapnik.patch;
49 libmapnik = "${mapnik}/lib";
51 # Use `std::optional` rather than `boost::optional`
52 # https://github.com/mapnik/python-mapnik/commit/e9f88a95a03dc081826a69da67bbec3e4cccd5eb
53 ./python-mapnik_std_optional.patch
56 stdenv = python.stdenv;
58 build-system = [ setuptools ];
61 mapnik # for mapnik_config
82 propagatedBuildInputs = [
87 configureFlags = [ "XMLPARSER=libxml2" ];
92 export BOOST_PYTHON_LIB="boost_python${"${lib.versions.major python.version}${lib.versions.minor python.version}"}"
93 export BOOST_THREAD_LIB="boost_thread"
94 export BOOST_SYSTEM_LIB="boost_system"
96 export XMLPARSER=libxml2
99 nativeCheckInputs = [ pytestCheckHook ];
106 + lib.optionalString stdenv.hostPlatform.isDarwin ''
107 # Replace the hardcoded /tmp references with $TMPDIR
108 sed -i "s,/tmp,$TMPDIR,g" test/python_tests/*.py
111 # https://github.com/mapnik/python-mapnik/issues/255
115 "test_passing_pycairo_context_pdf"
117 "test_render_with_scale_factor"
119 ++ lib.optionals stdenv.hostPlatform.isDarwin [
120 "test_passing_pycairo_context_png"
121 "test_passing_pycairo_context_svg"
122 "test_pycairo_pdf_surface1"
123 "test_pycairo_pdf_surface2"
124 "test_pycairo_pdf_surface3"
125 "test_pycairo_svg_surface1"
126 "test_pycairo_svg_surface2"
127 "test_pycairo_svg_surface3"
130 pythonImportsCheck = [ "mapnik" ];
133 description = "Python bindings for Mapnik";
135 homepage = "https://mapnik.org";
136 license = licenses.lgpl21Plus;
137 broken = true; # At 2024-11-13, test_raster_warping fails.