|
|
|
@ -97,12 +97,12 @@ class cpProcessProgress(processProgress):
|
|
|
|
|
return 100
|
|
|
|
|
|
|
|
|
|
def processString(self, strdata):
|
|
|
|
|
if strdata.startswith("cp:") or strdata.startswith("/bin/cp:"):
|
|
|
|
|
self._cachedata.append(strdata.partition(": ")[2])
|
|
|
|
|
if "->" in strdata:
|
|
|
|
|
if strdata.startswith(b"cp:") or strdata.startswith(b"/bin/cp:"):
|
|
|
|
|
self._cachedata.append(strdata.partition(b": ")[2])
|
|
|
|
|
if b"->" in strdata:
|
|
|
|
|
self.value += 1
|
|
|
|
|
if self.maxfiles:
|
|
|
|
|
percent = 100 * self.value / self.maxfiles
|
|
|
|
|
percent = 100 * self.value // self.maxfiles
|
|
|
|
|
percent = min(percent, 99)
|
|
|
|
|
if percent > self.percent:
|
|
|
|
|
self.percent = percent
|
|
|
|
@ -116,7 +116,7 @@ def progressCopyFile(source, dest):
|
|
|
|
|
Copy file with progress
|
|
|
|
|
"""
|
|
|
|
|
size = int(os.lstat(source).st_size)
|
|
|
|
|
bufsize = (100 - (size % 100) + size) / 100
|
|
|
|
|
bufsize = (100 - (size % 100) + size) // 100
|
|
|
|
|
with open(source, 'rb') as infile:
|
|
|
|
|
with open(dest, 'w') as outfile:
|
|
|
|
|
for i in range(1, 101):
|
|
|
|
@ -388,9 +388,9 @@ class Distributive():
|
|
|
|
|
if byfile:
|
|
|
|
|
percFiles = [x for x in listDirectory(fromdir) if byfile(x)]
|
|
|
|
|
if len(percFiles) > 1:
|
|
|
|
|
maxPercOnFile = 100 / len(percFiles)
|
|
|
|
|
maxPercOnFile = 100 // len(percFiles)
|
|
|
|
|
recountPerc = \
|
|
|
|
|
lambda perc, num: perc / len(
|
|
|
|
|
lambda perc, num: perc // len(
|
|
|
|
|
percFiles) + maxPercOnFile * num
|
|
|
|
|
else:
|
|
|
|
|
recountPerc = lambda perc, num: perc
|
|
|
|
|