hook-platform.py 1.2 KB

123456789101112131415161718192021222324252627
  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. import sys
  12. excludedimports = []
  13. # see https://github.com/python/cpython/blob/3.9/Lib/platform.py#L411
  14. # This will exclude `plistlib` for sys.platform != 'darwin'
  15. if sys.platform != 'darwin':
  16. excludedimports += ["plistlib"]
  17. # Avoid collecting `_ios_support`, which in turn triggers unnecessary collection of `libobjc` shared library if the
  18. # latter happens to be available on the build system.
  19. # See https://github.com/pyinstaller/pyinstaller/issues/9333, as well as
  20. # https://github.com/python/cpython/blob/v3.13.0/Lib/platform.py#L508-L521
  21. # and
  22. # https://github.com/python/cpython/blob/v3.13.0/Lib/_ios_support.py#L13
  23. if sys.platform != 'ios':
  24. excludedimports += ["_ios_support"]