faster startup on windows by asking for ffmpeg.exe explicitly

rather than just "ffmpeg" which makes windows try to open each of
ffmpeg.BAT,CMD,COM,EXE,JS,JSE,MSC,VBE,VBS,WSF,WSH one by one
(ffmpeg.js? hello??)
This commit is contained in:
ed 2023-09-13 23:32:19 +00:00
parent 23ca00bba8
commit 91cafc2511
3 changed files with 22 additions and 2 deletions

View file

@ -8,7 +8,7 @@ import shutil
import subprocess as sp
import sys
from .__init__ import EXE, PY2, WINDOWS, E, unicode
from .__init__ import ANYWIN, EXE, PY2, WINDOWS, E, unicode
from .bos import bos
from .util import (
FFMPEG_URL,
@ -29,6 +29,9 @@ if True: # pylint: disable=using-constant-test
def have_ff(scmd: str) -> bool:
if ANYWIN:
scmd += ".exe"
if PY2:
print("# checking {}".format(scmd))
acmd = (scmd + " -version").encode("ascii").split(b" ")

View file

@ -298,11 +298,19 @@ REKOBO_KEY = {
REKOBO_LKEY = {k.lower(): v for k, v in REKOBO_KEY.items()}
_exestr = "python3 python ffmpeg ffprobe cfssl cfssljson cfssl-certinfo"
CMD_EXEB = set(_exestr.encode("utf-8").split())
CMD_EXES = set(_exestr.split())
pybin = sys.executable or ""
if EXE:
pybin = ""
for zsg in "python3 python".split():
try:
if ANYWIN:
zsg += ".exe"
zsg = shutil.which(zsg)
if zsg:
pybin = zsg
@ -2450,6 +2458,14 @@ def runcmd(
bout: bytes
berr: bytes
if ANYWIN:
if isinstance(argv[0], (bytes, bytearray)):
if argv[0] in CMD_EXEB:
argv[0] += b".exe"
else:
if argv[0] in CMD_EXES:
argv[0] += ".exe"
p = sp.Popen(argv, stdout=cout, stderr=cerr, **ka)
if not timeout or PY2:
bout, berr = p.communicate(sin)

View file

@ -9,7 +9,7 @@ tee build2.sh | cmp build.sh && rm build2.sh || {
[[ $r =~ [yY] ]] && mv build{2,}.sh && exec ./build.sh
}
[ -e up2k.sh ] && ./up2k.sh
[ -e up2k.sh ] && [ ! "$1" ] && ./up2k.sh
uname -s | grep WOW64 && m=64 || m=32
uname -s | grep NT-10 && w10=1 || w7=1
@ -73,6 +73,7 @@ excl=(
multiprocessing
pdb
pickle
PIL.EpsImagePlugin
pyftpdlib.prefork
urllib.request
urllib.response