summary refs log tree commit diff
path: root/pkgs/development/python-modules/python-mapnik/default.nix
blob: 228e0d74ebc26937df7c5a3d4102cd65c49f036d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{ lib
, buildPythonPackage
, isPyPy
, python
, pkgs
, pillow
, pycairo
}:

let
  boost = pkgs.boost.override {
    enablePython = true;
    inherit python;
  };
  mapnik = pkgs.mapnik.override {
    inherit python boost;
  };

in buildPythonPackage rec {
  pname = "python-mapnik";
  version = "unstable-2020-02-24";

  src = pkgs.fetchFromGitHub {
    owner = "mapnik";
    repo = "python-mapnik";
    rev = "7da019cf9eb12af8f8aa88b7d75789dfcd1e901b";
    sha256 = "0snn7q7w1ab90311q8wgd1z64kw1svm5w831q0xd6glqhah86qc8";
  };

  disabled = isPyPy;
  doCheck = false; # doesn't find needed test data files
  preBuild = let
    pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
  in ''
    export BOOST_PYTHON_LIB="boost_python${pythonVersion}"
    export BOOST_THREAD_LIB="boost_thread"
    export BOOST_SYSTEM_LIB="boost_system"
    export PYCAIRO=true
  '';

  nativeBuildInputs = [
    mapnik # for mapnik_config
    pkgs.pkgconfig
  ];

  patches = [
    ./find-pycairo-with-pkg-config.patch
  ];

  buildInputs = [
    mapnik
    boost
  ] ++ (with pkgs; [
    cairo
    harfbuzz
    icu
    libjpeg
    libpng
    libtiff
    libwebp
    proj
    zlib
  ]);
  propagatedBuildInputs = [ pillow pycairo ];

  pythonImportsCheck = [ "mapnik" ] ;

  meta = with lib; {
    description = "Python bindings for Mapnik";
    homepage = "https://mapnik.org";
    license  = licenses.lgpl21;
  };

}