def path_surgery(cmd):
 dirs = ('/usr/sbin', '/usr/local/bin', '/usr/local/sbin')
 path = os.environ['PATH']
 added = []
 for d in dirs:
  if (d not in path):
   path += (os.pathsep + d)
   added.append(d)
 if any(added):
  logger.debug("Can't find %s, attempting PATH mitigation by adding %s", cmd, os.pathsep.join(added))
  os.environ['PATH'] = path
 if util.exe_exists(cmd):
  return True
 else:
  expanded = (' expanded' if any(added) else '')
  logger.warning('Failed to find %s in%s PATH: %s', cmd, expanded, path)
  return False

def path_surgery ( cmd ) : dirs = ( '/usr/sbin' , '/usr/local/bin' , '/usr/local/sbin' ) path = os . environ [ 'PATH' ] added = [ ] for d in dirs : if ( d not in path ) : path += ( os . pathsep + d ) added . append ( d ) if any ( added ) : logger . debug ( "Can't find %s, attempting PATH mitigation by adding %s" , cmd , os . pathsep . join ( added ) ) os . environ [ 'PATH' ] = path if util . exe_exists ( cmd ) : return True else : expanded = ( ' expanded' if any ( added ) else '' ) logger . warning ( 'Failed to find %s in%s PATH: %s' , cmd , expanded , path ) return False
attempt to perform path surgery to find cmd mitigates URL .