hook-fastparquet.py 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2023 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. import os
  13. from PyInstaller.compat import is_win
  14. from PyInstaller.utils.hooks import get_package_paths
  15. # In all versions for which fastparquet provides Windows wheels (>= 0.7.0), delvewheel is used,
  16. # so we need to collect the external site-packages/fastparquet.libs directory.
  17. if is_win:
  18. pkg_base, pkg_dir = get_package_paths("fastparquet")
  19. lib_dir = os.path.join(pkg_base, "fastparquet.libs")
  20. if os.path.isdir(lib_dir):
  21. # We collect DLLs as data files instead of binaries to suppress binary
  22. # analysis, which would result in duplicates (because it collects a copy
  23. # into the top-level directory instead of preserving the original layout).
  24. # In addition to DLls, this also collects .load-order* file (required on
  25. # python < 3.8), and ensures that fastparquet.libs directory exists (required
  26. # on python >= 3.8 due to os.add_dll_directory call).
  27. datas = [
  28. (os.path.join(lib_dir, lib_file), 'fastparquet.libs')
  29. for lib_file in os.listdir(lib_dir)
  30. ]