'If conda_exec is set to a path outside of conda_prefix,
there is no use installing conda into conda_prefix, since it can\'t be used by galaxy.
If conda_exec equals conda_prefix/bin/conda, we can install conda if either conda_prefix
does not exist or is empty.'

def can_install_conda(self):

    conda_exec = os.path.abspath(self.conda_exec)
    conda_prefix_plus_exec = os.path.abspath(os.path.join(self.conda_prefix, 'bin/conda'))
    if (conda_exec == conda_prefix_plus_exec):
        if (not os.path.exists(self.conda_prefix)):
            return True
        elif (os.listdir(self.conda_prefix) == []):
            os.rmdir(self.conda_prefix)
            return True
        else:
            log.warning("Cannot    install    Conda    because    conda_prefix    '%s'    exists    and    is    not    empty.", self.conda_prefix)
            return False
    else:
        log.warning("Skipping    installation    of    Conda    into    conda_prefix    '%s',    since    conda_exec    '%s'    is    set    to    a    path    outside    of    conda_prefix.", self.conda_prefix, self.conda_exec)
        return False
