tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
0
fork
atom
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
0
fork
atom
overview
issues
pulls
pipelines
python3Packages.weasyprint: 52 -> 54.3
Rasmus Précenth
4 years ago
abbba8eb
e9511873
+69
-55
2 changed files
expand all
collapse all
unified
split
pkgs
development
python-modules
weasyprint
default.nix
library-paths.patch
+43
-22
pkgs/development/python-modules/weasyprint/default.nix
reviewed
···
1
1
{ buildPythonPackage,
2
2
fetchPypi,
3
3
fetchpatch,
4
4
+
pytestCheckHook,
5
5
+
brotli,
4
6
cairosvg,
7
7
+
fonttools,
8
8
+
pydyf,
5
9
pyphen,
6
10
cffi,
7
11
cssselect,
8
12
lxml,
9
13
html5lib,
10
14
tinycss,
15
15
+
zopfli,
11
16
glib,
17
17
+
harfbuzz,
12
18
pango,
13
19
fontconfig,
14
20
lib, stdenv,
21
21
+
ghostscript,
15
22
pytest,
16
23
pytest-runner,
17
24
pytest-isort,
···
30
23
31
24
buildPythonPackage rec {
32
25
pname = "weasyprint";
33
33
-
version = "52";
26
26
+
version = "53.4";
34
27
disabled = !isPy3k;
35
28
36
36
-
# excluded test needs the Ahem font
37
37
-
checkPhase = ''
38
38
-
runHook preCheck
39
39
-
pytest -k 'not test_font_stretch'
40
40
-
runHook postCheck
41
41
-
'';
29
29
+
pytestFlagsArray = [
30
30
+
# setup.py is auto-generated and doesn't pass the flake8 check
31
31
+
"--ignore=setup.py"
32
32
+
# ffi.py is patched by us and doesn't pass the flake8 check
33
33
+
"--ignore=weasyprint/text/ffi.py"
34
34
+
];
42
35
43
43
-
# ignore failing flake8-test
44
44
-
prePatch = ''
45
45
-
substituteInPlace setup.cfg \
46
46
-
--replace '[tool:pytest]' '[tool:pytest]\nflake8-ignore = E501'
47
47
-
'';
36
36
+
disabledTests = [
37
37
+
# test_font_stretch needs the Ahem font (fails on macOS)
38
38
+
"test_font_stretch"
39
39
+
];
48
40
49
49
-
checkInputs = [ pytest pytest-runner pytest-isort pytest-flake8 pytest-cov ];
41
41
+
checkInputs = [
42
42
+
pytestCheckHook
43
43
+
ghostscript
44
44
+
pytest
45
45
+
pytest-runner
46
46
+
pytest-isort
47
47
+
pytest-flake8
48
48
+
pytest-cov
49
49
+
];
50
50
51
51
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
52
52
53
53
-
propagatedBuildInputs = [ cairosvg pyphen cffi cssselect lxml html5lib tinycss ];
53
53
+
propagatedBuildInputs = [
54
54
+
brotli
55
55
+
cairosvg
56
56
+
cffi
57
57
+
cssselect
58
58
+
fonttools
59
59
+
html5lib
60
60
+
lxml
61
61
+
pydyf
62
62
+
pyphen
63
63
+
tinycss
64
64
+
zopfli
65
65
+
];
54
66
55
55
-
# 47043a1fd7e50a892b9836466f521df85d597c4.patch can be removed after next release of weasyprint, see:
56
56
-
# https://github.com/Kozea/WeasyPrint/issues/1333#issuecomment-818062970
57
67
patches = [
58
58
-
(fetchpatch {
59
59
-
url = "https://github.com/Kozea/WeasyPrint/commit/47043a1fd7e50a892b9836466f521df85d597c44.patch";
60
60
-
sha256 = "0l9z0hrav3bcdajlg3vbzljq0lkw7hlj8ppzrq3v21hbj1il1nsb";
61
61
-
})
62
68
(substituteAll {
63
69
src = ./library-paths.patch;
64
70
fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
···
79
59
gobject = "${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}";
80
60
pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
81
61
pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
62
62
+
harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}";
82
63
})
83
64
];
84
65
85
66
src = fetchPypi {
86
67
inherit version;
87
87
-
pname = "WeasyPrint";
88
88
-
sha256 = "0rwf43111ws74m8b1alkkxzz57g0np3vmd8as74adwnxslfcg4gs";
68
68
+
pname = "weasyprint";
69
69
+
sha256 = "sha256-EMyxfVXHMJa98e3T7+WMuFWwfkwwfZutTryaPxP/RYA=";
89
70
};
90
71
91
72
meta = with lib; {
+26
-33
pkgs/development/python-modules/weasyprint/library-paths.patch
reviewed
···
1
1
-
diff --git a/weasyprint/fonts.py b/weasyprint/fonts.py
2
2
-
index 79e3b5b..4438eb4 100644
3
3
-
--- a/weasyprint/fonts.py
4
4
-
+++ b/weasyprint/fonts.py
5
5
-
@@ -45,11 +45,8 @@ else:
6
6
-
# with OSError: dlopen() failed to load a library: cairo / cairo-2
7
7
-
# So let's hope we find the same file as cairo already did ;)
8
8
-
# Same applies to pangocairo requiring pangoft2
9
9
-
- fontconfig = dlopen(ffi, 'fontconfig', 'libfontconfig',
10
10
-
- 'libfontconfig-1.dll',
11
11
-
- 'libfontconfig.so.1', 'libfontconfig-1.dylib')
12
12
-
- pangoft2 = dlopen(ffi, 'pangoft2-1.0', 'libpangoft2-1.0-0',
13
13
-
- 'libpangoft2-1.0.so.0', 'libpangoft2-1.0.dylib')
14
14
-
+ fontconfig = dlopen(ffi, '@fontconfig@')
15
15
-
+ pangoft2 = dlopen(ffi, '@pangoft2@')
16
16
-
17
17
-
ffi.cdef('''
18
18
-
// FontConfig
19
19
-
diff --git a/weasyprint/text.py b/weasyprint/text.py
20
20
-
index 1dc5e4d..b070bad 100644
21
21
-
--- a/weasyprint/text.py
22
22
-
+++ b/weasyprint/text.py
23
23
-
@@ -255,12 +255,9 @@ def dlopen(ffi, *names):
1
1
+
diff --git a/weasyprint/text/ffi.py b/weasyprint/text/ffi.py
2
2
+
index 0734cbea..22e31a5e 100644
3
3
+
--- a/weasyprint/text/ffi.py
4
4
+
+++ b/weasyprint/text/ffi.py
5
5
+
@@ -387,21 +387,11 @@ def _dlopen(ffi, *names):
24
6
return ffi.dlopen(names[0]) # pragma: no cover
25
7
26
8
27
27
-
-gobject = dlopen(ffi, 'gobject-2.0', 'libgobject-2.0-0', 'libgobject-2.0.so.0',
28
28
-
- 'libgobject-2.0.dylib')
29
29
-
-pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so.0',
30
30
-
- 'libpango-1.0.dylib')
31
31
-
-pangocairo = dlopen(ffi, 'pangocairo-1.0', 'libpangocairo-1.0-0',
32
32
-
- 'libpangocairo-1.0.so.0', 'libpangocairo-1.0.dylib')
33
33
-
+gobject = dlopen(ffi, '@gobject@')
34
34
-
+pango = dlopen(ffi, '@pango@')
35
35
-
+pangocairo = dlopen(ffi, '@pangocairo@')
9
9
+
-gobject = _dlopen(
10
10
+
- ffi, 'gobject-2.0-0', 'gobject-2.0', 'libgobject-2.0-0',
11
11
+
- 'libgobject-2.0.so.0', 'libgobject-2.0.dylib')
12
12
+
-pango = _dlopen(
13
13
+
- ffi, 'pango-1.0-0', 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so.0',
14
14
+
- 'libpango-1.0.dylib')
15
15
+
-harfbuzz = _dlopen(
16
16
+
- ffi, 'harfbuzz', 'harfbuzz-0.0', 'libharfbuzz-0',
17
17
+
- 'libharfbuzz.so.0', 'libharfbuzz.so.0', 'libharfbuzz.0.dylib')
18
18
+
-fontconfig = _dlopen(
19
19
+
- ffi, 'fontconfig-1', 'fontconfig', 'libfontconfig', 'libfontconfig-1.dll',
20
20
+
- 'libfontconfig.so.1', 'libfontconfig-1.dylib')
21
21
+
-pangoft2 = _dlopen(
22
22
+
- ffi, 'pangoft2-1.0-0', 'pangoft2-1.0', 'libpangoft2-1.0-0',
23
23
+
- 'libpangoft2-1.0.so.0', 'libpangoft2-1.0.dylib')
24
24
+
+gobject = _dlopen(ffi, '@gobject@')
25
25
+
+pango = _dlopen(ffi, '@pango@')
26
26
+
+harfbuzz = _dlopen(ffi, '@harfbuzz@')
27
27
+
+fontconfig = _dlopen(ffi, '@fontconfig@')
28
28
+
+pangoft2 = _dlopen(ffi, '@pangoft2@')
36
29
37
30
gobject.g_type_init()
38
38
-
31
31
+