diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-04-15 23:47:10 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-24 11:05:57 +0100 |
commit | 13416c1941f5dc8abcdb0073f2104a89eae2d6f1 (patch) | |
tree | f7851e14e0bacf210bcf676e20bbd9a4b6ea2dad /scripts | |
parent | db0903ad89dcb655c0eec5ac6dce96aae26533da (diff) | |
download | openembedded-core-13416c1941f5dc8abcdb0073f2104a89eae2d6f1.tar.gz openembedded-core-13416c1941f5dc8abcdb0073f2104a89eae2d6f1.tar.bz2 openembedded-core-13416c1941f5dc8abcdb0073f2104a89eae2d6f1.zip |
wic: code cleanup: wildcard imports
Here is what PEP8(Style Guide for Python Code) says about this:
Wildcard imports (from <module> import *) should be avoided, as they
make it unclear which names are present in the namespace, confusing
both readers and many automated tools.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/image/engine.py | 18 | ||||
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/plugin.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 8 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-partition.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-pcbios.py | 9 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/fsimage.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/rawcopy.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/rootfs.py | 9 | ||||
-rw-r--r-- | scripts/lib/wic/utils/fs_related.py | 5 | ||||
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 4 | ||||
-rwxr-xr-x | scripts/wic | 41 |
12 files changed, 43 insertions, 60 deletions
diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py index 68d1ce2659..05c26386e7 100644 --- a/scripts/lib/image/engine.py +++ b/scripts/lib/image/engine.py @@ -42,7 +42,7 @@ from wic.utils import cmdln, misc, errors from wic.conf import configmgr from wic.plugin import pluginmgr from wic.__version__ import VERSION -from wic.utils.oe.misc import * +from wic.utils.oe import misc def verify_build_env(): @@ -65,19 +65,19 @@ def find_artifacts(image_name): Gather the build artifacts for the current image (the image_name e.g. core-image-minimal) for the current MACHINE set in local.conf """ - bitbake_env_lines = get_bitbake_env_lines() + bitbake_env_lines = misc.get_bitbake_env_lines() rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = "" for line in bitbake_env_lines.split('\n'): - if (get_line_val(line, "IMAGE_ROOTFS")): - rootfs_dir = get_line_val(line, "IMAGE_ROOTFS") + if (misc.get_line_val(line, "IMAGE_ROOTFS")): + rootfs_dir = misc.get_line_val(line, "IMAGE_ROOTFS") continue - if (get_line_val(line, "DEPLOY_DIR_IMAGE")): - kernel_dir = get_line_val(line, "DEPLOY_DIR_IMAGE") + if (misc.get_line_val(line, "DEPLOY_DIR_IMAGE")): + kernel_dir = misc.get_line_val(line, "DEPLOY_DIR_IMAGE") continue - if (get_line_val(line, "STAGING_DIR_NATIVE")): - native_sysroot = get_line_val(line, "STAGING_DIR_NATIVE") + if (misc.get_line_val(line, "STAGING_DIR_NATIVE")): + native_sysroot = misc.get_line_val(line, "STAGING_DIR_NATIVE") continue return (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) @@ -87,7 +87,7 @@ CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR def build_canned_image_list(dl): - layers_path = get_bitbake_var("BBLAYERS") + layers_path = misc.get_bitbake_var("BBLAYERS") canned_wks_layer_dirs = [] if layers_path is not None: diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 0e687bd70e..9a7d0f5117 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -32,7 +32,6 @@ from wic.utils import fs_related, runner, misc from wic.utils.partitionedfs import Image from wic.utils.errors import CreatorError, ImageError from wic.imager.baseimager import BaseImageCreator -from wic.utils.oe.misc import * from wic.plugin import pluginmgr disk_methods = { diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py index 41a80175ca..9872d20985 100644 --- a/scripts/lib/wic/plugin.py +++ b/scripts/lib/wic/plugin.py @@ -20,7 +20,7 @@ import os, sys from wic import msger from wic import pluginbase from wic.utils import errors -from wic.utils.oe.misc import * +from wic.utils.oe.misc import get_bitbake_var __ALL__ = ['PluginMgr', 'pluginmgr'] diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 883378ee84..2fc0357a5c 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -29,13 +29,9 @@ import shutil from wic.utils.errors import ImageError from wic import kickstart, msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr -import wic.imager.direct as direct from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * -from wic.imager.direct import DirectImageCreator +from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \ + BOOTDD_EXTRA_SPACE class BootimgEFIPlugin(SourcePlugin): name = 'bootimg-efi' diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index c5eb7b8b80..909e59b6e2 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -28,7 +28,7 @@ import re from wic import msger from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * +from wic.utils.oe.misc import exec_cmd, get_bitbake_var from glob import glob class BootimgPartitionPlugin(SourcePlugin): diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 2280867308..9c638554c0 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -28,13 +28,10 @@ import os from wic.utils.errors import ImageError from wic import kickstart, msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr -import wic.imager.direct as direct +from wic.utils import runner from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * -from wic.imager.direct import DirectImageCreator +from wic.utils.oe.misc import exec_cmd, exec_native_cmd, \ + get_bitbake_var, BOOTDD_EXTRA_SPACE class BootimgPcbiosPlugin(SourcePlugin): name = 'bootimg-pcbios' diff --git a/scripts/lib/wic/plugins/source/fsimage.py b/scripts/lib/wic/plugins/source/fsimage.py index 4a090bac42..ef56cf278b 100644 --- a/scripts/lib/wic/plugins/source/fsimage.py +++ b/scripts/lib/wic/plugins/source/fsimage.py @@ -19,7 +19,7 @@ import os from wic import msger from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * +from wic.utils.oe.misc import get_bitbake_var class FSImagePlugin(SourcePlugin): name = 'fsimage' diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index ca6b721b67..444c0268fb 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -19,7 +19,7 @@ import os from wic import msger from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * +from wic.utils.oe.misc import exec_cmd, get_bitbake_var class RawCopyPlugin(SourcePlugin): name = 'rawcopy' diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index 6f5d9bb19f..7d444301fb 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -27,14 +27,9 @@ import os -from wic import kickstart, msger -from wic.utils import misc, fs_related, errors, runner, cmdln -from wic.conf import configmgr -from wic.plugin import pluginmgr -import wic.imager.direct as direct +from wic import msger from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import * -from wic.imager.direct import DirectImageCreator +from wic.utils.oe.misc import find_bitbake_env_lines, find_artifact class RootfsPlugin(SourcePlugin): name = 'rootfs' diff --git a/scripts/lib/wic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py index fb9054d568..2e74461a40 100644 --- a/scripts/lib/wic/utils/fs_related.py +++ b/scripts/lib/wic/utils/fs_related.py @@ -20,10 +20,7 @@ from __future__ import with_statement import os import errno -from wic import msger -from wic.utils import runner -from wic.utils.errors import * -from wic.utils.oe.misc import * +from wic.utils.oe.misc import exec_cmd def makedirs(dirname): """A version of os.makedirs() that doesn't throw an diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 40d6e889b0..1c9e3eab58 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -19,10 +19,8 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. from wic import msger -from wic.utils import runner from wic.utils.errors import ImageError -from wic.utils.fs_related import * -from wic.utils.oe.misc import * +from wic.utils.oe.misc import exec_cmd, exec_native_cmd # Overhead of the MBR partitioning scheme (just one sector) MBR_OVERHEAD = 1 diff --git a/scripts/wic b/scripts/wic index 7d388c9768..1e07dfe922 100755 --- a/scripts/wic +++ b/scripts/wic @@ -52,8 +52,9 @@ if bitbake_exe: else: bitbake_main = None -from image.help import * -from image.engine import * +from wic.utils.oe.misc import find_bitbake_env_lines, set_bitbake_env_lines +from image import engine +from image import help as hlp def rootfs_dir_to_args(krootfs_dir): """ @@ -132,7 +133,7 @@ def wic_create_subcommand(args, usage_str): if options.build_check and not options.properties_file: print "Checking basic build environment..." - if not verify_build_env(): + if not engine.verify_build_env(): print "Couldn't verify build environment, exiting\n" sys.exit(1) else: @@ -158,7 +159,7 @@ def wic_create_subcommand(args, usage_str): sys.exit(1) (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \ - = find_artifacts(options.image_name) + = engine.find_artifacts(options.image_name) else: if options.build_rootfs: @@ -168,7 +169,7 @@ def wic_create_subcommand(args, usage_str): wks_file = args[0] if not wks_file.endswith(".wks"): - wks_file = find_canned_image(scripts_path, wks_file) + wks_file = engine.find_canned_image(scripts_path, wks_file) if not wks_file: print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % wks_file sys.exit(1) @@ -223,9 +224,9 @@ def wic_create_subcommand(args, usage_str): rootfs_dir = rootfs_dir_to_args(krootfs_dir) print "Creating image(s)...\n" - wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, - native_sysroot, scripts_path, image_output_dir, - options.debug, options.properties_file) + engine.wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, scripts_path, image_output_dir, + options.debug, options.properties_file) def wic_list_subcommand(args, usage_str): @@ -247,7 +248,7 @@ def wic_list_subcommand(args, usage_str): sys.exit(1) set_bitbake_env_lines(bitbake_env_lines) - if not wic_list(args, scripts_path, options.properties_file): + if not engine.wic_list(args, scripts_path, options.properties_file): logging.error("Bad list arguments, exiting\n") parser.print_help() sys.exit(1) @@ -268,20 +269,20 @@ wic_help_topic_usage = """ subcommands = { "create": [wic_create_subcommand, - wic_create_usage, - wic_create_help], + hlp.wic_create_usage, + hlp.wic_create_help], "list": [wic_list_subcommand, - wic_list_usage, - wic_list_help], + hlp.wic_list_usage, + hlp.wic_list_help], "plugins": [wic_help_topic_subcommand, wic_help_topic_usage, - wic_plugins_help], - "overview": [wic_help_topic_subcommand, + hlp.wic_plugins_help], + "overview": [wic_help_topic_subcommand, wic_help_topic_usage, - wic_overview_help], - "kickstart": [wic_help_topic_subcommand, + hlp.wic_overview_help], + "kickstart": [wic_help_topic_subcommand, wic_help_topic_usage, - wic_kickstart_help], + hlp.wic_kickstart_help], } @@ -291,7 +292,7 @@ def start_logging(loglevel): def main(argv): parser = optparse.OptionParser(version="wic version %s" % __version__, - usage=wic_usage) + usage=hlp.wic_usage) parser.disable_interspersed_args() @@ -303,7 +304,7 @@ def main(argv): parser.print_help() sys.exit(1) - invoke_subcommand(args, parser, wic_help_usage, subcommands) + hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) if __name__ == "__main__": |