hook-importlib_resources.py 1015 B

12345678910111213141516171819202122
  1. #-----------------------------------------------------------------------------
  2. # Copyright (c) 2019-2023, 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. `importlib_resources` is a backport of the 3.9+ module `importlib.resources`
  13. """
  14. from PyInstaller.utils.hooks import check_requirement, collect_data_files
  15. # Prior to v1.2.0, a `version.txt` file is used to set __version__. Later versions use `importlib.metadata`.
  16. if check_requirement("importlib_resources < 1.2.0"):
  17. datas = collect_data_files("importlib_resources", includes=["version.txt"])
  18. if check_requirement("importlib_resources >= 1.3.1"):
  19. hiddenimports = ['importlib_resources.trees']