diff options
author | Erik Troan <ewt@redhat.com> | 2000-05-11 16:42:17 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2000-05-11 16:42:17 +0000 |
commit | 9131cb25bb5395bac0fc21faad8284a123189a50 (patch) | |
tree | c7fed6236f678ca80bd5881796e9449858f6edeb /iutil.py | |
parent | 47f54085b2611e2e5bebfa070183c63f62096e2a (diff) | |
download | anaconda-9131cb25bb5395bac0fc21faad8284a123189a50.tar.gz anaconda-9131cb25bb5395bac0fc21faad8284a123189a50.tar.xz anaconda-9131cb25bb5395bac0fc21faad8284a123189a50.zip |
copyFile() allows progress window
Diffstat (limited to 'iutil.py')
-rw-r--r-- | iutil.py | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,5 +1,6 @@ import types, os, sys, isys, select, string, stat, signal +import os.path def getArch (): arch = os.uname ()[4] @@ -128,18 +129,30 @@ def execWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0): return rc -def copyFile(source, to): +def copyFile(source, to, pw = None): f = os.open(source, os.O_RDONLY) t = os.open(to, os.O_RDWR | os.O_TRUNC | os.O_CREAT) + if pw: + (fn, title, text) = pw + total = os.path.getsize(source) + win = fn(title, text, total) + count = os.read(f, 262144) + total = 0 while (count): os.write(t, count) + total = total + len(count) + if pw: + win.set(total) count = os.read(f, 16384) os.close(f) os.close(t) + if pw: + win.pop() + def memInstalled(): f = open("/proc/meminfo", "r") mem = f.readlines()[1] |