diff --git a/news/674.new.rst b/news/674.new.rst new file mode 100644 index 00000000..2b6ddf9b --- /dev/null +++ b/news/674.new.rst @@ -0,0 +1,2 @@ +Add a hook for ``z3c.rml`` that collects the required subset of Bitstream +Vera TTF fonts from the ``reportlab`` package. diff --git a/requirements-test-libraries.txt b/requirements-test-libraries.txt index 44a92deb..9a59493f 100644 --- a/requirements-test-libraries.txt +++ b/requirements-test-libraries.txt @@ -161,6 +161,7 @@ gmsh==4.11.1 sspilib==0.1.0 rlp==4.0.0 eth-rlp==1.0.0 +z3c.rml==4.4.0 # ------------------- Platform (OS) specifics diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-z3c.rml.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-z3c.rml.py new file mode 100644 index 00000000..3eac8c88 --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-z3c.rml.py @@ -0,0 +1,25 @@ +# ------------------------------------------------------------------ +# Copyright (c) 2023 PyInstaller Development Team. +# +# This file is distributed under the terms of the GNU General Public +# License (version 2.0 or later). +# +# The full license is available in LICENSE.GPL.txt, distributed with +# this software. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# ------------------------------------------------------------------ + +from PyInstaller.utils.hooks import collect_data_files + +# `z3c.rml` uses Bitstream Vera TTF fonts from the `reportlab` package. As that package can be used without the bundled +# fonts and as some of the bundled fonts have restrictive license (e.g., DarkGarden), we collect the required subset +# of fonts here, instead of collecting them all in a hook for `reportlab`. +datas = collect_data_files( + "reportlab", + includes=[ + "fonts/00readme.txt", + "fonts/bitstream-vera-license.txt", + "fonts/Vera*.ttf", + ], +) diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index fd3af155..73164105 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -1917,3 +1917,31 @@ def test_eth_rlp(pyi_builder): pyi_builder.test_source(""" import eth_rlp """) + + +@importorskip('z3c.rml') +def test_z3c_rml_rml2pdf(pyi_builder): + pyi_builder.test_source(""" + from z3c.rml import rml2pdf + + rml = ''' + + + + + + Welcome to RML. + + + ''' + + pdf_bytes = rml2pdf.parseString(rml) + """)