forked from mirrors/nixpkgs
python3Packages.weasyprint: 52 -> 54.3
This commit is contained in:
parent
e951187304
commit
abbba8eb4c
|
@ -1,17 +1,24 @@
|
||||||
{ buildPythonPackage,
|
{ buildPythonPackage,
|
||||||
fetchPypi,
|
fetchPypi,
|
||||||
fetchpatch,
|
fetchpatch,
|
||||||
|
pytestCheckHook,
|
||||||
|
brotli,
|
||||||
cairosvg,
|
cairosvg,
|
||||||
|
fonttools,
|
||||||
|
pydyf,
|
||||||
pyphen,
|
pyphen,
|
||||||
cffi,
|
cffi,
|
||||||
cssselect,
|
cssselect,
|
||||||
lxml,
|
lxml,
|
||||||
html5lib,
|
html5lib,
|
||||||
tinycss,
|
tinycss,
|
||||||
|
zopfli,
|
||||||
glib,
|
glib,
|
||||||
|
harfbuzz,
|
||||||
pango,
|
pango,
|
||||||
fontconfig,
|
fontconfig,
|
||||||
lib, stdenv,
|
lib, stdenv,
|
||||||
|
ghostscript,
|
||||||
pytest,
|
pytest,
|
||||||
pytest-runner,
|
pytest-runner,
|
||||||
pytest-isort,
|
pytest-isort,
|
||||||
|
@ -23,35 +30,48 @@
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "weasyprint";
|
pname = "weasyprint";
|
||||||
version = "52";
|
version = "53.4";
|
||||||
disabled = !isPy3k;
|
disabled = !isPy3k;
|
||||||
|
|
||||||
# excluded test needs the Ahem font
|
pytestFlagsArray = [
|
||||||
checkPhase = ''
|
# setup.py is auto-generated and doesn't pass the flake8 check
|
||||||
runHook preCheck
|
"--ignore=setup.py"
|
||||||
pytest -k 'not test_font_stretch'
|
# ffi.py is patched by us and doesn't pass the flake8 check
|
||||||
runHook postCheck
|
"--ignore=weasyprint/text/ffi.py"
|
||||||
'';
|
];
|
||||||
|
|
||||||
# ignore failing flake8-test
|
disabledTests = [
|
||||||
prePatch = ''
|
# test_font_stretch needs the Ahem font (fails on macOS)
|
||||||
substituteInPlace setup.cfg \
|
"test_font_stretch"
|
||||||
--replace '[tool:pytest]' '[tool:pytest]\nflake8-ignore = E501'
|
];
|
||||||
'';
|
|
||||||
|
|
||||||
checkInputs = [ pytest pytest-runner pytest-isort pytest-flake8 pytest-cov ];
|
checkInputs = [
|
||||||
|
pytestCheckHook
|
||||||
|
ghostscript
|
||||||
|
pytest
|
||||||
|
pytest-runner
|
||||||
|
pytest-isort
|
||||||
|
pytest-flake8
|
||||||
|
pytest-cov
|
||||||
|
];
|
||||||
|
|
||||||
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
|
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
|
||||||
|
|
||||||
propagatedBuildInputs = [ cairosvg pyphen cffi cssselect lxml html5lib tinycss ];
|
propagatedBuildInputs = [
|
||||||
|
brotli
|
||||||
|
cairosvg
|
||||||
|
cffi
|
||||||
|
cssselect
|
||||||
|
fonttools
|
||||||
|
html5lib
|
||||||
|
lxml
|
||||||
|
pydyf
|
||||||
|
pyphen
|
||||||
|
tinycss
|
||||||
|
zopfli
|
||||||
|
];
|
||||||
|
|
||||||
# 47043a1fd7e50a892b9836466f521df85d597c4.patch can be removed after next release of weasyprint, see:
|
|
||||||
# https://github.com/Kozea/WeasyPrint/issues/1333#issuecomment-818062970
|
|
||||||
patches = [
|
patches = [
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/Kozea/WeasyPrint/commit/47043a1fd7e50a892b9836466f521df85d597c44.patch";
|
|
||||||
sha256 = "0l9z0hrav3bcdajlg3vbzljq0lkw7hlj8ppzrq3v21hbj1il1nsb";
|
|
||||||
})
|
|
||||||
(substituteAll {
|
(substituteAll {
|
||||||
src = ./library-paths.patch;
|
src = ./library-paths.patch;
|
||||||
fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
|
fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
|
@ -59,13 +79,14 @@ buildPythonPackage rec {
|
||||||
gobject = "${glib.out}/lib/libgobject-2.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}";
|
pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
|
pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
|
harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit version;
|
inherit version;
|
||||||
pname = "WeasyPrint";
|
pname = "weasyprint";
|
||||||
sha256 = "0rwf43111ws74m8b1alkkxzz57g0np3vmd8as74adwnxslfcg4gs";
|
sha256 = "sha256-EMyxfVXHMJa98e3T7+WMuFWwfkwwfZutTryaPxP/RYA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
|
@ -1,38 +1,31 @@
|
||||||
diff --git a/weasyprint/fonts.py b/weasyprint/fonts.py
|
diff --git a/weasyprint/text/ffi.py b/weasyprint/text/ffi.py
|
||||||
index 79e3b5b..4438eb4 100644
|
index 0734cbea..22e31a5e 100644
|
||||||
--- a/weasyprint/fonts.py
|
--- a/weasyprint/text/ffi.py
|
||||||
+++ b/weasyprint/fonts.py
|
+++ b/weasyprint/text/ffi.py
|
||||||
@@ -45,11 +45,8 @@ else:
|
@@ -387,21 +387,11 @@ def _dlopen(ffi, *names):
|
||||||
# with OSError: dlopen() failed to load a library: cairo / cairo-2
|
|
||||||
# So let's hope we find the same file as cairo already did ;)
|
|
||||||
# Same applies to pangocairo requiring pangoft2
|
|
||||||
- fontconfig = dlopen(ffi, 'fontconfig', 'libfontconfig',
|
|
||||||
- 'libfontconfig-1.dll',
|
|
||||||
- 'libfontconfig.so.1', 'libfontconfig-1.dylib')
|
|
||||||
- pangoft2 = dlopen(ffi, 'pangoft2-1.0', 'libpangoft2-1.0-0',
|
|
||||||
- 'libpangoft2-1.0.so.0', 'libpangoft2-1.0.dylib')
|
|
||||||
+ fontconfig = dlopen(ffi, '@fontconfig@')
|
|
||||||
+ pangoft2 = dlopen(ffi, '@pangoft2@')
|
|
||||||
|
|
||||||
ffi.cdef('''
|
|
||||||
// FontConfig
|
|
||||||
diff --git a/weasyprint/text.py b/weasyprint/text.py
|
|
||||||
index 1dc5e4d..b070bad 100644
|
|
||||||
--- a/weasyprint/text.py
|
|
||||||
+++ b/weasyprint/text.py
|
|
||||||
@@ -255,12 +255,9 @@ def dlopen(ffi, *names):
|
|
||||||
return ffi.dlopen(names[0]) # pragma: no cover
|
return ffi.dlopen(names[0]) # pragma: no cover
|
||||||
|
|
||||||
|
|
||||||
-gobject = dlopen(ffi, 'gobject-2.0', 'libgobject-2.0-0', 'libgobject-2.0.so.0',
|
-gobject = _dlopen(
|
||||||
- 'libgobject-2.0.dylib')
|
- ffi, 'gobject-2.0-0', 'gobject-2.0', 'libgobject-2.0-0',
|
||||||
-pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so.0',
|
- 'libgobject-2.0.so.0', 'libgobject-2.0.dylib')
|
||||||
|
-pango = _dlopen(
|
||||||
|
- ffi, 'pango-1.0-0', 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so.0',
|
||||||
- 'libpango-1.0.dylib')
|
- 'libpango-1.0.dylib')
|
||||||
-pangocairo = dlopen(ffi, 'pangocairo-1.0', 'libpangocairo-1.0-0',
|
-harfbuzz = _dlopen(
|
||||||
- 'libpangocairo-1.0.so.0', 'libpangocairo-1.0.dylib')
|
- ffi, 'harfbuzz', 'harfbuzz-0.0', 'libharfbuzz-0',
|
||||||
+gobject = dlopen(ffi, '@gobject@')
|
- 'libharfbuzz.so.0', 'libharfbuzz.so.0', 'libharfbuzz.0.dylib')
|
||||||
+pango = dlopen(ffi, '@pango@')
|
-fontconfig = _dlopen(
|
||||||
+pangocairo = dlopen(ffi, '@pangocairo@')
|
- ffi, 'fontconfig-1', 'fontconfig', 'libfontconfig', 'libfontconfig-1.dll',
|
||||||
|
- 'libfontconfig.so.1', 'libfontconfig-1.dylib')
|
||||||
|
-pangoft2 = _dlopen(
|
||||||
|
- ffi, 'pangoft2-1.0-0', 'pangoft2-1.0', 'libpangoft2-1.0-0',
|
||||||
|
- 'libpangoft2-1.0.so.0', 'libpangoft2-1.0.dylib')
|
||||||
|
+gobject = _dlopen(ffi, '@gobject@')
|
||||||
|
+pango = _dlopen(ffi, '@pango@')
|
||||||
|
+harfbuzz = _dlopen(ffi, '@harfbuzz@')
|
||||||
|
+fontconfig = _dlopen(ffi, '@fontconfig@')
|
||||||
|
+pangoft2 = _dlopen(ffi, '@pangoft2@')
|
||||||
|
|
||||||
gobject.g_type_init()
|
gobject.g_type_init()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue