From: Michael Tremer Date: Sat, 19 Jul 2008 23:49:19 +0000 (+0200) Subject: Manually reintended pomona's code. X-Git-Tag: v3.0-alpha1~860 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d8ea2283b952e4ee524543cfb59f1dcd59ea1c1a;p=ipfire-3.x.git Manually reintended pomona's code. No functionally changes, just cleanups. --- diff --git a/src/pomona/src/autopart.py b/src/pomona/src/autopart.py index 0bc9c9b0f..dc652b137 100644 --- a/src/pomona/src/autopart.py +++ b/src/pomona/src/autopart.py @@ -64,7 +64,7 @@ def printNewRequestsCyl(diskset, newRequest): part = partedUtils.get_partition_by_name(diskset.disks, req.device) ## print req ## print "Start Cyl:%s End Cyl: %s" % (partedUtils.start_sector_to_cyl(part.geom.dev, part.geom.start), -## partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end)) +## partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end)) def printFreespaceitem(part): return partedUtils.get_partition_name(part), part.geom.start, part.geom.end, partedUtils.getPartSizeMB(part) @@ -259,7 +259,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): for num in number: for request in todo[num]: -# print "\nInserting ->",request +# print "\nInserting ->",request if requests.isBootable(request): isBoot = 1 else: @@ -274,7 +274,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): # drives. this keeps us on the first possible drive if isBoot and largestPart[1]: break -## print "Trying drive", drive +## print "Trying drive", drive disk = diskset.disks[drive] numPrimary = len(partedUtils.get_primary_partitions(disk)) numLogical = len(partedUtils.get_logical_partitions(disk)) @@ -589,9 +589,9 @@ def growParts(diskset, requests, newParts): maxsect = long(maxfree) + startSize imposedMax = 1 -# print "freesize, max, maxfree = ",freeSize[drive],maxsect, maxfree -# print "freeSizeMB, maxMB = ", freeSize[drive] * sector_size/(1024.0 * 1024.0), maxsect * sector_size/(1024.0*1024.0), largestFree[drive] * sector_size/(1024.0*1024.0) -# print "startsize = ",startSize +# print "freesize, max, maxfree = ",freeSize[drive],maxsect, maxfree +# print "freeSizeMB, maxMB = ", freeSize[drive] * sector_size/(1024.0 * 1024.0), maxsect * sector_size/(1024.0*1024.0), largestFree[drive] * sector_size/(1024.0*1024.0) +# print "startsize = ",startSize min = startSize max = maxsect @@ -599,15 +599,15 @@ def growParts(diskset, requests, newParts): cur = max - (diff / 2) lastDiff = 0 -# binary search -## print "start min, max, cur, diffs = ",min,max,cur,diff,lastDiff +# binary search +## print "start min, max, cur, diffs = ",min,max,cur,diff,lastDiff inner_iter = 0 ret = PARTITION_SUCCESS # request succeeded with initial size while (max != min) and (lastDiff != diff) and (inner_iter < 2000): -## printNewRequestsCyl(diskset, newRequest) +## printNewRequestsCyl(diskset, newRequest) # XXX need to request in sectors preferably, more accurate -## print "trying cur=%s" % cur +## print "trying cur=%s" % cur request.requestSize = (cur*sector_size)/1024.0/1024.0 # try adding @@ -617,44 +617,44 @@ def growParts(diskset, requests, newParts): except PartitioningError, msg: ret = PARTITION_FAIL max = cur -## print "!!!!!!!!!!! processPartitioning failed - %s" % msg +## print "!!!!!!!!!!! processPartitioning failed - %s" % msg lastDiff = diff diff = max - min -# print min, max, diff, cylsectors -# print diskset.diskState() +# print min, max, diff, cylsectors +# print diskset.diskState() cur = max - (diff / 2) inner_iter = inner_iter + 1 -# print "sizes at end of loop - cur: %s min:%s max:%s diff:%s lastDiff:%s" % (cur,min,max,diff,lastDiff) +# print "sizes at end of loop - cur: %s min:%s max:%s diff:%s lastDiff:%s" % (cur,min,max,diff,lastDiff) -# freeSize[drive] = freeSize[drive] - (min - startSize) -# print "shrinking freeSize to ",freeSize[drive], lastFreeSize -# if freeSize[drive] < 0: -# print "freesize < 0!" -# freeSize[drive] = 0 +# freeSize[drive] = freeSize[drive] - (min - startSize) +# print "shrinking freeSize to ",freeSize[drive], lastFreeSize +# if freeSize[drive] < 0: +# print "freesize < 0!" +# freeSize[drive] = 0 # we could have failed on the last try, in which case we # should go back to the smaller size if ret == PARTITION_FAIL: -# print "growing finally failed at size", min +# print "growing finally failed at size", min request.requestSize = min*sector_size/1024.0/1024.0 processPartitioning(diskset, newRequest, newParts) -# print "end min, max, cur, diffs = ",min,max,cur,diff,lastDiff -# print "%s took %s loops" % (request.mountpoint, inner_iter) +# print "end min, max, cur, diffs = ",min,max,cur,diff,lastDiff +# print "%s took %s loops" % (request.mountpoint, inner_iter) lastFreeSize = freeSize[drive] (free, freeSize, largestFree) = getFreeSpace(diskset) -# print Freespace(free) +# print Freespace(free) if ret == PARTITION_FAIL or (max == maxsect and imposedMax): -# print "putting ",request.uniqueID,request.mountpoint," in grownList" +# print "putting ",request.uniqueID,request.mountpoint," in grownList" grownList.append(request.uniqueID) growSize[drive] = growSize[drive] - origSize[request.uniqueID] if growSize[drive] < 0: -# print "growsize < 0!" +# print "growsize < 0!" growSize[drive] = 0 def setPreexistParts(diskset, requests): @@ -809,7 +809,7 @@ def doPartitioning(diskset, requests, doRefresh = 1): elif ret != PARTITION_SUCCESS: # more specific message? raise PartitioningWarning, _("Boot partition %s may not meet booting constraints for your architecture.") %(requests.getBootableRequest()[0].mountpoint,) -# raise PartitioningWarning, _("Boot partition %s may not meet booting constraints for your architecture. Creation of a boot disk is highly encouraged.") %(requests.getBootableRequest()[0].mountpoint,) +# raise PartitioningWarning, _("Boot partition %s may not meet booting constraints for your architecture. Creation of a boot disk is highly encouraged.") %(requests.getBootableRequest()[0].mountpoint,) # given clearpart specification execute it # probably want to reset diskset and partition request lists before calling @@ -998,19 +998,19 @@ def doAutoPartition(pomona): errors = req.sanityCheckRequest(partitions) if errors: pomona.intf.messageWindow(_("Automatic Partitioning Errors"), - _("The following errors occurred with your " - "partitioning:\n\n%s\n\n" - "Press 'OK' to reboot your system.") % - (errors,), custom_icon='error') + _("The following errors occurred with your " + "partitioning:\n\n%s\n\n" + "Press 'OK' to reboot your system.") + % (errors,), custom_icon='error') sys.exit(0) try: doPartitioning(diskset, partitions, doRefresh = 0) except PartitioningWarning, msg: pomona.intf.messageWindow(_("Warnings During Automatic Partitioning"), - _("Following warnings occurred during automatic " - "partitioning:\n\n%s") % (msg.value,), - custom_icon='warning') + _("Following warnings occurred during automatic " + "partitioning:\n\n%s") % (msg.value,), + custom_icon='warning') except PartitioningError, msg: # restore drives to original state diskset.refreshDevices() @@ -1062,11 +1062,11 @@ def autoCreatePartitionRequests(autoreq): ptype = fsset.fileSystemTypeGetDefault() newrequest = partRequests.PartitionSpec(ptype, - mountpoint = mntpt, - size = minsize, - maxSizeMB = maxsize, - grow = grow, - format = format) + mountpoint = mntpt, + size = minsize, + maxSizeMB = maxsize, + grow = grow, + format = format) requests.append(newrequest) @@ -1128,24 +1128,24 @@ def setDefaultPartitioning(partitions, clear = CLEARPART_TYPE_ALL, doClear = 1): # XXX hack but these are common strings to TUI PARTMETHOD_TYPE_DESCR_TEXT = N_("Automatic Partitioning sets partitions " - "based on the selected installation type. " - "You also " - "can customize the partitions once they " - "have been created.\n\n" - "The manual disk partitioning tool, Disk Druid, " - "allows you " - "to create partitions in an interactive " - "environment. You can set the file system " - "types, mount points, partition sizes, and more.") + "based on the selected installation type. " + "You also " + "can customize the partitions once they " + "have been created.\n\n" + "The manual disk partitioning tool, Disk Druid, " + "allows you " + "to create partitions in an interactive " + "environment. You can set the file system " + "types, mount points, partition sizes, and more.") AUTOPART_DISK_CHOICE_DESCR_TEXT = N_("Before automatic partitioning can be " - "set up by the installation program, you " - "must choose how to use the space on " - "your hard drives.") + "set up by the installation program, you " + "must choose how to use the space on " + "your hard drives.") CLEARPART_TYPE_ALL_DESCR_TEXT = N_("Remove all partitions on this system") CLEARPART_TYPE_ALL_WARNING_MSG = N_("You have chosen to remove " - "all partitions (ALL DATA) on the " - "following drives:%s\nAre you sure you " - "want to do this?") + "all partitions (ALL DATA) on the " + "following drives:%s\nAre you sure you " + "want to do this?") diff --git a/src/pomona/src/backend.py b/src/pomona/src/backend.py index 04324aee0..2533de9fa 100644 --- a/src/pomona/src/backend.py +++ b/src/pomona/src/backend.py @@ -29,8 +29,8 @@ log = logging.getLogger("pomona") class PomonaBackend: def __init__(self, method, instPath): """Abstract backend class all backends should inherit from this - @param method: Object of InstallMethod type - @param instPath: root path for the installation to occur""" + @param method: Object of InstallMethod type + @param instPath: root path for the installation to occur""" self.method = method self.instPath = instPath diff --git a/src/pomona/src/bootloader.py b/src/pomona/src/bootloader.py index e5af2b401..e45633ebf 100644 --- a/src/pomona/src/bootloader.py +++ b/src/pomona/src/bootloader.py @@ -57,7 +57,7 @@ def bootloaderSetupChoices(pomona): if not bootDev: bootDev = pomona.id.fsset.getEntryByMountPoint("/boot") part = partedUtils.get_partition_by_name(pomona.id.diskset.disks, - bootDev.device.getDevice()) + bootDev.device.getDevice()) if part and partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end) >= 1024: pomona.id.bootloader.above1024 = 1 @@ -115,16 +115,16 @@ def writeBootloader(pomona): dosync() try: pomona.id.bootloader.write(pomona.rootPath, pomona.id.fsset, pomona.id.bootloader, - pomona.id.instLanguage, kernelList, otherList, defaultDev, - pomona.intf) + pomona.id.instLanguage, kernelList, otherList, defaultDev, + pomona.intf) w.pop() except BootyNoKernelWarning: w.pop() if pomona.intf: pomona.intf.messageWindow(_("Warning"), - _("No kernel packages were installed on your " - "system. Your boot loader configuration " - "will not be changed.")) + _("No kernel packages were installed on your " + "system. Your boot loader configuration " + "will not be changed.")) dosync() # return instance of the appropriate bootloader for our arch diff --git a/src/pomona/src/bootloaderInfo.py b/src/pomona/src/bootloaderInfo.py index fe8edecf0..a63a4f87b 100644 --- a/src/pomona/src/bootloaderInfo.py +++ b/src/pomona/src/bootloaderInfo.py @@ -66,15 +66,15 @@ def syncDataToDisk(dev, mntpt, instRoot = "/"): # and xfs is even more "special" (#117968) if fsset.isValidXFS(dev): pyfire.executil.execWithRedirect("/usr/sbin/xfs_freeze", - ["/usr/sbin/xfs_freeze", "-f", mntpt], - stdout = "/dev/tty5", - stderr = "/dev/tty5", - root = instRoot) - pyfire.executil.execWithRedirect( "/usr/sbin/xfs_freeze", - ["/usr/sbin/xfs_freeze", "-u", mntpt], - stdout = "/dev/tty5", - stderr = "/dev/tty5", - root = instRoot) + ["/usr/sbin/xfs_freeze", "-f", mntpt], + stdout = "/dev/tty5", + stderr = "/dev/tty5", + root = instRoot) + pyfire.executil.execWithRedirect("/usr/sbin/xfs_freeze", + ["/usr/sbin/xfs_freeze", "-u", mntpt], + stdout = "/dev/tty5", + stderr = "/dev/tty5", + root = instRoot) class BootyNoKernelWarning: def __init__ (self, value=""): @@ -110,7 +110,7 @@ class KernelArguments: newArgs = [] # look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth=", "apic", "noapic", "apm=", "ide=nodma", - "noht", "acpi=", "video=", "pci="] + "noht", "acpi=", "video=", "pci="] f = open("/proc/cmdline") cmdline = f.read()[:-1] f.close() @@ -122,7 +122,6 @@ class KernelArguments: self.args = " ".join(newArgs) - class BootImages: """A collection to keep track of boot images available on the system. Examples would be: @@ -209,7 +208,7 @@ class BootImages: slash = fsset.getEntryByMountPoint('/') if not slash or not slash.device or not slash.fsystem: raise ValueError,("Trying to pick boot devices but do not have a " - "sane root partition. Aborting install.") + "sane root partition. Aborting install.") devs.append((slash.device.getDevice(), slash.fsystem.getName())) devs.sort() @@ -479,8 +478,7 @@ class x86BootloaderInfo(bootloaderInfo): # XXX hack city. If they're not the sort of thing that'll # be in the device map, they shouldn't still be in the list. if not drive.startswith('md'): - f.write("(%s) /dev/%s\n" % (self.grubbyDiskName(drive), - drive)) + f.write("(%s) /dev/%s\n" % (self.grubbyDiskName(drive), drive)) f.close() args = "--stage2=/boot/grub/stage2 " @@ -490,13 +488,11 @@ class x86BootloaderInfo(bootloaderInfo): sysconf = '/etc/sysconfig/grub' if os.access (instRoot + sysconf, os.R_OK): self.perms = os.stat(instRoot + sysconf)[0] & 0777 - os.rename(instRoot + sysconf, - instRoot + sysconf + '.backup') + os.rename(instRoot + sysconf, instRoot + sysconf + '.backup') # if it's an absolute symlink, just get it out of our way elif (os.path.islink(instRoot + sysconf) and os.readlink(instRoot + sysconf)[0] == '/'): - os.rename(instRoot + sysconf, - instRoot + sysconf + '.backup') + os.rename(instRoot + sysconf, instRoot + sysconf + '.backup') f = open(instRoot + sysconf, 'w+') f.write("boot=/dev/%s\n" %(grubTarget,)) # XXX forcelba never gets read back... @@ -518,7 +514,7 @@ class x86BootloaderInfo(bootloaderInfo): stage1Target = self.grubbyPartitionName(gtPart) cmd += "install %s%s/stage1 d %s %s/stage2 p %s%s/grub.conf" % \ - (args, grubPath, stage1Target, grubPath, bPart, grubPath) + (args, grubPath, stage1Target, grubPath, bPart, grubPath) cmds.append(cmd) log.info("GRUB commands:") @@ -532,9 +528,9 @@ class x86BootloaderInfo(bootloaderInfo): # copy the stage files over into /boot pyfire.executil.execWithRedirect("/usr/sbin/grub-install", - ["/usr/sbin/grub-install", "--just-copy"], - stdout = "/dev/tty5", stderr = "/dev/tty5", - root = instRoot) + ["/usr/sbin/grub-install", "--just-copy"], + stdout = "/dev/tty5", stderr = "/dev/tty5", + root = instRoot) # really install the bootloader for cmd in cmds: @@ -550,12 +546,12 @@ class x86BootloaderInfo(bootloaderInfo): else: syncDataToDisk(bootDev, "/", instRoot) - pyfire.executil.execWithRedirect('/usr/sbin/grub' , - [ "grub", "--batch", "--no-floppy", - "--device-map=/boot/grub/device.map" ], - stdin = p[0], - stdout = "/dev/tty5", stderr = "/dev/tty5", - root = instRoot) + pyfire.executil.execWithRedirect("/usr/sbin/grub" , + [ "grub", "--batch", "--no-floppy", + "--device-map=/boot/grub/device.map" ], + stdin = p[0], + stdout = "/dev/tty5", stderr = "/dev/tty5", + root = instRoot) os.close(p[0]) return "" @@ -579,10 +575,8 @@ class x86BootloaderInfo(bootloaderInfo): else: return "(%s)" %(self.grubbyDiskName(name)) - def write(self, instRoot, fsset, bl, langs, kernelList, chainList, - defaultDev, intf): - out = self.writeGrub(instRoot, fsset, bl, langs, kernelList, - chainList, defaultDev) + def write(self, instRoot, fsset, bl, langs, kernelList, chainList, defaultDev, intf): + out = self.writeGrub(instRoot, fsset, bl, langs, kernelList, chainList, defaultDev) def getArgList(self): args = bootloaderInfo.getArgList(self) @@ -592,7 +586,6 @@ class x86BootloaderInfo(bootloaderInfo): if self.password: args.append("--md5pass=%s" %(self.password)) - # XXX add location of bootloader here too return args @@ -655,5 +648,5 @@ def getRootDevName(initrd, fsset, rootDev, instRoot): # returns a product name to use for the boot loader string def getProductName(): - # XXX Check /etc/ipfire-release here... + # XXX Check /etc/ipfire-release here... return "IPFire Linux" diff --git a/src/pomona/src/exception.py b/src/pomona/src/exception.py index 9a029dde7..76610c276 100644 --- a/src/pomona/src/exception.py +++ b/src/pomona/src/exception.py @@ -28,7 +28,7 @@ def dumpClass(instance, fd, level=0, parentkey="", skipList=[]): fd.write("%s\n" % (instance,)) return fd.write("%s instance, containing members:\n" % - (instance.__class__.__name__)) + (instance.__class__.__name__)) pad = ' ' * ((level) * 2) for key, value in instance.__dict__.items(): @@ -40,7 +40,7 @@ def dumpClass(instance, fd, level=0, parentkey="", skipList=[]): # Don't dump objects that are in our skip list, though ones that are # None are probably okay. if eval("instance.%s is not None" % key) and \ - eval("id(instance.%s)" % key) in skipList: + eval("id(instance.%s)" % key) in skipList: continue if type(value) == types.ListType: @@ -170,8 +170,8 @@ def copyExceptionToRemote(intf): elif childpid == 0: # child process - run scp args = ["scp", "-oNumberOfPasswordPrompts=1", - "-oStrictHostKeyChecking=no"] + portArgs + \ - ["/tmp/anacdump.txt", "%s@%s:%s" % (user, host, path)] + "-oStrictHostKeyChecking=no"] + portArgs + \ + ["/tmp/anacdump.txt", "%s@%s:%s" % (user, host, path)] os.execvp("scp", args) # parent process @@ -253,15 +253,15 @@ def handleException(pomona, (type, value, tb)): if scpRc == 0: pomona.intf.messageWindow(_("Dump Written"), - _("Your system's state has been successfully written to " - "the remote host. Your system will now be rebooted."), - type="custom", custom_icon="info", - custom_buttons=[_("_Reboot")]) + _("Your system's state has been successfully written to " + "the remote host. Your system will now be rebooted."), + type="custom", custom_icon="info", + custom_buttons=[_("_Reboot")]) sys.exit(0) elif scpRc == 1: continue elif scpRc == 2: pomona.intf.messageWindow(_("Dump Not Written"), - _("There was a problem writing the system state to the " - "remote host.")) + _("There was a problem writing the system state to the " + "remote host.")) continue diff --git a/src/pomona/src/fsset.py b/src/pomona/src/fsset.py index 5adf53f58..3e1a00b91 100644 --- a/src/pomona/src/fsset.py +++ b/src/pomona/src/fsset.py @@ -187,8 +187,8 @@ class FileSystemType: def badblocksDevice(self, entry, windowCreator, chroot='/'): if windowCreator: w = windowCreator(_("Checking for Bad Blocks"), - _("Checking for bad blocks on /dev/%s...") - % (entry.device.getDevice(),), 100) + _("Checking for bad blocks on /dev/%s...") + % (entry.device.getDevice(),), 100) else: w = None @@ -380,10 +380,10 @@ class reiserfsFileSystem(FileSystemType): os.close(p[1]) rc = inutil.execWithRedirect("mkreiserfs", - [devicePath], - stdin = p[0], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + [devicePath], + stdin = p[0], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError @@ -392,9 +392,9 @@ class reiserfsFileSystem(FileSystemType): devicePath = entry.device.setupDevice(chroot) label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars) rc = inutil.execWithRedirect("reiserfstune", - ["--label", label, devicePath], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + ["--label", label, devicePath], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError entry.setLabel(label) @@ -418,10 +418,10 @@ class xfsFileSystem(FileSystemType): devicePath = entry.device.setupDevice(chroot) rc = inutil.execWithRedirect("mkfs.xfs", - ["-f", "-l", "internal", - "-i", "attr=2", devicePath], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + ["-f", "-l", "internal", + "-i", "attr=2", devicePath], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError @@ -431,9 +431,9 @@ class xfsFileSystem(FileSystemType): label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars) db_cmd = "label " + label rc = inutil.execWithRedirect("xfs_db", - ["-x", "-c", db_cmd, devicePath], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + ["-x", "-c", db_cmd, devicePath], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError entry.setLabel(label) @@ -455,9 +455,9 @@ class extFileSystem(FileSystemType): label = labelFactory.createLabel(entry.mountpoint, self.maxLabelChars) rc = inutil.execWithRedirect("e2label", - [devicePath, label], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + [devicePath, label], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError entry.setLabel(label) @@ -473,8 +473,8 @@ class extFileSystem(FileSystemType): log.info("Format command: %s\n" % str(args)) rc = ext2FormatFilesystem(args, "/dev/tty5", - progress, - entry.mountpoint) + progress, + entry.mountpoint) if rc: raise SystemError @@ -492,10 +492,10 @@ class extFileSystem(FileSystemType): return rc = inutil.execWithRedirect("tune2fs", - ["-c0", "-i0", "-Odir_index", - "-ouser_xattr,acl", devicePath], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + ["-c0", "-i0", "-Odir_index", + "-ouser_xattr,acl", devicePath], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) class ext2FileSystem(extFileSystem): def __init__(self): @@ -509,10 +509,9 @@ class ext2FileSystem(extFileSystem): if not entry.fsystem or not entry.origfsystem: raise RuntimeError, ("Trying to migrate fs w/o fsystem or " - "origfsystem set") + "origfsystem set") if entry.fsystem.getName() != "ext3": - raise RuntimeError, ("Trying to migrate ext2 to something other " - "than ext3") + raise RuntimeError, ("Trying to migrate ext2 to something other than ext3") # if journal already exists skip if isys.ext2HasJournal(devicePath): @@ -520,9 +519,9 @@ class ext2FileSystem(extFileSystem): return rc = inutil.execWithRedirect("tune2fs", - ["-j", devicePath ], - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + ["-j", devicePath ], + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError @@ -532,14 +531,14 @@ class ext2FileSystem(extFileSystem): # At least we can avoid leaving them with a system which won't boot if not isys.ext2HasJournal(devicePath): log.warning("Migration of %s attempted but no journal exists after " - "running tune2fs.\n" % (devicePath)) + "running tune2fs.\n" % (devicePath)) if message: rc = message(_("Error"), - _("An error occurred migrating %s to ext3. It is " - "possible to continue without migrating this " - "file system if desired.\n\n" - "Would you like to continue without migrating %s?") - % (devicePath, devicePath), type = "yesno") + _("An error occurred migrating %s to ext3. It is " + "possible to continue without migrating this " + "file system if desired.\n\n" + "Would you like to continue without migrating %s?") + % (devicePath, devicePath), type = "yesno") if rc == 0: sys.exit(0) entry.fsystem = entry.origfsystem ### XXX what is this? @@ -608,10 +607,10 @@ class swapFileSystem(FileSystemType): def formatDevice(self, entry, progress, chroot='/'): file = entry.device.setupDevice(chroot) rc = inutil.execWithRedirect("mkswap", - ['-v1', file], - stdout = "/dev/tty5", - stderr = "/dev/tty5", - searchPath = 1) + ["-v1", file], + stdout = "/dev/tty5", + stderr = "/dev/tty5", + searchPath = 1) if rc: raise SystemError @@ -628,10 +627,10 @@ class swapFileSystem(FileSystemType): swapLabel = "SWAP-%s" % (devName) label = labelFactory.createLabel(swapLabel, self.maxLabelChars) rc = inutil.execWithRedirect("mkswap", - ['-v1', "-L", label, file], - stdout = "/dev/tty5", - stderr = "/dev/tty5", - searchPath = 1) + ["-v1", "-L", label, file], + stdout = "/dev/tty5", + stderr = "/dev/tty5", + searchPath = 1) if rc: raise SystemError entry.setLabel(label) @@ -670,8 +669,8 @@ class FATFileSystem(FileSystemType): args.extend(devArgs) rc = inutil.execWithRedirect("mkdosfs", args, - stdout = "/dev/tty5", - stderr = "/dev/tty5", searchPath = 1) + stdout = "/dev/tty5", + stderr = "/dev/tty5", searchPath = 1) if rc: raise SystemError @@ -853,10 +852,10 @@ class FileSystemSet: ### debuggin' #log.info ("fsset at %s\n" - # "adding entry for %s\n" - # "entry object %s, class __dict__ is %s", - # self, entry.mountpoint, entry, - # isys.printObject(entry.__dict__)) + # "adding entry for %s\n" + # "entry object %s, class __dict__ is %s", + # self, entry.mountpoint, entry, + # isys.printObject(entry.__dict__)) insertAt = 0 @@ -908,9 +907,9 @@ class FileSystemSet: device = devify(entry.device.getDevice()) fstab = fstab + entry.device.getComment() fstab = fstab + format % (device, entry.mountpoint, - entry.fsystem.getName(), - entry.options, entry.fsck, - entry.order) + entry.fsystem.getName(), + entry.options, entry.fsck, + entry.order) return fstab def mtab(self): @@ -928,9 +927,9 @@ class FileSystemSet: else: options = "rw" mtab = mtab + format % (devify(entry.device.getDevice()), - entry.mountpoint, - entry.fsystem.getName(), - options) + entry.mountpoint, + entry.fsystem.getName(), + options) return mtab @@ -1041,12 +1040,12 @@ class FileSystemSet: except SystemError: if self.messageWindow: self.messageWindow(_("Error"), - _("An error occurred trying to " - "initialize swap on device %s. This " - "problem is serious, and the install " - "cannot continue.\n\n" - "Press to reboot your system.") - % (entry.device.getDevice(),)) + _("An error occurred trying to " + "initialize swap on device %s. This " + "problem is serious, and the install " + "cannot continue.\n\n" + "Press to reboot your system.") + % (entry.device.getDevice(),)) sys.exit(0) for entry in formatted: @@ -1092,39 +1091,39 @@ class FileSystemSet: except OldSwapError: if self.messageWindow: msg = _("The swap device:\n\n /dev/%s\n\n" - "is a version 0 Linux swap partition. If you " - "want to use this device, you must reformat as " - "a version 1 Linux swap partition. If you skip " - "it, the installer will ignore it during the " - "installation.") % (entry.device.getDevice()) + "is a version 0 Linux swap partition. If you " + "want to use this device, you must reformat as " + "a version 1 Linux swap partition. If you skip " + "it, the installer will ignore it during the " + "installation.") % (entry.device.getDevice()) swapErrorDialog(msg, _("Reformat"), entry) except SuspendError: if self.messageWindow: if upgrading: msg = _("The swap device:\n\n /dev/%s\n\n" - "in your /etc/fstab file is currently in " - "use as a software suspend partition, " - "which means your system is hibernating. " - "To perform an upgrade, please shut down " - "your system rather than hibernating it.") \ - % (entry.device.getDevice()) + "in your /etc/fstab file is currently in " + "use as a software suspend partition, " + "which means your system is hibernating. " + "To perform an upgrade, please shut down " + "your system rather than hibernating it.") \ + % (entry.device.getDevice()) else: msg = _("The swap device:\n\n /dev/%s\n\n" - "in your /etc/fstab file is currently in " - "use as a software suspend partition, " - "which means your system is hibernating. " - "If you are performing a new install, " - "make sure the installer is set " - "to format all swap partitions.") \ - % (entry.device.getDevice()) + "in your /etc/fstab file is currently in " + "use as a software suspend partition, " + "which means your system is hibernating. " + "If you are performing a new install, " + "make sure the installer is set " + "to format all swap partitions.") \ + % (entry.device.getDevice()) # choose your own adventure swap partitions... msg = msg + _("\n\nChoose Skip if you want the " - "installer to ignore this partition during " - "the upgrade. Choose Format to reformat " - "the partition as swap space. Choose Reboot " - "to restart the system.") + "installer to ignore this partition during " + "the upgrade. Choose Format to reformat " + "the partition as swap space. Choose Reboot " + "to restart the system.") swapErrorDialog(msg, _("Format"), entry) else: @@ -1134,25 +1133,25 @@ class FileSystemSet: if self.messageWindow: if upgrading: self.messageWindow(_("Error"), - _("Error enabling swap device " - "%s: %s\n\n" - "The /etc/fstab on your " - "upgrade partition does not " - "reference a valid swap " - "partition.\n\n" - "Press OK to reboot your " - "system.") - % (entry.device.getDevice(), msg)) + _("Error enabling swap device " + "%s: %s\n\n" + "The /etc/fstab on your " + "upgrade partition does not " + "reference a valid swap " + "partition.\n\n" + "Press OK to reboot your " + "system.") + % (entry.device.getDevice(), msg)) else: self.messageWindow(_("Error"), - _("Error enabling swap device " - "%s: %s\n\n" - "This most likely means this " - "swap partition has not been " - "initialized.\n\n" - "Press OK to reboot your " - "system.") - % (entry.device.getDevice(), msg)) + _("Error enabling swap device " + "%s: %s\n\n" + "This most likely means this " + "swap partition has not been " + "initialized.\n\n" + "Press OK to reboot your " + "system.") + % (entry.device.getDevice(), msg)) sys.exit(0) def labelEntry(self, entry, chroot): @@ -1199,23 +1198,23 @@ class FileSystemSet: log.error("Bad blocks detected on device %s",entry.device.getDevice()) if self.messageWindow: self.messageWindow(_("Error"), - _("Bad blocks have been detected on " - "device /dev/%s. We do " - "not recommend you use this device." - "\n\n" - "Press to reboot your system") - % (entry.device.getDevice(),)) + _("Bad blocks have been detected on " + "device /dev/%s. We do " + "not recommend you use this device." + "\n\n" + "Press to reboot your system") + % (entry.device.getDevice(),)) sys.exit(0) except SystemError: if self.messageWindow: self.messageWindow(_("Error"), - _("An error occurred searching for " - "bad blocks on %s. This problem is " - "serious, and the install cannot " - "continue.\n\n" - "Press to reboot your system.") - % (entry.device.getDevice(),)) + _("An error occurred searching for " + "bad blocks on %s. This problem is " + "serious, and the install cannot " + "continue.\n\n" + "Press to reboot your system.") + % (entry.device.getDevice(),)) sys.exit(0) def makeFilesystems(self, chroot='/'): @@ -1232,12 +1231,12 @@ class FileSystemSet: except SystemError: if self.messageWindow: self.messageWindow(_("Error"), - _("An error occurred trying to " - "format %s. This problem is " - "serious, and the install cannot " - "continue.\n\n" - "Press to reboot your system.") - % (entry.device.getDevice(),)) + _("An error occurred trying to " + "format %s. This problem is " + "serious, and the install cannot " + "continue.\n\n" + "Press to reboot your system.") + % (entry.device.getDevice(),)) sys.exit(0) for entry in formatted: @@ -1281,12 +1280,12 @@ class FileSystemSet: except SystemError: if self.messageWindow: self.messageWindow(_("Error"), - _("An error occurred trying to " - "migrate %s. This problem is " - "serious, and the install cannot " - "continue.\n\n" - "Press to reboot your system.") - % (entry.device.getDevice(),)) + _("An error occurred trying to " + "migrate %s. This problem is " + "serious, and the install cannot " + "continue.\n\n" + "Press to reboot your system.") + % (entry.device.getDevice(),)) sys.exit(0) self.migratedfs = 1 @@ -1309,21 +1308,21 @@ class FileSystemSet: if self.messageWindow: if num == errno.EEXIST: self.messageWindow(_("Invalid mount point"), - _("An error occurred when trying " - "to create %s. Some element of " - "this path is not a directory. " - "This is a fatal error and the " - "install cannot continue.\n\n" - "Press to reboot your " - "system.") % (entry.mountpoint,)) + _("An error occurred when trying " + "to create %s. Some element of " + "this path is not a directory. " + "This is a fatal error and the " + "install cannot continue.\n\n" + "Press to reboot your " + "system.") % (entry.mountpoint,)) else: self.messageWindow(_("Invalid mount point"), - _("An error occurred when trying " - "to create %s: %s. This is " - "a fatal error and the install " - "cannot continue.\n\n" - "Press to reboot your " - "system.") % (entry.mountpoint, msg)) + _("An error occurred when trying " + "to create %s: %s. This is " + "a fatal error and the install " + "cannot continue.\n\n" + "Press to reboot your " + "system.") % (entry.mountpoint, msg)) sys.exit(0) except SystemError, (num, msg): if raiseErrors: @@ -1332,14 +1331,14 @@ class FileSystemSet: if self.messageWindow: if not entry.fsystem.isLinuxNativeFS(): ret = self.messageWindow(_("Unable to mount filesystem"), - _("An error occurred mounting " - "device %s as %s. You may " - "continue installation, but " - "there may be problems.") % - (entry.device.getDevice(), - entry.mountpoint), - type="custom", custom_icon="warning", - custom_buttons=[_("_Reboot"), _("_Continue")]) + _("An error occurred mounting " + "device %s as %s. You may " + "continue installation, but " + "there may be problems.") + % (entry.device.getDevice(), + entry.mountpoint), + type="custom", custom_icon="warning", + custom_buttons=[_("_Reboot"), _("_Continue")]) if ret == 0: sys.exit(0) @@ -1348,18 +1347,18 @@ class FileSystemSet: else: if pomona.id.getUpgrade() and not entry.getLabel(): errStr = _("Error mounting device %s as %s: " - "%s\n\n" - "Devices in /etc/fstab should be " - "specified by label, not by device name." - "\n\n" - "Press OK to reboot your system.") % (entry.device.getDevice(), entry.mountpoint, msg) + "%s\n\n" + "Devices in /etc/fstab should be " + "specified by label, not by device name." + "\n\n" + "Press OK to reboot your system.") % (entry.device.getDevice(), entry.mountpoint, msg) else: errStr = _("Error mounting device %s as %s: " - "%s\n\n" - "This most likely means this " - "partition has not been formatted." - "\n\n" - "Press OK to reboot your system.") % (entry.device.getDevice(), entry.mountpoint, msg) + "%s\n\n" + "This most likely means this " + "partition has not been formatted." + "\n\n" + "Press OK to reboot your system.") % (entry.device.getDevice(), entry.mountpoint, msg) self.messageWindow(_("Error"), errStr) @@ -1416,7 +1415,7 @@ class FileSystemSet: isys.umount(instPath + '/proc/bus/usb', removeDir = 0) log.info("Umount USB OK") except: -# log.error("Umount USB Fail") +# log.error("Umount USB Fail") pass # take a slice so we don't modify self.entries @@ -1430,10 +1429,10 @@ class FileSystemSet: class FileSystemSetEntry: def __init__ (self, device, mountpoint, - fsystem=None, options=None, - origfsystem=None, migrate=0, - order=-1, fsck=-1, format=0, - badblocks = 0, bytesPerInode=4096): + fsystem=None, options=None, + origfsystem=None, migrate=0, + order=-1, fsck=-1, format=0, + badblocks = 0, bytesPerInode=4096): if not fsystem: fsystem = fileSystemTypeGet("ext2") self.device = device @@ -1463,8 +1462,8 @@ class FileSystemSetEntry: self.order = order if format and not fsystem.isFormattable(): raise RuntimeError, ("file system type %s is not formattable, " - "but has been added to fsset with format " - "flag on" % fsystem.getName()) + "but has been added to fsset with format " + "flag on" % fsystem.getName()) self.format = format self.badblocks = badblocks self.bytesPerInode = bytesPerInode @@ -1476,16 +1475,16 @@ class FileSystemSetEntry: # but it's too late now if (self.migrate == 1) and (self.origfsystem is not None): self.origfsystem.mount(device, "%s" % (self.mountpoint,), - readOnly = readOnly, - bindMount = isinstance(self.device, - BindMountDevice), - instroot = chroot) + readOnly = readOnly, + bindMount = isinstance(self.device, + BindMountDevice), + instroot = chroot) else: self.fsystem.mount(device, "%s" % (self.mountpoint,), - readOnly = readOnly, - bindMount = isinstance(self.device, - BindMountDevice), - instroot = chroot) + readOnly = readOnly, + bindMount = isinstance(self.device, + BindMountDevice), + instroot = chroot) self.mountcount = self.mountcount + 1 @@ -1541,13 +1540,13 @@ class FileSystemSetEntry: mntpt = self.mountpoint str = ("fsentry -- device: %(device)s mountpoint: %(mountpoint)s\n" - " fsystem: %(fsystem)s format: %(format)s\n" - " ismounted: %(mounted)s options: '%(options)s'\n" - " bytesPerInode: %(bytesPerInode)s label: %(label)s\n" - % {"device": self.device.getDevice(), "mountpoint": mntpt, - "fsystem": self.fsystem.getName(), "format": self.format, - "mounted": self.mountcount, "options": self.options, - "bytesPerInode": self.bytesPerInode, "label": self.label}) + " fsystem: %(fsystem)s format: %(format)s\n" + " ismounted: %(mounted)s options: '%(options)s'\n" + " bytesPerInode: %(bytesPerInode)s label: %(label)s\n" + % {"device": self.device.getDevice(), "mountpoint": mntpt, + "fsystem": self.fsystem.getName(), "format": self.format, + "mounted": self.mountcount, "options": self.options, + "bytesPerInode": self.bytesPerInode, "label": self.label}) return str @@ -1669,7 +1668,7 @@ class SwapFileDevice(Device): isys.ddfile(file, self.size, None) else: raise SystemError, (0, "swap file creation necessary, but " - "required size is unknown.") + "required size is unknown.") return file # This is a device that describes a swap file that is sitting on @@ -1731,26 +1730,26 @@ def readFstab(pomona): elif intf is not None: try: intf.messageWindow(_("Duplicate Labels"), - _("Multiple devices on your system are " - "labelled %s. Labels across devices must be " - "unique for your system to function " - "properly.\n\n" - "Please fix this problem and restart the " - "installation process.") - % (label,), type="custom", custom_icon="error", - custom_buttons=[_("_Reboot")]) + _("Multiple devices on your system are " + "labelled %s. Labels across devices must be " + "unique for your system to function " + "properly.\n\n" + "Please fix this problem and restart the " + "installation process.") + % (label,), type="custom", custom_icon="error", + custom_buttons=[_("_Reboot")]) except TypeError: intf.messageWindow(_("Invalid Label"), - _("An invalid label was found on device " - "%s. Please fix this problem and restart " - "the installation process.") - % (device,), type="custom", custom_icon="error", - custom_buttons=[_("_Reboot")]) + _("An invalid label was found on device " + "%s. Please fix this problem and restart " + "the installation process.") + % (device,), type="custom", custom_icon="error", + custom_buttons=[_("_Reboot")]) sys.exit(0) else: log.warning("Duplicate labels for %s, but no intf so trying " - "to continue" % (label,)) + "to continue" % (label,)) # mark these labels found on the system as used so the factory # doesn't give them to another device @@ -1814,7 +1813,7 @@ def readFstab(pomona): device = makeDevice(labelToDevice[label]) else: log.warning ("fstab file has LABEL=%s, but this label " - "could not be found on any file system", label) + "could not be found on any file system", label) # bad luck, skip this entry. continue elif fields[2] == "swap" and not fields[0].startswith('/dev/'): @@ -1849,7 +1848,7 @@ def readFstab(pomona): pass entry = FileSystemSetEntry(device, fields[1], fsystem, fields[3], - origfsystem=fsystem) + origfsystem=fsystem) if label: entry.setLabel(label) fsset.add(entry) @@ -1968,7 +1967,7 @@ def allocateLoopback(file): def ext2FormatFilesystem(argList, messageFile, windowCreator, mntpoint): if windowCreator: w = windowCreator(_("Formatting"), - _("Formatting %s file system...") % (mntpoint,), 100) + _("Formatting %s file system...") % (mntpoint,), 100) else: w = None diff --git a/src/pomona/src/harddrive.py b/src/pomona/src/harddrive.py index 37aeb07b7..492b3b0f8 100644 --- a/src/pomona/src/harddrive.py +++ b/src/pomona/src/harddrive.py @@ -42,11 +42,11 @@ class HardDriveInstallMethod(InstallMethod): def badPackageError(self, pkgname): return _("The file %s cannot be opened. This is due to a missing " - "file or perhaps a corrupt package. Please verify your " - "installation images and that you have all the required " - "media.\n\n" - "If you reboot, your system will be left in an inconsistent " - "state that will likely require reinstallation.\n\n") % pkgname + "file or perhaps a corrupt package. Please verify your " + "installation images and that you have all the required " + "media.\n\n" + "If you reboot, your system will be left in an inconsistent " + "state that will likely require reinstallation.\n\n") % pkgname # mounts disc image cdNum under self.tree def mountMedia(self, cdNum): @@ -76,9 +76,9 @@ class HardDriveInstallMethod(InstallMethod): "drive and click Retry. Click Reboot " " to abort the installation.") % (cdNum,), type="custom", - custom_icon="warning", - custom_buttons=[_("_Reboot"), - _("Re_try")]) + custom_icon="warning", + custom_buttons=[_("_Reboot"), + _("Re_try")]) if ans == 0: sys.exit(0) elif ans == 1: diff --git a/src/pomona/src/image.py b/src/pomona/src/image.py index 71aba51e9..12c179828 100644 --- a/src/pomona/src/image.py +++ b/src/pomona/src/image.py @@ -36,21 +36,21 @@ class CdromInstallMethod(InstallMethod): except Exception, e: log.error("exception when umounting media: %s" % (e,)) self.messageWindow(_("Error"), - _("An error occurred unmounting the disc. " - "Please make sure you're not accessing " - "the disk from the shell on tty2 " - "and then click OK to retry.")) + _("An error occurred unmounting the disc. " + "Please make sure you're not accessing " + "the disk from the shell on tty2 " + "and then click OK to retry.")) def ejectMedia(self): isys.ejectCdrom(self.device) def badPackageError(self, pkgname): return _("The file %s cannot be opened. This is due to a missing " - "file or perhaps a corrupt package. Please verify your " - "installation images and that you have all the required " - "media.\n\n" - "If you reboot, your system will be left in an inconsistent " - "state that will likely require reinstallation.\n\n") % pkgname + "file or perhaps a corrupt package. Please verify your " + "installation images and that you have all the required " + "media.\n\n" + "If you reboot, your system will be left in an inconsistent " + "state that will likely require reinstallation.\n\n") % pkgname def getFilename(self, filename, callback=None, destdir=None, retry=1): return self.tree + "/" + filename @@ -90,7 +90,7 @@ class CdromInstallMethod(InstallMethod): else: w.pop() self.messageWindow(_("Wrong CDROM"), - _("That's not the correct %s CDROM in /dev/%s.") % (name, dev,)) + _("That's not the correct %s CDROM in /dev/%s.") % (name, dev,)) isys.umount(SOURCE_PATH) isys.ejectCdrom(dev) else: @@ -106,7 +106,7 @@ class CdromInstallMethod(InstallMethod): self.intf.beep() self.messageWindow(_("Insert CDROM"), - _("Please insert the %s disc to continue.") % (name,)) + _("Please insert the %s disc to continue.") % (name,)) def unlinkFilename(self, fullName): pass diff --git a/src/pomona/src/installclass.py b/src/pomona/src/installclass.py index 6a470f067..5b00505bd 100644 --- a/src/pomona/src/installclass.py +++ b/src/pomona/src/installclass.py @@ -77,7 +77,7 @@ class BaseInstallClass: skipkey = False def setBootloader(self, id, location=None, forceLBA=0, password=None, - md5pass=None, appendLine="", driveorder = []): + md5pass=None, appendLine="", driveorder = []): if appendLine: id.bootloader.args.set(appendLine) id.bootloader.setForceLBA(forceLBA) @@ -99,7 +99,7 @@ class BaseInstallClass: new.append(drive) else: log.warning("requested drive %s in boot drive order " - "doesn't exist" %(drive,)) + "doesn't exist" %(drive,)) id.bootloader.drivelist = new def setIgnoredDisks(self, id, drives): @@ -117,47 +117,47 @@ class BaseInstallClass: def setSteps(self, pomona): dispatch = pomona.dispatch dispatch.setStepList( - "language", - "keyboard", - "welcome", - "findrootparts", - "betanag", - "installtype", - "partitionobjinit", - "parttype", - "autopartitionexecute", - "partition", - "partitiondone", - "bootloadersetup", - "bootloader", - "networkdevicecheck", - "network", - "timezone", - "accounts", - "reposetup", - "basepkgsel", - "tasksel", - "postselection", - "confirminstall", - "install", - "enablefilesystems", - "migratefilesystems", - "setuptime", - "preinstallconfig", - "installpackages", - "postinstallconfig", - "writeconfig", - "firstboot", - "instbootloader", - "dopostaction", - "postscripts", - "writexconfig", - "writeksconfig", - "writeregkey", - "methodcomplete", - "copylogs", - "setfilecon", - "complete" + "language", + "keyboard", + "welcome", + "findrootparts", + "betanag", + "installtype", + "partitionobjinit", + "parttype", + "autopartitionexecute", + "partition", + "partitiondone", + "bootloadersetup", + "bootloader", + "networkdevicecheck", + "network", + "timezone", + "accounts", + "reposetup", + "basepkgsel", + "tasksel", + "postselection", + "confirminstall", + "install", + "enablefilesystems", + "migratefilesystems", + "setuptime", + "preinstallconfig", + "installpackages", + "postinstallconfig", + "writeconfig", + "firstboot", + "instbootloader", + "dopostaction", + "postscripts", + "writexconfig", + "writeksconfig", + "writeregkey", + "methodcomplete", + "copylogs", + "setfilecon", + "complete" ) def setZeroMbr(self, id, zeroMbr): @@ -176,7 +176,7 @@ class BaseInstallClass: id.instLanguage.setRuntimeLanguage(nick) def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, - doClear = 1): + doClear = 1): autorequests = [ ("/", None, 1024, None, 1, 1, 1) ] bootreq = getAutopartitionBoot() @@ -237,7 +237,7 @@ class InstallClass(BaseInstallClass): def setInstallData(self, pomona): BaseInstallClass.setInstallData(self, pomona) BaseInstallClass.setDefaultPartitioning(self, pomona.id.partitions, - CLEARPART_TYPE_ALL) + CLEARPART_TYPE_ALL) def setSteps(self, pomona): dispatch = pomona.dispatch diff --git a/src/pomona/src/installer.py b/src/pomona/src/installer.py index a4d6a2cd0..b26b8bf1f 100644 --- a/src/pomona/src/installer.py +++ b/src/pomona/src/installer.py @@ -83,12 +83,12 @@ def checkMemory(): from snack import SnackScreen, ButtonChoiceWindow screen = SnackScreen() - ButtonChoiceWindow(screen, _('Fatal Error'), - _('You do not have enough RAM to install %s ' - 'on this machine.\n' - '\n' - 'Press to reboot your system.\n') - %(name,), buttons = (_("OK"),)) + ButtonChoiceWindow(screen, _("Fatal Error"), + _("You do not have enough RAM to install %s " + "on this machine.\n" + "\n" + "Press to reboot your system.\n") + % (name,), buttons = (_("OK"),)) screen.finish() sys.exit(0) diff --git a/src/pomona/src/instdata.py b/src/pomona/src/instdata.py index 17845a479..4690e5dc7 100644 --- a/src/pomona/src/instdata.py +++ b/src/pomona/src/instdata.py @@ -40,7 +40,7 @@ class InstallData: # - The keyboard self.instClass = None -# self.network = network.Network() +# self.network = network.Network() self.timezone = timezone.Timezone() self.timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone()) self.users = None diff --git a/src/pomona/src/packages.py b/src/pomona/src/packages.py index 71fdc2fbe..b53dd9bbd 100644 --- a/src/pomona/src/packages.py +++ b/src/pomona/src/packages.py @@ -85,7 +85,7 @@ def setupTimezone(pomona): try: inutil.execWithRedirect("/sbin/hwclock", args, stdin = None, - stdout = "/dev/tty5", stderr = "/dev/tty5") + stdout = "/dev/tty5", stderr = "/dev/tty5") except RuntimeError: log.error("Failed to set clock") @@ -101,20 +101,20 @@ def betaNagScreen(pomona): while 1: rc = pomona.intf.messageWindow( _("Warning! This is pre-release software!"), - _("Thank you for downloading this " - "pre-release of %s.\n\n" - "This is not a final " - "release and is not intended for use " - "on production systems. The purpose of " - "this release is to collect feedback " - "from testers, and it is not suitable " - "for day to day usage.\n\n" - "To report feedback, please visit:\n\n" - " %s\n\n" - "and file a report against '%s'.\n") - %(name, bugurl, name), - type="custom", custom_icon="warning", - custom_buttons=[_("_Exit"), _("_Install anyway")]) + _("Thank you for downloading this " + "pre-release of %s.\n\n" + "This is not a final " + "release and is not intended for use " + "on production systems. The purpose of " + "this release is to collect feedback " + "from testers, and it is not suitable " + "for day to day usage.\n\n" + "To report feedback, please visit:\n\n" + " %s\n\n" + "and file a report against '%s'.\n") + % (name, bugurl, name), + type="custom", custom_icon="warning", + custom_buttons=[_("_Exit"), _("_Install anyway")]) if not rc: msg = _("Your system will now be rebooted...") diff --git a/src/pomona/src/pakfireinstall.py b/src/pomona/src/pakfireinstall.py index 3d97320b1..0b60e6b89 100644 --- a/src/pomona/src/pakfireinstall.py +++ b/src/pomona/src/pakfireinstall.py @@ -134,8 +134,8 @@ class PomonaPakfire: extractor = \ subprocess.Popen(command, shell=True, - stdout=subprocess.PIPE, - stdin=subprocess.PIPE) + stdout=subprocess.PIPE, + stdin=subprocess.PIPE) cb.callback(CB_START, title=_("Base system"), text=_("Installing base system...")) @@ -222,10 +222,8 @@ class PakfireBackend(PomonaBackend): def kernelVersionList(self, pomona): kernelVersions = [] - tag2desc = { - "-smp" : _("Symmetric multiprocessing"), - "-xen" : _("Xen guest"), - } + tag2desc = { "-smp" : _("Symmetric multiprocessing"), + "-xen" : _("Xen guest"), } kernelName = "%skernel-%s" % (sname, kernelVersion) @@ -258,7 +256,7 @@ class PakfireProgress: self.window.set(float(current)/total * self.incr + self.current) else: warnings.warn("PakfireProgress.progressbar called when popped", - RuntimeWarning, stacklevel=2) + RuntimeWarning, stacklevel=2) def pop(self): self.window.pop() @@ -273,4 +271,4 @@ class PakfireProgress: self.window.set(self.current) else: warnings.warn("PakfireProgress.set called when popped", - RuntimeWarning, stacklevel=2) + RuntimeWarning, stacklevel=2) diff --git a/src/pomona/src/partIntfHelpers.py b/src/pomona/src/partIntfHelpers.py index 79aaaf73b..fd0d06971 100644 --- a/src/pomona/src/partIntfHelpers.py +++ b/src/pomona/src/partIntfHelpers.py @@ -46,8 +46,8 @@ def sanityCheckMountPoint(mntpt, fstype, preexisting, format): if not passed: return _("The mount point %s is invalid. Mount points must start " - "with '/' and cannot end with '/', and must contain " - "printable characters and no spaces." % mntpt) + "with '/' and cannot end with '/', and must contain " + "printable characters and no spaces." % mntpt) else: return None else: @@ -70,14 +70,14 @@ def doDeletePartitionByRequest(intf, requestlist, partition, confirm=1, quiet=0) if partition == None: intf.messageWindow(_("Unable To Delete"), - _("You must first select a partition to delete."), - custom_icon="error") + _("You must first select a partition to delete."), + custom_icon="error") return 0 if partition.type & parted.PARTITION_FREESPACE: intf.messageWindow(_("Unable To Delete"), - _("You cannot delete free space."), - custom_icon="error") + _("You cannot delete free space."), + custom_icon="error") return 0 else: device = partedUtils.get_partition_name(partition) @@ -86,10 +86,10 @@ def doDeletePartitionByRequest(intf, requestlist, partition, confirm=1, quiet=0) if ret: if not quiet: intf.messageWindow(_("Unable To Delete"), - _("You cannot delete this " - "partition, as it is an extended partition " - "which contains %s") - % (ret), custom_icon="error") + _("You cannot delete this " + "partition, as it is an extended partition " + "which contains %s") + % (ret), custom_icon="error") return 0 # see if device is in our partition requests, remove @@ -102,13 +102,13 @@ def doDeletePartitionByRequest(intf, requestlist, partition, confirm=1, quiet=0) # reason why. if state is None and request.getProtected(): state = _("This partition is holding the data for the hard " - "drive install.") + "drive install.") if state: if not quiet: intf.messageWindow(_("Unable To Delete"), - _("You cannot delete this partition:\n\n") + state, - custom_icon="error") + _("You cannot delete this partition:\n\n") + state, + custom_icon="error") return (None, None) if confirm and not confirmDeleteRequest(intf, request): @@ -142,10 +142,10 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device, """ Remove all partitions currently on device """ if confirm: rc = intf.messageWindow(_("Confirm Delete"), - _("You are about to delete all partitions on " - "the device '/dev/%s'.") % (device,), - type="custom", custom_icon="warning", - custom_buttons=[_("Cancel"), _("_Delete")]) + _("You are about to delete all partitions on " + "the device '/dev/%s'.") % (device,), + type="custom", custom_icon="warning", + custom_buttons=[_("Cancel"), _("_Delete")]) if not rc: return @@ -202,9 +202,9 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device, if outlist != "" and not quiet: intf.messageWindow(_("Notice"), - _("The following partitions were not deleted " - "because they are in use:\n\n%s") % outlist, - custom_icon="warning") + _("The following partitions were not deleted " + "because they are in use:\n\n%s") % outlist, + custom_icon="warning") return 1 @@ -218,14 +218,14 @@ def doEditPartitionByRequest(intf, requestlist, part): if part == None: intf.messageWindow(_("Unable To Edit"), - _("You must select a partition to edit"), custom_icon="error") + _("You must select a partition to edit"), custom_icon="error") return (None, None) if part.type & parted.PARTITION_FREESPACE: request = partRequests.PartitionSpec(fsset.fileSystemTypeGetDefault(), - start = partedUtils.start_sector_to_cyl(part.geom.dev, part.geom.start), - end = partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end), - drive = [ partedUtils.get_partition_drive(part) ]) + start = partedUtils.start_sector_to_cyl(part.geom.dev, part.geom.start), + end = partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end), + drive = [ partedUtils.get_partition_drive(part) ]) return ("NEW", request) elif part.type & parted.PARTITION_EXTENDED: @@ -234,9 +234,9 @@ def doEditPartitionByRequest(intf, requestlist, part): ret = requestlist.containsImmutablePart(part) if ret: intf.messageWindow(_("Unable To Edit"), - _("You cannot edit this " - "partition, as it is an extended partition " - "which contains %s") %(ret), custom_icon="error") + _("You cannot edit this " + "partition, as it is an extended partition " + "which contains %s") %(ret), custom_icon="error") return 0 name = partedUtils.get_partition_name(part) @@ -245,8 +245,8 @@ def doEditPartitionByRequest(intf, requestlist, part): state = isNotChangable(request, requestlist) if state is not None: intf.messageWindow(_("Unable To Edit"), - _("You cannot edit this partition:\n\n") + state, - custom_icon="error") + _("You cannot edit this partition:\n\n") + state, + custom_icon="error") return (None, None) return ("PARTITION", request) @@ -268,14 +268,14 @@ def checkForSwapNoMatch(pomona): and (request.fstype and request.fstype.getName() != "swap") and (not request.format)): rc = pomona.intf.messageWindow(_("Format as Swap?"), - _("/dev/%s has a partition type of 0x82 " - "(Linux swap) but does not appear to " - "be formatted as a Linux swap " - "partition.\n\n" - "Would you like to format this " - "partition as a swap partition?") - % (request.device), type = "yesno", - custom_icon="question") + _("/dev/%s has a partition type of 0x82 " + "(Linux swap) but does not appear to " + "be formatted as a Linux swap " + "partition.\n\n" + "Would you like to format this " + "partition as a swap partition?") + % (request.device), type = "yesno", + custom_icon="question") if rc == 1: request.format = 1 request.fstype = fsset.fileSystemTypeGet("swap") @@ -289,16 +289,16 @@ def mustHaveSelectedDrive(intf): def queryNoFormatPreExisting(intf): """Ensure the user wants to use a partition without formatting.""" txt = _("You have chosen to use a pre-existing " - "partition for this installation without formatting it. " - "We recommend that you format this partition " - "to make sure files from a previous operating system installation " - "do not cause problems with this installation of Linux. " - "However, if this partition contains files that you need " - "to keep, such as home directories, then " - "continue without formatting this partition.") + "partition for this installation without formatting it. " + "We recommend that you format this partition " + "to make sure files from a previous operating system installation " + "do not cause problems with this installation of Linux. " + "However, if this partition contains files that you need " + "to keep, such as home directories, then " + "continue without formatting this partition.") rc = intf.messageWindow(_("Format?"), txt, type = "custom", - custom_buttons=[_("_Modify Partition"), _("Do _Not Format")], - custom_icon="warning") + custom_buttons=[_("_Modify Partition"), _("Do _Not Format")], + custom_icon="warning") return rc def partitionSanityErrors(intf, errors): @@ -307,13 +307,13 @@ def partitionSanityErrors(intf, errors): if errors: errorstr = string.join(errors, "\n\n") rc = intf.messageWindow(_("Error with Partitioning"), - _("The following critical errors exist " - "with your requested partitioning " - "scheme. " - "These errors must be corrected prior " - "to continuing with your install of " - "%s.\n\n%s") %(name, errorstr), - custom_icon="error") + _("The following critical errors exist " + "with your requested partitioning " + "scheme. " + "These errors must be corrected prior " + "to continuing with your install of " + "%s.\n\n%s") %(name, errorstr), + custom_icon="error") return rc def partitionSanityWarnings(intf, warnings): @@ -322,12 +322,12 @@ def partitionSanityWarnings(intf, warnings): if warnings: warningstr = string.join(warnings, "\n\n") rc = intf.messageWindow(_("Partitioning Warning"), - _("The following warnings exist with " - "your requested partition scheme.\n\n%s" - "\n\nWould you like to continue with " - "your requested partitioning " - "scheme?") % (warningstr), - type="yesno", custom_icon="warning") + _("The following warnings exist with " + "your requested partition scheme.\n\n%s" + "\n\nWould you like to continue with " + "your requested partitioning " + "scheme?") % (warningstr), + type="yesno", custom_icon="warning") return rc @@ -336,16 +336,16 @@ def partitionPreExistFormatWarnings(intf, warnings): rc = 1 if warnings: labelstr1 = _("The following pre-existing partitions have been " - "selected to be formatted, destroying all data.") + "selected to be formatted, destroying all data.") labelstr2 = _("Select 'Yes' to continue and format these " - "partitions, or 'No' to go back and change these " - "settings.") + "partitions, or 'No' to go back and change these " + "settings.") commentstr = "" for (dev, type, mntpt) in warnings: commentstr = commentstr + "/dev/%s %s %s\n" % (dev,type,mntpt) rc = intf.messageWindow(_("Format Warning"), "%s\n\n%s\n\n%s" % - (labelstr1, labelstr2, commentstr), - type="yesno", custom_icon="warning") + (labelstr1, labelstr2, commentstr), + type="yesno", custom_icon="warning") return rc def getPreExistFormatWarnings(partitions, diskset): @@ -394,7 +394,7 @@ def confirmDeleteRequest(intf, request): def confirmResetPartitionState(intf): """Confirm reset of partitioning to that present on the system.""" rc = intf.messageWindow(_("Confirm Reset"), - _("Are you sure you want to reset the " - "partition table to its original state?"), - type="yesno", custom_icon="question") + _("Are you sure you want to reset the " + "partition table to its original state?"), + type="yesno", custom_icon="question") return rc diff --git a/src/pomona/src/partRequests.py b/src/pomona/src/partRequests.py index 0d0dc18fb..cf049f7f0 100644 --- a/src/pomona/src/partRequests.py +++ b/src/pomona/src/partRequests.py @@ -52,10 +52,9 @@ class DeleteSpec: class RequestSpec: """Generic Request specification.""" def __init__(self, fstype, size = None, mountpoint = None, format = None, - badblocks = None, preexist = 0, fslabel = None, - migrate = None, origfstype = None, bytesPerInode = 4096): + badblocks = None, preexist = 0, fslabel = None, + migrate = None, origfstype = None, bytesPerInode = 4096): """Create a generic RequestSpec. - This should probably never be externally used. """ @@ -100,14 +99,14 @@ class RequestSpec: fsname = "None" str = ("Generic Request -- mountpoint: %(mount)s uniqueID: %(id)s\n" - " type: %(fstype)s format: %(format)s badblocks: %(bb)s\n" - " device: %(dev)s migrate: %(migrate)s fslabel: %(fslabel)s\n" - " bytesPerInode: %(bytesPerInode)s options: '%(fsopts)s'" - % {"mount": self.mountpoint, "id": self.uniqueID, - "fstype": fsname, "format": self.format, "bb": self.badblocks, - "dev": self.device, "migrate": self.migrate, - "fslabel": self.fslabel, "bytesPerInode": self.bytesPerInode, - "fsopts": self.fsopts}) + " type: %(fstype)s format: %(format)s badblocks: %(bb)s\n" + " device: %(dev)s migrate: %(migrate)s fslabel: %(fslabel)s\n" + " bytesPerInode: %(bytesPerInode)s options: '%(fsopts)s'" + % {"mount": self.mountpoint, "id": self.uniqueID, + "fstype": fsname, "format": self.format, "bb": self.badblocks, + "dev": self.device, "migrate": self.migrate, + "fslabel": self.fslabel, "bytesPerInode": self.bytesPerInode, + "fsopts": self.fsopts}) return str def getActualSize(self, partitions, diskset): @@ -131,9 +130,9 @@ class RequestSpec: mountpoint = self.mountpoint entry = fsset.FileSystemSetEntry(device, mountpoint, self.fstype, - origfsystem=self.origfstype, - bytesPerInode=self.bytesPerInode, - options=self.fsopts) + origfsystem=self.origfstype, + bytesPerInode=self.bytesPerInode, + options=self.fsopts) if self.format: entry.setFormat(self.format) @@ -163,9 +162,9 @@ class RequestSpec: def doMountPointLinuxFSChecks(self): """Return an error string if the mountpoint is not valid for Linux FS.""" mustbeonroot = ('/bin','/dev','/sbin','/etc','/lib','/root', - '/mnt', 'lost+found', '/proc') + '/mnt', 'lost+found', '/proc') mustbeonlinuxfs = ('/', '/boot', '/var', '/tmp', '/usr', '/home', - '/usr/share', '/usr/lib' ) + '/usr/share', '/usr/lib' ) # these are symlinks so you cant make them mount points otherexcept = ('/var/mail', '/usr/tmp') @@ -179,12 +178,12 @@ class RequestSpec: if self.fstype.isMountable(): if self.mountpoint in mustbeonroot: return _("This mount point is invalid. The %s directory must " - "be on the / file system.") % (self.mountpoint,) + "be on the / file system.") % (self.mountpoint,) elif self.mountpoint in otherexcept: return _("The mount point %s cannot be used. It must " - "be a symbolic link for proper system " - "operation. Please select a different " - "mount point.") % (self.mountpoint,) + "be a symbolic link for proper system " + "operation. Please select a different " + "mount point.") % (self.mountpoint,) if not self.fstype.isLinuxNativeFS(): if self.mountpoint in mustbeonlinuxfs: @@ -209,8 +208,8 @@ class RequestSpec: if request.mountpoint == mntpt: if (not self.uniqueID or request.uniqueID != self.uniqueID): return _("The mount point \"%s\" is already in use, " - "please choose a different mount point." - % (mntpt)) + "please choose a different mount point." + % (mntpt)) return None def doSizeSanityCheck(self): @@ -223,10 +222,9 @@ class RequestSpec: if self.size and self.size > self.fstype.getMaxSizeMB(): return (_("The size of the %s partition (%10.2f MB) " - "exceeds the maximum size of %10.2f MB.") - % (self.fstype.getName(), self.size, - self.fstype.getMaxSizeMB())) - + "exceeds the maximum size of %10.2f MB.") + % (self.fstype.getName(), self.size, + self.fstype.getMaxSizeMB())) return None # set skipMntPtExistCheck to non-zero if you want to handle this @@ -303,10 +301,10 @@ class PartitionSpec(RequestSpec): """Object to define a requested partition.""" def __init__(self, fstype, size = None, mountpoint = None, - preexist = 0, migrate = None, grow = 0, maxSizeMB = None, - start = None, end = None, drive = None, primary = None, - format = None, multidrive = None, bytesPerInode = 4096, - fslabel = None): + preexist = 0, migrate = None, grow = 0, maxSizeMB = None, + start = None, end = None, drive = None, primary = None, + format = None, multidrive = None, bytesPerInode = 4096, + fslabel = None): """Create a new PartitionSpec object. fstype is the fsset filesystem type. @@ -334,10 +332,10 @@ class PartitionSpec(RequestSpec): origfs = None RequestSpec.__init__(self, fstype = fstype, size = size, - mountpoint = mountpoint, format = format, - preexist = preexist, migrate = None, - origfstype = origfs, bytesPerInode = bytesPerInode, - fslabel = fslabel) + mountpoint = mountpoint, format = format, + preexist = preexist, migrate = None, + origfstype = origfs, bytesPerInode = bytesPerInode, + fslabel = fslabel) self.type = REQUEST_NEW self.grow = grow @@ -371,20 +369,20 @@ class PartitionSpec(RequestSpec): pre = "Existing" str = ("%(n)s Part Request -- mountpoint: %(mount)s uniqueID: %(id)s\n" - " type: %(fstype)s format: %(format)s badblocks: %(bb)s\n" - " device: %(dev)s drive: %(drive)s primary: %(primary)s\n" - " size: %(size)s grow: %(grow)s maxsize: %(max)s\n" - " start: %(start)s end: %(end)s migrate: %(migrate)s " - " fslabel: %(fslabel)s origfstype: %(origfs)s\n" - " bytesPerInode: %(bytesPerInode)s options: '%(fsopts)s'" - % {"n": pre, "mount": self.mountpoint, "id": self.uniqueID, - "fstype": fsname, "format": self.format, "dev": self.device, - "drive": self.drive, "primary": self.primary, - "size": self.size, "grow": self.grow, "max": self.maxSizeMB, - "start": self.start, "end": self.end, "bb": self.badblocks, - "migrate": self.migrate, "fslabel": self.fslabel, - "origfs": oldfs, "bytesPerInode": self.bytesPerInode, - "fsopts": self.fsopts}) + " type: %(fstype)s format: %(format)s badblocks: %(bb)s\n" + " device: %(dev)s drive: %(drive)s primary: %(primary)s\n" + " size: %(size)s grow: %(grow)s maxsize: %(max)s\n" + " start: %(start)s end: %(end)s migrate: %(migrate)s " + " fslabel: %(fslabel)s origfstype: %(origfs)s\n" + " bytesPerInode: %(bytesPerInode)s options: '%(fsopts)s'" + % {"n": pre, "mount": self.mountpoint, "id": self.uniqueID, + "fstype": fsname, "format": self.format, "dev": self.device, + "drive": self.drive, "primary": self.primary, + "size": self.size, "grow": self.grow, "max": self.maxSizeMB, + "start": self.start, "end": self.end, "bb": self.badblocks, + "migrate": self.migrate, "fslabel": self.fslabel, + "origfs": oldfs, "bytesPerInode": self.bytesPerInode, + "fsopts": self.fsopts}) return str @@ -412,12 +410,12 @@ class PartitionSpec(RequestSpec): if (self.size and self.maxSizeMB and (self.size > self.maxSizeMB)): return (_("The size of the requested partition (size = %s MB) " - "exceeds the maximum size of %s MB.") - % (self.size, self.maxSizeMB)) + "exceeds the maximum size of %s MB.") + % (self.size, self.maxSizeMB)) if self.size and self.size < 0: return _("The size of the requested partition is " - "negative! (size = %s MB)") % (self.size) + "negative! (size = %s MB)") % (self.size) if self.start and self.start < 1: return _("Partitions can't start below the first cylinder.") @@ -431,9 +429,9 @@ class NewPartitionSpec(PartitionSpec): """Object to define a NEW requested partition.""" def __init__(self, fstype, size = None, mountpoint = None, - grow = 0, maxSizeMB = None, - start = None, end = None, - drive = None, primary = None, format = None): + grow = 0, maxSizeMB = None, + start = None, end = None, + drive = None, primary = None, format = None): """Create a new NewPartitionSpec object. fstype is the fsset filesystem type. @@ -449,18 +447,18 @@ class NewPartitionSpec(PartitionSpec): """ PartitionSpec.__init__(self, fstype = fstype, size = size, - mountpoint = mountpoint, grow = grow, - maxSizeMB = maxSizeMB, start = start, - end = end, drive = drive, primary = primary, - format = format, preexist = 0) + mountpoint = mountpoint, grow = grow, + maxSizeMB = maxSizeMB, start = start, + end = end, drive = drive, primary = primary, + format = format, preexist = 0) self.type = REQUEST_NEW class PreexistingPartitionSpec(PartitionSpec): """Request to represent partitions which already existed.""" def __init__(self, fstype, size = None, start = None, end = None, - drive = None, format = None, migrate = None, - mountpoint = None): + drive = None, format = None, migrate = None, + mountpoint = None): """Create a new PreexistingPartitionSpec object. fstype is the fsset filesystem type. @@ -474,7 +472,7 @@ class PreexistingPartitionSpec(PartitionSpec): """ PartitionSpec.__init__(self, fstype = fstype, size = size, - start = start, end = end, drive = drive, - format = format, migrate = migrate, - mountpoint = mountpoint, preexist = 1) + start = start, end = end, drive = drive, + format = format, migrate = migrate, + mountpoint = mountpoint, preexist = 1) self.type = REQUEST_PREEXIST diff --git a/src/pomona/src/partedUtils.py b/src/pomona/src/partedUtils.py index 512ceecae..9640eebd1 100644 --- a/src/pomona/src/partedUtils.py +++ b/src/pomona/src/partedUtils.py @@ -58,13 +58,11 @@ def get_flags(part): def start_sector_to_cyl(device, sector): """Return the closest cylinder (round down) to sector on device.""" - return int(math.floor((float(sector) - / (device.heads * device.sectors)) + 1)) + return int(math.floor((float(sector) / (device.heads * device.sectors)) + 1)) def end_sector_to_cyl(device, sector): """Return the closest cylinder (round up) to sector on device.""" - return int(math.ceil(float((sector + 1)) - / (device.heads * device.sectors))) + return int(math.ceil(float((sector + 1)) / (device.heads * device.sectors))) def start_cyl_to_sector(device, cyl): "Return the sector corresponding to cylinder as a starting cylinder." @@ -80,13 +78,11 @@ def getPartSize(partition): def getPartSizeMB(partition): """Return the size of partition in megabytes.""" - return (partition.geom.length * partition.geom.dev.sector_size - / 1024.0 / 1024.0) + return (partition.geom.length * partition.geom.dev.sector_size / 1024.0 / 1024.0) def getDeviceSizeMB(dev): """Return the size of dev in megabytes.""" - return (float(dev.heads * dev.cylinders * dev.sectors) / (1024 * 1024) - * dev.sector_size) + return (float(dev.heads * dev.cylinders * dev.sectors) / (1024 * 1024) * dev.sector_size) def get_partition_by_name(disks, partname): """Return the parted part object associated with partname. @@ -230,16 +226,16 @@ def checkDiskLabel(disk, intf): if intf: rc = intf.messageWindow(_("Warning"), - _("/dev/%s currently has a %s partition " - "layout. To use this drive for " - "the installation of %s, it must be " - "re-initialized, causing the loss of " - "ALL DATA on this drive.\n\n" - "Would you like to re-initialize this " - "drive?") - %(disk.dev.path[5:], disk.type.name, name), - type="custom", custom_buttons = [ _("_Ignore drive"), - _("_Re-initialize drive") ], custom_icon="question") + _("/dev/%s currently has a %s partition " + "layout. To use this drive for " + "the installation of %s, it must be " + "re-initialized, causing the loss of " + "ALL DATA on this drive.\n\n" + "Would you like to re-initialize this " + "drive?") + %(disk.dev.path[5:], disk.type.name, name), + type="custom", custom_buttons = [ _("_Ignore drive"), + _("_Re-initialize drive") ], custom_icon="question") if rc == 0: return 1 @@ -271,8 +267,7 @@ def hasProtectedPartitions(drive, pomona): # didn't probe as one type or another. def validateFsType(part): # we only care about primary and logical partitions - if not part.type in (parted.PARTITION_PRIMARY, - parted.PARTITION_LOGICAL): + if not part.type in (parted.PARTITION_PRIMARY, parted.PARTITION_LOGICAL): return # if the partition already has a type, no need to search if part.fs_type: @@ -394,8 +389,8 @@ class DiskSet: for drive in drives: disk = self.disks[drive] func = lambda part: (part.is_active() and - not (part.get_flag(parted.PARTITION_RAID) - or part.get_flag(parted.PARTITION_LVM))) + not (part.get_flag(parted.PARTITION_RAID) + or part.get_flag(parted.PARTITION_LVM))) parts = filter_partitions(disk, func) for part in parts: node = get_partition_name(part) @@ -416,9 +411,8 @@ class DiskSet: disk = self.disks[drive] part = disk.next_partition() while part: - if (part.is_active() - and (part.get_flag(parted.PARTITION_RAID) - or part.get_flag(parted.PARTITION_LVM))): + if (part.is_active() and (part.get_flag(parted.PARTITION_RAID) + or part.get_flag(parted.PARTITION_LVM))): pass elif (part.fs_type and part.fs_type.name in fsset.getUsableLinuxFs()): node = get_partition_name(part) @@ -550,7 +544,7 @@ class DiskSet: recreate = 0 if zeroMbr: log.error("zeroMBR was set and invalid partition table " - "found on %s" % (dev.path[5:])) + "found on %s" % (dev.path[5:])) recreate = 1 elif intf is None: DiskSet.skippedDisks.append(drive) @@ -561,14 +555,14 @@ class DiskSet: # if pomona is None here, we are called from labelFactory if self.pomona is not None: rc = intf.messageWindow(_("Warning"), - _("The partition table on device %s was unreadable. " - "To create new partitions it must be initialized, " - "causing the loss of ALL DATA on this drive.\n\n" - "This operation will override any previous " - "installation choices about which drives to " - "ignore.\n\n" - "Would you like to initialize this drive, " - "erasing ALL DATA?") % (format,), type = "yesno") + _("The partition table on device %s was unreadable. " + "To create new partitions it must be initialized, " + "causing the loss of ALL DATA on this drive.\n\n" + "This operation will override any previous " + "installation choices about which drives to " + "ignore.\n\n" + "Would you like to initialize this drive, " + "erasing ALL DATA?") % (format,), type = "yesno") if rc == 0: DiskSet.skippedDisks.append(drive) continue @@ -598,17 +592,17 @@ class DiskSet: # check for more than 15 partitions (libata limit) if drive.startswith('sd') and disk.get_last_partition_num() > 15: rc = intf.messageWindow(_("Warning"), - _("The drive /dev/%s has more than 15 " - "partitions on it. The SCSI " - "subsystem in the Linux kernel does " - "not allow for more than 15 partitons " - "at this time. You will not be able " - "to make changes to the partitioning " - "of this disk or use any partitions " - "beyond /dev/%s15 in %s") - % (drive, drive, name), type="custom", - custom_buttons = [_("_Reboot"), _("_Continue")], - custom_icon="warning") + _("The drive /dev/%s has more than 15 " + "partitions on it. The SCSI " + "subsystem in the Linux kernel does " + "not allow for more than 15 partitons " + "at this time. You will not be able " + "to make changes to the partitioning " + "of this disk or use any partitions " + "beyond /dev/%s15 in %s") + % (drive, drive, name), type="custom", + custom_buttons = [_("_Reboot"), _("_Continue")], + custom_icon="warning") if rc == 0: sys.exit(0) @@ -642,7 +636,7 @@ class DiskSet: part = disk.next_partition () while part: if part.type in (parted.PARTITION_PRIMARY, - parted.PARTITION_LOGICAL): + parted.PARTITION_LOGICAL): device = get_partition_name(part) if part.fs_type: ptype = part.fs_type.name @@ -658,18 +652,18 @@ class DiskSet: rc = "" for disk in self.disks.values(): rc = rc + ("%s: %s length %ld, maximum " - "primary partitions: %d\n" - % (disk.dev.path, - disk.dev.model, - disk.dev.length, - disk.max_primary_partition_count)) + "primary partitions: %d\n" + % (disk.dev.path, + disk.dev.model, + disk.dev.length, + disk.max_primary_partition_count)) part = disk.next_partition() if part: rc = rc + ("Device Type Filesystem Start " - "End Length Flags\n") + "End Length Flags\n") rc = rc + ("------ ---- ---------- ----- " - "--- ------ -----\n") + "--- ------ -----\n") while part: if not part.type & parted.PARTITION_METADATA: device = "" @@ -680,8 +674,8 @@ class DiskSet: fs_type_name = part.fs_type.name partFlags = get_flags (part) rc = rc + ("%-9s %-12s %-12s %-10ld %-10ld %-10ld %7s\n" - % (device, part.type_name, fs_type_name, - part.geom.start, part.geom.end, part.geom.length, partFlags)) + % (device, part.type_name, fs_type_name, + part.geom.start, part.geom.end, part.geom.length, partFlags)) part = disk.next_partition(part) return rc @@ -689,10 +683,10 @@ class DiskSet: """Check that there are valid disk devices.""" if len(self.disks.keys()) == 0: self.pomona.intf.messageWindow(_("No Drives Found"), - _("An error has occurred - no valid devices were " - "found on which to create new file systems. " - "Please check your hardware for the cause " - "of this problem.")) + _("An error has occurred - no valid devices were " + "found on which to create new file systems. " + "Please check your hardware for the cause " + "of this problem.")) return True return False diff --git a/src/pomona/src/partitioning.py b/src/pomona/src/partitioning.py index aa2b46d25..2edaa5a99 100644 --- a/src/pomona/src/partitioning.py +++ b/src/pomona/src/partitioning.py @@ -35,12 +35,12 @@ def partitionObjectsInitialize(pomona): def partitioningComplete(pomona): if pomona.dir == DISPATCH_BACK and pomona.id.fsset.isActive(): rc = pomona.intf.messageWindow(_("Installation cannot continue."), - _("The partitioning options you have chosen " - "have already been activated. You can " - "no longer return to the disk editing " - "screen. Would you like to continue " - "with the installation process?"), - type = "yesno") + _("The partitioning options you have chosen " + "have already been activated. You can " + "no longer return to the disk editing " + "screen. Would you like to continue " + "with the installation process?"), + type = "yesno") if rc == 0: sys.exit(0) return DISPATCH_FORWARD @@ -58,17 +58,17 @@ def partitioningComplete(pomona): pomona.id.fsset.add(entry) else: raise RuntimeError, ("Managed to not get an entry back from " - "request.toEntry") + "request.toEntry") if inutil.memAvailable() > isys.EARLY_SWAP_RAM: return rc = pomona.intf.messageWindow(_("Low Memory"), - _("As you don't have much memory in this " - "machine, we need to turn on swap space " - "immediately. To do this we'll have to " - "write your new partition table to the disk " - "immediately. Is that OK?"), "yesno") + _("As you don't have much memory in this " + "machine, we need to turn on swap space " + "immediately. To do this we'll have to " + "write your new partition table to the disk " + "immediately. Is that OK?"), "yesno") if rc: pomona.id.diskset.clearDevices() diff --git a/src/pomona/src/partitions.py b/src/pomona/src/partitions.py index 1aa98550b..e2db28afc 100644 --- a/src/pomona/src/partitions.py +++ b/src/pomona/src/partitions.py @@ -115,11 +115,11 @@ class Partitions: drive = partedUtils.get_partition_drive(part) spec = partRequests.PreexistingPartitionSpec(ptype, - size = size, - start = start, - end = end, - drive = drive, - format = format) + size = size, + start = start, + end = end, + drive = drive, + format = format) spec.device = fsset.PartedPartitionDevice(part).getDevice() # set label if makes sense @@ -302,20 +302,20 @@ class Partitions: accepting a partition will be run on the requests as well. """ checkSizes = [('/usr', 250), ('/tmp', 50), ('/var', 384), - ('/home', 100), ('/boot', 75)] + ('/home', 100), ('/boot', 75)] warnings = [] errors = [] slash = self.getRequestByMountPoint('/') if not slash: errors.append(_("You have not defined a root partition (/), " - "which is required for installation of %s " - "to continue.") % (name,)) + "which is required for installation of %s " + "to continue.") % (name,)) if slash and slash.getActualSize(self, diskset) < 250: warnings.append(_("Your root partition is less than 250 " - "megabytes which is usually too small to " - "install %s.") % (name,)) + "megabytes which is usually too small to " + "install %s.") % (name,)) bootreqs = self.getBootableRequest() or [] # FIXME: missing a check to ensure this is gpt. @@ -331,9 +331,8 @@ class Partitions: if int(num) > 4: print dev, num errors.append(_("Your boot partition isn't on one of " - "the first four partitions and thus " - "won't be bootable.")) - + "the first four partitions and thus " + "won't be bootable.")) for (mount, size) in checkSizes: req = self.getRequestByMountPoint(mount) @@ -341,9 +340,9 @@ class Partitions: continue if req.getActualSize(self, diskset) < size: warnings.append(_("Your %s partition is less than %s " - "megabytes which is lower than recommended " - "for a normal %s install.") - % (mount, size, name)) + "megabytes which is lower than recommended " + "for a normal %s install.") + % (mount, size, name)) foundSwap = 0 swapSize = 0 @@ -375,11 +374,11 @@ class Partitions: if usesUSB: warnings.append(_("Installing on a USB device. This may " - "or may not produce a working system.")) + "or may not produce a working system.")) if usesFireWire: warnings.append(_("Installing on a FireWire device. This may " - "or may not produce a working system.")) + "or may not produce a working system.")) bootreqs = self.getBootableRequest() if bootreqs: @@ -392,15 +391,15 @@ class Partitions: if foundSwap == 0: warnings.append(_("You have not specified a swap partition. " - "Although not strictly required in all cases, " - "it will significantly improve performance for " - "most installations.")) + "Although not strictly required in all cases, " + "it will significantly improve performance for " + "most installations.")) # XXX number of swaps not exported from kernel and could change if foundSwap >= 32: warnings.append(_("You have specified more than 32 swap devices. " - "The kernel for %s only supports 32 " - "swap devices.") % (name,)) + "The kernel for %s only supports 32 " + "swap devices.") % (name,)) mem = inutil.memInstalled() rem = mem % 16384 @@ -410,9 +409,9 @@ class Partitions: if foundSwap and (swapSize < (mem - 8)) and (mem < 1024): warnings.append(_("You have allocated less swap space (%dM) than " - "available RAM (%dM) on your system. This " - "could negatively impact performance.") - % (swapSize, mem)) + "available RAM (%dM) on your system. This " + "could negatively impact performance.") + % (swapSize, mem)) if warnings == []: warnings = None @@ -478,7 +477,7 @@ class Partitions: if request.preexist: drive = partedUtils.get_partition_drive(partition) delete = partRequests.DeleteSpec(drive, partition.geom.start, - partition.geom.end) + partition.geom.end) self.addDelete(delete) def containsImmutablePart(self, part): diff --git a/src/pomona/src/pomona_log.py b/src/pomona/src/pomona_log.py index c6124dc4d..0bf79a713 100644 --- a/src/pomona/src/pomona_log.py +++ b/src/pomona/src/pomona_log.py @@ -72,8 +72,8 @@ class InstallerLog: # Add a simple handler - file or stream, depending on what we're given. def addFileHandler(self, file, addToLogger, minLevel=DEFAULT_LEVEL, - fmtStr="%(asctime)s %(levelname)-8s: %(message)s", - autoSetLevel=True): + fmtStr="%(asctime)s %(levelname)-8s: %(message)s", + autoSetLevel=True): if type (file) == type ("string"): logfileHandler = logging.FileHandler(file) else: @@ -91,7 +91,7 @@ class InstallerLog: # Add a handler for remote syslogs. def addSysLogHandler(self, logger, host, port=SYSLOG_UDP_PORT, - minLevel=DEFAULT_LEVEL): + minLevel=DEFAULT_LEVEL): fmt = logging.Formatter("%(levelname)-8s %(message)s") syslogHandler = SysLogHandler((host, port)) syslogHandler.setLevel(minLevel) diff --git a/src/pomona/src/tui.py b/src/pomona/src/tui.py index 396357c83..9d8b85771 100644 --- a/src/pomona/src/tui.py +++ b/src/pomona/src/tui.py @@ -15,10 +15,10 @@ log = logging.getLogger("pomona") stepToClasses = { "accounts" : ("tui_userauth", "RootPasswordWindow"), "bootloader" : ("tui_bootloader", ("BootloaderChoiceWindow", - "BootloaderAppendWindow", - "BootloaderPasswordWindow")), + "BootloaderAppendWindow", + "BootloaderPasswordWindow")), "bootloaderadvanced" : ("tui_bootloader", ("BootloaderImagesWindow", - "BootloaderLocationWindow")), + "BootloaderLocationWindow")), "complete" : ("tui_complete", "FinishedWindow"), "confirminstall" : ("tui_confirm", "BeginInstallWindow"), "install" : ("tui_progress", "setupForInstall"), @@ -96,8 +96,7 @@ class OkCancelWindow: return self.rc def __init__(self, screen, title, text): - rc = ButtonChoiceWindow(screen, title, text, - buttons=[TEXT_OK_BUTTON, _("Cancel")]) + rc = ButtonChoiceWindow(screen, title, text, buttons=[TEXT_OK_BUTTON, _("Cancel")]) if rc == string.lower(_("Cancel")): self.rc = 1 else: @@ -113,7 +112,7 @@ class ExceptionWindow: def run(self): log.info ("in run, screen = %s" % self.screen) self.rc = ButtonChoiceWindow(self.screen, _("Exception Occurred"), - self.text, self.buttons) + self.text, self.buttons) def getrc(self): return 0 @@ -187,18 +186,18 @@ class InstallInterface: try: found = imputil.imp.find_module(file) loaded = imputil.imp.load_module(classNames[step], - found[0], found[1], - found[2]) + found[0], found[1], + found[2]) nextWindow = loaded.__dict__[classNames[step]] break except ImportError, e: rc = ButtonChoiceWindow(self.screen, _("Error!"), - _("An error occurred when attempting " - "to load an pomona interface " - "component.\n\nclassName = %s\n\n" - "Error: %s") - % (classNames[step],e), - buttons=[_("Exit"), _("Retry")]) + _("An error occurred when attempting " + "to load an pomona interface " + "component.\n\nclassName = %s\n\n" + "Error: %s") + % (classNames[step],e), + buttons=[_("Exit"), _("Retry")]) if rc == string.lower(_("Exit")): sys.exit(0) @@ -224,10 +223,10 @@ class InstallInterface: if step == -1: if not pomona.dispatch.canGoBack(): ButtonChoiceWindow(self.screen, _("Cancelled"), - _("I can't go to the previous step " - "from here. You will have to try " - "again."), - buttons=[_("OK")]) + _("I can't go to the previous step " + "from here. You will have to try " + "again."), + buttons=[_("OK")]) pomona.dispatch.gotoPrev() else: pomona.dispatch.gotoNext() @@ -289,9 +288,9 @@ class InstallInterface: if not f: ButtonChoiceWindow(screen, _("Help not available"), - _("No help is available for this " - "step of the install."), - buttons=[TEXT_OK_BUTTON]) + _("No help is available for this " + "step of the install."), + buttons=[TEXT_OK_BUTTON]) return None lines = f.readlines() @@ -353,10 +352,10 @@ class InstallInterface: return exnWin def messageWindow(self, title, text, type="ok", default = None, - custom_icon=None, custom_buttons=[]): + custom_icon=None, custom_buttons=[]): if type == "ok": ButtonChoiceWindow(self.screen, title, text, - buttons=[TEXT_OK_BUTTON]) + buttons=[TEXT_OK_BUTTON]) elif type == "yesno": if default and default == "no": btnlist = [TEXT_NO_BUTTON, TEXT_YES_BUTTON] @@ -405,7 +404,7 @@ class InstallInterface: rc = None while not buttonToAction.has_key(rc): rc = ButtonChoiceWindow(self.screen, exc.type_string, exc.message, - buttons=buttons) + buttons=buttons) return buttonToAction[rc] diff --git a/src/pomona/src/tui_bootloader.py b/src/pomona/src/tui_bootloader.py index 9049ed338..e3561b2fb 100644 --- a/src/pomona/src/tui_bootloader.py +++ b/src/pomona/src/tui_bootloader.py @@ -37,7 +37,7 @@ class BootloaderChoiceWindow: buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) grid = GridFormHelp(screen, _("Boot Loader Configuration"), - "btloadinstall", 1, 5) + "btloadinstall", 1, 5) grid.add(t, 0, 0, (0,0,0,1)) grid.add(grub, 0, 1, (0,0,0,0)) grid.add(skipbl, 0, 3, (0,0,0,1)) @@ -55,13 +55,13 @@ class BootloaderChoiceWindow: if blradio.getSelection() == "nobl": rc = ButtonChoiceWindow(screen, _("Skip Boot Loader"), _("You have elected not to install " - "any boot loader, which is not recommended " - "unless you have an advanced need. Booting " - "your system into Linux directly from the " - "hard drive almost always requires a boot " - "loader.\n\n" - "Are you sure you want to skip boot loader " - "installation?"), + "any boot loader, which is not recommended " + "unless you have an advanced need. Booting " + "your system into Linux directly from the " + "hard drive almost always requires a boot " + "loader.\n\n" + "Are you sure you want to skip boot loader " + "installation?"), [ (_("Yes"), "yes"), (_("No"), "no") ], width = 50) if rc == "no": continue @@ -84,10 +84,10 @@ class BootloaderAppendWindow: return INSTALL_NOOP t = TextboxReflowed(53, _("A few systems need to pass special options " - "to the kernel at boot time to function " - "properly. If you need to pass boot options to the " - "kernel, enter them now. If you don't need any or " - "aren't sure, leave this blank.")) + "to the kernel at boot time to function " + "properly. If you need to pass boot options to the " + "kernel, enter them now. If you don't need any or " + "aren't sure, leave this blank.")) entry = Entry(48, scroll = 1, returnExit = 1) entry.set(pomona.id.bootloader.args.get()) @@ -115,11 +115,11 @@ class BootloaderAppendWindow: if cb.selected() and not pomona.id.bootloader.forceLBA32: rc = pomona.intf.messageWindow(_("Warning"), - _("If LBA32 is not supported by your system's BIOS, " - "forcing its use can prevent your machine from " - "booting.\n\n" - "Would you like to continue and force LBA32 mode?"), - type = "yesno") + _("If LBA32 is not supported by your system's BIOS, " + "forcing its use can prevent your machine from " + "booting.\n\n" + "Would you like to continue and force LBA32 mode?"), + type = "yesno") if rc != 1: continue @@ -157,10 +157,10 @@ class BootloaderLocationWindow: devices.append(device) (rc, sel) = ListboxChoiceWindow (screen, _("Boot Loader Configuration"), - _("Where do you want to install the boot loader?"), - locations, default = default, - buttons = [ TEXT_OK_BUTTON, TEXT_BACK_BUTTON ], - help = "bootloaderlocation") + _("Where do you want to install the boot loader?"), + locations, default = default, + buttons = [ TEXT_OK_BUTTON, TEXT_BACK_BUTTON ], + help = "bootloaderlocation") if rc == TEXT_BACK_CHECK: return INSTALL_BACK @@ -189,7 +189,7 @@ class BootloaderImagesWindow: newLabel = Entry (20, scroll = 1, returnExit = 1, text = itemLabel) buttons = ButtonBar(screen, [TEXT_OK_BUTTON, (_("Clear"), "clear"), - (_("Cancel"), "cancel")]) + (_("Cancel"), "cancel")]) subgrid = Grid(2, 2) subgrid.setField(devLabel, 0, 0, anchorLeft = 1) @@ -215,14 +215,14 @@ class BootloaderImagesWindow: elif (result == TEXT_OK_CHECK or result == TEXT_F12_CHECK or result == newLabel): if not allowNone and not newLabel.value(): ButtonChoiceWindow(screen, _("Invalid Boot Label"), - _("Boot label may not be empty."), - [ TEXT_OK_BUTTON ]) + _("Boot label may not be empty."), + [ TEXT_OK_BUTTON ]) result = "" elif not self.validBootloaderLabel(newLabel.value()): ButtonChoiceWindow(screen, _("Invalid Boot Label"), - _("Boot label contains " - "illegal characters."), - [ TEXT_OK_BUTTON ]) + _("Boot label contains " + "illegal characters."), + [ TEXT_OK_BUTTON ]) result = "" screen.popWindow() @@ -249,8 +249,8 @@ class BootloaderImagesWindow: images = self.bl.images.getImages() default = self.bl.images.getDefault() - listboxLabel = Label( "%-7s %-25s %-12s" % - ( _("Default"), _("Boot label"), _("Device"))) + listboxLabel = Label("%-7s %-25s %-12s" % + (_("Default"), _("Boot label"), _("Device"))) listbox = Listbox(5, scroll = 1, returnExit = 1) sortedKeys = images.keys() @@ -268,14 +268,13 @@ class BootloaderImagesWindow: buttons = ButtonBar(screen, [ TEXT_OK_BUTTON, (_("Edit"), "edit"), TEXT_BACK_BUTTON ]) - text = TextboxReflowed(55, - _("The boot manager %s uses can boot other " - "operating systems as well. Please tell me " - "what partitions you would like to be able to boot " - "and what label you want to use for each of them.") % (name,)) + text = TextboxReflowed(55, _("The boot manager %s uses can boot other " + "operating systems as well. Please tell me " + "what partitions you would like to be able to boot " + "and what label you want to use for each of them.") % (name,)) g = GridFormHelp(screen, _("Boot Loader Configuration"), - "bootloaderlabels", 1, 4) + "bootloaderlabels", 1, 4) g.add(text, 0, 0, anchorLeft = 1) g.add(listboxLabel, 0, 1, padding = (0, 1, 0, 0), anchorLeft = 1) g.add(listbox, 0, 2, padding = (0, 0, 0, 1), anchorLeft = 1) @@ -332,11 +331,10 @@ class BootloaderImagesWindow: default = "" else: pomona.intf.messageWindow(_("Cannot Delete"), - _("This boot target cannot be " - "deleted because it is for " - "the %s system you are about " - "to install.") %(name,)) - + _("This boot target cannot be " + "deleted because it is for " + "the %s system you are about " + "to install.") %(name,)) screen.popHelpLine() screen.popWindow() @@ -375,11 +373,10 @@ class BootloaderPasswordWindow: buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) - text = TextboxReflowed(55, - _("A boot loader password prevents users from passing arbitrary " - "options to the kernel. For highest security, you " - "should set a password, but a password is not " - "necessary for more casual users.")) + text = TextboxReflowed(55, _("A boot loader password prevents users from passing arbitrary " + "options to the kernel. For highest security, you " + "should set a password, but a password is not " + "necessary for more casual users.")) g = GridFormHelp(screen, _("Boot Loader Configuration"), "grubpasswd", 1, 6) g.add(text, 0, 0, (0,0,0,1), anchorLeft = 1) @@ -428,23 +425,23 @@ class BootloaderPasswordWindow: if pw != confirm: pomona.intf.messageWindow(_("Passwords Do Not Match"), - _("Passwords do not match")) + _("Passwords do not match")) continue if len(pw) < 1: pomona.intf.messageWindow(_("Password Too Short"), - _("Boot loader password is too short")) + _("Boot loader password is too short")) continue if len(pw) < 6: rc = pomona.intf.messageWindow(_("Warning"), - _("Your boot loader password is shorter than " - "six characters. We recommend a longer " - "boot loader password." - "\n\n" - "Would you like to continue with this " - "password?"), - type = "yesno") + _("Your boot loader password is shorter than " + "six characters. We recommend a longer " + "boot loader password." + "\n\n" + "Would you like to continue with this " + "password?"), + type = "yesno") if rc == 0: continue diff --git a/src/pomona/src/tui_complete.py b/src/pomona/src/tui_complete.py index 064b2659b..3532a0e86 100644 --- a/src/pomona/src/tui_complete.py +++ b/src/pomona/src/tui_complete.py @@ -26,15 +26,15 @@ class FinishedWindow: screen.pushHelpLine(string.center(bottomstr, screen.width)) txt = _("Congratulations, your %s installation is " - "complete.\n\n" - "%s%s") %(name, floppystr, bootstr) + "complete.\n\n" + "%s%s") %(name, floppystr, bootstr) foo = _("For information on errata (updates and bug fixes), visit " - "%s.\n\n" - "Information on using your " - "system is available in the %s wiki at " - "%s.") %(bugurl, name, wikiurl,) + "%s.\n\n" + "Information on using your " + "system is available in the %s wiki at " + "%s.") %(bugurl, name, wikiurl,) rc = ButtonChoiceWindow(screen, _("Complete"), txt, - [ _("Reboot") ], help = "finished", width=60) + [ _("Reboot") ], help = "finished", width=60) return INSTALL_OK diff --git a/src/pomona/src/tui_confirm.py b/src/pomona/src/tui_confirm.py index f8ef80cb7..b5c9b30de 100644 --- a/src/pomona/src/tui_confirm.py +++ b/src/pomona/src/tui_confirm.py @@ -19,20 +19,20 @@ from pyfire.translate import _ class BeginInstallWindow: def __call__ (self, screen, pomona): rc = ButtonChoiceWindow(screen, _("Installation to begin"), - _("Now, we got all information we need for " - "installation. If there is something you " - "want change you can still go back. " - "If not choose OK to start."), - buttons = [ _("OK"), _("Back") ], - help = "begininstall") + _("Now, we got all information we need for " + "installation. If there is something you " + "want change you can still go back. " + "If not choose OK to start."), + buttons = [ _("OK"), _("Back") ], + help = "begininstall") if rc == string.lower(_("Back")): return INSTALL_BACK if rc == 0: rc2 = pomona.intf.messageWindow(_("Reboot?"), - _("The system will be rebooted now."), - type="custom", custom_icon="warning", - custom_buttons=[_("_Back"), _("_Reboot")]) + _("The system will be rebooted now."), + type="custom", custom_icon="warning", + custom_buttons=[_("_Back"), _("_Reboot")]) if rc2 == 1: sys.exit(0) else: diff --git a/src/pomona/src/tui_keyboard.py b/src/pomona/src/tui_keyboard.py index 0f8a40fb2..7d46b8b40 100644 --- a/src/pomona/src/tui_keyboard.py +++ b/src/pomona/src/tui_keyboard.py @@ -36,7 +36,7 @@ class KeyboardWindow: (button, choice) = \ ListboxChoiceWindow(screen, _("Keyboard Selection"), - _("Which model keyboard is attached to this computer?"), keyboards, + _("Which model keyboard is attached to this computer?"), keyboards, buttons = [TEXT_OK_BUTTON, TEXT_BACK_BUTTON], width = 30, scroll = 1, height = 8, default = default, help = "kybd") diff --git a/src/pomona/src/tui_partition.py b/src/pomona/src/tui_partition.py index 59ae66071..4290539f3 100644 --- a/src/pomona/src/tui_partition.py +++ b/src/pomona/src/tui_partition.py @@ -116,25 +116,25 @@ class PartitionWindow: if part.type & parted.PARTITION_EXTENDED: if extendedParent: raise RuntimeError, ("can't handle more than" - "one extended partition per disk") + "one extended partition per disk") extendedParent = part.num indent = 2 * " " elif part.type & parted.PARTITION_LOGICAL: if not extendedParent: raise RuntimeError("crossed logical partition " - "before extended") + "before extended") indent = 4 * " " else: indent = 2 * " " if part.type & parted.PARTITION_FREESPACE: self.lb.append(["%s%s" %(indent, _("Free space")), - "%d" %(start), - "%d" %(end), - "%dM" %(size), - "%s" %(ptype), - ""], part, - [LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT]) + "%d" %(start), + "%d" %(end), + "%dM" %(size), + "%s" %(ptype), + ""], part, + [LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT]) else: dev = devify(get_partition_name(part)) @@ -142,12 +142,12 @@ class PartitionWindow: if dev.startswith("/dev/"): dev = dev[5:] self.lb.append(["%s%s" %(indent, dev), - "%d" %(start), - "%d" %(end), - "%dM" %(size), - "%s" %(ptype), - "%s" %(mount)], part, - [LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT]) + "%d" %(start), + "%d" %(end), + "%dM" %(size), + "%s" %(ptype), + "%s" %(mount)], part, + [LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT]) part = disk.next_partition(part) def refresh(self): @@ -174,8 +174,8 @@ class PartitionWindow: log.error("Failed to restore original info") self.intf.messageWindow(_("Error Partitioning"), - _("Could not allocate requested partitions: %s.") - % (msg)) + _("Could not allocate requested partitions: %s.") + % (msg)) rc = -1 except PartitioningWarning, msg: rc = ButtonChoiceWindow(self.screen, _("Warning"), _("Warning: %s") %(msg), @@ -230,8 +230,7 @@ class PartitionWindow: return (mount, mountgrid) # make the list of available filesystems and its label - def makeFsList(self, request, usecallback=1, uselabel=1, usetypes=None, - ignorefs = None): + def makeFsList(self, request, usecallback=1, uselabel=1, usetypes=None, ignorefs = None): subgrid = Grid(1, 2) row = 0 # filesystem type selection @@ -444,11 +443,11 @@ class PartitionWindow: badblocksCB.setFlags(FLAG_DISABLED, flag) poplevel = GridFormHelp(self.screen, _("File System Options"), - "fsoption", 1, 6) + "fsoption", 1, 6) row = 0 poplevel.add(TextboxReflowed(40, _("Please choose how you would " - "like to prepare the file system " - "on this partition.")), 0, 0) + "like to prepare the file system " + "on this partition.")), 0, 0) row = row + 1 subgrid = Grid(2, 5) srow = 0 @@ -459,7 +458,7 @@ class PartitionWindow: badblocksCB = None noformatrb = SingleRadioButton(_("Leave unchanged (preserve data)"), - None, not format and not migrate) + None, not format and not migrate) subgrid.setField(noformatrb, 0, srow, (0,0,0,1),anchorLeft = 1) srow = srow + 1 @@ -493,7 +492,7 @@ class PartitionWindow: migtypes = origrequest.origfstype.getMigratableFSTargets() (migtype, miggrid) = self.makeFsList(origrequest, usecallback = 0, - uselabel = 0, usetypes = migtypes) + uselabel = 0, usetypes = migtypes) if newfstype and newfstype.getName() in migtypes: migtype.setCurrent(newfstype) @@ -629,8 +628,8 @@ class PartitionWindow: popbb = ButtonBar(self.screen, (TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON)) else: popbb = ButtonBar(self.screen, (TEXT_OK_BUTTON, - (_("File System Options"), "fsopts"), - TEXT_CANCEL_BUTTON)) + (_("File System Options"), "fsopts"), + TEXT_CANCEL_BUTTON)) poplevel.add(popbb, 0, row, (0,1,0,0), growx = 1) while 1: @@ -685,7 +684,7 @@ class PartitionWindow: if origrequest.start == None: if invalidInteger(size.value()): self.intf.messageWindow(_("Invalid Entry for Partition Size"), - invalidInteger(size.value())) + invalidInteger(size.value())) continue request.size = int(size.value()) @@ -717,7 +716,7 @@ class PartitionWindow: else: if invalidInteger(start.value()): self.intf.messageWindow(_("Invalid Entry for Starting Cylinder"), - invalidInteger(start.value())) + invalidInteger(start.value())) continue request.start = int(start.value()) @@ -731,7 +730,7 @@ class PartitionWindow: if cyltype == "end": if invalidInteger(end.value()): self.intf.messageWindow(_("Invalid Entry for End Cylinder"), - invalidInteger(end.value())) + invalidInteger(end.value())) continue request.end = int(end.value()) @@ -739,7 +738,7 @@ class PartitionWindow: elif cyltype == "size": if invalidInteger(size.value()): self.intf.messageWindow(_("Invalid Entry for Partition Size"), - invalidInteger(size.value())) + invalidInteger(size.value())) continue request.end = None request.size = int(size.value()) @@ -841,17 +840,17 @@ class PartitionWindow: self.g = GridFormHelp(screen, _("Partitioning"), "partition", 1, 5) self.lb = CListbox(height=10, cols=6, - col_widths=[17,6,6,7,10,12], - scroll=1, returnExit = 1, - width=70, col_pad=2, - col_labels=[_('Device'), _('Start'), _('End'), _('Size'), _('Type'), _('Mount Point')], - col_label_align=[CENTER, CENTER,CENTER,CENTER,CENTER,CENTER]) + col_widths=[17,6,6,7,10,12], + scroll=1, returnExit = 1, + width=70, col_pad=2, + col_labels=[_('Device'), _('Start'), _('End'), _('Size'), _('Type'), _('Mount Point')], + col_label_align=[CENTER, CENTER,CENTER,CENTER,CENTER,CENTER]) self.g.add(self.lb, 0, 1) self.bb = ButtonBar (screen, ((_("New"), "new", "F2"), - (_("Edit"), "edit", "F3"), - (_("Delete"), "delete", "F4"), - TEXT_OK_BUTTON, TEXT_BACK_BUTTON)) + (_("Edit"), "edit", "F3"), + (_("Delete"), "delete", "F4"), + TEXT_OK_BUTTON, TEXT_BACK_BUTTON)) screen.pushHelpLine( _(" F1-Help F2-New F3-Edit F4-Delete F5-Reset F12-OK ")) @@ -884,7 +883,7 @@ class PartitionWindow: else: if not self.partitions.getRequestByMountPoint("/"): self.intf.messageWindow(_("No Root Partition"), - _("Installation requires a / partition.")) + _("Installation requires a / partition.")) continue (errors, warnings) = self.partitions.sanityCheckAllRequests(self.diskset) @@ -926,14 +925,14 @@ class PartitionTypeWindow: g = GridFormHelp(screen, _("Partitioning Type"), "autopart", 1, 6) txt = TextboxReflowed(65, _("Installation requires partitioning " - "of your hard drive. The default " - "layout is reasonable for most " - "users. You can either choose " - "to use this or create your own.")) + "of your hard drive. The default " + "layout is reasonable for most " + "users. You can either choose " + "to use this or create your own.")) g.add(txt, 0, 0, (0, 0, 0, 0)) opts = ((_("Remove all partitions on selected drives and create default layout"), CLEARPART_TYPE_ALL), - (_("Create custom layout"), -1)) + (_("Create custom layout"), -1)) typebox = Listbox(height = len(opts), scroll = 0) for (txt, val) in opts: typebox.append(txt, val) @@ -948,7 +947,7 @@ class PartitionTypeWindow: # list of drives to select which to clear subgrid = Grid(1, 2) subgrid.setField(TextboxReflowed(55, _("Which drive(s) do you want to " - "use for this installation?")), 0, 0) + "use for this installation?")), 0, 0) drivelist = CheckboxTree(height=2, scroll=1) subgrid.setField(drivelist, 0, 1) g.add(subgrid, 0, 2, (0, 1, 0, 0)) @@ -1030,8 +1029,8 @@ class PartitionTypeWindow: if partmethod_ans != -1: reviewLayout = pomona.intf.messageWindow(_("Review Partition Layout"), - _("Review and modify partitioning layout?"), - type = "yesno") + _("Review and modify partitioning layout?"), + type = "yesno") if reviewLayout != 1: pomona.dispatch.skipStep("partition", skip = 1) diff --git a/src/pomona/src/tui_partmethod.py b/src/pomona/src/tui_partmethod.py index b1aadd818..99397a7d2 100644 --- a/src/pomona/src/tui_partmethod.py +++ b/src/pomona/src/tui_partmethod.py @@ -22,10 +22,10 @@ from autopart import PARTMETHOD_TYPE_DESCR_TEXT class PartitionMethod: def __call__(self, screen, partitions, instclass): rc = ButtonChoiceWindow(screen, _("Disk Partitioning Setup"), - _(PARTMETHOD_TYPE_DESCR_TEXT), - [ (_("Autopartition"), "auto"), - (_("Disk Druid"), "ds"), TEXT_BACK_BUTTON ], - width = 50, help = "parttool") + _(PARTMETHOD_TYPE_DESCR_TEXT), + [ (_("Autopartition"), "auto"), + (_("Disk Druid"), "ds"), TEXT_BACK_BUTTON ], + width = 50, help = "parttool") if rc == TEXT_BACK_CHECK: return INSTALL_BACK diff --git a/src/pomona/src/tui_source.py b/src/pomona/src/tui_source.py index 8eb5695e1..27223b27a 100644 --- a/src/pomona/src/tui_source.py +++ b/src/pomona/src/tui_source.py @@ -22,15 +22,15 @@ class SourceTypeWindow: g = GridFormHelp(screen, _("Source Type"), "source", 1, 6) txt = TextboxReflowed(65, _("In installation you have to choose " - "a source for the installation files. " - "Mostly you will choose the disc here, " - "but you are also able to install by " - "HTTP, FTP hard disk or usb-key.")) + "a source for the installation files. " + "Mostly you will choose the disc here, " + "but you are also able to install by " + "HTTP, FTP hard disk or usb-key.")) g.add(txt, 0, 0, (0, 0, 0, 0)) options = ((_("Install Disc"), SOURCE_CDROM), - (_("Internet Source"), SOURCE_URL), - (_("External Drive"), SOURCE_HD)) + (_("Internet Source"), SOURCE_URL), + (_("External Drive"), SOURCE_HD)) typebox = Listbox(height = len(options), scroll = 0) for (txt, val) in options: @@ -57,10 +57,10 @@ class SourceTypeWindow: if source_type == SOURCE_CDROM: if not isys.cdromList(): ButtonChoiceWindow(screen, _("No CDROM found"), - _("You choosed to install from an installtion disc, " - "but there was no cdrom drive found on the system. " - "Please choose another installation method."), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("You choosed to install from an installtion disc, " + "but there was no cdrom drive found on the system. " + "Please choose another installation method."), + buttons = [ TEXT_OK_BUTTON ], width = 50) continue from image import CdromInstallMethod @@ -84,9 +84,9 @@ class SourceTypeWindow: toplevel = GridFormHelp(screen, _("Source URL"), "sourceurl", 1, 3) toplevel.add(TextboxReflowed(37, _("Enter a host you get the files from." - "You also must enter a path where the " - "installer finds the files in.")) - , 0, 0, (0, 0, 0, 1)) + "You also must enter a path where the " + "installer finds the files in.")) + , 0, 0, (0, 0, 0, 1)) host = Entry(24, text = URL_HOST) path = Entry(24, text = URL_PATH) @@ -113,13 +113,13 @@ class SourceTypeWindow: if url.scheme not in ("http", "ftp"): ButtonChoiceWindow(screen, _("Wrong Protocol"), - _("You entered a protocol that is not supported by Pomona. " - "There are only http:// and ftp:// available."), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("You entered a protocol that is not supported by Pomona. " + "There are only http:// and ftp:// available."), + buttons = [ TEXT_OK_BUTTON ], width = 50) elif not url.path.endswith("/"): ButtonChoiceWindow(screen, _("Syntax Error"), - _("The path of the URL must end with a /."), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("The path of the URL must end with a /."), + buttons = [ TEXT_OK_BUTTON ], width = 50) else: from urlinstall import urlretrieve testurl = urljoin(urlunparse(url), INFO_FILE) @@ -127,8 +127,8 @@ class SourceTypeWindow: urlretrieve(testurl, "/tmp/" + INFO_FILE) except IOError, e: ButtonChoiceWindow(screen, _("Error"), - _("When we tested your given URL there was an error.\n\n%s" % (e,)), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("When we tested your given URL there was an error.\n\n%s" % (e,)), + buttons = [ TEXT_OK_BUTTON ], width = 50) continue break diff --git a/src/pomona/src/tui_userauth.py b/src/pomona/src/tui_userauth.py index c7c8b4904..1c794d7b1 100644 --- a/src/pomona/src/tui_userauth.py +++ b/src/pomona/src/tui_userauth.py @@ -27,11 +27,11 @@ class RootPasswordWindow: toplevel = GridFormHelp(screen, _("Root Password"), "rootpw", 1, 3) toplevel.add(TextboxReflowed(37, _("Pick a root password. You must " - "type it twice to ensure you know " - "it and do not make a typing mistake. " - "Remember that the " - "root password is a critical part " - "of system security!")), 0, 0, (0, 0, 0, 1)) + "type it twice to ensure you know " + "it and do not make a typing mistake. " + "Remember that the root password is" + "a critical part of system " + "security!")), 0, 0, (0, 0, 0, 1)) entry1 = Entry(24, password = 1, text = pomona.id.rootPassword["password"]) entry2 = Entry(24, password = 1, text = pomona.id.rootPassword["password"]) @@ -55,17 +55,17 @@ class RootPasswordWindow: if len(entry1.value ()) < 6: ButtonChoiceWindow(screen, _("Password Length"), - _("The root password must be at least 6 characters long."), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("The root password must be at least 6 characters long."), + buttons = [ TEXT_OK_BUTTON ], width = 50) elif entry1.value() != entry2.value(): ButtonChoiceWindow(screen, _("Password Mismatch"), - _("The passwords you entered were different. Please try again."), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("The passwords you entered were different. Please try again."), + buttons = [ TEXT_OK_BUTTON ], width = 50) elif has_bad_chars(entry1.value()): ButtonChoiceWindow(screen, _("Error with Password"), - _("Requested password contains non-ASCII characters, " - "which are not allowed."), - buttons = [ TEXT_OK_BUTTON ], width = 50) + _("Requested password contains non-ASCII characters, " + "which are not allowed."), + buttons = [ TEXT_OK_BUTTON ], width = 50) else: break diff --git a/src/pomona/src/urlinstall.py b/src/pomona/src/urlinstall.py index d6ef6f865..c665159f9 100644 --- a/src/pomona/src/urlinstall.py +++ b/src/pomona/src/urlinstall.py @@ -65,7 +65,7 @@ def urlretrieve(location, file, callback=None): if callback is not None: callback.callback(CB_START, title=_("Downloading"), text=_("Retrieving %s") - % os.path.basename(urlparse.urlparse(location).path)) + % os.path.basename(urlparse.urlparse(location).path)) # if they dont want a status callback just do it in one big swoop if callback is None: @@ -90,11 +90,11 @@ def urlretrieve(location, file, callback=None): class UrlInstallMethod(InstallMethod): def badPackageError(self, pkgname): return _("The file %s cannot be opened. This is due to a missing " - "file or perhaps a corrupt package. Please verify your " - "mirror contains all required packages, and try using a " - "different one.\n\n" - "If you reboot, your system will be left in an inconsistent " - "state that will likely require reinstallation.\n\n") % pkgname + "file or perhaps a corrupt package. Please verify your " + "mirror contains all required packages, and try using a " + "different one.\n\n" + "If you reboot, your system will be left in an inconsistent " + "state that will likely require reinstallation.\n\n") % pkgname def getFilename(self, filename, callback=None, destdir=None, retry=1): if destdir is None: @@ -112,7 +112,7 @@ class UrlInstallMethod(InstallMethod): rc=urlretrieve(fullPath, file, callback=callback) except IOError, (errnum, msg): log.critical("IOError %s occurred getting %s: %s" - % (errnum, fullPath.replace("%", "%%"), str(msg))) + % (errnum, fullPath.replace("%", "%%"), str(msg))) if not retry: raise FileCopyException @@ -178,11 +178,11 @@ class UrlInstallMethod(InstallMethod): except Exception, e: log.error("exception in unmountCD: %s" %(e,)) self.messageWindow(_("Error"), - _("An error occurred unmounting the disc. " - "Please make sure you're not accessing " - "%s from the shell on tty2 " - "and then click OK to retry.") - % ("/mnt/source",)) + _("An error occurred unmounting the disc. " + "Please make sure you're not accessing " + "%s from the shell on tty2 " + "and then click OK to retry.") + % ("/mnt/source",)) def filesDone(self): for file in REQUIRED_FILES: