hook-pygments.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. #-----------------------------------------------------------------------------
  2. # Copyright (c) 2005-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. """
  12. PyInstaller hook file for Pygments. Tested with version 2.0.2.
  13. """
  14. from PyInstaller.utils.hooks import collect_submodules
  15. # The following applies to pygments version 2.0.2, as reported by ``pip show pygments``.
  16. #
  17. # From pygments.formatters, line 37::
  18. #
  19. # def _load_formatters(module_name):
  20. # """Load a formatter (and all others in the module too)."""
  21. # mod = __import__(module_name, None, None, ['__all__'])
  22. #
  23. # Therefore, we need all the modules in ``pygments.formatters``.
  24. hiddenimports = collect_submodules('pygments.formatters')
  25. hiddenimports.extend(collect_submodules('pygments.lexers'))
  26. hiddenimports.extend(collect_submodules('pygments.styles'))