hook-pygments.py 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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
  16. # pygments``.
  17. #
  18. # From pygments.formatters, line 37::
  19. #
  20. # def _load_formatters(module_name):
  21. # """Load a formatter (and all others in the module too)."""
  22. # mod = __import__(module_name, None, None, ['__all__'])
  23. #
  24. # Therefore, we need all the modules in ``pygments.formatters``.
  25. hiddenimports = collect_submodules('pygments.formatters')
  26. hiddenimports.extend(collect_submodules('pygments.lexers'))
  27. hiddenimports.extend(collect_submodules('pygments.styles'))