Beispiel #1
0
def assert_can_execute(command_and_arguments,
                       prerequisite,
                       caller,
                       env,
                       no_path_search=False,
                       logger=None):
    with tempfile.NamedTemporaryFile() as f:
        try:
            if IS_WIN and not is_string(
                    command_and_arguments) and not no_path_search:
                which_cmd = which(command_and_arguments[0],
                                  path=env.get("PATH") if env else None)
                if which_cmd:
                    command_and_arguments[0] = which_cmd

            if logger:
                logger.debug(
                    "Verifying command: %s",
                    " ".join(repr(cmd) for cmd in command_and_arguments))

            process = subprocess.Popen(command_and_arguments,
                                       stdout=f,
                                       stderr=f,
                                       shell=False,
                                       env=env)
            process.wait()
        except OSError:
            raise MissingPrerequisiteException(prerequisite, caller)
Beispiel #2
0
def assert_can_execute(command_and_arguments, prerequisite, caller):
    with tempfile.NamedTemporaryFile() as f:
        try:
            process = subprocess.Popen(command_and_arguments, stdout=f, stderr=f, shell=False)
            process.wait()
        except OSError:
            raise MissingPrerequisiteException(prerequisite, caller)
Beispiel #3
0
def assert_can_execute(command_and_arguments, prerequisite, caller):
    fd, outfile = tempfile.mkstemp()
    f = open(outfile, "w")
    try:
        process = subprocess.Popen(command_and_arguments, stdout=f, stderr=f, shell=False)
        process.wait()
    except OSError:
        raise MissingPrerequisiteException(prerequisite, caller)
    finally:
        f.close()
        os.close(fd)
        os.unlink(outfile)
def assert_jedi_is_installed(logger):
    if not jedi:
        raise MissingPrerequisiteException("'jedi'", caller="jedi_linter_plugin")
    if "_analysis" not in dir(jedi.Script):
        raise InternalException(
            "The jedi linter API changed, please file a bug at https://github.com/pybuilder/pybuilder/issues/new")