diff options
author | Mike Fulbright <msf@redhat.com> | 1999-11-12 21:25:12 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 1999-11-12 21:25:12 +0000 |
commit | 3230f88eef53294ac71019f620c998e98b62af77 (patch) | |
tree | 117cce52e97506ff48d9b95aa4fd4489b6805e93 /text.py | |
parent | 6789ee5933034d6a38d68ac6cb474feb3010738b (diff) | |
download | anaconda-3230f88eef53294ac71019f620c998e98b62af77.tar.gz anaconda-3230f88eef53294ac71019f620c998e98b62af77.tar.xz anaconda-3230f88eef53294ac71019f620c998e98b62af77.zip |
Added makerelname() and findtz() functions. There are used in the
TimezoneWindow class to read in the available timezones from
/usr/share/zoneinfo if required. For use when run in anaconda mode.
Dr Mike
Diffstat (limited to 'text.py')
-rw-r--r-- | text.py | 58 |
1 files changed, 53 insertions, 5 deletions
@@ -788,18 +788,66 @@ class WaitWindow: g.draw() self.screen.refresh() + +# +# do these belong here or should they be made nested functions in +# the TimeZoneWindow below, or perhaps put in a utility module? +# +def makerelname(relpath, filename): + if relpath != '': + return relpath+'/'+filename + else: + return filename + + +def findtz(basepath, relpath): + tzdata = [] + for n in os.listdir(basepath+'/'+relpath): + timezone = makerelname(relpath, n) + if relpath != '': + timezone = relpath+'/'+n + else: + timezone = n + + filestat = os.lstat(basepath+'/'+timezone) + [filemode] = filestat[:1] + + if (not (stat.S_ISLNK(filemode) or + stat.S_ISREG(filemode) or + stat.S_ISDIR(filemode))): + continue + elif n[:1] >= 'A' and n[:1] <= 'Z': + if stat.S_ISDIR(filemode): + tmptzdata = findtz(basepath, timezone) + else: + tmptzdata = [timezone] + + for m in tmptzdata: + if tzdata == []: + tzdata = [m] + else: + tzdata.append(m) + + return tzdata + + class TimezoneWindow: def getTimezoneList(self, test): - if test and not os.access("/usr/lib/timezones.gz", os.R_OK): - cmd = "./gettzlist" - stdin = None + if not os.access("/usr/lib/timezones.gz", os.R_OK): + if test: + cmd = "./gettzlist" + stdin = None + else: + zoneList = findtz('/usr/share/zoneinfo', '') + cmd = "" else: cmd = "/usr/bin/gunzip" stdin = os.open("/usr/lib/timezones.gz", 0) - zones = iutil.execWithCapture(cmd, [ cmd ], stdin = stdin) - zoneList = string.split(zones) + if cmd != "": + zones = iutil.execWithCapture(cmd, [ cmd ], stdin = stdin) + zoneList = string.split(zones) if (stdin != None): os.close(stdin) |