Add lookup caching and absolute path checking to is_exe_in_path().

Review Request #11526 — Created March 15, 2021 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.0.x

Reviewers

Every time we call is_exe_in_path(), it must re-scan the $PATH.
It's not a big performance issue, but we do look up some of the same
binaries more than once.

This change addresses this by allowing is_exe_in_path() to take a
cache parameter, which is a dictionary matching names to found paths
(or None, if not found). It also prevents a lookup if the path
provided is an absolute path.

Really, though, this is laying some groundwork for some improved
dependency checking, where the cache will be reused for looking up
binary files at both dependency resolution and process execution time.

Unit tests passed.

Made use of this in the upcoming dependency change.

Commits

Files

    Loading...