hook-gi.py 1.0 KB

1234567891011121314151617181920212223242526
  1. #-----------------------------------------------------------------------------
  2. # Copyright (c) 2005-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. from PyInstaller import compat
  12. from packaging.version import Version
  13. pygobject_version = Version(compat.importlib_metadata.version("pygobject")).release
  14. hiddenimports = ['gi._error', 'gi._option']
  15. # PyGObject 3.50.0 added support for `asyncio`, and attempts to import inside the `_gi` extension.
  16. if pygobject_version >= (3, 50, 0):
  17. hiddenimports += ['asyncio']
  18. # PyGobject 3.52.0 added `gi._enum`, which needs to be added to hiddenimports due to being imported from the
  19. # `_gi` extension.
  20. if pygobject_version >= (3, 52, 0):
  21. hiddenimports += ['gi._enum']