errors.py 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. """distutils.errors
  2. Provides exceptions used by the Distutils modules. Note that Distutils
  3. modules may raise standard exceptions; in particular, SystemExit is
  4. usually raised for errors that are obviously the end-user's fault
  5. (eg. bad command-line arguments).
  6. This module is safe to use in "from ... import *" mode; it only exports
  7. symbols whose names start with "Distutils" and end with "Error"."""
  8. class DistutilsError (Exception):
  9. """The root of all Distutils evil."""
  10. pass
  11. class DistutilsModuleError (DistutilsError):
  12. """Unable to load an expected module, or to find an expected class
  13. within some module (in particular, command modules and classes)."""
  14. pass
  15. class DistutilsClassError (DistutilsError):
  16. """Some command class (or possibly distribution class, if anyone
  17. feels a need to subclass Distribution) is found not to be holding
  18. up its end of the bargain, ie. implementing some part of the
  19. "command "interface."""
  20. pass
  21. class DistutilsGetoptError (DistutilsError):
  22. """The option table provided to 'fancy_getopt()' is bogus."""
  23. pass
  24. class DistutilsArgError (DistutilsError):
  25. """Raised by fancy_getopt in response to getopt.error -- ie. an
  26. error in the command line usage."""
  27. pass
  28. class DistutilsFileError (DistutilsError):
  29. """Any problems in the filesystem: expected file not found, etc.
  30. Typically this is for problems that we detect before OSError
  31. could be raised."""
  32. pass
  33. class DistutilsOptionError (DistutilsError):
  34. """Syntactic/semantic errors in command options, such as use of
  35. mutually conflicting options, or inconsistent options,
  36. badly-spelled values, etc. No distinction is made between option
  37. values originating in the setup script, the command line, config
  38. files, or what-have-you -- but if we *know* something originated in
  39. the setup script, we'll raise DistutilsSetupError instead."""
  40. pass
  41. class DistutilsSetupError (DistutilsError):
  42. """For errors that can be definitely blamed on the setup script,
  43. such as invalid keyword arguments to 'setup()'."""
  44. pass
  45. class DistutilsPlatformError (DistutilsError):
  46. """We don't know how to do something on the current platform (but
  47. we do know how to do it on some platform) -- eg. trying to compile
  48. C files on a platform not supported by a CCompiler subclass."""
  49. pass
  50. class DistutilsExecError (DistutilsError):
  51. """Any problems executing an external program (such as the C
  52. compiler, when compiling C files)."""
  53. pass
  54. class DistutilsInternalError (DistutilsError):
  55. """Internal inconsistencies or impossibilities (obviously, this
  56. should never be seen if the code is working!)."""
  57. pass
  58. class DistutilsTemplateError (DistutilsError):
  59. """Syntax error in a file list template."""
  60. class DistutilsByteCompileError(DistutilsError):
  61. """Byte compile error."""
  62. # Exception classes used by the CCompiler implementation classes
  63. class CCompilerError (Exception):
  64. """Some compile/link operation failed."""
  65. class PreprocessError (CCompilerError):
  66. """Failure to preprocess one or more C/C++ files."""
  67. class CompileError (CCompilerError):
  68. """Failure to compile one or more C/C++ source files."""
  69. class LibError (CCompilerError):
  70. """Failure to create a static library from one or more C/C++ object
  71. files."""
  72. class LinkError (CCompilerError):
  73. """Failure to link one or more C/C++ object files into an executable
  74. or shared library file."""
  75. class UnknownFileError (CCompilerError):
  76. """Attempt to process an unknown file type."""