diff options
Diffstat (limited to 'scripts/lib/wic')
| -rw-r--r-- | scripts/lib/wic/imager/baseimager.py | 8 | ||||
| -rw-r--r-- | scripts/lib/wic/imager/direct.py | 10 | ||||
| -rw-r--r-- | scripts/lib/wic/kickstart/__init__.py | 14 | ||||
| -rw-r--r-- | scripts/lib/wic/msger.py | 10 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/fs_related.py | 2 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/misc.py | 2 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/oe/misc.py | 8 | ||||
| -rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 8 |
8 files changed, 31 insertions, 31 deletions
diff --git a/scripts/lib/wic/imager/baseimager.py b/scripts/lib/wic/imager/baseimager.py index 2075358bdc..0afbc2cf0c 100644 --- a/scripts/lib/wic/imager/baseimager.py +++ b/scripts/lib/wic/imager/baseimager.py | |||
| @@ -42,7 +42,7 @@ class BaseImageCreator(object): | |||
| 42 | def __del__(self): | 42 | def __del__(self): |
| 43 | self.cleanup() | 43 | self.cleanup() |
| 44 | 44 | ||
| 45 | def __init__(self, createopts = None): | 45 | def __init__(self, createopts=None): |
| 46 | """Initialize an ImageCreator instance. | 46 | """Initialize an ImageCreator instance. |
| 47 | 47 | ||
| 48 | ks -- a pykickstart.KickstartParser instance; this instance will be | 48 | ks -- a pykickstart.KickstartParser instance; this instance will be |
| @@ -131,8 +131,8 @@ class BaseImageCreator(object): | |||
| 131 | self.workdir = os.path.join(self.tmpdir, "build") | 131 | self.workdir = os.path.join(self.tmpdir, "build") |
| 132 | if not os.path.exists(self.workdir): | 132 | if not os.path.exists(self.workdir): |
| 133 | os.makedirs(self.workdir) | 133 | os.makedirs(self.workdir) |
| 134 | self.__builddir = tempfile.mkdtemp(dir = self.workdir, | 134 | self.__builddir = tempfile.mkdtemp(dir=self.workdir, |
| 135 | prefix = "imgcreate-") | 135 | prefix="imgcreate-") |
| 136 | except OSError, (err, msg): | 136 | except OSError, (err, msg): |
| 137 | raise CreatorError("Failed create build directory in %s: %s" % | 137 | raise CreatorError("Failed create build directory in %s: %s" % |
| 138 | (self.tmpdir, msg)) | 138 | (self.tmpdir, msg)) |
| @@ -178,7 +178,7 @@ class BaseImageCreator(object): | |||
| 178 | 178 | ||
| 179 | self._cleanup() | 179 | self._cleanup() |
| 180 | 180 | ||
| 181 | shutil.rmtree(self.__builddir, ignore_errors = True) | 181 | shutil.rmtree(self.__builddir, ignore_errors=True) |
| 182 | self.__builddir = None | 182 | self.__builddir = None |
| 183 | 183 | ||
| 184 | self.__clean_tmpdir() | 184 | self.__clean_tmpdir() |
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index b236c7a7d0..c1e5f09eee 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py | |||
| @@ -269,11 +269,11 @@ class DirectImageCreator(BaseImageCreator): | |||
| 269 | p.source_file, | 269 | p.source_file, |
| 270 | p.fstype, | 270 | p.fstype, |
| 271 | p.label, | 271 | p.label, |
| 272 | fsopts = p.fsopts, | 272 | fsopts=p.fsopts, |
| 273 | boot = p.active, | 273 | boot=p.active, |
| 274 | align = p.align, | 274 | align=p.align, |
| 275 | no_table = p.no_table, | 275 | no_table=p.no_table, |
| 276 | part_type = p.part_type) | 276 | part_type=p.part_type) |
| 277 | 277 | ||
| 278 | self._restore_fstab(fstab) | 278 | self._restore_fstab(fstab) |
| 279 | 279 | ||
diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py index 10959213d1..111723b133 100644 --- a/scripts/lib/wic/kickstart/__init__.py +++ b/scripts/lib/wic/kickstart/__init__.py | |||
| @@ -68,7 +68,7 @@ def read_kickstart(path): | |||
| 68 | 68 | ||
| 69 | return ks | 69 | return ks |
| 70 | 70 | ||
| 71 | def get_image_size(ks, default = None): | 71 | def get_image_size(ks, default=None): |
| 72 | __size = 0 | 72 | __size = 0 |
| 73 | for p in ks.handler.partition.partitions: | 73 | for p in ks.handler.partition.partitions: |
| 74 | if p.mountpoint == "/" and p.size: | 74 | if p.mountpoint == "/" and p.size: |
| @@ -78,40 +78,40 @@ def get_image_size(ks, default = None): | |||
| 78 | else: | 78 | else: |
| 79 | return default | 79 | return default |
| 80 | 80 | ||
| 81 | def get_image_fstype(ks, default = None): | 81 | def get_image_fstype(ks, default=None): |
| 82 | for p in ks.handler.partition.partitions: | 82 | for p in ks.handler.partition.partitions: |
| 83 | if p.mountpoint == "/" and p.fstype: | 83 | if p.mountpoint == "/" and p.fstype: |
| 84 | return p.fstype | 84 | return p.fstype |
| 85 | return default | 85 | return default |
| 86 | 86 | ||
| 87 | def get_image_fsopts(ks, default = None): | 87 | def get_image_fsopts(ks, default=None): |
| 88 | for p in ks.handler.partition.partitions: | 88 | for p in ks.handler.partition.partitions: |
| 89 | if p.mountpoint == "/" and p.fsopts: | 89 | if p.mountpoint == "/" and p.fsopts: |
| 90 | return p.fsopts | 90 | return p.fsopts |
| 91 | return default | 91 | return default |
| 92 | 92 | ||
| 93 | def get_timeout(ks, default = None): | 93 | def get_timeout(ks, default=None): |
| 94 | if not hasattr(ks.handler.bootloader, "timeout"): | 94 | if not hasattr(ks.handler.bootloader, "timeout"): |
| 95 | return default | 95 | return default |
| 96 | if ks.handler.bootloader.timeout is None: | 96 | if ks.handler.bootloader.timeout is None: |
| 97 | return default | 97 | return default |
| 98 | return int(ks.handler.bootloader.timeout) | 98 | return int(ks.handler.bootloader.timeout) |
| 99 | 99 | ||
| 100 | def get_kernel_args(ks, default = "ro rd.live.image"): | 100 | def get_kernel_args(ks, default="ro rd.live.image"): |
| 101 | if not hasattr(ks.handler.bootloader, "appendLine"): | 101 | if not hasattr(ks.handler.bootloader, "appendLine"): |
| 102 | return default | 102 | return default |
| 103 | if ks.handler.bootloader.appendLine is None: | 103 | if ks.handler.bootloader.appendLine is None: |
| 104 | return default | 104 | return default |
| 105 | return "%s %s" %(default, ks.handler.bootloader.appendLine) | 105 | return "%s %s" %(default, ks.handler.bootloader.appendLine) |
| 106 | 106 | ||
| 107 | def get_menu_args(ks, default = ""): | 107 | def get_menu_args(ks, default=""): |
| 108 | if not hasattr(ks.handler.bootloader, "menus"): | 108 | if not hasattr(ks.handler.bootloader, "menus"): |
| 109 | return default | 109 | return default |
| 110 | if ks.handler.bootloader.menus in (None, ""): | 110 | if ks.handler.bootloader.menus in (None, ""): |
| 111 | return default | 111 | return default |
| 112 | return "%s" % ks.handler.bootloader.menus | 112 | return "%s" % ks.handler.bootloader.menus |
| 113 | 113 | ||
| 114 | def get_default_kernel(ks, default = None): | 114 | def get_default_kernel(ks, default=None): |
| 115 | if not hasattr(ks.handler.bootloader, "default"): | 115 | if not hasattr(ks.handler.bootloader, "default"): |
| 116 | return default | 116 | return default |
| 117 | if not ks.handler.bootloader.default: | 117 | if not ks.handler.bootloader.default: |
diff --git a/scripts/lib/wic/msger.py b/scripts/lib/wic/msger.py index 9f557e7b9a..35b705b867 100644 --- a/scripts/lib/wic/msger.py +++ b/scripts/lib/wic/msger.py | |||
| @@ -60,7 +60,7 @@ CATCHERR_BUFFILE_FD = -1 | |||
| 60 | CATCHERR_BUFFILE_PATH = None | 60 | CATCHERR_BUFFILE_PATH = None |
| 61 | CATCHERR_SAVED_2 = -1 | 61 | CATCHERR_SAVED_2 = -1 |
| 62 | 62 | ||
| 63 | def _general_print(head, color, msg = None, stream = None, level = 'normal'): | 63 | def _general_print(head, color, msg=None, stream=None, level='normal'): |
| 64 | global LOG_CONTENT | 64 | global LOG_CONTENT |
| 65 | if not stream: | 65 | if not stream: |
| 66 | stream = sys.stdout | 66 | stream = sys.stdout |
| @@ -130,7 +130,7 @@ def _color_print(head, color, msg, stream, level): | |||
| 130 | 130 | ||
| 131 | stream.flush() | 131 | stream.flush() |
| 132 | 132 | ||
| 133 | def _color_perror(head, color, msg, level = 'normal'): | 133 | def _color_perror(head, color, msg, level='normal'): |
| 134 | if CATCHERR_BUFFILE_FD > 0: | 134 | if CATCHERR_BUFFILE_FD > 0: |
| 135 | _general_print(head, color, msg, sys.stdout, level) | 135 | _general_print(head, color, msg, sys.stdout, level) |
| 136 | else: | 136 | else: |
| @@ -190,7 +190,7 @@ def info(msg): | |||
| 190 | 190 | ||
| 191 | def verbose(msg): | 191 | def verbose(msg): |
| 192 | head, msg = _split_msg('Verbose', msg) | 192 | head, msg = _split_msg('Verbose', msg) |
| 193 | _general_print(head, INFO_COLOR, msg, level = 'verbose') | 193 | _general_print(head, INFO_COLOR, msg, level='verbose') |
| 194 | 194 | ||
| 195 | def warning(msg): | 195 | def warning(msg): |
| 196 | head, msg = _split_msg('Warning', msg) | 196 | head, msg = _split_msg('Warning', msg) |
| @@ -198,7 +198,7 @@ def warning(msg): | |||
| 198 | 198 | ||
| 199 | def debug(msg): | 199 | def debug(msg): |
| 200 | head, msg = _split_msg('Debug', msg) | 200 | head, msg = _split_msg('Debug', msg) |
| 201 | _color_perror(head, ERR_COLOR, msg, level = 'debug') | 201 | _color_perror(head, ERR_COLOR, msg, level='debug') |
| 202 | 202 | ||
| 203 | def error(msg): | 203 | def error(msg): |
| 204 | head, msg = _split_msg('Error', msg) | 204 | head, msg = _split_msg('Error', msg) |
| @@ -299,7 +299,7 @@ def disable_logstderr(): | |||
| 299 | global CATCHERR_BUFFILE_PATH | 299 | global CATCHERR_BUFFILE_PATH |
| 300 | global CATCHERR_SAVED_2 | 300 | global CATCHERR_SAVED_2 |
| 301 | 301 | ||
| 302 | raw(msg = None) # flush message buffer and print it. | 302 | raw(msg=None) # flush message buffer and print it. |
| 303 | os.dup2(CATCHERR_SAVED_2, 2) | 303 | os.dup2(CATCHERR_SAVED_2, 2) |
| 304 | os.close(CATCHERR_SAVED_2) | 304 | os.close(CATCHERR_SAVED_2) |
| 305 | os.close(CATCHERR_BUFFILE_FD) | 305 | os.close(CATCHERR_BUFFILE_FD) |
diff --git a/scripts/lib/wic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py index 1e266b16c1..d0bc8ee6d3 100644 --- a/scripts/lib/wic/utils/fs_related.py +++ b/scripts/lib/wic/utils/fs_related.py | |||
| @@ -57,7 +57,7 @@ class Disk: | |||
| 57 | """ | 57 | """ |
| 58 | Generic base object for a disk. | 58 | Generic base object for a disk. |
| 59 | """ | 59 | """ |
| 60 | def __init__(self, size, device = None): | 60 | def __init__(self, size, device=None): |
| 61 | self._device = device | 61 | self._device = device |
| 62 | self._size = size | 62 | self._size = size |
| 63 | 63 | ||
diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py index 5d6337c9cf..9d750694df 100644 --- a/scripts/lib/wic/utils/misc.py +++ b/scripts/lib/wic/utils/misc.py | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | import os | 18 | import os |
| 19 | import time | 19 | import time |
| 20 | 20 | ||
| 21 | def build_name(kscfg, release=None, prefix = None, suffix = None): | 21 | def build_name(kscfg, release=None, prefix=None, suffix=None): |
| 22 | """Construct and return an image name string. | 22 | """Construct and return an image name string. |
| 23 | 23 | ||
| 24 | This is a utility function to help create sensible name and fslabel | 24 | This is a utility function to help create sensible name and fslabel |
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py index 7769f3ff72..119f07276e 100644 --- a/scripts/lib/wic/utils/oe/misc.py +++ b/scripts/lib/wic/utils/oe/misc.py | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | from wic import msger | 28 | from wic import msger |
| 29 | from wic.utils import runner | 29 | from wic.utils import runner |
| 30 | 30 | ||
| 31 | def __exec_cmd(cmd_and_args, as_shell = False, catch = 3): | 31 | def __exec_cmd(cmd_and_args, as_shell=False, catch=3): |
| 32 | """ | 32 | """ |
| 33 | Execute command, catching stderr, stdout | 33 | Execute command, catching stderr, stdout |
| 34 | 34 | ||
| @@ -49,7 +49,7 @@ def __exec_cmd(cmd_and_args, as_shell = False, catch = 3): | |||
| 49 | return (rc, out) | 49 | return (rc, out) |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | def exec_cmd(cmd_and_args, as_shell = False, catch = 3): | 52 | def exec_cmd(cmd_and_args, as_shell=False, catch=3): |
| 53 | """ | 53 | """ |
| 54 | Execute command, catching stderr, stdout | 54 | Execute command, catching stderr, stdout |
| 55 | 55 | ||
| @@ -63,7 +63,7 @@ def exec_cmd(cmd_and_args, as_shell = False, catch = 3): | |||
| 63 | return out | 63 | return out |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | def exec_cmd_quiet(cmd_and_args, as_shell = False): | 66 | def exec_cmd_quiet(cmd_and_args, as_shell=False): |
| 67 | """ | 67 | """ |
| 68 | Execute command, catching nothing in the output | 68 | Execute command, catching nothing in the output |
| 69 | 69 | ||
| @@ -72,7 +72,7 @@ def exec_cmd_quiet(cmd_and_args, as_shell = False): | |||
| 72 | return exec_cmd(cmd_and_args, as_shell, 0) | 72 | return exec_cmd(cmd_and_args, as_shell, 0) |
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3): | 75 | def exec_native_cmd(cmd_and_args, native_sysroot, catch=3): |
| 76 | """ | 76 | """ |
| 77 | Execute native command, catching stderr, stdout | 77 | Execute native command, catching stderr, stdout |
| 78 | 78 | ||
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index bb99c6a6c1..b9fbc16e12 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py | |||
| @@ -86,9 +86,9 @@ class Image: | |||
| 86 | self.partitions.append(part) | 86 | self.partitions.append(part) |
| 87 | self.__add_disk(part['disk_name']) | 87 | self.__add_disk(part['disk_name']) |
| 88 | 88 | ||
| 89 | def add_partition(self, size, disk_name, mountpoint, source_file = None, fstype = None, | 89 | def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None, |
| 90 | label=None, fsopts = None, boot = False, align = None, no_table=False, | 90 | label=None, fsopts=None, boot=False, align=None, no_table=False, |
| 91 | part_type = None): | 91 | part_type=None): |
| 92 | """ Add the next partition. Prtitions have to be added in the | 92 | """ Add the next partition. Prtitions have to be added in the |
| 93 | first-to-last order. """ | 93 | first-to-last order. """ |
| 94 | 94 | ||
| @@ -116,7 +116,7 @@ class Image: | |||
| 116 | 116 | ||
| 117 | self.__add_partition(part) | 117 | self.__add_partition(part) |
| 118 | 118 | ||
| 119 | def layout_partitions(self, ptable_format = "msdos"): | 119 | def layout_partitions(self, ptable_format="msdos"): |
| 120 | """ Layout the partitions, meaning calculate the position of every | 120 | """ Layout the partitions, meaning calculate the position of every |
| 121 | partition on the disk. The 'ptable_format' parameter defines the | 121 | partition on the disk. The 'ptable_format' parameter defines the |
| 122 | partition table format and may be "msdos". """ | 122 | partition table format and may be "msdos". """ |
