Bug 1367741 - Search libexec paths on Unix systems for git-cinnabar; r?chmanchester
When following git-cinnabar's installation instructions, it does not
automatically get installed in a directory on PATH. Instead, it gets
placed in the system's libexec path, which is meant for programs to be
called by other programs and not directly by users.
According to the Filesystem Hierarchy Standard (FHS) published by
the Linux Foundation, Linux distributions should use /usr/libexec and
/usr/local/libexec. This patch appends these two paths to the which(1)
search path when it detects it is on Linux or macOS, which happens to
share the same concept.
Effectively, this change lets users install git-cinnabar following the
normal installation instructions and avoid placing git-cinnabar on the
system path.
MozReview-Commit-ID: 8lxpi4ahMJz
--- a/testing/tools/autotry/autotry.py
+++ b/testing/tools/autotry/autotry.py
@@ -532,19 +532,25 @@ class AutoTry(object):
try:
subprocess.check_output(['hg', 'showconfig',
'extensions.push-to-try'])
except subprocess.CalledProcessError:
print('\nThe "push-to-try" hg extension is required. It '
'can be installed to Mercurial 3.3 or above by '
'running ./mach mercurial-setup')
sys.exit(1)
+
else:
+ # libexec contains programs meant for execution by other programs
+ path = list(sys.path)
+ if sys.platform in ['darwin', 'linux2']:
+ path.extend(['/usr/libexec/git-core', '/usr/local/libexec/git-core'])
+
try:
- which.which('git-cinnabar')
+ which.which('git-cinnabar', path=path)
self._git_push_to_try(msg)
except which.WhichError:
print('ERROR git-cinnabar is required to push from git to try with'
'the autotry command.\n\nMore information can by found at '
'https://github.com/glandium/git-cinnabar')
sys.exit(1)
def find_uncommited_changes(self):