mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-21 16:05:02 +02:00
Use "with suppress()" to suppress a python exception
This commit is contained in:
@@ -7,6 +7,7 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
from bypy.constants import (
|
from bypy.constants import (
|
||||||
LIBDIR, PREFIX, PYTHON, SRC as KITTY_DIR, ismacos, worker_env
|
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'))
|
ignore=shutil.ignore_patterns('b', 'build', 'dist', '*_commands.json', '*.o'))
|
||||||
|
|
||||||
# Build the launcher as it is needed for the spawn test
|
# 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'))
|
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:
|
if run(PYTHON, 'setup.py', 'build-launcher', cwd=writeable_src_dir) != 0:
|
||||||
print('Building of kitty launcher failed', file=sys.stderr)
|
print('Building of kitty launcher failed', file=sys.stderr)
|
||||||
os.chdir(KITTY_DIR)
|
os.chdir(KITTY_DIR)
|
||||||
|
|||||||
Reference in New Issue
Block a user