2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
substituteAll,
|
|
|
|
isPyPy,
|
|
|
|
python,
|
|
|
|
pillow,
|
|
|
|
pycairo,
|
|
|
|
pkg-config,
|
|
|
|
boost,
|
|
|
|
cairo,
|
|
|
|
harfbuzz,
|
|
|
|
icu,
|
|
|
|
libjpeg,
|
|
|
|
libpng,
|
|
|
|
libtiff,
|
|
|
|
libwebp,
|
|
|
|
mapnik,
|
|
|
|
proj,
|
|
|
|
zlib,
|
|
|
|
libxml2,
|
|
|
|
sqlite,
|
|
|
|
nose,
|
|
|
|
pytestCheckHook,
|
|
|
|
stdenv,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "python-mapnik";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "unstable-2023-02-23";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
src = fetchFromGitHub {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "mapnik";
|
|
|
|
repo = "python-mapnik";
|
2024-01-13 08:15:51 +00:00
|
|
|
# Use proj6 branch in order to support Proj >= 6 (excluding commits after 2023-02-23)
|
|
|
|
# https://github.com/mapnik/python-mapnik/compare/master...proj6
|
|
|
|
rev = "687b2c72a24c59d701d62e4458c380f8c54f0549";
|
|
|
|
hash = "sha256-q3Snd3K/JndckwAVwSKU+kFK5E1uph78ty7mwVo/7Ik=";
|
2022-11-21 17:40:18 +00:00
|
|
|
# Only needed for test data
|
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
patches = [
|
|
|
|
# python-mapnik seems to depend on having the mapnik src directory
|
|
|
|
# structure available at build time. We just hardcode the paths.
|
|
|
|
(substituteAll {
|
|
|
|
src = ./find-libmapnik.patch;
|
|
|
|
libmapnik = "${mapnik}/lib";
|
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
mapnik # for mapnik_config
|
2021-08-05 21:33:18 +00:00
|
|
|
pkg-config
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
|
|
|
mapnik
|
2024-01-13 08:15:51 +00:00
|
|
|
boost
|
2020-04-24 23:36:52 +00:00
|
|
|
cairo
|
|
|
|
harfbuzz
|
|
|
|
icu
|
|
|
|
libjpeg
|
|
|
|
libpng
|
|
|
|
libtiff
|
|
|
|
libwebp
|
|
|
|
proj
|
|
|
|
zlib
|
2022-11-21 17:40:18 +00:00
|
|
|
libxml2
|
|
|
|
sqlite
|
2021-08-05 21:33:18 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pillow
|
|
|
|
pycairo
|
2022-11-21 17:40:18 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
configureFlags = [ "XMLPARSER=libxml2" ];
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
disabled = isPyPy;
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export BOOST_PYTHON_LIB="boost_python${"${lib.versions.major python.version}${lib.versions.minor python.version}"}"
|
|
|
|
export BOOST_THREAD_LIB="boost_thread"
|
|
|
|
export BOOST_SYSTEM_LIB="boost_system"
|
|
|
|
export PYCAIRO=true
|
|
|
|
export XMLPARSER=libxml2
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
nose
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
preCheck =
|
|
|
|
''
|
|
|
|
# import from $out
|
|
|
|
rm -r mapnik
|
|
|
|
''
|
|
|
|
+ lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Replace the hardcoded /tmp references with $TMPDIR
|
|
|
|
sed -i "s,/tmp,$TMPDIR,g" test/python_tests/*.py
|
|
|
|
'';
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
# https://github.com/mapnik/python-mapnik/issues/255
|
|
|
|
disabledTests = [
|
2023-05-24 13:37:59 +00:00
|
|
|
"test_geometry_type"
|
2024-01-13 08:15:51 +00:00
|
|
|
"test_marker_ellipse_render1"
|
|
|
|
"test_marker_ellipse_render2"
|
2022-11-21 17:40:18 +00:00
|
|
|
"test_normalizing_definition"
|
2024-01-13 08:15:51 +00:00
|
|
|
"test_passing_pycairo_context_pdf"
|
2022-11-21 17:40:18 +00:00
|
|
|
"test_pdf_printing"
|
|
|
|
"test_visual_zoom_all_rendering2"
|
|
|
|
"test_wgs84_inverse_forward"
|
2024-06-05 15:53:02 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [ "test_passing_pycairo_context_svg" ];
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
pythonImportsCheck = [ "mapnik" ];
|
2021-05-29 03:34:57 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python bindings for Mapnik";
|
2023-04-12 12:48:02 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://mapnik.org";
|
2022-11-21 17:40:18 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|