Add executable check to find_executable

Find_executable returns a file in the path, so it must be checked for
executability.
This commit is contained in:
Brendan Harley 2017-07-02 17:16:25 +02:00
parent df3a200df3
commit acb17a98d0

View file

@ -10,13 +10,15 @@ class CheckExternalCommands(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
import re import re
import os
import logging import logging
from distutils.spawn import find_executable from distutils.spawn import find_executable
missing_packages = [] missing_packages = []
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
for command, package in info.host_dependencies.items(): for command, package in info.host_dependencies.items():
log.debug('Checking availability of ' + command) log.debug('Checking availability of ' + command)
if find_executable(command) is None: path = find_executable(command)
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}\'.'