Skip to content

Commit

Permalink
hooks: add hook for h3
Browse files Browse the repository at this point in the history
Add hook for `h3` (dependency of `timezonefinder`), which started
to query its version from metadata with v4.0.0.
  • Loading branch information
rokm committed Oct 29, 2024
1 parent 7b505ad commit 5818893
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions _pyinstaller_hooks_contrib/stdhooks/hook-h3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ------------------------------------------------------------------
# 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 is_module_satisfies, copy_metadata

# Starting with v4.0.0, h3 determines its version from its metadata.
if is_module_satisfies("h3 >= 4.0.0"):
datas = copy_metadata("h3")
2 changes: 2 additions & 0 deletions news/825.new.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add hook for ``h3`` to collect its metadata (required with ``h3`` v4.0.0
and later).
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ 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'
h3==4.1.2

# ------------------- Platform (OS) specifics

Expand Down
7 changes: 7 additions & 0 deletions tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2282,3 +2282,10 @@ def test_numbers_parser(pyi_builder, tmpdir):
table.write(1, 3, 3000)
doc.save(output_filename)
""", app_args=[str(output_filename)])


@importorskip('h3')
def test_h3(pyi_builder):
pyi_builder.test_source("""
import h3
""")

0 comments on commit 5818893

Please sign in to comment.