blob: 8924a2dcfc3ebc48545edda40748fcadc87c801e [file] [log] [blame]
Tarek Ziade1231a4e2011-05-19 13:07:25 +02001"""Exceptions used throughout the package.
2
3Submodules of packaging may raise exceptions defined in this module as
4well as standard exceptions; in particular, SystemExit is usually raised
5for errors that are obviously the end-user's fault (e.g. bad
6command-line arguments).
7"""
8
9
10class PackagingError(Exception):
11 """The root of all Packaging evil."""
12
13
14class 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
19class 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
26class PackagingGetoptError(PackagingError):
27 """The option table provided to 'fancy_getopt()' is bogus."""
28
29
30class PackagingArgError(PackagingError):
31 """Raised by fancy_getopt in response to getopt.error -- ie. an
32 error in the command line usage."""
33
34
35class 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
41class 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
50class PackagingSetupError(PackagingError):
51 """For errors that can be definitely blamed on the setup script,
52 such as invalid keyword arguments to 'setup()'."""
53
54
55class 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
61class PackagingExecError(PackagingError):
62 """Any problems executing an external program (such as the C
63 compiler, when compiling C files)."""
64
65
66class PackagingInternalError(PackagingError):
67 """Internal inconsistencies or impossibilities (obviously, this
68 should never be seen if the code is working!)."""
69
70
71class PackagingTemplateError(PackagingError):
72 """Syntax error in a file list template."""
73
74
75class PackagingByteCompileError(PackagingError):
76 """Byte compile error."""
77
78
79class PackagingPyPIError(PackagingError):
80 """Any problem occuring during using the indexes."""
81
82
83# Exception classes used by the CCompiler implementation classes
84class CCompilerError(Exception):
85 """Some compile/link operation failed."""
86
87
88class PreprocessError(CCompilerError):
89 """Failure to preprocess one or more C/C++ files."""
90
91
92class CompileError(CCompilerError):
93 """Failure to compile one or more C/C++ source files."""
94
95
96class LibError(CCompilerError):
97 """Failure to create a static library from one or more C/C++ object
98 files."""
99
100
101class LinkError(CCompilerError):
102 """Failure to link one or more C/C++ object files into an executable
103 or shared library file."""
104
105
106class UnknownFileError(CCompilerError):
107 """Attempt to process an unknown file type."""
108
109
110class MetadataMissingError(PackagingError):
111 """A required metadata is missing"""
112
113
114class MetadataConflictError(PackagingError):
115 """Attempt to read or write metadata fields that are conflictual."""
116
117
118class MetadataUnrecognizedVersionError(PackagingError):
119 """Unknown metadata version number."""
120
121
122class IrrationalVersionError(Exception):
123 """This is an irrational version."""
124 pass
125
126
127class 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
137class InstallationException(Exception):
138 """Base exception for installation scripts"""
139
140
141class InstallationConflict(InstallationException):
142 """Raised when a conflict is detected"""