mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 00:12:25 -04:00
run latex commands without bundled libs
https://anki.tenderapp.com/discussions/ankidesktop/30531-latex-wont-generate-svgs-automatically-but-will-generate-pngs
This commit is contained in:
parent
b4f4e65c55
commit
a4edc57dc5
2 changed files with 11 additions and 10 deletions
|
@ -18,6 +18,7 @@ from hashlib import sha1
|
|||
import platform
|
||||
import traceback
|
||||
import json
|
||||
from contextlib import contextmanager
|
||||
|
||||
from anki.lang import _, ngettext
|
||||
|
||||
|
@ -314,6 +315,13 @@ def namedtmp(name, rm=True):
|
|||
# Cmd invocation
|
||||
##############################################################################
|
||||
|
||||
@contextmanager
|
||||
def noBundledLibs():
|
||||
oldlpath = os.environ.pop("LD_LIBRARY_PATH", None)
|
||||
yield
|
||||
if oldlpath is not None:
|
||||
os.environ["LD_LIBRARY_PATH"] = oldlpath
|
||||
|
||||
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
|
||||
|
@ -327,6 +335,7 @@ def call(argv, wait=True, **kwargs):
|
|||
si = None
|
||||
# run
|
||||
try:
|
||||
with noBundledLibs():
|
||||
o = subprocess.Popen(argv, startupinfo=si, **kwargs)
|
||||
except OSError:
|
||||
# command not found
|
||||
|
|
10
aqt/utils.py
10
aqt/utils.py
|
@ -6,15 +6,7 @@ from aqt.qt import *
|
|||
import re, os, sys, urllib.request, urllib.parse, urllib.error, subprocess
|
||||
import aqt
|
||||
from anki.sound import stripSounds
|
||||
from anki.utils import isWin, isMac, invalidFilename
|
||||
from contextlib import contextmanager
|
||||
|
||||
@contextmanager
|
||||
def noBundledLibs():
|
||||
oldlpath = os.environ.pop("LD_LIBRARY_PATH", None)
|
||||
yield
|
||||
if oldlpath is not None:
|
||||
os.environ["LD_LIBRARY_PATH"] = oldlpath
|
||||
from anki.utils import isWin, isMac, invalidFilename, noBundledLibs
|
||||
|
||||
def openHelp(section):
|
||||
link = aqt.appHelpSite
|
||||
|
|
Loading…
Reference in a new issue