errors.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. # This module should be kept compatible with Python 2.1.
  9. __revision__ = "$Id: errors.py 37828 2004-11-10 22:23:15Z loewis $"
  10. class DistutilsError (Exception):
  11. """The root of all Distutils evil."""
  12. pass
  13. class DistutilsModuleError (DistutilsError):
  14. """Unable to load an expected module, or to find an expected class
  15. within some module (in particular, command modules and classes)."""
  16. pass
  17. class DistutilsClassError (DistutilsError):
  18. """Some command class (or possibly distribution class, if anyone
  19. feels a need to subclass Distribution) is found not to be holding
  20. up its end of the bargain, ie. implementing some part of the
  21. "command "interface."""
  22. pass
  23. class DistutilsGetoptError (DistutilsError):
  24. """The option table provided to 'fancy_getopt()' is bogus."""
  25. pass
  26. class DistutilsArgError (DistutilsError):
  27. """Raised by fancy_getopt in response to getopt.error -- ie. an
  28. error in the command line usage."""
  29. pass
  30. class DistutilsFileError (DistutilsError):
  31. """Any problems in the filesystem: expected file not found, etc.
  32. Typically this is for problems that we detect before IOError or
  33. OSError could be raised."""
  34. pass
  35. class DistutilsOptionError (DistutilsError):
  36. """Syntactic/semantic errors in command options, such as use of
  37. mutually conflicting options, or inconsistent options,
  38. badly-spelled values, etc. No distinction is made between option
  39. values originating in the setup script, the command line, config
  40. files, or what-have-you -- but if we *know* something originated in
  41. the setup script, we'll raise DistutilsSetupError instead."""
  42. pass
  43. class DistutilsSetupError (DistutilsError):
  44. """For errors that can be definitely blamed on the setup script,
  45. such as invalid keyword arguments to 'setup()'."""
  46. pass
  47. class DistutilsPlatformError (DistutilsError):
  48. """We don't know how to do something on the current platform (but
  49. we do know how to do it on some platform) -- eg. trying to compile
  50. C files on a platform not supported by a CCompiler subclass."""
  51. pass
  52. class DistutilsExecError (DistutilsError):
  53. """Any problems executing an external program (such as the C
  54. compiler, when compiling C files)."""
  55. pass
  56. class DistutilsInternalError (DistutilsError):
  57. """Internal inconsistencies or impossibilities (obviously, this
  58. should never be seen if the code is working!)."""
  59. pass
  60. class DistutilsTemplateError (DistutilsError):
  61. """Syntax error in a file list template."""
  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."""