blob: d9c47c761cb4428cacef0efbe010f78a9d1f930d [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
Greg Ward3ce77fd2000-03-02 01:49:45 +000011__revision__ = "$Id$"
Greg Ward2689e3d1999-03-22 14:52:19 +000012
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000013class DistutilsError(Exception):
Greg Wardc1cb0492000-05-30 02:02:14 +000014 """The root of all Distutils evil."""
Greg Ward2689e3d1999-03-22 14:52:19 +000015
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000016class DistutilsModuleError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000017 """Unable to load an expected module, or to find an expected class
18 within some module (in particular, command modules and classes)."""
Greg Ward2689e3d1999-03-22 14:52:19 +000019
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +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."""
Greg Ward2689e3d1999-03-22 14:52:19 +000025
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000026class DistutilsGetoptError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000027 """The option table provided to 'fancy_getopt()' is bogus."""
Greg Ward2689e3d1999-03-22 14:52:19 +000028
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000029class DistutilsArgError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000030 """Raised by fancy_getopt in response to getopt.error -- ie. an
31 error in the command line usage."""
Greg Ward2689e3d1999-03-22 14:52:19 +000032
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000033class DistutilsFileError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000034 """Any problems in the filesystem: expected file not found, etc.
35 Typically this is for problems that we detect before IOError or
36 OSError could be raised."""
Greg Ward2689e3d1999-03-22 14:52:19 +000037
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000038class DistutilsOptionError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000039 """Syntactic/semantic errors in command options, such as use of
40 mutually conflicting options, or inconsistent options,
41 badly-spelled values, etc. No distinction is made between option
42 values originating in the setup script, the command line, config
43 files, or what-have-you -- but if we *know* something originated in
44 the setup script, we'll raise DistutilsSetupError instead."""
Greg Ward2689e3d1999-03-22 14:52:19 +000045
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000046class DistutilsSetupError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000047 """For errors that can be definitely blamed on the setup script,
48 such as invalid keyword arguments to 'setup()'."""
Greg Ward2689e3d1999-03-22 14:52:19 +000049
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000050class DistutilsPlatformError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000051 """We don't know how to do something on the current platform (but
52 we do know how to do it on some platform) -- eg. trying to compile
53 C files on a platform not supported by a CCompiler subclass."""
Greg Ward2689e3d1999-03-22 14:52:19 +000054
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000055class DistutilsExecError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000056 """Any problems executing an external program (such as the C
57 compiler, when compiling C files)."""
Greg Ward8c66b691999-08-14 23:43:45 +000058
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000059class DistutilsInternalError(DistutilsError):
Greg Wardc1cb0492000-05-30 02:02:14 +000060 """Internal inconsistencies or impossibilities (obviously, this
61 should never be seen if the code is working!)."""
Greg Wardccbb3f01999-07-10 02:01:44 +000062
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000063class DistutilsTemplateError(DistutilsError):
Greg Ward58bff532000-07-30 01:03:31 +000064 """Syntax error in a file list template."""
65
Tarek Ziadé04fe7c02009-10-25 23:08:47 +000066class DistutilsByteCompileError(DistutilsError):
67 """Byte compile error."""
Greg Ward8c66b691999-08-14 23:43:45 +000068
Greg Wardc1cb0492000-05-30 02:02:14 +000069# Exception classes used by the CCompiler implementation classes
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000070class CCompilerError(Exception):
Greg Wardc1cb0492000-05-30 02:02:14 +000071 """Some compile/link operation failed."""
Greg Ward318a9d72000-03-31 02:57:31 +000072
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000073class PreprocessError(CCompilerError):
Greg Ward68ff6152000-06-25 02:12:14 +000074 """Failure to preprocess one or more C/C++ files."""
75
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000076class CompileError(CCompilerError):
Greg Wardc1cb0492000-05-30 02:02:14 +000077 """Failure to compile one or more C/C++ source files."""
78
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000079class LibError(CCompilerError):
Greg Wardc1cb0492000-05-30 02:02:14 +000080 """Failure to create a static library from one or more C/C++ object
81 files."""
82
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000083class LinkError(CCompilerError):
Greg Wardc1cb0492000-05-30 02:02:14 +000084 """Failure to link one or more C/C++ object files into an executable
85 or shared library file."""
86
Tarek Ziadé7a8ad4a2009-10-28 06:48:27 +000087class UnknownFileError(CCompilerError):
Greg Ward68ff6152000-06-25 02:12:14 +000088 """Attempt to process an unknown file type."""