Skip to content

Commit a09c185

Browse files
committed
Better handling of missing urwid install
1 parent 7cccfbf commit a09c185

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
- Add possibility to specify optional requirements for components. This is useful for combination with the exclude
66
feature.
77

8-
## Fixed
8+
### Fixed
99
- Having requires or depends defined as empty list does not cause an exception anymore.
10+
- Program will exit with correct exit code on missing urwid installation after showing the error output.
1011

1112
## [2.1.0] - 23.02.2019
1213

hyperion/lib/util/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ExitStatus(Enum):
1616
ENVIRONMENT_FILE_MISSING = 9
1717
MISSING_SSH_CONFIG = 10
1818
CONFIG_RESET_FAILED = 11
19+
MISSING_URWID_INSTALL = 12
1920

2021

2122
class CheckState(Enum):

hyperion/runner.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ def main():
243243

244244
start_gui(ui)
245245
else:
246-
logger.error('To use this feature you need PyQt4! Check the README.md for install instructions')
247246
cc.cleanup(False, config.ExitStatus.MISSING_PYQT_INSTALL)
247+
logger.error('To use this feature you need PyQt4! Check the README.md for install instructions')
248248
else:
249249
# Urwid
250250
if interactive_enabled:
@@ -257,7 +257,10 @@ def main():
257257

258258
cc.cleanup(interactiveCLI.main(cc, log_file_path))
259259
else:
260-
logger.error('To use this feature you need urwid! Check the README.md for install instructions')
260+
cc.cleanup(False, config.ExitStatus.MISSING_URWID_INSTALL)
261+
logger.error('To use this feature you need urwid! Check the README.md for install instructions. If you'
262+
' already ran the installation try adding site-packages of your installation prefix to'
263+
' your PYTHONPATH environment variable.')
261264

262265
if args.cmd == 'edit':
263266
logger.debug('Launching editor mode')
@@ -311,13 +314,13 @@ def main():
311314
logger.debug('Chose show log of %s' % args.component)
312315
if len(comps) > 1:
313316
logger.warning('The show log option only supports a single component as argument. Only the first is'
314-
'used!')
317+
' used!')
315318
cc.show_comp_log(comps[0])
316319
if args.comp_term:
317320
logger.debug('Chose show term of %s' % args.component)
318321
if len(comps) > 1:
319-
logger.warning('The show term option only supports a single component as argument. Only the first '
320-
'is used!')
322+
logger.warning('The show term option only supports a single component as argument. Only the first'
323+
' is used!')
321324
cc.start_clone_session_and_attach(comps[0])
322325
cc.cleanup()
323326

@@ -339,7 +342,8 @@ def main():
339342
draw_graph(cc, unmet)
340343
else:
341344
logger.error('This feature requires graphviz. To use it install hyperion with the GRAPH option '
342-
"(pip install -e .['GRAPH'])")
345+
"(pip install -e .['GRAPH']). If you already ran the installation try adding site-packages"
346+
" of your installation prefix to your PYTHONPATH environment variable.")
343347
else:
344348
try:
345349
cc.set_dependencies()

0 commit comments

Comments
 (0)