1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-21 05:58:52 +02:00

reworked meter.py based on discussion

* new function create_text_meter with fallback selection
* NoPBTextMeter.start() will print the basename (if not stated otherise with
  basename = None)
* The callers that should use an alternare TextMeter class now call create_text_meter()
* The callers that should not use and alternate TextMeter (because of different handling,
  like build.py) call create_text_meter(use_pb_fallback=False)
* the warning 'Please install the progressbar module' is now only shown once

improvements
This commit is contained in:
lethliel
2019-01-14 12:03:16 +01:00
parent e608200414
commit 93d15fc83b
5 changed files with 35 additions and 23 deletions

View File

@@ -33,7 +33,7 @@ except ImportError:
from .conf import config, cookiejar
from .meter import TextMeter
from .meter import create_text_meter
change_personality = {
'i686': 'linux32',
@@ -305,10 +305,9 @@ def get_preinstall_image(apiurl, arch, cache_dir, img_info):
print('packagecachedir is not writable for you?', file=sys.stderr)
print(e, file=sys.stderr)
sys.exit(1)
if sys.stdout.isatty() and TextMeter:
progress_obj = TextMeter()
else:
progress_obj = None
progress_obj = None
if sys.stdout.isatty():
progress_obj = create_text_meter(use_pb_fallback=False)
gr = OscFileGrabber(progress_obj=progress_obj)
try:
gr.urlgrab(url, filename=ifile_path_part, text='fetching image')