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 | |
| 19 | # DistutilsError is the root of all Distutils evil. |
| 20 | class DistutilsError (Exception): |
| 21 | pass |
| 22 | |
| 23 | # DistutilsModuleError is raised if we are unable to load an expected |
| 24 | # module, or find an expected class within some module |
| 25 | class DistutilsModuleError (DistutilsError): |
| 26 | pass |
| 27 | |
| 28 | # DistutilsClassError is raised if we encounter a distribution or command |
| 29 | # class that's not holding up its end of the bargain. |
| 30 | class DistutilsClassError (DistutilsError): |
| 31 | pass |
| 32 | |
| 33 | # DistutilsGetoptError (help me -- I have JavaProgrammersDisease!) is |
| 34 | # raised if the option table provided to fancy_getopt is bogus. |
| 35 | class DistutilsGetoptError (DistutilsError): |
| 36 | pass |
| 37 | |
| 38 | # DistutilsArgError is raised by fancy_getopt in response to getopt.error; |
| 39 | # distutils.core then turns around and raises SystemExit from that. (Thus |
| 40 | # client code should never see DistutilsArgError.) |
| 41 | class DistutilsArgError (DistutilsError): |
| 42 | pass |
| 43 | |
| 44 | # DistutilsFileError is raised for any problems in the filesystem: |
| 45 | # expected file not found, etc. |
| 46 | class DistutilsFileError (DistutilsError): |
| 47 | pass |
| 48 | |
Greg Ward | 02a1a2b | 2000-04-15 22:15:07 +0000 | [diff] [blame^] | 49 | # DistutilsOptionError is raised for syntactic/semantic errors in |
| 50 | # command options, such as use of mutually conflicting options, or |
| 51 | # inconsistent options, badly-spelled values, etc. No distinction is |
| 52 | # made between option values originating in the setup script, the |
| 53 | # command line, config files, or what-have-you. |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 54 | class DistutilsOptionError (DistutilsError): |
| 55 | pass |
| 56 | |
Greg Ward | 02a1a2b | 2000-04-15 22:15:07 +0000 | [diff] [blame^] | 57 | # DistutilsSetupError is raised for errors that can be definitely |
| 58 | # blamed on the setup script, such as invalid keyword arguments to |
| 59 | # 'setup()'. |
| 60 | class DistutilsSetupError (DistutilsError): |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 61 | pass |
| 62 | |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 63 | # DistutilsPlatformError is raised when we find that we don't |
| 64 | # know how to do something on the current platform (but we do |
| 65 | # know how to do it on some platform). |
| 66 | class DistutilsPlatformError (DistutilsError): |
| 67 | pass |
| 68 | |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 69 | # DistutilsExecError is raised if there are any problems executing |
| 70 | # an external program |
| 71 | class DistutilsExecError (DistutilsError): |
| 72 | pass |
| 73 | |
Greg Ward | 318a9d7 | 2000-03-31 02:57:31 +0000 | [diff] [blame] | 74 | # DistutilsInternalError is raised on internal inconsistencies |
| 75 | # or impossibilities |
| 76 | class DistutilsInternalError (DistutilsError): |
| 77 | pass |
| 78 | |
Greg Ward | 2689e3d | 1999-03-22 14:52:19 +0000 | [diff] [blame] | 79 | # String-based exceptions |
| 80 | else: |
| 81 | DistutilsError = 'DistutilsError' |
| 82 | DistutilsModuleError = 'DistutilsModuleError' |
| 83 | DistutilsClassError = 'DistutilsClassError' |
| 84 | DistutilsGetoptError = 'DistutilsGetoptError' |
| 85 | DistutilsArgError = 'DistutilsArgError' |
| 86 | DistutilsFileError = 'DistutilsFileError' |
| 87 | DistutilsOptionError = 'DistutilsOptionError' |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 88 | DistutilsPlatformError = 'DistutilsPlatformError' |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 89 | DistutilsExecError = 'DistutilsExecError' |
Greg Ward | 318a9d7 | 2000-03-31 02:57:31 +0000 | [diff] [blame] | 90 | DistutilsInternalError = 'DistutilsInternalError' |
Greg Ward | 8c66b69 | 1999-08-14 23:43:45 +0000 | [diff] [blame] | 91 | |
Greg Ward | ccbb3f0 | 1999-07-10 02:01:44 +0000 | [diff] [blame] | 92 | del types |