Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 2.4 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, cairosvg 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 23}: 24 25buildPythonPackage rec { 26 pname = "weasyprint"; 27 version = "59.0"; 28 format = "pyproject"; 29 30 disabled = pythonOlder "3.7"; 31 32 src = fetchPypi { 33 inherit version; 34 pname = "weasyprint"; 35 hash = "sha256-Ijp2Y2s3ROqkq4oohfUM9Gz467GsuZtSdtAv7M9QdJI="; 36 }; 37 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 ]; 49 50 nativeBuildInputs = [ 51 flit-core 52 ]; 53 54 propagatedBuildInputs = [ 55 cffi 56 cssselect2 57 fonttools 58 html5lib 59 pillow 60 pydyf 61 pyphen 62 tinycss2 63 ] ++ fonttools.optional-dependencies.woff; 64 65 nativeCheckInputs = [ 66 pytestCheckHook 67 ghostscript 68 ]; 69 70 disabledTests = [ 71 # needs the Ahem font (fails on macOS) 72 "test_font_stretch" 73 # sensitive to sandbox environments 74 "test_tab_size" 75 "test_tabulation_character" 76 "test_linear_gradients_5" 77 "test_linear_gradients_12" 78 ]; 79 80 FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf"; 81 82 # Fontconfig error: Cannot load default config file: No such file: (null) 83 makeWrapperArgs = [ 84 "--set FONTCONFIG_FILE ${FONTCONFIG_FILE}" 85 ]; 86 87 postPatch = '' 88 substituteInPlace pyproject.toml \ 89 --replace "--isort --flake8 --cov --no-cov-on-fail" "" 90 ''; 91 92 preCheck = '' 93 # Fontconfig wants to create a cache. 94 export HOME=$TMPDIR 95 ''; 96 97 pythonImportsCheck = [ 98 "weasyprint" 99 ]; 100 101 meta = with lib; { 102 description = "Converts web documents to PDF"; 103 homepage = "https://weasyprint.org/"; 104 license = licenses.bsd3; 105 maintainers = with maintainers; [ elohmeier ]; 106 }; 107}