evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / weasyprint / default.nix
blobbc6c57e94083859c725781def500a38a8108ef6f
2   lib,
3   stdenv,
4   buildPythonPackage,
5   cffi,
6   cssselect2,
7   fetchPypi,
8   flit-core,
9   fontconfig,
10   fonttools,
11   ghostscript,
12   glib,
13   harfbuzz,
14   html5lib,
15   pango,
16   pillow,
17   pydyf,
18   pyphen,
19   pytestCheckHook,
20   pythonOlder,
21   substituteAll,
22   tinycss2,
25 buildPythonPackage rec {
26   pname = "weasyprint";
27   version = "62.3";
28   format = "pyproject";
30   disabled = pythonOlder "3.9";
32   src = fetchPypi {
33     inherit version;
34     pname = "weasyprint";
35     hash = "sha256-jYaA1zL3+g/LxYdpKlpcsJXDUlYnBmkY1uIDy/Qrf80=";
36   };
38   patches = [
39     (substituteAll {
40       src = ./library-paths.patch;
41       fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
42       pangoft2 = "${pango.out}/lib/libpangoft2-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
43       gobject = "${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}";
44       pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
45       pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
46       harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}";
47     })
48   ];
50   nativeBuildInputs = [ flit-core ];
52   propagatedBuildInputs = [
53     cffi
54     cssselect2
55     fonttools
56     html5lib
57     pillow
58     pydyf
59     pyphen
60     tinycss2
61   ] ++ fonttools.optional-dependencies.woff;
63   nativeCheckInputs = [
64     pytestCheckHook
65     ghostscript
66   ];
68   disabledTests = [
69     # needs the Ahem font (fails on macOS)
70     "test_font_stretch"
71     # sensitive to sandbox environments
72     "test_tab_size"
73     "test_tabulation_character"
74     "test_linear_gradients_5"
75     "test_linear_gradients_12"
76   ];
78   FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
80   # Set env variable explicitly for Darwin, but allow overriding when invoking directly
81   makeWrapperArgs = [ "--set-default FONTCONFIG_FILE ${FONTCONFIG_FILE}" ];
83   postPatch = ''
84     substituteInPlace pyproject.toml \
85       --replace "--isort --flake8 --cov --no-cov-on-fail" ""
86   '';
88   preCheck = ''
89     # Fontconfig wants to create a cache.
90     export HOME=$TMPDIR
91   '';
93   pythonImportsCheck = [ "weasyprint" ];
95   meta = with lib; {
96     description = "Converts web documents to PDF";
97     mainProgram = "weasyprint";
98     homepage = "https://weasyprint.org/";
99     license = licenses.bsd3;
100   };