2022-11-04 12:27:35 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
2021-12-06 16:07:01 +00:00
|
|
|
, cairosvg
|
|
|
|
, cffi
|
2022-06-26 10:26:21 +00:00
|
|
|
, cssselect2
|
2022-11-04 12:27:35 +00:00
|
|
|
, fetchPypi
|
|
|
|
, flit-core
|
|
|
|
, fontconfig
|
|
|
|
, fonttools
|
|
|
|
, ghostscript
|
2021-12-06 16:07:01 +00:00
|
|
|
, glib
|
|
|
|
, harfbuzz
|
2022-11-04 12:27:35 +00:00
|
|
|
, html5lib
|
2021-12-06 16:07:01 +00:00
|
|
|
, pango
|
2022-06-26 10:26:21 +00:00
|
|
|
, pillow
|
2022-11-04 12:27:35 +00:00
|
|
|
, pydyf
|
|
|
|
, pyphen
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
|
|
|
, substituteAll
|
|
|
|
, tinycss2
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "weasyprint";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "58.1";
|
2022-01-13 20:06:32 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit version;
|
|
|
|
pname = "weasyprint";
|
2023-05-24 13:37:59 +00:00
|
|
|
hash = "sha256-YXMAnjE75lgH/vv3ioBRzrepN3bv2n67uIwT9XaXlPM=";
|
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 = [
|
|
|
|
cffi
|
2022-06-26 10:26:21 +00:00
|
|
|
cssselect2
|
2021-12-06 16:07:01 +00:00
|
|
|
fonttools
|
|
|
|
html5lib
|
2022-06-26 10:26:21 +00:00
|
|
|
pillow
|
2021-12-06 16:07:01 +00:00
|
|
|
pydyf
|
|
|
|
pyphen
|
2022-06-26 10:26:21 +00:00
|
|
|
tinycss2
|
|
|
|
] ++ fonttools.optional-dependencies.woff;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-01-13 20:06:32 +00:00
|
|
|
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-05-18 14:49:53 +00:00
|
|
|
"test_linear_gradients_5"
|
|
|
|
"test_linear_gradients_12"
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
# Fontconfig error: Cannot load default config file: No such file: (null)
|
|
|
|
makeWrapperArgs = [
|
|
|
|
"--set FONTCONFIG_FILE ${FONTCONFIG_FILE}"
|
|
|
|
];
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace "--isort --flake8 --cov --no-cov-on-fail" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# Fontconfig wants to create a cache.
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
'';
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"weasyprint"
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Converts web documents to PDF";
|
2022-11-04 12:27:35 +00:00
|
|
|
homepage = "https://weasyprint.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ elohmeier ];
|
|
|
|
};
|
|
|
|
}
|