You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.2 KiB

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