From 72e3d20a14f0f82a5909da74a3d6a0c20aac185d Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 5 Oct 2019 22:19:21 +0200 Subject: menuconfig: Give hint when 'curses' can't be imported on Windows Tell people to install something like windows-curses. Might help avoid some trouble after commit 21b4c1e ("Do not automatically install windows-curses on Windows"). --- menuconfig.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index 58175c3..552b537 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -182,12 +182,32 @@ See the https://github.com/zephyrproject-rtos/windows-curses repository. """ from __future__ import print_function -import curses +import sys + +try: + import curses +except ImportError as e: + if sys.platform != "win32": + raise + sys.exit("""\ +menuconfig failed to import the standard Python 'curses' library. Try +installing a package like windows-curses +(https://github.com/zephyrproject-rtos/windows-curses) by running this command +in cmd.exe: + + pip install windows-curses + +Starting with Kconfiglib 13.0.0, windows-curses is no longer automatically +installed when installing Kconfiglib via pip on Windows (because it breaks +installation on MSYS2). + +Exception: +{}: {}""".format(type(e).__name__, e)) + import errno import locale import os import re -import sys import textwrap from kconfiglib import Symbol, Choice, MENU, COMMENT, MenuNode, \ -- cgit v1.2.3