diff options
author | Huang Hao <hao.h.huang@intel.com> | 2013-02-28 14:22:33 +0800 |
---|---|---|
committer | Gerrit Code Review <gerrit2@otctools.jf.intel.com> | 2013-03-04 19:02:54 -0800 |
commit | 5aa8ecfa16841d2e1e322c78106561f06c9f16c2 (patch) | |
tree | ae9a306bfd5c01ba9e8cda2cace54ba144723729 | |
parent | 8dd29b0163f317c4ab02e72c4b9161b5e621b986 (diff) | |
download | mic-5aa8ecfa16841d2e1e322c78106561f06c9f16c2.tar.gz mic-5aa8ecfa16841d2e1e322c78106561f06c9f16c2.tar.bz2 mic-5aa8ecfa16841d2e1e322c78106561f06c9f16c2.zip |
Uniform import statements to absolute import.
Change all relative imports into absolute since mixing them is bad.
Refer PEP8 for more details.
Change-Id: I39fdbe056cb0d76c5ed5812c4f69e74ce8837924
-rw-r--r-- | mic/conf.py | 8 | ||||
-rw-r--r-- | mic/creator.py | 5 | ||||
-rw-r--r-- | mic/imager/livecd.py | 3 | ||||
-rw-r--r-- | mic/imager/liveusb.py | 3 | ||||
-rw-r--r-- | mic/imager/loop.py | 3 | ||||
-rw-r--r-- | mic/imager/raw.py | 3 | ||||
-rw-r--r-- | mic/kickstart/__init__.py | 12 | ||||
-rw-r--r-- | mic/plugin.py | 7 | ||||
-rw-r--r-- | mic/utils/fs_related.py | 5 | ||||
-rw-r--r-- | mic/utils/misc.py | 15 | ||||
-rw-r--r-- | mic/utils/rpmmisc.py | 10 |
11 files changed, 43 insertions, 31 deletions
diff --git a/mic/conf.py b/mic/conf.py index 1d7a6e2..e37334c 100644 --- a/mic/conf.py +++ b/mic/conf.py @@ -18,12 +18,14 @@ import os, sys, re import ConfigParser -import msger -import kickstart -from .utils import misc, runner, proxy, errors +from mic import msger +from mic import kickstart +from mic.utils import misc, runner, proxy, errors + DEFAULT_GSITECONF = '/etc/mic/mic.conf' + def get_siteconf(): mic_path = os.path.dirname(__file__) diff --git a/mic/creator.py b/mic/creator.py index a829506..6bd8cbe 100644 --- a/mic/creator.py +++ b/mic/creator.py @@ -20,8 +20,9 @@ from optparse import SUPPRESS_HELP from mic import msger, rt_util from mic.utils import cmdln, errors, rpmmisc -from conf import configmgr -from plugin import pluginmgr +from mic.conf import configmgr +from mic.plugin import pluginmgr + class Creator(cmdln.Cmdln): """${name}: create an image diff --git a/mic/imager/livecd.py b/mic/imager/livecd.py index 6240763..a992ee0 100644 --- a/mic/imager/livecd.py +++ b/mic/imager/livecd.py @@ -22,8 +22,9 @@ import shutil from mic import kickstart, msger from mic.utils import fs_related, rpmmisc, runner, misc from mic.utils.errors import CreatorError +from mic.imager.loop import LoopImageCreator + -from loop import LoopImageCreator class LiveImageCreatorBase(LoopImageCreator): """A base class for LiveCD image creators. diff --git a/mic/imager/liveusb.py b/mic/imager/liveusb.py index bb8e225..a909928 100644 --- a/mic/imager/liveusb.py +++ b/mic/imager/liveusb.py @@ -23,8 +23,9 @@ from mic import msger from mic.utils import misc, fs_related, runner from mic.utils.errors import CreatorError, MountError from mic.utils.partitionedfs import PartitionedMount +from mic.imager.livecd import LiveCDImageCreator + -from livecd import LiveCDImageCreator class LiveUSBImageCreator(LiveCDImageCreator): def __init__(self, *args): LiveCDImageCreator.__init__(self, *args) diff --git a/mic/imager/loop.py b/mic/imager/loop.py index 890bdb1..4d05ef2 100644 --- a/mic/imager/loop.py +++ b/mic/imager/loop.py @@ -22,12 +22,13 @@ import shutil from mic import kickstart, msger from mic.utils.errors import CreatorError, MountError from mic.utils import misc, runner, fs_related as fs +from mic.imager.baseimager import BaseImageCreator -from baseimager import BaseImageCreator # The maximum string length supported for LoopImageCreator.fslabel FSLABEL_MAXLEN = 32 + def save_mountpoints(fpath, loops, arch = None): """Save mount points mapping to file diff --git a/mic/imager/raw.py b/mic/imager/raw.py index d0fb535..43935d7 100644 --- a/mic/imager/raw.py +++ b/mic/imager/raw.py @@ -26,8 +26,9 @@ from mic import kickstart, msger from mic.utils import fs_related, runner, misc from mic.utils.partitionedfs import PartitionedMount from mic.utils.errors import CreatorError, MountError +from mic.imager.baseimager import BaseImageCreator + -from baseimager import BaseImageCreator class RawImageCreator(BaseImageCreator): """Installs a system into a file containing a partitioned disk image. diff --git a/mic/kickstart/__init__.py b/mic/kickstart/__init__.py index 7b98897..f618758 100644 --- a/mic/kickstart/__init__.py +++ b/mic/kickstart/__init__.py @@ -21,9 +21,6 @@ import shutil import subprocess import string -from mic import msger -from mic.utils import errors, misc, runner, fs_related as fs - import pykickstart.sections as kssections import pykickstart.commands as kscommands import pykickstart.constants as ksconstants @@ -33,13 +30,14 @@ import pykickstart.version as ksversion from pykickstart.handlers.control import commandMap from pykickstart.handlers.control import dataMap -import custom_commands.desktop as desktop -import custom_commands.micrepo as micrepo -import custom_commands.micboot as micboot -import custom_commands.partition as partition +from mic import msger +from mic.utils import errors, misc, runner, fs_related as fs +from custom_commands import desktop, micrepo, micboot, partition + AUTH_URL_PTN = r"(?P<scheme>.*)://(?P<username>.*)(:?P<password>.*)?@(?P<url>.*)" + class PrepackageSection(kssections.Section): sectionOpen = "%prepackages" diff --git a/mic/plugin.py b/mic/plugin.py index c1153a9..18c93ad 100644 --- a/mic/plugin.py +++ b/mic/plugin.py @@ -16,15 +16,18 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os, sys -import msger -import pluginbase + +from mic import msger +from mic import pluginbase from mic.conf import configmgr from mic.utils import errors + __ALL__ = ['PluginMgr', 'pluginmgr'] PLUGIN_TYPES = ["imager", "backend"] # TODO "hook" + class PluginMgr(object): plugin_dirs = {} diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index 4209b49..b3ca7ec 100644 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -25,9 +25,10 @@ import random import string import time -from errors import * from mic import msger -import runner +from mic.utils import runner +from mic.utils.errors import * + def find_binary_inchroot(binary, chroot): paths = ["/usr/sbin", diff --git a/mic/utils/misc.py b/mic/utils/misc.py index 49275d4..ca7ff93 100644 --- a/mic/utils/misc.py +++ b/mic/utils/misc.py @@ -24,7 +24,6 @@ import glob import hashlib import subprocess import platform -import rpmmisc try: import sqlite3 as sqlite @@ -37,18 +36,20 @@ except ImportError: import cElementTree xmlparse = cElementTree.parse -from errors import CreatorError, SquashfsError -from fs_related import find_binary_path, makedirs -from grabber import myurlgrab -from proxy import get_proxy_for -import runner - from mic import msger +from mic.utils.errors import CreatorError, SquashfsError +from mic.utils.fs_related import find_binary_path, makedirs +from mic.utils.grabber import myurlgrab +from mic.utils.proxy import get_proxy_for +from mic.utils import runner +from mic.utils import rpmmisc + RPM_RE = re.compile("(.*)\.(.*) (.*)-(.*)") RPM_FMT = "%(name)s.%(arch)s %(version)s-%(release)s" SRPM_RE = re.compile("(.*)-(\d+.*)-(\d+\.\d+).src.rpm") + def build_name(kscfg, release=None, prefix = None, suffix = None): """Construct and return an image name string. diff --git a/mic/utils/rpmmisc.py b/mic/utils/rpmmisc.py index 37a22eb..af15763 100644 --- a/mic/utils/rpmmisc.py +++ b/mic/utils/rpmmisc.py @@ -19,10 +19,12 @@ import os import sys import re import rpm + from mic import msger -from .errors import CreatorError -from .proxy import get_proxy_for -import runner +from mic.utils.errors import CreatorError +from mic.utils.proxy import get_proxy_for +from mic.utils import runner + class RPMInstallCallback: """ Command line callback class for callbacks from the RPM library. @@ -439,7 +441,7 @@ def checkRepositoryEULA(name, repo): import urlparse import urllib2 as u2 import httplib - from errors import CreatorError + from mic.utils.errors import CreatorError def _check_and_download_url(u2opener, url, savepath): try: |