blob: d66043a1fecd2461601f433388ae9d859fb507e8 [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
8This module safe to use in "from ... import *" mode; it only exports
9symbols whose names start with "Distutils" and end with "Error"."""
10
11# created 1999/03/03, Greg Ward
12
Greg Ward3ce77fd2000-03-02 01:49:45 +000013__revision__ = "$Id$"
Greg Ward2689e3d1999-03-22 14:52:19 +000014
Greg Wardccbb3f01999-07-10 02:01:44 +000015import types
Greg Ward2689e3d1999-03-22 14:52:19 +000016
Greg Wardccbb3f01999-07-10 02:01:44 +000017if type (RuntimeError) is types.ClassType:
Greg Ward2689e3d1999-03-22 14:52:19 +000018
Greg Ward2689e3d1999-03-22 14:52:19 +000019 class DistutilsError (Exception):
Greg Wardeacdea82000-04-15 22:23:47 +000020 """The root of all Distutils evil."""
Greg Ward2689e3d1999-03-22 14:52:19 +000021 pass
22
Greg Ward2689e3d1999-03-22 14:52:19 +000023 class DistutilsModuleError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000024 """Unable to load an expected module, or to find an expected class
25 within some module (in particular, command modules and classes)."""
Greg Ward2689e3d1999-03-22 14:52:19 +000026 pass
27
Greg Ward2689e3d1999-03-22 14:52:19 +000028 class DistutilsClassError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000029 """Some command class (or possibly distribution class, if anyone
30 feels a need to subclass Distribution) is found not to be holding
31 up its end of the bargain, ie. implementing some part of the
32 "command "interface."""
Greg Ward2689e3d1999-03-22 14:52:19 +000033 pass
34
Greg Ward2689e3d1999-03-22 14:52:19 +000035 class DistutilsGetoptError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000036 """The option table provided to 'fancy_getopt()' is bogus."""
Greg Ward2689e3d1999-03-22 14:52:19 +000037 pass
38
Greg Ward2689e3d1999-03-22 14:52:19 +000039 class DistutilsArgError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000040 """Raised by fancy_getopt in response to getopt.error -- ie. an
41 error in the command line usage."""
Greg Ward2689e3d1999-03-22 14:52:19 +000042 pass
43
Greg Ward2689e3d1999-03-22 14:52:19 +000044 class DistutilsFileError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000045 """Any problems in the filesystem: expected file not found, etc.
46 Typically this is for problems that we detect before IOError or
47 OSError could be raised."""
Greg Ward2689e3d1999-03-22 14:52:19 +000048 pass
49
Greg Ward2689e3d1999-03-22 14:52:19 +000050 class DistutilsOptionError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000051 """Syntactic/semantic errors in command options, such as use of
52 mutually conflicting options, or inconsistent options,
53 badly-spelled values, etc. No distinction is made between option
54 values originating in the setup script, the command line, config
55 files, or what-have-you -- but if we *know* something originated in
56 the setup script, we'll raise DistutilsSetupError instead."""
Greg Ward2689e3d1999-03-22 14:52:19 +000057 pass
58
Greg Ward02a1a2b2000-04-15 22:15:07 +000059 class DistutilsSetupError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000060 """For errors that can be definitely blamed on the setup script,
61 such as invalid keyword arguments to 'setup()'."""
Greg Ward8c66b691999-08-14 23:43:45 +000062 pass
63
Greg Wardccbb3f01999-07-10 02:01:44 +000064 class DistutilsPlatformError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000065 """We don't know how to do something on the current platform (but
66 we do know how to do it on some platform) -- eg. trying to compile
67 C files on a platform not supported by a CCompiler subclass."""
Greg Wardccbb3f01999-07-10 02:01:44 +000068 pass
69
Greg Ward8c66b691999-08-14 23:43:45 +000070 class DistutilsExecError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000071 """Any problems executing an external program (such as the C
72 compiler, when compiling C files)."""
Greg Ward8c66b691999-08-14 23:43:45 +000073 pass
74
Greg Ward318a9d72000-03-31 02:57:31 +000075 class DistutilsInternalError (DistutilsError):
Greg Wardeacdea82000-04-15 22:23:47 +000076 """Internal inconsistencies or impossibilities (obviously, this
77 should never be seen if the code is working!)."""
Greg Ward318a9d72000-03-31 02:57:31 +000078 pass
79
Greg Ward2689e3d1999-03-22 14:52:19 +000080# String-based exceptions
81else:
82 DistutilsError = 'DistutilsError'
83 DistutilsModuleError = 'DistutilsModuleError'
84 DistutilsClassError = 'DistutilsClassError'
85 DistutilsGetoptError = 'DistutilsGetoptError'
86 DistutilsArgError = 'DistutilsArgError'
87 DistutilsFileError = 'DistutilsFileError'
88 DistutilsOptionError = 'DistutilsOptionError'
Greg Wardccbb3f01999-07-10 02:01:44 +000089 DistutilsPlatformError = 'DistutilsPlatformError'
Greg Ward8c66b691999-08-14 23:43:45 +000090 DistutilsExecError = 'DistutilsExecError'
Greg Ward318a9d72000-03-31 02:57:31 +000091 DistutilsInternalError = 'DistutilsInternalError'
Greg Ward8c66b691999-08-14 23:43:45 +000092
Greg Wardccbb3f01999-07-10 02:01:44 +000093del types