-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweasyprint.nix
110 lines (97 loc) · 2.47 KB
/
weasyprint.nix
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{ buildPythonPackage
, fetchPypi
, pytestCheckHook
, brotli
, flit-core
, fonttools
, pydyf
, pyphen
, cffi
, cssselect2
, pillow
, html5lib
, tinycss2
, zopfli
, glib
, harfbuzz
, pango
, fontconfig
, lib
, stdenv
, ghostscript
, isPy3k
, substituteAll
}:
buildPythonPackage rec {
pname = "weasyprint";
version = "54.1";
disabled = !isPy3k;
format = "pyproject";
src =
(builtins.fetchTarball {
# Descriptive name to make the store path easier to identify
name = "weasyprint-54.x-b33df96";
url = "https://github.com/kozea/weasyprint/archive/b33df96de05357751257db94bcc5a91daeed96bb.tar.gz";
# Hash obtained using `nix-prefetch-url --unpack <url>`
sha256 = "1w9chxzaif1vmijc45c75c084vszzx8p27ri3mcaxia9m1qckkvq";
});
# fetchPypi {
# inherit version;
# pname = "weasyprint";
# sha256 = "sha256-+lfbhi4GvQHF59gtrTmbO5lSo5gnAjwXvumxwGH/G70=";
# };
patches = [
(substituteAll {
src = ./library-paths.patch;
fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
pangoft2 = "${pango.out}/lib/libpangoft2-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
gobject = "${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}";
pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}";
})
];
nativeBuildInputs = [
flit-core
];
propagatedBuildInputs = [
brotli
cffi
cssselect2
pillow
fonttools
html5lib
flit-core
pydyf
pyphen
tinycss2
zopfli
];
checkInputs = [
pytestCheckHook
ghostscript
];
disabledTests = [
# needs the Ahem font (fails on macOS)
"test_font_stretch"
# sensitive to sandbox environments
"test_tab_size"
"test_tabulation_character"
"test_http"
];
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
makeWrapperArgs = [ "--set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf" ];
postPatch = ''
substituteInPlace pyproject.toml \
--replace "--isort --flake8 --cov --no-cov-on-fail" ""
'';
preCheck = ''
# Fontconfig wants to create a cache.
export HOME=$TMPDIR
'';
meta = with lib; {
homepage = "https://weasyprint.org/";
description = "Converts web documents to PDF";
license = licenses.bsd3;
maintainers = with maintainers; [ elohmeier ];
};
}