Tarek Ziade | 1231a4e | 2011-05-19 13:07:25 +0200 | [diff] [blame] | 1 | """Exceptions used throughout the package. |
| 2 | |
| 3 | Submodules of packaging may raise exceptions defined in this module as |
| 4 | well as standard exceptions; in particular, SystemExit is usually raised |
| 5 | for errors that are obviously the end-user's fault (e.g. bad |
| 6 | command-line arguments). |
| 7 | """ |
| 8 | |
| 9 | |
| 10 | class PackagingError(Exception): |
| 11 | """The root of all Packaging evil.""" |
| 12 | |
| 13 | |
| 14 | class PackagingModuleError(PackagingError): |
| 15 | """Unable to load an expected module, or to find an expected class |
| 16 | within some module (in particular, command modules and classes).""" |
| 17 | |
| 18 | |
| 19 | class PackagingClassError(PackagingError): |
| 20 | """Some command class (or possibly distribution class, if anyone |
| 21 | feels a need to subclass Distribution) is found not to be holding |
| 22 | up its end of the bargain, ie. implementing some part of the |
| 23 | "command "interface.""" |
| 24 | |
| 25 | |
| 26 | class PackagingGetoptError(PackagingError): |
| 27 | """The option table provided to 'fancy_getopt()' is bogus.""" |
| 28 | |
| 29 | |
| 30 | class PackagingArgError(PackagingError): |
| 31 | """Raised by fancy_getopt in response to getopt.error -- ie. an |
| 32 | error in the command line usage.""" |
| 33 | |
| 34 | |
| 35 | class PackagingFileError(PackagingError): |
| 36 | """Any problems in the filesystem: expected file not found, etc. |
| 37 | Typically this is for problems that we detect before IOError or |
| 38 | OSError could be raised.""" |
| 39 | |
| 40 | |
| 41 | class PackagingOptionError(PackagingError): |
| 42 | """Syntactic/semantic errors in command options, such as use of |
| 43 | mutually conflicting options, or inconsistent options, |
| 44 | badly-spelled values, etc. No distinction is made between option |
| 45 | values originating in the setup script, the command line, config |
| 46 | files, or what-have-you -- but if we *know* something originated in |
| 47 | the setup script, we'll raise PackagingSetupError instead.""" |
| 48 | |
| 49 | |
| 50 | class PackagingSetupError(PackagingError): |
| 51 | """For errors that can be definitely blamed on the setup script, |
| 52 | such as invalid keyword arguments to 'setup()'.""" |
| 53 | |
| 54 | |
| 55 | class PackagingPlatformError(PackagingError): |
| 56 | """We don't know how to do something on the current platform (but |
| 57 | we do know how to do it on some platform) -- eg. trying to compile |
| 58 | C files on a platform not supported by a CCompiler subclass.""" |
| 59 | |
| 60 | |
| 61 | class PackagingExecError(PackagingError): |
| 62 | """Any problems executing an external program (such as the C |
| 63 | compiler, when compiling C files).""" |
| 64 | |
| 65 | |
| 66 | class PackagingInternalError(PackagingError): |
| 67 | """Internal inconsistencies or impossibilities (obviously, this |
| 68 | should never be seen if the code is working!).""" |
| 69 | |
| 70 | |
| 71 | class PackagingTemplateError(PackagingError): |
| 72 | """Syntax error in a file list template.""" |
| 73 | |
| 74 | |
| 75 | class PackagingByteCompileError(PackagingError): |
| 76 | """Byte compile error.""" |
| 77 | |
| 78 | |
| 79 | class PackagingPyPIError(PackagingError): |
| 80 | """Any problem occuring during using the indexes.""" |
| 81 | |
| 82 | |
| 83 | # Exception classes used by the CCompiler implementation classes |
| 84 | class CCompilerError(Exception): |
| 85 | """Some compile/link operation failed.""" |
| 86 | |
| 87 | |
| 88 | class PreprocessError(CCompilerError): |
| 89 | """Failure to preprocess one or more C/C++ files.""" |
| 90 | |
| 91 | |
| 92 | class CompileError(CCompilerError): |
| 93 | """Failure to compile one or more C/C++ source files.""" |
| 94 | |
| 95 | |
| 96 | class LibError(CCompilerError): |
| 97 | """Failure to create a static library from one or more C/C++ object |
| 98 | files.""" |
| 99 | |
| 100 | |
| 101 | class LinkError(CCompilerError): |
| 102 | """Failure to link one or more C/C++ object files into an executable |
| 103 | or shared library file.""" |
| 104 | |
| 105 | |
| 106 | class UnknownFileError(CCompilerError): |
| 107 | """Attempt to process an unknown file type.""" |
| 108 | |
| 109 | |
| 110 | class MetadataMissingError(PackagingError): |
| 111 | """A required metadata is missing""" |
| 112 | |
| 113 | |
| 114 | class MetadataConflictError(PackagingError): |
| 115 | """Attempt to read or write metadata fields that are conflictual.""" |
| 116 | |
| 117 | |
| 118 | class MetadataUnrecognizedVersionError(PackagingError): |
| 119 | """Unknown metadata version number.""" |
| 120 | |
| 121 | |
| 122 | class IrrationalVersionError(Exception): |
| 123 | """This is an irrational version.""" |
| 124 | pass |
| 125 | |
| 126 | |
| 127 | class HugeMajorVersionNumError(IrrationalVersionError): |
| 128 | """An irrational version because the major version number is huge |
| 129 | (often because a year or date was used). |
| 130 | |
| 131 | See `error_on_huge_major_num` option in `NormalizedVersion` for details. |
| 132 | This guard can be disabled by setting that option False. |
| 133 | """ |
| 134 | pass |
| 135 | |
| 136 | |
| 137 | class InstallationException(Exception): |
| 138 | """Base exception for installation scripts""" |
| 139 | |
| 140 | |
| 141 | class InstallationConflict(InstallationException): |
| 142 | """Raised when a conflict is detected""" |