From 808c70b81de5c3cfc3dcb01f08213e2ea33b7252 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 14 Feb 2017 21:31:05 +0200 Subject: wic: move errors module Moved from lib/wic/utils/ to lib/wic as this is a core module. Signed-off-by: Ed Bartosh --- scripts/lib/wic/errors.py | 29 ++++++++++++++++++++++ scripts/lib/wic/plugin.py | 4 +-- scripts/lib/wic/plugins/imager/direct.py | 2 +- scripts/lib/wic/plugins/source/bootimg-pcbios.py | 2 +- .../lib/wic/plugins/source/rootfs_pcbios_ext.py | 2 +- scripts/lib/wic/utils/errors.py | 29 ---------------------- scripts/wic | 3 +-- 7 files changed, 35 insertions(+), 36 deletions(-) create mode 100644 scripts/lib/wic/errors.py delete mode 100644 scripts/lib/wic/utils/errors.py (limited to 'scripts') diff --git a/scripts/lib/wic/errors.py b/scripts/lib/wic/errors.py new file mode 100644 index 0000000000..d1b514dd9d --- /dev/null +++ b/scripts/lib/wic/errors.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python -tt +# +# Copyright (c) 2007 Red Hat, Inc. +# Copyright (c) 2011 Intel, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; version 2 of the License +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +class WicError(Exception): + pass + +class CreatorError(WicError): + pass + +class Usage(WicError): + pass + +class ImageError(WicError): + pass diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py index 70d337789f..31311adb55 100644 --- a/scripts/lib/wic/plugin.py +++ b/scripts/lib/wic/plugin.py @@ -19,8 +19,8 @@ import os import sys import logging +from wic.errors import CreatorError from wic import pluginbase -from wic.utils import errors from wic.utils.misc import get_bitbake_var __ALL__ = ['PluginMgr', 'pluginmgr'] @@ -110,7 +110,7 @@ class PluginMgr(): """ the return value is dict of name:class pairs """ if ptype not in PLUGIN_TYPES: - raise errors.CreatorError('%s is not valid plugin type' % ptype) + raise CreatorError('%s is not valid plugin type' % ptype) plugins_dir = self._build_plugin_dir_list(self.plugin_dir, ptype) diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 2e2d26ad7d..e51c8be298 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -33,11 +33,11 @@ import uuid from time import strftime +from wic.errors import ImageError from wic.filemap import sparse_copy from wic.ksparser import KickStart, KickStartError from wic.plugin import pluginmgr from wic.pluginbase import ImagerPlugin -from wic.utils.errors import ImageError from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd logger = logging.getLogger('wic') diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 590d3d6784..8f53fa2a48 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -29,8 +29,8 @@ import os import sys from wic.engine import get_custom_config +from wic.errors import ImageError from wic.utils import runner -from wic.utils.errors import ImageError from wic.pluginbase import SourcePlugin from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, BOOTDD_EXTRA_SPACE) diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py index ed5fbdfa9c..850aa5aaf1 100644 --- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py +++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py @@ -23,9 +23,9 @@ import os import re import sys +from wic.errors import ImageError from wic.utils import runner from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd -from wic.utils.errors import ImageError from wic.pluginbase import SourcePlugin logger = logging.getLogger('wic') diff --git a/scripts/lib/wic/utils/errors.py b/scripts/lib/wic/utils/errors.py deleted file mode 100644 index d1b514dd9d..0000000000 --- a/scripts/lib/wic/utils/errors.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2007 Red Hat, Inc. -# Copyright (c) 2011 Intel, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -class WicError(Exception): - pass - -class CreatorError(WicError): - pass - -class Usage(WicError): - pass - -class ImageError(WicError): - pass diff --git a/scripts/wic b/scripts/wic index 10ce440529..d14671769d 100755 --- a/scripts/wic +++ b/scripts/wic @@ -53,8 +53,8 @@ if bitbake_exe: else: bitbake_main = None +from wic.errors import WicError from wic.utils.misc import get_bitbake_var, BB_VARS -from wic.utils.errors import WicError from wic import engine from wic import help as hlp @@ -339,4 +339,3 @@ if __name__ == "__main__": except WicError as err: logger.error(err) sys.exit(1) - -- cgit v1.2.3