blob: 8b93059e19faa9f821ffad1b8a298e7301fe8ab2 [file] [log] [blame]
Greg Ward2689e3d1999-03-22 14:52:19 +00001"""distutils.errors
2
3Provides exceptions used by the Distutils modules. Note that Distutils
4modules may raise standard exceptions; in particular, SystemExit is
5usually raised for errors that are obviously the end-user's fault
6(eg. bad command-line arguments).
7
Andrew M. Kuchlingf6756e82002-11-14 01:58:48 +00008This module is safe to use in "from ... import *" mode; it only exports
Greg Ward2689e3d1999-03-22 14:52:19 +00009symbols whose names start with "Distutils" and end with "Error"."""
10
Tarek Ziadé36797272010-07-22 12:50:05 +000011class DistutilsError (Exception):
Greg Wardc1cb0492000-05-30 02:02:14 +000012 """The root of all Distutils evil."""
Tarek Ziadé36797272010-07-22 12:50:05 +000013 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000014
Tarek Ziadé36797272010-07-22 12:50:05 +000015class DistutilsModuleError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000016 """Unable to load an expected module, or to find an expected class
17 within some module (in particular, command modules and classes)."""
Tarek Ziadé36797272010-07-22 12:50:05 +000018 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000019
Tarek Ziadé36797272010-07-22 12:50:05 +000020class DistutilsClassError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000021 """Some command class (or possibly distribution class, if anyone
22 feels a need to subclass Distribution) is found not to be holding
23 up its end of the bargain, ie. implementing some part of the
24 "command "interface."""
Tarek Ziadé36797272010-07-22 12:50:05 +000025 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000026
Tarek Ziadé36797272010-07-22 12:50:05 +000027class DistutilsGetoptError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000028 """The option table provided to 'fancy_getopt()' is bogus."""
Tarek Ziadé36797272010-07-22 12:50:05 +000029 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000030
Tarek Ziadé36797272010-07-22 12:50:05 +000031class DistutilsArgError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000032 """Raised by fancy_getopt in response to getopt.error -- ie. an
33 error in the command line usage."""
Tarek Ziadé36797272010-07-22 12:50:05 +000034 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000035
Tarek Ziadé36797272010-07-22 12:50:05 +000036class DistutilsFileError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000037 """Any problems in the filesystem: expected file not found, etc.
Andrew Svetlovf7a17b42012-12-25 16:47:37 +020038 Typically this is for problems that we detect before OSError
39 could be raised."""
Tarek Ziadé36797272010-07-22 12:50:05 +000040 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000041
Tarek Ziadé36797272010-07-22 12:50:05 +000042class DistutilsOptionError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000043 """Syntactic/semantic errors in command options, such as use of
44 mutually conflicting options, or inconsistent options,
45 badly-spelled values, etc. No distinction is made between option
46 values originating in the setup script, the command line, config
47 files, or what-have-you -- but if we *know* something originated in
48 the setup script, we'll raise DistutilsSetupError instead."""
Tarek Ziadé36797272010-07-22 12:50:05 +000049 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000050
Tarek Ziadé36797272010-07-22 12:50:05 +000051class DistutilsSetupError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000052 """For errors that can be definitely blamed on the setup script,
53 such as invalid keyword arguments to 'setup()'."""
Tarek Ziadé36797272010-07-22 12:50:05 +000054 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000055
Tarek Ziadé36797272010-07-22 12:50:05 +000056class DistutilsPlatformError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000057 """We don't know how to do something on the current platform (but
58 we do know how to do it on some platform) -- eg. trying to compile
59 C files on a platform not supported by a CCompiler subclass."""
Tarek Ziadé36797272010-07-22 12:50:05 +000060 pass
Greg Ward2689e3d1999-03-22 14:52:19 +000061
Tarek Ziadé36797272010-07-22 12:50:05 +000062class DistutilsExecError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000063 """Any problems executing an external program (such as the C
64 compiler, when compiling C files)."""
Tarek Ziadé36797272010-07-22 12:50:05 +000065 pass
Greg Ward8c66b691999-08-14 23:43:45 +000066
Tarek Ziadé36797272010-07-22 12:50:05 +000067class DistutilsInternalError (DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000068 """Internal inconsistencies or impossibilities (obviously, this
69 should never be seen if the code is working!)."""
Tarek Ziadé36797272010-07-22 12:50:05 +000070 pass
Greg Wardccbb3f01999-07-10 02:01:44 +000071
Tarek Ziadé36797272010-07-22 12:50:05 +000072class DistutilsTemplateError (DistutilsError):
Greg Ward58bff532000-07-30 01:03:31 +000073 """Syntax error in a file list template."""
74
Tarek Ziadé04fe7c02009-10-25 23:08:47 +000075class DistutilsByteCompileError(DistutilsError):
76 """Byte compile error."""
Greg Ward8c66b691999-08-14 23:43:45 +000077
Greg Wardc1cb0492000-05-30 02:02:14 +000078# Exception classes used by the CCompiler implementation classes
Tarek Ziadé36797272010-07-22 12:50:05 +000079class CCompilerError (Exception):
Greg Wardc1cb0492000-05-30 02:02:14 +000080 """Some compile/link operation failed."""
Greg Ward318a9d72000-03-31 02:57:31 +000081
Tarek Ziadé36797272010-07-22 12:50:05 +000082class PreprocessError (CCompilerError):
Greg Ward68ff6152000-06-25 02:12:14 +000083 """Failure to preprocess one or more C/C++ files."""
84
Tarek Ziadé36797272010-07-22 12:50:05 +000085class CompileError (CCompilerError):
Greg Wardc1cb0492000-05-30 02:02:14 +000086 """Failure to compile one or more C/C++ source files."""
87
Tarek Ziadé36797272010-07-22 12:50:05 +000088class LibError (CCompilerError):
Greg Wardc1cb0492000-05-30 02:02:14 +000089 """Failure to create a static library from one or more C/C++ object
90 files."""
91
Tarek Ziadé36797272010-07-22 12:50:05 +000092class LinkError (CCompilerError):
Greg Wardc1cb0492000-05-30 02:02:14 +000093 """Failure to link one or more C/C++ object files into an executable
94 or shared library file."""
95
Tarek Ziadé36797272010-07-22 12:50:05 +000096class UnknownFileError (CCompilerError):
Greg Ward68ff6152000-06-25 02:12:14 +000097 """Attempt to process an unknown file type."""