Exemple #1
0
def _get_gsutil_path():
  """Get path to gsutil executable.

  Returns:
    Path to gsutil executable on the system.
  """
  gsutil_executable = 'gsutil'
  if environment.platform() == 'WINDOWS':
    gsutil_executable += '.cmd'

  gsutil_directory = environment.get_value('GSUTIL_PATH')
  if not gsutil_directory:
    # Try searching the binary in path.
    gsutil_absolute_path = shell.which(gsutil_executable)
    if gsutil_absolute_path:
      return gsutil_absolute_path

    logs.log_error('Cannot locate gsutil in PATH, set GSUTIL_PATH to directory '
                   'containing gsutil binary.')
    return None

  gsutil_absolute_path = os.path.join(gsutil_directory, gsutil_executable)
  return gsutil_absolute_path
Exemple #2
0
def _xdotool_path():
    """Return full path to xdotool."""
    return shell.which('xdotool')
Exemple #3
0
 def test(self):
     self.assertEqual('/bin/ls', shell.which('ls'))
Exemple #4
0
 def test(self):
   self.assertTrue(shell.which('ls') in ['/bin/ls', '/usr/bin/ls'])