aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/compat
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/compat')
-rw-r--r--yt_dlp/compat/__init__.py16
-rw-r--r--yt_dlp/compat/_legacy.py7
2 files changed, 7 insertions, 16 deletions
diff --git a/yt_dlp/compat/__init__.py b/yt_dlp/compat/__init__.py
index a0cd62110..c02e843d4 100644
--- a/yt_dlp/compat/__init__.py
+++ b/yt_dlp/compat/__init__.py
@@ -1,6 +1,4 @@
-import contextlib
import os
-import subprocess
import sys
import warnings
import xml.etree.ElementTree as etree
@@ -74,17 +72,3 @@ if compat_os_name in ('nt', 'ce'):
return userhome + path[i:]
else:
compat_expanduser = os.path.expanduser
-
-
-WINDOWS_VT_MODE = False if compat_os_name == 'nt' else None
-
-
-def windows_enable_vt_mode(): # TODO: Do this the proper way https://bugs.python.org/issue30075
- if compat_os_name != 'nt':
- return
- global WINDOWS_VT_MODE
- startupinfo = subprocess.STARTUPINFO()
- startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- with contextlib.suppress(Exception):
- subprocess.Popen('', shell=True, startupinfo=startupinfo).wait()
- WINDOWS_VT_MODE = True
diff --git a/yt_dlp/compat/_legacy.py b/yt_dlp/compat/_legacy.py
index ce24760e5..c4d95e1fb 100644
--- a/yt_dlp/compat/_legacy.py
+++ b/yt_dlp/compat/_legacy.py
@@ -55,3 +55,10 @@ compat_xml_parse_error = etree.ParseError
compat_xpath = lambda xpath: xpath
compat_zip = zip
workaround_optparse_bug9161 = lambda: None
+
+
+def __getattr__(name):
+ if name in ('WINDOWS_VT_MODE', 'windows_enable_vt_mode'):
+ from .. import utils
+ return getattr(utils, name)
+ raise AttributeError(name)