mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use find_msvcrt() to load the CRT instead of globbing
This commit is contained in:
parent
96e743c5b1
commit
0ba86c31f4
@ -274,6 +274,12 @@ def test_openssl():
|
||||
raise ValueError('Mozilla CA certs not loaded')
|
||||
fprint('SSL OK!')
|
||||
|
||||
def test_crt():
|
||||
from ctypes.util import find_msvcrt
|
||||
if not find_msvcrt():
|
||||
raise SystemExit('find_msvcrt() failed')
|
||||
fprint('CRT OK!')
|
||||
|
||||
def test():
|
||||
if iswindows:
|
||||
test_dlls()
|
||||
@ -305,6 +311,7 @@ def test():
|
||||
test_wpd()
|
||||
test_winutil()
|
||||
test_file_dialog_helper()
|
||||
test_crt()
|
||||
else:
|
||||
test_terminal()
|
||||
if isosx:
|
||||
|
@ -158,9 +158,9 @@ def crt():
|
||||
# We use the C runtime bundled with the calibre windows build
|
||||
global _crt
|
||||
if _crt is None:
|
||||
import glob, ctypes
|
||||
d = os.path.join(os.path.dirname(sys.executable), '*.CRT', 'msvcr*.dll')
|
||||
_crt = ctypes.CDLL(glob.glob(d)[0])
|
||||
import ctypes
|
||||
from ctypes.util import find_msvcrt
|
||||
_crt = ctypes.CDLL(find_msvcrt())
|
||||
return _crt
|
||||
|
||||
class ColoredStream(Detect):
|
||||
|
Loading…
x
Reference in New Issue
Block a user