exceptions.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. class ExecCommandFailed(SystemExit):
  12. pass
  13. class HookError(Exception):
  14. """
  15. Base class for hook related errors.
  16. """
  17. pass
  18. class ImportErrorWhenRunningHook(HookError):
  19. def __str__(self):
  20. return (
  21. "ERROR: Failed to import module {0} required by hook for module {1}. Please check whether module {0} "
  22. "actually exists and whether the hook is compatible with your version of {1}: You might want to read more "
  23. "about hooks in the manual and provide a pull-request to improve PyInstaller.".format(
  24. self.args[0], self.args[1]
  25. )
  26. )
  27. class RemovedCipherFeatureError(SystemExit):
  28. def __init__(self, message):
  29. super().__init__(
  30. f"ERROR: Bytecode encryption was removed in PyInstaller v6.0. {message}"
  31. " For the rationale and alternatives see https://github.com/pyinstaller/pyinstaller/pull/6999"
  32. )
  33. class RemovedExternalManifestError(SystemExit):
  34. def __init__(self, message):
  35. super().__init__(f"ERROR: Support for external executable manifest was removed in PyInstaller v6.0. {message}")
  36. class RemovedWinSideBySideSupportError(SystemExit):
  37. def __init__(self, message):
  38. super().__init__(
  39. f"ERROR: Support for collecting and processing WinSxS assemblies was removed in PyInstaller v6.0. {message}"
  40. )
  41. class PythonLibraryNotFoundError(SystemExit):
  42. def __init__(self, message):
  43. super().__init__(f"ERROR: {message}")
  44. class InvalidSrcDestTupleError(SystemExit):
  45. def __init__(self, src_dest, message):
  46. super().__init__(f"ERROR: Invalid (SRC, DEST_DIR) tuple: {src_dest!r}. {message}")
  47. class ImportlibMetadataError(SystemExit):
  48. def __init__(self):
  49. super().__init__(
  50. "ERROR: PyInstaller requires importlib.metadata from python >= 3.10 stdlib or importlib_metadata from "
  51. "importlib-metadata >= 4.6"
  52. )