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 subprocess as sp
import sys import sys
from .__init__ import EXE, PY2, WINDOWS, E, unicode from .__init__ import ANYWIN, EXE, PY2, WINDOWS, E, unicode
from .bos import bos from .bos import bos
from .util import ( from .util import (
FFMPEG_URL, FFMPEG_URL,
@ -29,6 +29,9 @@ if True: # pylint: disable=using-constant-test
def have_ff(scmd: str) -> bool: def have_ff(scmd: str) -> bool:
if ANYWIN:
scmd += ".exe"
if PY2: if PY2:
print("# checking {}".format(scmd)) print("# checking {}".format(scmd))
acmd = (scmd + " -version").encode("ascii").split(b" ") 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()} 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 "" pybin = sys.executable or ""
if EXE: if EXE:
pybin = "" pybin = ""
for zsg in "python3 python".split(): for zsg in "python3 python".split():
try: try:
if ANYWIN:
zsg += ".exe"
zsg = shutil.which(zsg) zsg = shutil.which(zsg)
if zsg: if zsg:
pybin = zsg pybin = zsg
@ -2450,6 +2458,14 @@ def runcmd(
bout: bytes bout: bytes
berr: 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) p = sp.Popen(argv, stdout=cout, stderr=cerr, **ka)
if not timeout or PY2: if not timeout or PY2:
bout, berr = p.communicate(sin) 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 [[ $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 WOW64 && m=64 || m=32
uname -s | grep NT-10 && w10=1 || w7=1 uname -s | grep NT-10 && w10=1 || w7=1
@ -73,6 +73,7 @@ excl=(
multiprocessing multiprocessing
pdb pdb
pickle pickle
PIL.EpsImagePlugin
pyftpdlib.prefork pyftpdlib.prefork
urllib.request urllib.request
urllib.response urllib.response