mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
platform-specific imports
This commit is contained in:
parent
c9820fae99
commit
d2f4450dc0
4 changed files with 10 additions and 11 deletions
|
|
@ -128,7 +128,7 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
|
|||
if not isWin:
|
||||
return
|
||||
# pylint: disable=import-error
|
||||
import win32api, win32file
|
||||
import win32api, win32file # pytype: disable=import-error
|
||||
try:
|
||||
name = win32file.GetVolumeNameForVolumeMountPoint(self._dir[:3])
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ class MPVTimeoutError(MPVError):
|
|||
from anki.utils import isWin
|
||||
if isWin:
|
||||
# pylint: disable=import-error
|
||||
import win32file, win32pipe, pywintypes, winerror
|
||||
|
||||
import win32file, win32pipe, pywintypes, winerror # pytype: disable=import-error
|
||||
class MPVBase:
|
||||
"""Base class for communication with the mpv media player via unix socket
|
||||
based JSON IPC.
|
||||
|
|
|
|||
|
|
@ -66,13 +66,13 @@ processingChain = [
|
|||
|
||||
# don't show box on windows
|
||||
if sys.platform == "win32":
|
||||
si = subprocess.STARTUPINFO()
|
||||
si = subprocess.STARTUPINFO() # pytype: disable=module-attr
|
||||
try:
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr
|
||||
except:
|
||||
# pylint: disable=no-member
|
||||
# python2.7+
|
||||
si.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
|
||||
si.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr
|
||||
else:
|
||||
si = None
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ def cleanupMPV():
|
|||
# which prevents renaming or deleting the profile
|
||||
def cleanupOldMplayerProcesses():
|
||||
# pylint: disable=import-error
|
||||
import psutil
|
||||
import psutil # pytype: disable=import-error
|
||||
|
||||
exeDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
|
||||
|
|
|
|||
|
|
@ -334,12 +334,12 @@ def call(argv, wait=True, **kwargs):
|
|||
"Execute a command. If WAIT, return exit code."
|
||||
# ensure we don't open a separate window for forking process on windows
|
||||
if isWin:
|
||||
si = subprocess.STARTUPINFO()
|
||||
si = subprocess.STARTUPINFO() # pytype: disable=module-attr
|
||||
try:
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr
|
||||
except:
|
||||
# pylint: disable=no-member
|
||||
si.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
|
||||
si.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr
|
||||
else:
|
||||
si = None
|
||||
# run
|
||||
|
|
@ -396,7 +396,7 @@ def platDesc():
|
|||
elif isWin:
|
||||
theos = "win:%s" % (platform.win32_ver()[0])
|
||||
elif system == "Linux":
|
||||
import distro
|
||||
import distro # pytype: disable=import-error
|
||||
r = distro.linux_distribution(full_distribution_name=False)
|
||||
theos = "lin:%s:%s" % (r[0], r[1])
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue