__init__.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2020 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. import sys
  13. __version__ = '2026.6'
  14. __maintainer__ = 'Legorooj, bwoodsend'
  15. __uri__ = 'https://github.com/pyinstaller/pyinstaller-hooks-contrib'
  16. def get_hook_dirs():
  17. import os
  18. hooks_dir = os.path.dirname(__file__)
  19. return [
  20. # Required because standard hooks are in sub-directory instead of the top-level hooks directory.
  21. os.path.join(hooks_dir, 'stdhooks'),
  22. # pre_* and run-time hooks
  23. hooks_dir,
  24. ]
  25. # Several packages for which provide hooks are involved in deep dependency chains when various optional dependencies are
  26. # installed in the environment, and their analysis typically requires recursion limit that exceeds the default 1000.
  27. # Therefore, automatically raise the recursion limit to at least 5000. This alleviates the need to do so on per-hook
  28. # basis.
  29. if (sys.platform.startswith('win') or sys.platform == 'cygwin') and sys.version_info < (3, 11):
  30. # The recursion limit test in PyInstaller main repository seems to push the recursion level to the limit; and if the
  31. # limit is set to 5000, this crashes python 3.8 - 3.10 on Windows and 3.9 that is (at the time of writing) available
  32. # under Cygwin. Further investigation revealed that Windows builds of python 3.8 and 3.10 handle recursion up to
  33. # level ~2075, while the practical limit for 3.9 is between 1950 and 1975. Therefore, for affected combinations of
  34. # platforms and python versions, use a conservative limit of 1900 - if only to avoid issues with the recursion limit
  35. # test in the main PyInstaller repository...
  36. new_recursion_limit = 1900
  37. else:
  38. new_recursion_limit = 5000
  39. if sys.getrecursionlimit() < new_recursion_limit:
  40. sys.setrecursionlimit(new_recursion_limit)