|
|
|
@ -70,13 +70,20 @@ class RsyncProgressBar:
|
|
|
|
|
maximum = 1
|
|
|
|
|
copyStarting = False
|
|
|
|
|
|
|
|
|
|
def __init__(self, title, secondtitle, rsyncstr, parent,maximum=1):
|
|
|
|
|
def __init__(self, title, secondtitle, rsyncstr, parent,maximum=1,
|
|
|
|
|
rsyncver="3.0.9"):
|
|
|
|
|
self.title = title
|
|
|
|
|
self.secondtitle = secondtitle
|
|
|
|
|
self.maximum = maximum
|
|
|
|
|
self.rsyncstr = rsyncstr
|
|
|
|
|
self.parent = parent
|
|
|
|
|
self.value = 0
|
|
|
|
|
if cmpVersion(rsyncver, "3.1.0") >= 0:
|
|
|
|
|
self.extraopts = " --msgs2stderr"
|
|
|
|
|
self.use_stderr = True
|
|
|
|
|
else:
|
|
|
|
|
self.extraopts = ""
|
|
|
|
|
self.use_stderr = False
|
|
|
|
|
|
|
|
|
|
def getFilesNum(self):
|
|
|
|
|
"""
|
|
|
|
@ -105,11 +112,15 @@ class RsyncProgressBar:
|
|
|
|
|
"""
|
|
|
|
|
Run rsync without progressbar
|
|
|
|
|
"""
|
|
|
|
|
self.pipe = subprocess.Popen(self.rsyncstr, stdin=subprocess.PIPE,
|
|
|
|
|
self.pipe = subprocess.Popen(self.rsyncstr+self.extraopts,
|
|
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
|
close_fds=True, shell=True)
|
|
|
|
|
while True:
|
|
|
|
|
if self.use_stderr:
|
|
|
|
|
s = self.pipe.stderr.readline()
|
|
|
|
|
else:
|
|
|
|
|
s = self.pipe.stdout.readline()
|
|
|
|
|
if len(s) == 0:
|
|
|
|
|
break
|
|
|
|
@ -122,12 +133,16 @@ class RsyncProgressBar:
|
|
|
|
|
Run rsync with progressbar
|
|
|
|
|
"""
|
|
|
|
|
self.parent.startTask(self.title,progress=True)
|
|
|
|
|
self.pipe = subprocess.Popen(self.rsyncstr, stdin=subprocess.PIPE,
|
|
|
|
|
self.pipe = subprocess.Popen(self.rsyncstr+self.extraopts,
|
|
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
|
close_fds=True, shell=True)
|
|
|
|
|
oldpercent = 0
|
|
|
|
|
while True:
|
|
|
|
|
if self.use_stderr:
|
|
|
|
|
s = self.pipe.stderr.readline()
|
|
|
|
|
else:
|
|
|
|
|
s = self.pipe.stdout.readline()
|
|
|
|
|
if len(s) == 0:
|
|
|
|
|
break
|
|
|
|
@ -338,12 +353,12 @@ class Client(commandServer, encrypt, Desktop):
|
|
|
|
|
rsync = RsyncProgressBar(\
|
|
|
|
|
_("Fetching the file list from %s") % host,
|
|
|
|
|
_("Fetching the user profile from %s") % host,
|
|
|
|
|
execStr,self)
|
|
|
|
|
execStr,self, rsyncver=self.clVars.Get('cl_rsync_ver'))
|
|
|
|
|
else:
|
|
|
|
|
rsync = RsyncProgressBar(\
|
|
|
|
|
_("Sending the file list to %s") % host,
|
|
|
|
|
_("Uploading the user profile to %s") % host,
|
|
|
|
|
execStr,self)
|
|
|
|
|
execStr,self, rsyncver=self.clVars.Get('cl_rsync_ver'))
|
|
|
|
|
pathConfig = os.path.join(remoteProfile,
|
|
|
|
|
self.pathConfig)
|
|
|
|
|
# remove old ini file
|
|
|
|
|