Skip to content

Commit

Permalink
Fix hook to work with astropy version 5.0, which requires metadata (#381
Browse files Browse the repository at this point in the history
)
  • Loading branch information
EfremBraun committed Feb 16, 2022
1 parent c1266b2 commit 44ed886
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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']

0 comments on commit 44ed886

Please sign in to comment.