errors.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. """setuptools.errors
  2. Provides exceptions used by setuptools modules.
  3. """
  4. from distutils import errors as _distutils_errors
  5. # Re-export errors from distutils to facilitate the migration to PEP632
  6. ByteCompileError = _distutils_errors.DistutilsByteCompileError
  7. CCompilerError = _distutils_errors.CCompilerError
  8. ClassError = _distutils_errors.DistutilsClassError
  9. CompileError = _distutils_errors.CompileError
  10. ExecError = _distutils_errors.DistutilsExecError
  11. FileError = _distutils_errors.DistutilsFileError
  12. InternalError = _distutils_errors.DistutilsInternalError
  13. LibError = _distutils_errors.LibError
  14. LinkError = _distutils_errors.LinkError
  15. ModuleError = _distutils_errors.DistutilsModuleError
  16. OptionError = _distutils_errors.DistutilsOptionError
  17. PlatformError = _distutils_errors.DistutilsPlatformError
  18. PreprocessError = _distutils_errors.PreprocessError
  19. SetupError = _distutils_errors.DistutilsSetupError
  20. TemplateError = _distutils_errors.DistutilsTemplateError
  21. UnknownFileError = _distutils_errors.UnknownFileError
  22. # The root error class in the hierarchy
  23. BaseError = _distutils_errors.DistutilsError
  24. class RemovedCommandError(BaseError, RuntimeError):
  25. """Error used for commands that have been removed in setuptools.
  26. Since ``setuptools`` is built on ``distutils``, simply removing a command
  27. from ``setuptools`` will make the behavior fall back to ``distutils``; this
  28. error is raised if a command exists in ``distutils`` but has been actively
  29. removed in ``setuptools``.
  30. """
  31. class PackageDiscoveryError(BaseError, RuntimeError):
  32. """Impossible to perform automatic discovery of packages and/or modules.
  33. The current project layout or given discovery options can lead to problems when
  34. scanning the project directory.
  35. Setuptools might also refuse to complete auto-discovery if an error prone condition
  36. is detected (e.g. when a project is organised as a flat-layout but contains
  37. multiple directories that can be taken as top-level packages inside a single
  38. distribution [*]_). In these situations the users are encouraged to be explicit
  39. about which packages to include or to make the discovery parameters more specific.
  40. .. [*] Since multi-package distributions are uncommon it is very likely that the
  41. developers did not intend for all the directories to be packaged, and are just
  42. leaving auxiliary code in the repository top-level, such as maintenance-related
  43. scripts.
  44. """