Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

enhance the installation detection of involucro #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion galaxy/tools/deps/mulled/mulled_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import string
import subprocess
import sys
from distutils.spawn import find_executable
from sys import platform as _platform

from six.moves import shlex_quote
Expand Down Expand Up @@ -285,7 +286,9 @@ def exec_command(self, involucro_args):
return res

def is_installed(self):
return os.path.exists(self.involucro_bin)
if find_executable('involucro') is not None or os.path.exists(self.involucro_bin):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

distutils.spawn.find_executable only does half the job of shutil.which, i.e., it is only checking for existence but not user executability.
I think (given a shutil.which implementation) you'd want something like

if not os.path.dirname(self.involucro_bin):
    return shutil.which(self.involucro_bin)
return (os.access(self.involucro_bin, os.F_OK | os.X_OK) and not os.path.isdir(self.involucro_bin))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbargull missed that, sorry. Do you think if we find the binary, but it is not executable, that we should install/download a new binary? We should probably error out, isn't it?

return True
return False

def can_install(self):
return True
Expand Down