Files
chromium_depot_tools/recipes/recipe_modules/depot_tools/api.py
Henrique Nakashima fa32fc9cc9 Revert "[recipe_modules/depot_tools] Add dirmd_path to api"
This reverts commit 25b2cb499a.

Reason for revert: Used copy of dirmd in third_party/ instead,
making this unnecessary.

Original change's description:
> [recipe_modules/depot_tools] Add dirmd_path to api
>
> This is required to parse DIR_METADATA files.
>
> Bug: 1135347
> Change-Id: I620656d4dbec5e918bfc0f535397869c869446b8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2644827
> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@google.com>

TBR=tandrii@google.com,hnakashima@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1135347
Change-Id: I8ea8dfe8f3587177493fb37a4a37eb24266240e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2686631
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
2021-02-10 19:22:23 +00:00

73 lines
1.9 KiB
Python

# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The `depot_tools` module provides safe functions to access paths within
the depot_tools repo."""
import contextlib
from recipe_engine import recipe_api
class DepotToolsApi(recipe_api.RecipeApi):
@property
def download_from_google_storage_path(self):
return self.repo_resource('download_from_google_storage.py')
@property
def upload_to_google_storage_path(self):
return self.repo_resource('upload_to_google_storage.py')
@property
def root(self):
"""Returns (Path): The "depot_tools" root directory."""
return self.repo_resource()
@property
def cros_path(self):
return self.repo_resource('cros')
@property
def gn_py_path(self):
return self.repo_resource('gn.py')
# TODO(dnj): Remove this once everything uses the "gsutil" recipe module
# version.
@property
def gsutil_py_path(self):
return self.repo_resource('gsutil.py')
@property
def ninja_path(self):
ninja_exe = 'ninja.exe' if self.m.platform.is_win else 'ninja'
return self.repo_resource(ninja_exe)
@property
def autoninja_path(self):
autoninja = 'autoninja.bat' if self.m.platform.is_win else 'autoninja'
return self.repo_resource(autoninja)
@property
def presubmit_support_py_path(self):
return self.repo_resource('presubmit_support.py')
@contextlib.contextmanager
def on_path(self):
"""Use this context manager to put depot_tools on $PATH.
Example:
```python
with api.depot_tools.on_path():
# run some steps
```
"""
# By default Depot Tools do not auto update on the bots.
# (crbug/1090603)
with self.m.context(
**{'env_suffixes': {
'PATH': [self.root],
'DEPOT_TOOLS_UPDATE': '0'
}}):
yield