hook-toga_gtk.py 1.2 KB

12345678910111213141516171819202122232425
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2024 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 collect_data_files, copy_metadata
  13. # Collect default icon from `resources`.
  14. datas = collect_data_files('toga_gtk')
  15. # Collect metadata so that the backend can be discovered via `toga.backends` entry-point.
  16. datas += copy_metadata("toga-gtk")
  17. # Starting with version 0.5.4, toga tries to determine the path to "resources" directory directly from the `__file__`
  18. # attribute of the `resources` submodule of a given factory module, whereas previous versions used the `__file__`
  19. # attribute of the factory module itself. Therefore, we now need a hidden import for the `resources` submodule, to
  20. # ensure that it is collected and treated as a regular package (rather than a namespace one) at run-time.
  21. hiddenimports = ['toga_gtk.resources']