Merge pull request #382 from Exy13/existing_commands

Fix unfailing CheckExternalCommands
This commit is contained in:
Anders Ingemann 2017-07-02 19:55:05 +02:00 committed by GitHub
commit 58c682818c

View file

@ -9,14 +9,16 @@ class CheckExternalCommands(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
from ..tools import log_check_call
from subprocess import CalledProcessError
import re import re
import os
import logging
from distutils.spawn import find_executable
missing_packages = [] missing_packages = []
log = logging.getLogger(__name__)
for command, package in info.host_dependencies.items(): for command, package in info.host_dependencies.items():
try: log.debug('Checking availability of ' + command)
log_check_call(['type', command], shell=True) path = find_executable(command)
except CalledProcessError: if path is None or not os.access(path, os.X_OK):
if re.match('^https?:\/\/', package): if re.match('^https?:\/\/', package):
msg = ('The command `{command}\' is not available, ' msg = ('The command `{command}\' is not available, '
'you can download the software at `{package}\'.' 'you can download the software at `{package}\'.'