main
Vadim vtroshchinskiy 2024-11-29 14:32:28 +01:00
parent d832e93497
commit 6997dfeeb6
2 changed files with 12 additions and 9 deletions

View File

@ -43,6 +43,7 @@ from disk import *
from ntfs import * from ntfs import *
import re import re
import uuid import uuid
from tqdm import tqdm
class OgProgressPrinter(git.RemoteProgress): class OgProgressPrinter(git.RemoteProgress):
""" """
@ -68,18 +69,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)

View File

@ -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