plugin.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright (C) 2016-2018 Wind River Systems, Inc.
  2. #
  3. # SPDX-License-Identifier: GPL-2.0-only
  4. #
  5. # The file contains:
  6. # LayerIndex exceptions
  7. # Plugin base class
  8. # Utility Functions for working on layerindex data
  9. import argparse
  10. import logging
  11. import os
  12. import bb.msg
  13. logger = logging.getLogger('BitBake.layerindexlib.plugin')
  14. class LayerIndexPluginException(Exception):
  15. """LayerIndex Generic Exception"""
  16. def __init__(self, message):
  17. self.msg = message
  18. Exception.__init__(self, message)
  19. def __str__(self):
  20. return self.msg
  21. class LayerIndexPluginUrlError(LayerIndexPluginException):
  22. """Exception raised when a plugin does not support a given URL type"""
  23. def __init__(self, plugin, url):
  24. msg = "%s does not support %s:" % (plugin, url)
  25. self.plugin = plugin
  26. self.url = url
  27. LayerIndexPluginException.__init__(self, msg)
  28. class IndexPlugin():
  29. def __init__(self):
  30. self.type = None
  31. def init(self, layerindex):
  32. self.layerindex = layerindex
  33. def plugin_type(self):
  34. return self.type
  35. def load_index(self, uri):
  36. raise NotImplementedError('load_index is not implemented')
  37. def store_index(self, uri, index):
  38. raise NotImplementedError('store_index is not implemented')