Skip to content

Commit

Permalink
dell-bto-autobuilder: make python3-progressbar optional
Browse files Browse the repository at this point in the history
  • Loading branch information
medicalwei authored and CragW committed Aug 1, 2023
1 parent 81b46b1 commit 4b2b87d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions bto-autobuilder/dell-bto-autobuilder
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ from Dell.recovery_common import DBUS_BUS_NAME, DBUS_INTERFACE_NAME, \
dbus_sync_call_signal_wrapper
import dbus.mainloop.glib

progressbar = None
try:
import progressbar
except ImportError:
print('Error: python3-progressbar is not installed', file=sys.stderr)
sys.exit(1)
print('python3-progressbar is not installed. ' \
'Progress bar will not be displayed.', file=sys.stderr)

class FidTag:
''' Convenience class that cleans up how the Dell FID
Expand Down Expand Up @@ -90,15 +91,18 @@ class Install:
def __init__(self):
self.old_state = 'starting progress tracking'
self.state = None
self.progress = progressbar.ProgressBar()
self.progress.start()
self.progress = None
if progressbar is not None:
self.progress = progressbar.ProgressBar()
self.progress.start()

def update_percent(self, state, num):
self._print_once(state)
if num < 100:
self.progress.update(num)
else:
self.progress.finish()
if self.progress is not None:
if num < 100:
self.progress.update(num)
else:
self.progress.finish()

def update_plain(self, state):
self._print_once(state)
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ Recommends: cd-boot-images-amd64,
mokutil,
mdadm (>> 4.1~rc1-2),
parted,
python3-progressbar,
usb-creator-gtk,
wodim,
xorriso,
Enhances: oem-config-gtk, ubiquity-frontend-gtk
Suggests: grub-pc
Suggests: grub-pc,
python3-progressbar,
Description: Dell Recovery Media Creation Package
This package is used to produce a Dell recovery media image.
It then uses known open source tools to write the image to
Expand Down

0 comments on commit 4b2b87d

Please sign in to comment.