Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 1 | """distutils.errors |
| 2 | |
| 3 | Provides exceptions used by the Distutils modules. Note that Distutils |
| 4 | modules may raise standard exceptions; in particular, SystemExit is |
| 5 | usually raised for errors that are obviously the end-user's fault |
| 6 | (eg. bad command-line arguments). |
| 7 | |
| 8 | This module safe to use in "from ... import *" mode; it only exports |
| 9 | symbols whose names start with "Distutils" and end with "Error".""" |
| 10 | |
| 11 | # created 1999/03/03, Greg Ward |
| 12 | |
Greg Ward | 3ce77fd | 2000-03-02 01:49:45 +0000 | [diff] [blame] | 13 | __revision__ = "$Id$" |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 14 | |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 15 | import types |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 16 | |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 17 | if type (RuntimeError) is types.ClassType: |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 18 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 19 | class DistutilsError (Exception): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 20 | """The root of all Distutils evil.""" |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 21 | pass |
| 22 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 23 | class DistutilsModuleError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 24 | """Unable to load an expected module, or to find an expected class |
| 25 | within some module (in particular, command modules and classes).""" |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 26 | pass |
| 27 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 28 | class DistutilsClassError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 29 | """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 Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 33 | pass |
| 34 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 35 | class DistutilsGetoptError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 36 | """The option table provided to 'fancy_getopt()' is bogus.""" |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 37 | pass |
| 38 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 39 | class DistutilsArgError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 40 | """Raised by fancy_getopt in response to getopt.error -- ie. an |
| 41 | error in the command line usage.""" |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 42 | pass |
| 43 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 44 | class DistutilsFileError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 45 | """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 Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 48 | pass |
| 49 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 50 | class DistutilsOptionError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 51 | """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 Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 57 | pass |
| 58 | |
Greg Ward | 02a1a2b | 2000-04-15 22:15:07 +0000 | [diff] [blame] | 59 | class DistutilsSetupError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 60 | """For errors that can be definitely blamed on the setup script, |
| 61 | such as invalid keyword arguments to 'setup()'.""" |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 62 | pass |
| 63 | |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 64 | class DistutilsPlatformError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 65 | """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 Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 68 | pass |
| 69 | |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 70 | class DistutilsExecError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 71 | """Any problems executing an external program (such as the C |
| 72 | compiler, when compiling C files).""" |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 73 | pass |
| 74 | |
Greg Ward | 318a9d7 | 2000-03-31 02:57:31 +0000 | [diff] [blame] | 75 | class DistutilsInternalError (DistutilsError): |
Greg Ward | eacdea8 | 2000-04-15 22:23:47 +0000 | [diff] [blame^] | 76 | """Internal inconsistencies or impossibilities (obviously, this |
| 77 | should never be seen if the code is working!).""" |
Greg Ward | 318a9d7 | 2000-03-31 02:57:31 +0000 | [diff] [blame] | 78 | pass |
| 79 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 80 | # String-based exceptions |
| 81 | else: |
| 82 | DistutilsError = 'DistutilsError' |
| 83 | DistutilsModuleError = 'DistutilsModuleError' |
| 84 | DistutilsClassError = 'DistutilsClassError' |
| 85 | DistutilsGetoptError = 'DistutilsGetoptError' |
| 86 | DistutilsArgError = 'DistutilsArgError' |
| 87 | DistutilsFileError = 'DistutilsFileError' |
| 88 | DistutilsOptionError = 'DistutilsOptionError' |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 89 | DistutilsPlatformError = 'DistutilsPlatformError' |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 90 | DistutilsExecError = 'DistutilsExecError' |
Greg Ward | 318a9d7 | 2000-03-31 02:57:31 +0000 | [diff] [blame] | 91 | DistutilsInternalError = 'DistutilsInternalError' |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 92 | |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 93 | del types |