Use "with suppress()" to suppress a python exception
This commit is contained in:
parent
d1b2f9c6a9
commit
ee4cedcc81
@ -7,6 +7,7 @@ import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
|
||||
from bypy.constants import (
|
||||
LIBDIR, PREFIX, PYTHON, SRC as KITTY_DIR, ismacos, worker_env
|
||||
@ -49,10 +50,8 @@ def build_c_extensions(ext_dir, args):
|
||||
ignore=shutil.ignore_patterns('b', 'build', 'dist', '*_commands.json', '*.o'))
|
||||
|
||||
# Build the launcher as it is needed for the spawn test
|
||||
try:
|
||||
with suppress(FileNotFoundError):
|
||||
os.remove(os.path.join(writeable_src_dir, 'kitty', 'launcher', 'kitty'))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if run(PYTHON, 'setup.py', 'build-launcher', cwd=writeable_src_dir) != 0:
|
||||
print('Building of kitty launcher failed', file=sys.stderr)
|
||||
os.chdir(KITTY_DIR)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user