4"""Small utility function to find depot_tools and add it to the python path.
5Will throw an ImportError exception if depot_tools can't be found since it
9from __future__
import print_function
15 return os.path.isfile(os.path.join(path,
'gclient.py'))
19 """Search for depot_tools and add it to sys.path."""
25 for i
in os.environ[
'PATH'].split(os.pathsep):
27 sys.path.append(i.rstrip(os.sep))
30 root_dir = os.path.dirname(os.path.abspath(__file__))
31 previous_dir = os.path.abspath(__file__)
32 while root_dir
and root_dir != previous_dir:
33 i = os.path.join(root_dir,
'depot_tools')
37 previous_dir = root_dir
38 root_dir = os.path.dirname(root_dir)
39 print(
'Failed to find depot_tools', file=sys.stderr)
def print(*args, **kwargs)