from __future__ import absolute_import
from __future__ import print_function
import os, sys
try:
import gclient_utils
except ImportError as e:
depot_tools = None
paths = os.environ.get('PATH').split(os.pathsep)
for path in paths:
if os.path.exists(os.path.join(path, 'gclient_utils.py')):
depot_tools = path
break
if depot_tools is None:
print('Error: could not find depot_tools in PATH.', file=sys.stderr)
sys.exit(2)
sys.path.append(depot_tools)
import gclient_utils
def RunAction(dir, command):
"""Runs the action."""
try:
gclient_utils.CheckCallAndFilter(
command, cwd=dir, always_show_header=True, print_stdout=True)
except gclient_utils.Error as e:
print('Error: %s' % str(e), file=sys.stderr)
sys.exit(2)