1{ buildPythonPackage
2, fetchPypi
3, fetchpatch
4, pytestCheckHook
5, brotli
6, cairosvg
7, fonttools
8, pydyf
9, pyphen
10, cffi
11, cssselect
12, lxml
13, html5lib
14, tinycss
15, zopfli
16, glib
17, harfbuzz
18, pango
19, fontconfig
20, lib
21, stdenv
22, ghostscript
23, isPy3k
24, substituteAll
25}:
26
27buildPythonPackage rec {
28 pname = "weasyprint";
29 version = "53.4";
30 disabled = !isPy3k;
31
32 src = fetchPypi {
33 inherit version;
34 pname = "weasyprint";
35 sha256 = "sha256-EMyxfVXHMJa98e3T7+WMuFWwfkwwfZutTryaPxP/RYA=";
36 };
37
38 postPatch = ''
39 substituteInPlace pyproject.toml \
40 --replace "--isort --flake8 --cov --no-cov-on-fail" ""
41 '';
42
43 disabledTests = [
44 # needs the Ahem font (fails on macOS)
45 "test_font_stretch"
46 ];
47
48 checkInputs = [
49 pytestCheckHook
50 ghostscript
51 ];
52
53 FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
54
55 propagatedBuildInputs = [
56 brotli
57 cairosvg
58 cffi
59 cssselect
60 fonttools
61 html5lib
62 lxml
63 pydyf
64 pyphen
65 tinycss
66 zopfli
67 ];
68
69 patches = [
70 (substituteAll {
71 src = ./library-paths.patch;
72 fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
73 pangoft2 = "${pango.out}/lib/libpangoft2-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
74 gobject = "${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}";
75 pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
76 pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
77 harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}";
78 })
79 ];
80
81 meta = with lib; {
82 homepage = "https://weasyprint.org/";
83 description = "Converts web documents to PDF";
84 license = licenses.bsd3;
85 maintainers = with maintainers; [ elohmeier ];
86 };
87}