errors.py 3.5 KB
Newer Older
1 2 3 4 5 6 7
"""distutils.errors

Provides exceptions used by the Distutils modules.  Note that Distutils
modules may raise standard exceptions; in particular, SystemExit is
usually raised for errors that are obviously the end-user's fault
(eg. bad command-line arguments).

8
This module is safe to use in "from ... import *" mode; it only exports
9 10
symbols whose names start with "Distutils" and end with "Error"."""

11
class DistutilsError (Exception):
12
    """The root of all Distutils evil."""
13
    pass
14

15
class DistutilsModuleError (DistutilsError):
16 17
    """Unable to load an expected module, or to find an expected class
    within some module (in particular, command modules and classes)."""
18
    pass
19

20
class DistutilsClassError (DistutilsError):
21 22 23 24
    """Some command class (or possibly distribution class, if anyone
    feels a need to subclass Distribution) is found not to be holding
    up its end of the bargain, ie. implementing some part of the
    "command "interface."""
25
    pass
26

27
class DistutilsGetoptError (DistutilsError):
28
    """The option table provided to 'fancy_getopt()' is bogus."""
29
    pass
30

31
class DistutilsArgError (DistutilsError):
32 33
    """Raised by fancy_getopt in response to getopt.error -- ie. an
    error in the command line usage."""
34
    pass
35

36
class DistutilsFileError (DistutilsError):
37 38 39
    """Any problems in the filesystem: expected file not found, etc.
    Typically this is for problems that we detect before IOError or
    OSError could be raised."""
40
    pass
41

42
class DistutilsOptionError (DistutilsError):
43 44 45 46 47 48
    """Syntactic/semantic errors in command options, such as use of
    mutually conflicting options, or inconsistent options,
    badly-spelled values, etc.  No distinction is made between option
    values originating in the setup script, the command line, config
    files, or what-have-you -- but if we *know* something originated in
    the setup script, we'll raise DistutilsSetupError instead."""
49
    pass
50

51
class DistutilsSetupError (DistutilsError):
52 53
    """For errors that can be definitely blamed on the setup script,
    such as invalid keyword arguments to 'setup()'."""
54
    pass
55

56
class DistutilsPlatformError (DistutilsError):
57 58 59
    """We don't know how to do something on the current platform (but
    we do know how to do it on some platform) -- eg. trying to compile
    C files on a platform not supported by a CCompiler subclass."""
60
    pass
61

62
class DistutilsExecError (DistutilsError):
63 64
    """Any problems executing an external program (such as the C
    compiler, when compiling C files)."""
65
    pass
66

67
class DistutilsInternalError (DistutilsError):
68 69
    """Internal inconsistencies or impossibilities (obviously, this
    should never be seen if the code is working!)."""
70
    pass
71

72
class DistutilsTemplateError (DistutilsError):
73 74
    """Syntax error in a file list template."""

75 76
class DistutilsByteCompileError(DistutilsError):
    """Byte compile error."""
77 78

# Exception classes used by the CCompiler implementation classes
79
class CCompilerError (Exception):
80 81
    """Some compile/link operation failed."""

82
class PreprocessError (CCompilerError):
83 84
    """Failure to preprocess one or more C/C++ files."""

85
class CompileError (CCompilerError):
86 87
    """Failure to compile one or more C/C++ source files."""

88
class LibError (CCompilerError):
89 90 91
    """Failure to create a static library from one or more C/C++ object
    files."""

92
class LinkError (CCompilerError):
93 94 95
    """Failure to link one or more C/C++ object files into an executable
    or shared library file."""

96
class UnknownFileError (CCompilerError):
97
    """Attempt to process an unknown file type."""