Remove unused check_binary_exists

This commit is contained in:
Bastian Germann 2020-09-28 22:38:22 +02:00
parent 04e3ef5d86
commit 2c577e2382
1 changed files with 0 additions and 28 deletions

View File

@ -31,7 +31,6 @@ import sys
import traceback
from ipaddress import IPv4Address, IPv6Address, AddressValueError
from shutil import which
from subprocess import check_output, CalledProcessError, STDOUT
from PyQt5 import QtGui
from PyQt5.QtCore import QCryptographicHash as QHash
@ -472,33 +471,6 @@ def clean_filename(filename):
return INVALID_FILE_CHARS.sub('_', CONTROL_CHARS.sub('', filename))
def check_binary_exists(program_path):
"""
Function that checks whether a binary exists.
:param pathlib.Path program_path: The full path to the binary to check.
:return: program output to be parsed
:rtype: bytes
"""
log.debug('testing program_path: {text}'.format(text=program_path))
try:
# Setup startupinfo options for check_output to avoid console popping up on windows
if is_win():
from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW
startupinfo = STARTUPINFO()
startupinfo.dwFlags |= STARTF_USESHOWWINDOW
else:
startupinfo = None
run_log = check_output([str(program_path), '--help'], stderr=STDOUT, startupinfo=startupinfo)
except CalledProcessError as e:
run_log = e.output
except Exception:
trace_error_handler(log)
run_log = ''
log.debug('check_output returned: {text}'.format(text=run_log))
return run_log
def get_file_encoding(file_path):
"""
Utility function to incrementally detect the file encoding.