fixed padding
This commit is contained in:
9
Bakefile
9
Bakefile
@@ -3,6 +3,7 @@ build() {
|
||||
. useve-runner
|
||||
useve syncbin
|
||||
python3 -m hatchling build
|
||||
cp qgpg/__init__.py dist/qgpg.py
|
||||
echo "copy dist/ to six9.net/py/qgpg/"
|
||||
}
|
||||
|
||||
@@ -11,18 +12,18 @@ install_useve() {
|
||||
set -e
|
||||
. useve-runner
|
||||
py-format .
|
||||
useve up qgpg
|
||||
|
||||
useve qgpg
|
||||
pip install ./
|
||||
}
|
||||
|
||||
test_encrypt() {
|
||||
cd ~/tmp/
|
||||
. useve-runner
|
||||
useve qgpg
|
||||
rm -fr key2* datadir
|
||||
rm -fr key2* datadir sha1sum.txt
|
||||
GPGPASS=secret @ qgpg --key key2 k
|
||||
@ mkdir -p datadir/folder{1,2}
|
||||
@ dd if=/dev/random of=datadir/testfile bs=1024 count=102400
|
||||
@ dd if=/dev/random of=datadir/testfile bs=3024 count=102400
|
||||
for i in {1..10}; do
|
||||
dd if=/dev/random of=datadir/folder1/${i}testfile bs=1024 count=10240 &> /dev/null
|
||||
dd if=/dev/random of=datadir/folder2/${i}testfile bs=1024 count=10240 &> /dev/null
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
__version__ = "1.0"
|
||||
|
||||
import argparse
|
||||
@@ -8,7 +10,10 @@ import tempfile
|
||||
import time
|
||||
from getpass import getpass
|
||||
|
||||
import gnupg
|
||||
try:
|
||||
import gnupg
|
||||
except Exception:
|
||||
raise ImportError("You need to install python package python-gnupg")
|
||||
|
||||
chunk_size = 1024 * 1024 * 1 # = 1 Mb
|
||||
|
||||
@@ -73,11 +78,10 @@ class MiniProgress:
|
||||
def finish(self):
|
||||
if time.time() < self.started + self.update_frequency:
|
||||
return
|
||||
completed = 100
|
||||
elapsed = time.time() - self.started
|
||||
full_pad = self.bar_width
|
||||
full_pad = self.bar_width + 1
|
||||
s = (
|
||||
f"\r{completed: 3d}%"
|
||||
"\r100%"
|
||||
+ ("[ ]" if self.bar_wide else "")
|
||||
+ full_pad * self.progress_chars[-1]
|
||||
+ self._human_eta(elapsed)
|
||||
@@ -263,6 +267,7 @@ class Processor:
|
||||
return
|
||||
|
||||
file_size = os.path.getsize(in_file)
|
||||
if not self.opts.no_progress:
|
||||
self.gpg.on_data = Collector(out_file, self.opts.width, int(file_size / self.gpg.buffer_size))
|
||||
try:
|
||||
with open(in_file, "rb") as fp:
|
||||
@@ -281,3 +286,7 @@ class Processor:
|
||||
|
||||
def main():
|
||||
Processor()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user