Skip to content

Commit

Permalink
hooks: add hook for metpy (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
rokm committed Sep 10, 2021
1 parent d9d75d5 commit 629cc75
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/60.new.rst
@@ -0,0 +1 @@
Add hook for ``metpy``.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Expand Up @@ -16,6 +16,7 @@ iminuit==2.8.3
langdetect==1.0.9
mariadb==1.0.7; sys_platform != "darwin"
markdown==3.3.4
MetPy==1.1.0
mnemonic==0.20
msoffcrypto-tool==4.12.0
Office365-REST-Python-Client==2.3.8
Expand Down
21 changes: 21 additions & 0 deletions src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-metpy.py
@@ -0,0 +1,21 @@
# ------------------------------------------------------------------
# Copyright (c) 2021 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 copy_metadata, collect_data_files

# MetPy requires metadata, because it queries its version via
# pkg_resources.get_distribution(__package__).version or, in newer
# versions, importlib.metadata.version(__package__)
datas = copy_metadata('metpy')

# Collect data files
datas += collect_data_files('metpy')
8 changes: 8 additions & 0 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Expand Up @@ -809,3 +809,11 @@ def test_folium(pyi_builder):
import folium
m = folium.Map(location=[0, 0], zoom_start=5)
""")


@importorskip("metpy")
def test_metpy(pyi_builder):
# Import metpy.plots, which triggers search for colortables data.
pyi_builder.test_source("""
import metpy.plots
""")

0 comments on commit 629cc75

Please sign in to comment.