X-Git-Url: https://code.grnet.gr/git/snf-image-creator/blobdiff_plain/fb2d189cae88acfcb5fffe62a7490248d578769e..9ca717c4a13b35a686416c42c62b0aa03d01f64c:/image_creator/rsync.py diff --git a/image_creator/rsync.py b/image_creator/rsync.py index 5d1d5c1..833d0be 100644 --- a/image_creator/rsync.py +++ b/image_creator/rsync.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# # Copyright 2012 GRNET S.A. All rights reserved. # # Redistribution and use in source and binary forms, with or @@ -31,6 +33,8 @@ # interpreted as representing official policies, either expressed # or implied, of GRNET S.A. +"""This module provides an interface for the rsync utility""" + import subprocess import time import signal @@ -98,7 +102,7 @@ class Rsync: stdout=subprocess.PIPE, bufsize=0) try: total = 0 - for line in iter(dry_run.stdout.readline, b''): + for _ in iter(dry_run.stdout.readline, b''): total += 1 finally: dry_run.communicate() @@ -107,14 +111,13 @@ class Rsync: self._out.success("%d" % total) - progress = self._out.Progress(total, "Copying %s files to %s" % - (slabel, dlabel)) + progress = self._out.Progress(total, "Copying files to %s" % dlabel) run = subprocess.Popen(cmd + [src, dest], shell=False, stdout=subprocess.PIPE, bufsize=0) try: t = time.time() i = 0 - for line in iter(run.stdout.readline, b''): + for _ in iter(run.stdout.readline, b''): i += 1 current = time.time() if current - t > 0.1: