2021-12-06 16:07:01 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, fetchpatch
|
|
|
|
, pytestCheckHook
|
|
|
|
, brotli
|
|
|
|
, cairosvg
|
2022-01-13 20:06:32 +00:00
|
|
|
, flit-core
|
2021-12-06 16:07:01 +00:00
|
|
|
, fonttools
|
|
|
|
, pydyf
|
|
|
|
, pyphen
|
|
|
|
, cffi
|
|
|
|
, cssselect
|
|
|
|
, lxml
|
|
|
|
, html5lib
|
|
|
|
, tinycss
|
|
|
|
, zopfli
|
|
|
|
, glib
|
|
|
|
, harfbuzz
|
|
|
|
, pango
|
|
|
|
, fontconfig
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, ghostscript
|
|
|
|
, isPy3k
|
|
|
|
, substituteAll
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "weasyprint";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "54.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = !isPy3k;
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit version;
|
|
|
|
pname = "weasyprint";
|
2022-02-10 20:34:41 +00:00
|
|
|
sha256 = "sha256-+lfbhi4GvQHF59gtrTmbO5lSo5gnAjwXvumxwGH/G70=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
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}";
|
|
|
|
pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
flit-core
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
brotli
|
|
|
|
cairosvg
|
|
|
|
cffi
|
|
|
|
cssselect
|
|
|
|
fonttools
|
|
|
|
html5lib
|
|
|
|
lxml
|
2022-01-13 20:06:32 +00:00
|
|
|
flit-core
|
2021-12-06 16:07:01 +00:00
|
|
|
pydyf
|
|
|
|
pyphen
|
|
|
|
tinycss
|
|
|
|
zopfli
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
ghostscript
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
disabledTests = [
|
|
|
|
# needs the Ahem font (fails on macOS)
|
|
|
|
"test_font_stretch"
|
2022-01-19 23:45:15 +00:00
|
|
|
# sensitive to sandbox environments
|
|
|
|
"test_tab_size"
|
|
|
|
"test_tabulation_character"
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://weasyprint.org/";
|
|
|
|
description = "Converts web documents to PDF";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ elohmeier ];
|
|
|
|
};
|
|
|
|
}
|