Use tqdm
parent
a7f5a87539
commit
02d283b645
|
|
@ -40,6 +40,7 @@ import posix1e
|
||||||
import blkid
|
import blkid
|
||||||
from filesystem import *
|
from filesystem import *
|
||||||
from ntfs import *
|
from ntfs import *
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
class OgProgressPrinter(git.RemoteProgress):
|
class OgProgressPrinter(git.RemoteProgress):
|
||||||
"""
|
"""
|
||||||
|
|
@ -65,18 +66,18 @@ class OgProgressPrinter(git.RemoteProgress):
|
||||||
def __init__(self, parentLogger):
|
def __init__(self, parentLogger):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.logger = parentLogger
|
self.logger = parentLogger
|
||||||
self.prev_len = 0
|
|
||||||
|
|
||||||
print("\n", file=sys.stderr)
|
if sys.stdin.isatty():
|
||||||
|
self.progress = tqdm()
|
||||||
|
|
||||||
def update(self, op_code, cur_count, max_count=None, message=""):
|
def update(self, op_code, cur_count, max_count=None, message=""):
|
||||||
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
|
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
|
||||||
|
|
||||||
status_string = "Progress: %s %s/%s: %s" % (op_code, cur_count, max_count, message)
|
if self.progress:
|
||||||
padded_string = status_string.rjust(self.prev_len, " ")
|
self.progress.total = max_count
|
||||||
self.prev_len = len(status_string)
|
self.progress.n = cur_count
|
||||||
|
self.progress.desc = message
|
||||||
print(f"\r{padded_string}", file=sys.stderr, end="")
|
self.progress.refresh()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
print("\n", file=sys.stderr)
|
print("\n", file=sys.stderr)
|
||||||
|
|
@ -1572,4 +1573,4 @@ if __name__ == '__main__':
|
||||||
#
|
#
|
||||||
|
|
||||||
# Make sure all filesystem changes are written, just in case the oglive is rebooted without an unmount
|
# Make sure all filesystem changes are written, just in case the oglive is rebooted without an unmount
|
||||||
os.sync()
|
os.sync()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
gitdb==4.0.11
|
gitdb==4.0.11
|
||||||
GitPython==3.1.43
|
GitPython==3.1.43
|
||||||
libarchive==0.4.7
|
|
||||||
libarchive-c==5.1
|
libarchive-c==5.1
|
||||||
nose==1.3.7
|
nose==1.3.7
|
||||||
|
pathlib==1.0.1
|
||||||
|
pkg_resources==0.0.0
|
||||||
pylibacl==0.7.0
|
pylibacl==0.7.0
|
||||||
pylibblkid==0.3
|
pylibblkid==0.3
|
||||||
pyxattr==0.8.1
|
pyxattr==0.8.1
|
||||||
smmap==5.0.1
|
smmap==5.0.1
|
||||||
|
tqdm==4.66.5
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue