Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hook to work with astropy version 5.0, which requires metadata #381

Merged
merged 4 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/381.update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix hook for astropy when astropy >= 5.0.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# ------------------------------------------------------------------

from PyInstaller.utils.hooks import collect_data_files, collect_submodules
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, \
copy_metadata, is_module_satisfies

# Astropy includes a number of non-Python files that need to be present
# at runtime, so we include these explicitly here.
Expand All @@ -31,6 +32,11 @@

datas += ply_files

# Astropy version >= 5.0 queries metadata to get version information.
if is_module_satisfies('astropy >= 5.0'):
datas += copy_metadata('astropy')
datas += copy_metadata('numpy')

# In the Cython code, Astropy imports numpy.lib.recfunctions which isn't
# automatically discovered by pyinstaller, so we add this as a hidden import.
hiddenimports += ['numpy.lib.recfunctions']