hook-sudachipy.py 1.1 KB

123456789101112131415161718192021222324252627282930
  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. from PyInstaller.utils.hooks import can_import_module, collect_data_files, is_module_satisfies
  13. datas = collect_data_files('sudachipy')
  14. hiddenimports = []
  15. # In v0.6.8, `sudachipy.config` and `sudachipy.errors` modules were added, and are referenced from binary extension.
  16. if is_module_satisfies('sudachipy >= 0.6.8'):
  17. hiddenimports += [
  18. 'sudachipy.config',
  19. 'sudachipy.errors',
  20. ]
  21. # Check which types of dictionary are installed
  22. for sudachi_dict in ['sudachidict_small', 'sudachidict_core', 'sudachidict_full']:
  23. if can_import_module(sudachi_dict):
  24. datas += collect_data_files(sudachi_dict)
  25. hiddenimports += [sudachi_dict]