diff options
author | Matt Wilson <msw@redhat.com> | 2001-06-23 03:24:08 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2001-06-23 03:24:08 +0000 |
commit | 48153651a7519d0654b8c9685907a203464bc684 (patch) | |
tree | 76ad6e78b0c26fb668a7cd27e972c46ce0f91ab4 | |
parent | 7a3c395db8ac3e0db05acabd610758a555195556 (diff) | |
download | anaconda-48153651a7519d0654b8c9685907a203464bc684.tar.gz anaconda-48153651a7519d0654b8c9685907a203464bc684.tar.xz anaconda-48153651a7519d0654b8c9685907a203464bc684.zip |
more pychecker fixups
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | autopart.py | 6 | ||||
-rw-r--r-- | bootloader.py | 35 | ||||
-rw-r--r-- | comps.py | 8 | ||||
-rw-r--r-- | constants.py | 18 | ||||
-rw-r--r-- | desktop.py | 3 | ||||
-rw-r--r-- | dispatch.py | 5 | ||||
-rw-r--r-- | floppy.py | 8 | ||||
-rw-r--r-- | fsset.py | 5 | ||||
-rwxr-xr-x | gui.py | 42 | ||||
-rw-r--r-- | installclass.py | 4 | ||||
-rw-r--r-- | iw/bootdisk_gui.py | 4 | ||||
-rw-r--r-- | iw/progress_gui.py | 10 | ||||
-rw-r--r-- | lilo.py | 3 | ||||
-rw-r--r-- | monitor.py | 1 | ||||
-rw-r--r-- | packages.py | 59 | ||||
-rw-r--r-- | partitioning.py | 26 | ||||
-rw-r--r-- | textw/bootdisk_text.py | 4 | ||||
-rw-r--r-- | textw/progress_text.py | 6 | ||||
-rw-r--r-- | upgrade.py | 2 |
20 files changed, 121 insertions, 133 deletions
@@ -112,4 +112,7 @@ create-archive: make SNAPRELEASE=$(RELEASE) create-snapshot pycheck: - PYTHONPATH=edd:isys:balkan:textw:iw:installclasses pychecker *.py textw/*.py iw/*.py | grep -v "__init__() not called" + @for I in *.py textw/*.py iw/*.py; do \ + PYTHONPATH=.:edd:isys:balkan:textw:iw:installclasses:gnome-map pychecker $$I | grep -v "__init__() not called"; \ + done + diff --git a/autopart.py b/autopart.py index a33658a05..ec23d89b4 100644 --- a/autopart.py +++ b/autopart.py @@ -17,7 +17,7 @@ import parted import math import fsset from partitioning import * -from dispatch import DISPATCH_NOOP +from constants import * from translate import _, N_ PARTITION_FAIL = -1 @@ -130,7 +130,7 @@ def fitConstrained(diskset, requests, primOnly=0): raise PartitioningError, ("requested FileSystemType needs " "a flag that is not available.") newp.set_flag(flag, 1) - request.device = PartedPartitionDevice(newp).getDevice() + request.device = fsset.PartedPartitionDevice(newp).getDevice() request.currentDrive = request.drive[0] return PARTITION_SUCCESS @@ -222,7 +222,7 @@ def fitSized(diskset, requests, primOnly = 0): "a flag that is not available.") newp.set_flag(flag, 1) - request.device = PartedPartitionDevice(newp).getDevice() + request.device = fsset.PartedPartitionDevice(newp).getDevice() drive = newp.geom.disk.dev.path[5:] request.currentDrive = drive diff --git a/bootloader.py b/bootloader.py index 6952b600e..2149de62b 100644 --- a/bootloader.py +++ b/bootloader.py @@ -26,6 +26,41 @@ from log import log initrdsMade = {} +## if 0: +## if arch == "sparc": +## errors = self.silo.install (self.fstab, instPath, +## id.hdList, upgrade) +## elif arch == "i386": +## defaultlang = self.language.getLangNickByName(self.language.getDefault()) +## langlist = expandLangs(defaultlang) +## errors = self.lilo.install (self.fstab, instPath, +## id.hdList, upgrade, langlist) +## elif arch == "ia64": +## errors = self.eli.install (self.fstab, instPath, +## id.hdList, upgrade) +## elif arch == "alpha": +## errors = self.milo.write () +## else: +## raise RuntimeError, "What kind of machine is this, anyway?!" + +## if errors: +## w.pop() +## mess = _("An error occured while installing " +## "the bootloader.\n\n" +## "We HIGHLY recommend you make a recovery " +## "boot floppy when prompted, otherwise you " +## "may not be able to reboot into Red Hat Linux." +## "\n\nThe error reported was:\n\n") + errors +## intf.messageWindow(_("Bootloader Errors"), mess) + +## # make sure bootdisk window appears +## if iutil.getArch () == "i386": +## self.instClass.removeFromSkipList('bootdisk') +## self.bootdisk = 1 + +## w = apply(apply, createWindow) + + class KernelArguments: def get(self): @@ -19,11 +19,9 @@ import os from string import * import types import urllib -from translate import _ -from translate import N_ +from translate import _, N_ from log import log import time -import string ExcludePackages = { 'XFree86-3DLabs' : None, 'XFree86-8514' : None, 'XFree86-AGX' : None, 'XFree86-I128' : None, @@ -669,7 +667,7 @@ class ComponentSet: # install is ok. conflicts = 1 if reqversion: - fields = string.split(reqversion, '-') + fields = split(reqversion, '-') if (len (fields) == 2): needed = ("", fields [0], fields [1]) else: @@ -726,7 +724,7 @@ class ComponentSet: # nick is used to generate the lilo name for (ktag, nick) in [ ('kernel-enterprise', 'nick'), ('kernel-smp', 'smp') ]: - tag = string.split(ktag, '-')[1] + tag = split(ktag, '-')[1] if (self.packages.has_key(ktag) and self.packages[ktag].selected): version = (self.packages[ktag][rpm.RPMTAG_VERSION] + "-" + diff --git a/constants.py b/constants.py new file mode 100644 index 000000000..9746ebb84 --- /dev/null +++ b/constants.py @@ -0,0 +1,18 @@ +# +# constants.py: anaconda constants +# +# Erik Troan <ewt@redhat.com> +# +# Copyright 2001 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +DISPATCH_BACK = -1 +DISPATCH_FORWARD = 1 +DISPATCH_NOOP = None diff --git a/desktop.py b/desktop.py index fd2c8666c..fb5734ee6 100644 --- a/desktop.py +++ b/desktop.py @@ -14,9 +14,6 @@ # import string -import kudzu -import iutil -import isys from log import log class Desktop: diff --git a/dispatch.py b/dispatch.py index 98129c1bc..8688deebf 100644 --- a/dispatch.py +++ b/dispatch.py @@ -13,12 +13,9 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -DISPATCH_BACK = -1 -DISPATCH_FORWARD = 1 -DISPATCH_NOOP = None - import string from types import * +from constants import * from packages import readPackages, checkDependencies, doInstall from packages import handleX11Packages, writeConfiguration, writeXConfiguration from packages import writeKSConfiguration, turnOnFilesystems @@ -18,8 +18,8 @@ import errno import iutil import re import os -import dispatch import rpm +from constants import * from log import log from flags import flags from translate import _ @@ -85,7 +85,7 @@ def probeFloppyDevice(): def makeBootdisk (intf, floppyDevice, hdList, instPath): if flags.test: - return dispatch.DISPATCH_NOOP + return DISPATCH_NOOP # this is faster then waiting on mkbootdisk to fail device = floppyDevice @@ -94,7 +94,7 @@ def makeBootdisk (intf, floppyDevice, hdList, instPath): try: fd = os.open(file, os.O_RDONLY) except: - return dispatch.DISPATCH_BACK + return DISPATCH_BACK os.close(fd) kernel = hdList['kernel'] @@ -113,5 +113,5 @@ def makeBootdisk (intf, floppyDevice, hdList, instPath): w.pop() if rc: - return dispatch.DISPATCH_BACK + return DISPATCH_BACK @@ -20,6 +20,7 @@ import os import parted import sys import struct +import partitioning from log import log from translate import _, N_ @@ -61,7 +62,6 @@ class LabelFactory: def createLabel(self, mountpoint): if self.labels == None: - import partitioning self.labels = {} diskset = partitioning.DiskSet() @@ -855,8 +855,6 @@ class LoopbackDevice(Device): # XXX fix RAID def readFstab (path): - import partitioning - fsset = FileSystemSet() # first, we look at all the disks on the systems and get any ext2/3 @@ -1062,7 +1060,6 @@ def ext2FormatFilesystem(argList, messageFile, windowCreator, mntpoint): return 1 if __name__ == "__main__": - import sys log.open("foo") fsset = readFstab("fstab") @@ -18,20 +18,21 @@ os.environ["PYGTK_FATAL_EXCEPTIONS"] = "1" os.environ["GNOME_DISABLE_CRASH_DIALOG"] = "1" # msw says this is a good idea os.environ["LC_ALL"] = "C" -from gtk import * -from _gtk import gtk_set_locale -from _gtk import gtk_rc_init -from _gtk import gtk_rc_reparse_all -from _gtk import _gtk_nuke_rc_files -from _gtk import _gtk_nuke_rc_mtimes + import GDK import GdkImlib -from splashscreen import splashScreenPop - -import time import iutil +import string +import isys +import sys +from translate import cat, _ +from gnome.ui import * +from gnome.xmhtml import * +from gtk import * +from _gtk import gtk_set_locale, gtk_rc_init, gtk_rc_reparse_all +from _gtk import _gtk_nuke_rc_files, _gtk_nuke_rc_mtimes from language import expandLangs - +from splashscreen import splashScreenPop from log import log StayOnScreen = "stayOnScreen" @@ -75,16 +76,6 @@ if iutil.getArch() == 'sparc': else: stepToClass["bootloader"] = ( "lilo_gui", "LiloWindow" ) - -from translate import cat, _ -from gnome.ui import * -from gnome.xmhtml import * - -import string -import isys -import sys -import rpm - # setup globals def processEvents(): @@ -192,7 +183,6 @@ class ExceptionWindow: # I did it this way for future expantion # 0 is debug if self.rc == 0: - import isys try: # switch to VC1 so we can debug isys.vtActivate (1) @@ -276,9 +266,8 @@ class InstallInterface: def dumpWindow(self): window = MessageWindow("Save Crash Dump", - _("Please insert a floppy now. All " - "contents of the disk " - "will be erased, so please " + _("Please insert a floppy now. All contents " + "of the disk will be erased, so please " "choose your diskette carefully."), "okcancel") rc = window.getrc() @@ -287,9 +276,6 @@ class InstallInterface: def getBootdisk (self): return None - def getCongratulation (self): - return CongratulationWindow - def run(self, id, dispatch): from xkb import XKB kb = XKB() @@ -490,6 +476,7 @@ class InstallControlWindow: return self.prevClicked() (file, className) = stepToClass[step] + newScreenClass = None s = "from %s import %s; newScreenClass = %s" % (file, className, className) exec s @@ -576,7 +563,6 @@ class InstallControlWindow: if ((event.keyval == GDK.KP_Delete or event.keyval == GDK.Delete) and (event.state & (GDK.CONTROL_MASK | GDK.MOD1_MASK))): mainquit () - import os os._exit (0) def buildStockButtons(self): diff --git a/installclass.py b/installclass.py index 6cbc0a8eb..5df8b1acd 100644 --- a/installclass.py +++ b/installclass.py @@ -335,8 +335,7 @@ class BaseInstallClass: else: id.desktop.setDefaultRunLevel(3) - import xf86config - xcfg = xf86config.XF86Config(id.videocard, id.monitor, id.mouse) + xcfg = XF86Config(id.videocard, id.monitor, id.mouse) available = xcfg.availableModes() @@ -436,7 +435,6 @@ def availableClasses(showHidden=0): done[mainName] = 1 obj = None - name = None cmd = "import %s\nif %s.__dict__.has_key('InstallClass'): obj = %s.InstallClass\n" % (mainName, mainName, mainName) exec(cmd) diff --git a/iw/bootdisk_gui.py b/iw/bootdisk_gui.py index 9318f8b60..abac1a25d 100644 --- a/iw/bootdisk_gui.py +++ b/iw/bootdisk_gui.py @@ -1,8 +1,8 @@ +import iutil from iw_gui import * from gtk import * from translate import _, N_ -import iutil -import dispatch +from dispatch import * class BootdiskWindow (InstallWindow): diff --git a/iw/progress_gui.py b/iw/progress_gui.py index 7fa786894..cf367cfd6 100644 --- a/iw/progress_gui.py +++ b/iw/progress_gui.py @@ -1,13 +1,13 @@ -from gtk import * -from iw_gui import * import string import rpm import os import gui -from translate import _, N_ import sys +from gtk import * +from iw_gui import * +from translate import _, N_ from packages import doInstall -import dispatch +from constants import * class InstallProgressWindow (InstallWindow): @@ -138,7 +138,7 @@ class InstallProgressWindow (InstallWindow): self.intf = intf - if dir == dispatch.DISPATCH_BACK: + if dir == DISPATCH_BACK: intf.icw.prevClicked() return @@ -1,8 +1,5 @@ import string import os -import isys -import iutil -import rpm def needsEnterpriseKernel(): rc = 0 diff --git a/monitor.py b/monitor.py index 69a95b5fb..0943a775e 100644 --- a/monitor.py +++ b/monitor.py @@ -16,7 +16,6 @@ import string import kudzu import iutil -import isys from translate import _ from log import log diff --git a/packages.py b/packages.py index 94d8a8008..7e1db8944 100644 --- a/packages.py +++ b/packages.py @@ -13,7 +13,6 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -from translate import _ import iutil import isys import rpm @@ -22,13 +21,14 @@ import timer import sys import string import pcmcia -import dispatch import fsset from log import log from flags import flags +from constants import * +from translate import _ def queryUpgradeContinue(intf, dir): - if dir == dispatch.DISPATCH_FORWARD: + if dir == DISPATCH_FORWARD: return rc = intf.messageWindow(_("Proceed with upgrade?"), @@ -100,7 +100,7 @@ def readPackages(intf, method, id): def handleX11Packages(dir, intf, disp, id, instPath): - if dir == dispatch.DISPATCH_BACK: + if dir == DISPATCH_BACK: return # skip X setup if it is not being installed @@ -134,7 +134,7 @@ def handleX11Packages(dir, intf, disp, id, instPath): def checkDependencies(dir, intf, disp, id, instPath): - if dir == dispatch.DISPATCH_BACK: + if dir == DISPATCH_BACK: return win = intf.waitWindow(_("Dependency Check"), @@ -291,7 +291,7 @@ class rpmErrorClass: self.f = f def turnOnFilesystems(dir, thefsset, diskset, upgrade, instPath): - if dir == dispatch.DISPATCH_BACK: + if dir == DISPATCH_BACK: thefsset.umountFilesystems(instPath) return @@ -382,7 +382,7 @@ def doInstall(method, id, intf, instPath): if method.systemMounted (id.fsset, instPath, id.hdList.selected()): id.fsset.umountFilesystems(instPath) - return dispatch.DISPATCH_BACK + return DISPATCH_BACK for i in ( '/var', '/var/lib', '/var/lib/rpm', '/tmp', '/dev', '/etc', '/etc/sysconfig', '/etc/sysconfig/network-scripts', @@ -526,7 +526,7 @@ def doInstall(method, id, intf, instPath): method.systemUnmounted () rpm.errorSetCallback (oldError) - return dispatch.DISPATCH_BACK + return DISPATCH_BACK # This should close the RPM database so that you can # do RPM ops in the chroot in a %post ks script @@ -658,46 +658,9 @@ def doInstall(method, id, intf, instPath): # needed for prior systems which were not xinetd based migrateXinetd(instPath, instLogName) - if flags.setupFilesystems: - errors = None - - if 0: - if arch == "sparc": - errors = self.silo.install (self.fstab, instPath, - id.hdList, upgrade) - elif arch == "i386": - defaultlang = self.language.getLangNickByName(self.language.getDefault()) - langlist = expandLangs(defaultlang) - errors = self.lilo.install (self.fstab, instPath, - id.hdList, upgrade, langlist) - elif arch == "ia64": - errors = self.eli.install (self.fstab, instPath, - id.hdList, upgrade) - elif arch == "alpha": - errors = self.milo.write () - else: - raise RuntimeError, "What kind of machine is this, anyway?!" - - if errors: - w.pop() - mess = _("An error occured while installing " - "the bootloader.\n\n" - "We HIGHLY recommend you make a recovery " - "boot floppy when prompted, otherwise you " - "may not be able to reboot into Red Hat Linux." - "\n\nThe error reported was:\n\n") + errors - self.intf.messageWindow(_("Bootloader Errors"), mess) - - # make sure bootdisk window appears - if iutil.getArch () == "i386": - self.instClass.removeFromSkipList('bootdisk') - self.bootdisk = 1 - - w = apply(apply, createWindow) - - - w.set(5) + w.set(5) + if flags.setupFilesystems: # go ahead and depmod modules as modprobe in rc.sysinit # will complain loaduly if we don't do it now. depmodModules(id.comps, instPath) @@ -711,8 +674,6 @@ def doInstall(method, id, intf, instPath): if flags.setupFilesystems: f = open("/tmp/cleanup", "w") method.writeCleanupPath(f) - # XXX - #self.fstab.writeCleanupPath(f) f.close() w.set(8) diff --git a/partitioning.py b/partitioning.py index 7734a23b5..cc4cdb44f 100644 --- a/partitioning.py +++ b/partitioning.py @@ -22,9 +22,10 @@ import isys import parted import math import raid - -from fsset import * +import fsset +import os from translate import _ +from log import log # different types of partition requests # REQUEST_PREEXIST is a placeholder for a pre-existing partition on the system @@ -92,14 +93,14 @@ def get_partition_name(partition): def get_partition_file_system_type(part): if part.fs_type.name == "linux-swap": - ptype = fileSystemTypeGet("swap") + ptype = fsset.fileSystemTypeGet("swap") elif part.fs_type.name == "FAT": - ptype = fileSystemTypeGet("vfat") + ptype = fsset.fileSystemTypeGet("vfat") else: try: - ptype = fileSystemTypeGet(part.fs_type.name) + ptype = fsset.fileSystemTypeGet(part.fs_type.name) except: - ptype = fileSystemTypeGet("foreign") + ptype = fsset.fileSystemTypeGet("foreign") return ptype @@ -451,10 +452,11 @@ class PartitionSpec: # turn a partition request into a fsset entry def toEntry(self): if self.type == REQUEST_RAID: - device = RAIDDevice(int(self.raidlevel[-1:]), self.raidmembers, - spares = self.raidspares) + device = fsset.RAIDDevice(int(self.raidlevel[-1:]), + self.raidmembers, + spares = self.raidspares) else: - device = PartitionDevice(self.device) + device = fsset.PartitionDevice(self.device) # pin down our partitions so that we can reread the table device.solidify() @@ -464,7 +466,7 @@ class PartitionSpec: else: mountpoint = self.mountpoint - entry = FileSystemSetEntry(device, mountpoint, self.fstype) + entry = fsset.FileSystemSetEntry(device, mountpoint, self.fstype) if self.format: entry.setFormat(self.format) return entry @@ -515,7 +517,7 @@ class PartitionRequests: spec = PartitionSpec(ptype, requesttype = REQUEST_PREEXIST, start = start, end = end, size = size, drive = drive, format = format) - spec.device = PartedPartitionDevice(part).getDevice() + spec.device = fsset.PartedPartitionDevice(part).getDevice() self.addRequest(spec) part = disk.next_partition(part) @@ -617,7 +619,7 @@ class DiskSet: return labels - def findExistingRootPartitions(self): + def findExistingRootPartitions(self, intf): rootparts = [] drives = self.disks.keys() diff --git a/textw/bootdisk_text.py b/textw/bootdisk_text.py index 02ef4c8d9..4e078300d 100644 --- a/textw/bootdisk_text.py +++ b/textw/bootdisk_text.py @@ -2,7 +2,7 @@ import iutil from translate import _ from snack import * from constants_text import * -import dispatch +from constants import * class BootDiskWindow: def __call__(self, screen, dir, disp): @@ -61,7 +61,7 @@ class MakeBootDiskWindow: buttons = [ _("OK"), _("Skip") ] - if dir == dispatch.DISPATCH_FORWARD: + if dir == DISPATCH_FORWARD: rc = ButtonChoiceWindow (screen, _("Bootdisk"), _("If you have the install floppy in your drive, first " "remove it. Then insert a blank floppy in the first " diff --git a/textw/progress_text.py b/textw/progress_text.py index 705b7ea62..76f6481cd 100644 --- a/textw/progress_text.py +++ b/textw/progress_text.py @@ -1,8 +1,8 @@ +import rpm +from constants import * from snack import * from constants_text import * from translate import _ -import rpm -import dispatch class InstallProgressWindow: def completePackage(self, header, timer): @@ -146,7 +146,7 @@ class InstallProgressWindow: class setupForInstall: def __call__(self, screen, dir, intf, id): - if dir == dispatch.DISPATCH_BACK: + if dir == DISPATCH_BACK: id.setInstallProgressClass(None) return INSTALL_BACK else: diff --git a/upgrade.py b/upgrade.py index 72e17074e..622ab426c 100644 --- a/upgrade.py +++ b/upgrade.py @@ -36,7 +36,7 @@ def findExistingRoots (intf, id, chroot): win = intf.waitWindow (_("Searching"), _("Searching for Red Hat Linux installations...")) - rootparts = diskset.findExistingRootPartitions() + rootparts = diskset.findExistingRootPartitions(intf) win.pop () return rootparts |