1{ 2 stdenv, 3 lib, 4 pkgs, 5 buildPythonPackage, 6 cffi, 7 cssselect2, 8 fetchPypi, 9 flit-core, 10 fontconfig, 11 fonttools, 12 glib, 13 harfbuzz, 14 pango, 15 pillow, 16 pydyf, 17 pyphen, 18 pytest-cov-stub, 19 pytestCheckHook, 20 pythonOlder, 21 replaceVars, 22 tinycss2, 23 tinyhtml5, 24}: 25 26buildPythonPackage rec { 27 pname = "weasyprint"; 28 version = "65.1"; 29 pyproject = true; 30 31 disabled = pythonOlder "3.9"; 32 33 src = fetchPypi { 34 inherit version; 35 pname = "weasyprint"; 36 hash = "sha256-EgKBvb1C/6p9flztvjGCos7zbqWtl/6fNX5DvmoeWOo="; 37 }; 38 39 patches = [ 40 (replaceVars ./library-paths.patch { 41 fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}"; 42 gobject = "${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"; 43 harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}"; 44 harfbuzz_subset = "${harfbuzz.out}/lib/libharfbuzz-subset${stdenv.hostPlatform.extensions.sharedLibrary}"; 45 pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}"; 46 pangoft2 = "${pango.out}/lib/libpangoft2-1.0${stdenv.hostPlatform.extensions.sharedLibrary}"; 47 }) 48 ]; 49 50 build-system = [ flit-core ]; 51 52 dependencies = [ 53 cffi 54 cssselect2 55 fonttools 56 pillow 57 pydyf 58 pyphen 59 tinycss2 60 tinyhtml5 61 ] ++ fonttools.optional-dependencies.woff; 62 63 nativeCheckInputs = [ 64 pkgs.ghostscript 65 pytest-cov-stub 66 pytestCheckHook 67 ]; 68 69 disabledTests = [ 70 # needs the Ahem font (fails on macOS) 71 "test_font_stretch" 72 # sensitive to sandbox environments 73 "test_linear_gradients_12" 74 "test_linear_gradients_5" 75 "test_tab_size" 76 "test_tabulation_character" 77 # rounding issues in sandbox 78 "test_empty_inline_auto_margins" 79 "test_images_transparent_text" 80 "test_layout_table_auto_44" 81 "test_layout_table_auto_45" 82 "test_margin_boxes_element" 83 "test_running_elements" 84 "test_vertical_align_4" 85 "test_visibility_1" 86 "test_visibility_3" 87 "test_visibility_4" 88 "test_woff_simple" 89 ]; 90 91 FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf"; 92 93 # Set env variable explicitly for Darwin, but allow overriding when invoking directly 94 makeWrapperArgs = [ "--set-default FONTCONFIG_FILE ${FONTCONFIG_FILE}" ]; 95 96 preCheck = '' 97 # Fontconfig wants to create a cache. 98 export HOME=$TMPDIR 99 ''; 100 101 pythonImportsCheck = [ "weasyprint" ]; 102 103 meta = { 104 changelog = "https://github.com/Kozea/WeasyPrint/releases/tag/v${version}"; 105 description = "Converts web documents to PDF"; 106 mainProgram = "weasyprint"; 107 homepage = "https://weasyprint.org/"; 108 license = lib.licenses.bsd3; 109 teams = [ lib.teams.apm ]; 110 }; 111}