hook-tables.py 1.4 KB

123456789101112131415161718192021222324252627282930
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2020 PyInstaller Development Team.
  3. #
  4. # This file is distributed under the terms of the GNU General Public
  5. # License (version 2.0 or later).
  6. #
  7. # The full license is available in LICENSE, distributed with
  8. # this software.
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. # ------------------------------------------------------------------
  12. from PyInstaller.compat import is_win
  13. from PyInstaller.utils.hooks import collect_dynamic_libs, is_module_satisfies
  14. # PyTables is a package for managing hierarchical datasets
  15. hiddenimports = ["tables._comp_lzo", "tables._comp_bzip2"]
  16. # Collect the bundled copy of blosc2 shared library.
  17. binaries = collect_dynamic_libs('tables')
  18. datas = []
  19. # tables 3.7.0 started using `delvewheel` for its Windows PyPI wheels. While contemporary PyInstaller versions
  20. # automatically pick up DLLs from external `pyproj.libs` directory, this does not work on Anaconda python 3.8 and 3.9
  21. # due to defunct `os.add_dll_directory`, which forces `delvewheel` to use the old load-order file approach. So we need
  22. # to explicitly ensure that load-order file as well as DLLs are collected.
  23. if is_win and is_module_satisfies("tables >= 3.7.0"):
  24. if is_module_satisfies("PyInstaller >= 5.6"):
  25. from PyInstaller.utils.hooks import collect_delvewheel_libs_directory
  26. datas, binaries = collect_delvewheel_libs_directory("tables", datas=datas, binaries=binaries)