From d4f159935ed7efe3e3a01f4ac404e1411195dd29 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Tue, 22 Oct 2024 23:06:31 +0200 Subject: [PATCH] hooks: add hook for numbers_parser Add hook for `numbers_parser` to ensure that the package's data file (`numbers_parser/data/empty.numbers`) is collected. --- .../stdhooks/hook-numbers_parser.py | 16 +++++++++++++++ news/823.new.rst | 2 ++ requirements-test-libraries.txt | 1 + tests/test_libraries.py | 20 +++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 _pyinstaller_hooks_contrib/stdhooks/hook-numbers_parser.py create mode 100644 news/823.new.rst diff --git a/_pyinstaller_hooks_contrib/stdhooks/hook-numbers_parser.py b/_pyinstaller_hooks_contrib/stdhooks/hook-numbers_parser.py new file mode 100644 index 00000000..d6fd5352 --- /dev/null +++ b/_pyinstaller_hooks_contrib/stdhooks/hook-numbers_parser.py @@ -0,0 +1,16 @@ +# ------------------------------------------------------------------ +# Copyright (c) 2024 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, distributed with +# this software. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# ------------------------------------------------------------------ + +from PyInstaller.utils.hooks import collect_data_files + +# Ensure that `numbers_parser/data/empty.numbers` is collected. +datas = collect_data_files('numbers_parser') diff --git a/news/823.new.rst b/news/823.new.rst new file mode 100644 index 00000000..233fa99b --- /dev/null +++ b/news/823.new.rst @@ -0,0 +1,2 @@ +Add hook for ``numbers_parser`` to ensure that package's data file is +collected. diff --git a/requirements-test-libraries.txt b/requirements-test-libraries.txt index 3ebe653b..96d8c209 100644 --- a/requirements-test-libraries.txt +++ b/requirements-test-libraries.txt @@ -224,6 +224,7 @@ xmlschema==3.4.1 pysaml2==7.5.0; python_version >= '3.9' pysaml2==7.3.0; python_version < '3.9' # pyup: ignore toga==0.4.8; python_version >= '3.9' +numbers-parser==4.14.1; python_version >= '3.9' # ------------------- Platform (OS) specifics diff --git a/tests/test_libraries.py b/tests/test_libraries.py index 12d3d7e4..f19b5506 100644 --- a/tests/test_libraries.py +++ b/tests/test_libraries.py @@ -2262,3 +2262,23 @@ def test_toga(pyi_builder): app_args=['--automatic-shutdown', '5'], pyi_args=['--windowed'] if is_darwin else [], ) + + +@importorskip('numbers_parser') +def test_numbers_parser(pyi_builder, tmpdir): + output_filename = tmpdir / "output.numbers" + pyi_builder.test_source(""" + import sys + import numbers_parser + + output_filename = sys.argv[1] + + doc = numbers_parser.Document() + doc.add_sheet("New Sheet", "New Table") + sheet = doc.sheets["New Sheet"] + table = sheet.tables["New Table"] + table.write(1, 1, 1000) + table.write(1, 2, 2000) + table.write(1, 3, 3000) + doc.save(output_filename) + """, app_args=[str(output_filename)])