BinDeps.jl
BinDeps.jl copied to clipboard
Dependency on executables
Sometimes a package depends on an executable file, not a library.
While package providers can install dependencies in the same manner, find_library
would need to be substituted with an appropriate find_executable
function (e.g. "an executable is installed if which
or where
<exec_name> returns a file or it's in deps/usr/bin" or something like that). deps.jl
would maybe also set the path of the executable in a variable. There would then be executable_dependency
in place of library_dependency
.
I'm keen to write this and submit a PR unless anyone has any suggestions or objections.
Makes sense to me. Like for libraries, you may also want to accept a validate
function which would be called with the path to the executable, and return a boolean indicating whether the executable fits the bill.
- I didn't know that existed, cool
- Definitely!
Sounds like a good idea, would be happy to review something like this. One thing to note is that which
isn't always installed by default on e.g. minimal Fedora containers, so ideally there should be some sort of fallback - "find_executable
cannot work without having which
installed" or something. Manually crawling PATH
sounds like more trouble than it's worth.
Would find
be installed? Could use that to crawl PATH
.
If which
isn't available, do we at least have a way of trying to run the command using only its name, e.g. via /bin/sh
? Else, we could simply act as if the executable was missing, i.e. build the sources, so that we know where the binary is.
/usr/bin/env foo
maybe? depends whether executing with no arguments is expected to work meaningfully
We could have the validate
function run even if which
wasn't installed, and let the user determine what is a valid "no-op" call.
We could have the validate function run even if which wasn't installed, and let the user determine what is a valid "no-op" call.
The problem is, validate
should be able to run the executable very easily, without a special cases. Else, package authors won't test that path (since they don't use weird systems) and it will be broken too often. So validate
should always be passed one argument which can be handled in a single code path, e.g. by calling run
on it after adding some additional arguments.
I booted a VM with a minimal Fedora install (no extras, not even the Standard ones) and it came with which
in /usr/bin
.
It's docker containers where I've seen it missing and need to be manually installed (to be able to build Julia).