From 0591cd1fe34f84ff510c737554acf9e47a939c62 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 27 Nov 2019 00:10:51 +0100 Subject: menuconfig: Reuse _IS_WINDOWS for curses import error check No need to check both os.name and sys.platform. --- menuconfig.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index 8ae0cc8..2360541 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -185,12 +185,15 @@ See the https://github.com/zephyrproject-rtos/windows-curses repository. """ from __future__ import print_function +import os import sys +_IS_WINDOWS = os.name == "nt" # Are we running on Windows? + try: import curses except ImportError as e: - if sys.platform != "win32": + if not _IS_WINDOWS: raise sys.exit("""\ menuconfig failed to import the standard Python 'curses' library. Try @@ -209,7 +212,6 @@ Exception: import errno import locale -import os import re import textwrap @@ -3278,8 +3280,5 @@ def _change_c_lc_ctype_to_utf8(): return -# Are we running on Windows? -_IS_WINDOWS = os.name == "nt" - if __name__ == "__main__": _main() -- cgit v1.2.3