hook-scipy.py 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. # -----------------------------------------------------------------------------
  2. # Copyright (c) 2013-2021, PyInstaller Development Team.
  3. #
  4. # Distributed under the terms of the GNU General Public License (version 2
  5. # or later) with exception for distributing the bootloader.
  6. #
  7. # The full license is in the file COPYING.txt, distributed with this software.
  8. #
  9. # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
  10. # -----------------------------------------------------------------------------
  11. import os
  12. import glob
  13. from PyInstaller.utils.hooks import get_module_file_attribute
  14. from PyInstaller.compat import is_win
  15. binaries = []
  16. # package the DLL bundle that official scipy wheels for Windows ship
  17. # The DLL bundle will either be in extra-dll on windows proper
  18. # and in .libs if installed on a virtualenv created from MinGW (Git-Bash
  19. # for example)
  20. if is_win:
  21. extra_dll_locations = ['extra-dll', '.libs']
  22. for location in extra_dll_locations:
  23. dll_glob = os.path.join(os.path.dirname(
  24. get_module_file_attribute('scipy')), location, "*.dll")
  25. if glob.glob(dll_glob):
  26. binaries.append((dll_glob, "."))
  27. # collect library-wide utility extension modules
  28. hiddenimports = ['scipy._lib.%s' % m for m in [
  29. 'messagestream', "_ccallback_c", "_fpumode"]]