hook-nacl.py 1.0 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. # Tested with PyNaCl 0.3.0 on Mac OS X.
  13. import os.path
  14. import glob
  15. from PyInstaller.compat import EXTENSION_SUFFIXES
  16. from PyInstaller.utils.hooks import collect_data_files, get_module_file_attribute
  17. datas = collect_data_files('nacl')
  18. # Include the cffi extensions as binaries in a subfolder named like the package.
  19. binaries = []
  20. nacl_dir = os.path.dirname(get_module_file_attribute('nacl'))
  21. for ext in EXTENSION_SUFFIXES:
  22. ffimods = glob.glob(os.path.join(nacl_dir, '_lib', '*_cffi_*%s*' % ext))
  23. dest_dir = os.path.join('nacl', '_lib')
  24. for f in ffimods:
  25. binaries.append((f, dest_dir))