Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | # Copyright (C) 2016-2018 Wind River Systems, Inc. |
| 2 | # |
| 3 | # This program is free software; you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License version 2 as |
| 5 | # published by the Free Software Foundation. |
| 6 | # |
| 7 | # This program is distributed in the hope that it will be useful, |
| 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 10 | # See the GNU General Public License for more details. |
| 11 | # |
| 12 | # You should have received a copy of the GNU General Public License |
| 13 | # along with this program; if not, write to the Free Software |
| 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 15 | |
| 16 | # The file contains: |
| 17 | # LayerIndex exceptions |
| 18 | # Plugin base class |
| 19 | # Utility Functions for working on layerindex data |
| 20 | |
| 21 | import argparse |
| 22 | import logging |
| 23 | import os |
| 24 | import bb.msg |
| 25 | |
| 26 | logger = logging.getLogger('BitBake.layerindexlib.plugin') |
| 27 | |
| 28 | class LayerIndexPluginException(Exception): |
| 29 | """LayerIndex Generic Exception""" |
| 30 | def __init__(self, message): |
| 31 | self.msg = message |
| 32 | Exception.__init__(self, message) |
| 33 | |
| 34 | def __str__(self): |
| 35 | return self.msg |
| 36 | |
| 37 | class LayerIndexPluginUrlError(LayerIndexPluginException): |
| 38 | """Exception raised when a plugin does not support a given URL type""" |
| 39 | def __init__(self, plugin, url): |
| 40 | msg = "%s does not support %s:" % (plugin, url) |
| 41 | self.plugin = plugin |
| 42 | self.url = url |
| 43 | LayerIndexPluginException.__init__(self, msg) |
| 44 | |
| 45 | class IndexPlugin(): |
| 46 | def __init__(self): |
| 47 | self.type = None |
| 48 | |
| 49 | def init(self, layerindex): |
| 50 | self.layerindex = layerindex |
| 51 | |
| 52 | def plugin_type(self): |
| 53 | return self.type |
| 54 | |
| 55 | def load_index(self, uri): |
| 56 | raise NotImplementedError('load_index is not implemented') |
| 57 | |
| 58 | def store_index(self, uri, index): |
| 59 | raise NotImplementedError('store_index is not implemented') |
| 60 | |