Bug 1414894 - [tryselect] Don't install shell extensions when bootstrapping fzf for |mach try fuzzy|, r=armenzg
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 06 Nov 2017 20:29:25 -0500
changeset 390551 f0b47601baec03c6841615488c87c438d5a11dfd
parent 390550 71a2c8b33ae0ba5be4152df25da0b035381289aa
child 390552 f3fe7b47cdacd5e4c5e7d8e52511fe4a71956ffb
push id32836
push userebalazs@mozilla.com
push dateTue, 07 Nov 2017 21:56:07 +0000
treeherdermozilla-central@fb76bb12880c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1414894
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414894 - [tryselect] Don't install shell extensions when bootstrapping fzf for |mach try fuzzy|, r=armenzg Currently the prompts don't make it clear enough that running fzf will mess with your shell settings. This means users could install it without realizing, forget and get confused later on. Rather than try to address this, it's simpler to always skip the shell extensions as |mach try fuzzy| doesn't need them anyway. The extensions are useful, but are better installed via something like |mach bootstrap| which can be tackled in a separate bug. MozReview-Commit-ID: 2kx7UGO5LJ0
tools/tryselect/selectors/fuzzy.py
--- a/tools/tryselect/selectors/fuzzy.py
+++ b/tools/tryselect/selectors/fuzzy.py
@@ -47,23 +47,16 @@ platform:
     https://github.com/junegunn/fzf#installation
 
 Only the binary is required, if you do not wish to install the shell and
 editor integrations, download the appropriate binary and put it on your $PATH:
 
     https://github.com/junegunn/fzf-bin/releases
 """.lstrip()
 
-FZF_RUN_INSTALL_WIZARD = """
-{t.bold}Running the fzf installation wizard.{t.normal}
-
-Only the fzf binary is required, if you do not wish to install the shell
-integrations, {t.bold}feel free to press 'n' at each of the prompts.{t.normal}
-""".format(t=terminal)
-
 FZF_HEADER = """
 For more shortcuts, see {t.italic_white}mach help try fuzzy{t.normal} and {t.italic_white}man fzf
 {shortcuts}
 """.strip()
 
 fzf_shortcuts = {
     'ctrl-a': 'select-all',
     'ctrl-d': 'deselect-all',
@@ -111,28 +104,21 @@ class FuzzyParser(BaseTryParser):
     templates = ['artifact', 'env']
 
 
 def run(cmd, cwd=None):
     is_win = platform.system() == 'Windows'
     return subprocess.call(cmd, cwd=cwd, shell=True if is_win else False)
 
 
-def run_fzf_install_script(fzf_path, bin_only=False):
-    # We could run this without installing the shell integrations on all
-    # platforms, but those integrations are actually really useful so give user
-    # the choice.
+def run_fzf_install_script(fzf_path):
     if platform.system() == 'Windows':
         cmd = ['bash', '-c', './install --bin']
     else:
-        cmd = ['./install']
-        if bin_only:
-            cmd.append('--bin')
-        else:
-            print(FZF_RUN_INSTALL_WIZARD)
+        cmd = ['./install', '--bin']
 
     if run(cmd, cwd=fzf_path):
         print(FZF_INSTALL_FAILED)
         sys.exit(1)
 
 
 def fzf_bootstrap(update=False):
     """Bootstrap fzf if necessary and return path to the executable.
@@ -154,17 +140,17 @@ def fzf_bootstrap(update=False):
         return find_executable('fzf', os.path.join(fzf_path, 'bin'))
 
     if update:
         ret = run(['git', 'pull'], cwd=fzf_path)
         if ret:
             print("Update fzf failed.")
             sys.exit(1)
 
-        run_fzf_install_script(fzf_path, bin_only=True)
+        run_fzf_install_script(fzf_path)
         return get_fzf()
 
     if os.path.isdir(fzf_path):
         fzf_bin = get_fzf()
         if fzf_bin:
             return fzf_bin
         # Fzf is cloned, but binary doesn't exist. Try running the install script
         return fzf_bootstrap(update=True)