summaryrefslogtreecommitdiff
path: root/menuconfig.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-11-27 00:10:51 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2019-11-27 01:41:53 +0100
commit0591cd1fe34f84ff510c737554acf9e47a939c62 (patch)
tree4a19c9b3c722e9c701aeadad5995af2f8268752e /menuconfig.py
parent7020b86d437c149ed3582454daeb3aeca1429364 (diff)
menuconfig: Reuse _IS_WINDOWS for curses import error check
No need to check both os.name and sys.platform.
Diffstat (limited to 'menuconfig.py')
-rwxr-xr-xmenuconfig.py9
1 files 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()