aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/rich/_windows.py
diff options
context:
space:
mode:
Diffstat (limited to 'libs/rich/_windows.py')
-rw-r--r--libs/rich/_windows.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/rich/_windows.py b/libs/rich/_windows.py
index d252d1f9e..b1b30b65e 100644
--- a/libs/rich/_windows.py
+++ b/libs/rich/_windows.py
@@ -1,5 +1,4 @@
import sys
-
from dataclasses import dataclass
@@ -15,10 +14,13 @@ class WindowsConsoleFeatures:
try:
import ctypes
- from ctypes import wintypes
- from ctypes import LibraryLoader
+ from ctypes import LibraryLoader, wintypes
- windll = LibraryLoader(ctypes.WinDLL) # type: ignore
+ if sys.platform == "win32":
+ windll = LibraryLoader(ctypes.WinDLL)
+ else:
+ windll = None
+ raise ImportError("Not windows")
except (AttributeError, ImportError, ValueError):
# Fallback if we can't load the Windows DLL
@@ -26,7 +28,6 @@ except (AttributeError, ImportError, ValueError):
features = WindowsConsoleFeatures()
return features
-
else:
STDOUT = -11
@@ -53,7 +54,7 @@ else:
vt = bool(result and console_mode.value & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
truecolor = False
if vt:
- win_version = sys.getwindowsversion() # type: ignore
+ win_version = sys.getwindowsversion()
truecolor = win_version.major > 10 or (
win_version.major == 10 and win_version.build >= 15063
)