mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
switch to 4 space indent
Leave the recipes/ code at 2 space to match the rest of the recipes
project in other repos.
Reformatted using:
files=( $(
git ls-tree -r --name-only HEAD | \
grep -Ev -e '^(third_party|recipes)/' | \
grep '\.py$';
git grep -l '#!/usr/bin/env.*python' | grep -v '\.py$'
) )
parallel ./yapf -i -- "${files[@]}"
~/chromiumos/chromite/contrib/reflow_overlong_comments "${files[@]}"
The files that still had strings that were too long were manually
reformatted because they were easy and only a few issues.
autoninja.py
clang_format.py
download_from_google_storage.py
fix_encoding.py
gclient_utils.py
git_cache.py
git_common.py
git_map_branches.py
git_reparent_branch.py
gn.py
my_activity.py
owners_finder.py
presubmit_canned_checks.py
reclient_helper.py
reclientreport.py
roll_dep.py
rustfmt.py
siso.py
split_cl.py
subcommand.py
subprocess2.py
swift_format.py
upload_to_google_storage.py
These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
auth.py
gclient.py
gclient_eval.py
gclient_paths.py
gclient_scm.py
gerrit_util.py
git_cl.py
presubmit_canned_checks.py
presubmit_support.py
scm.py
Change-Id: Ia6535c4f2c48d46b589ec1e791dde6c6b2ea858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4836379
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
@@ -21,38 +21,38 @@ VERSION = 3
|
||||
|
||||
|
||||
def LoadConfig():
|
||||
if os.path.isfile(CONFIG):
|
||||
with open(CONFIG, 'r') as f:
|
||||
try:
|
||||
config = json.load(f)
|
||||
except Exception:
|
||||
# Set default value when failed to load config.
|
||||
config = {
|
||||
'is-googler': ninjalog_uploader.IsGoogler(),
|
||||
'countdown': 10,
|
||||
'version': VERSION,
|
||||
}
|
||||
if os.path.isfile(CONFIG):
|
||||
with open(CONFIG, 'r') as f:
|
||||
try:
|
||||
config = json.load(f)
|
||||
except Exception:
|
||||
# Set default value when failed to load config.
|
||||
config = {
|
||||
'is-googler': ninjalog_uploader.IsGoogler(),
|
||||
'countdown': 10,
|
||||
'version': VERSION,
|
||||
}
|
||||
|
||||
if config['version'] == VERSION:
|
||||
config['countdown'] = max(0, config['countdown'] - 1)
|
||||
return config
|
||||
if config['version'] == VERSION:
|
||||
config['countdown'] = max(0, config['countdown'] - 1)
|
||||
return config
|
||||
|
||||
return {
|
||||
'is-googler': ninjalog_uploader.IsGoogler(),
|
||||
'countdown': 10,
|
||||
'version': VERSION,
|
||||
}
|
||||
return {
|
||||
'is-googler': ninjalog_uploader.IsGoogler(),
|
||||
'countdown': 10,
|
||||
'version': VERSION,
|
||||
}
|
||||
|
||||
|
||||
def SaveConfig(config):
|
||||
with open(CONFIG, 'w') as f:
|
||||
json.dump(config, f)
|
||||
with open(CONFIG, 'w') as f:
|
||||
json.dump(config, f)
|
||||
|
||||
|
||||
def ShowMessage(countdown):
|
||||
whitelisted = '\n'.join(
|
||||
[' * %s' % config for config in ninjalog_uploader.ALLOWLISTED_CONFIGS])
|
||||
print("""
|
||||
whitelisted = '\n'.join(
|
||||
[' * %s' % config for config in ninjalog_uploader.ALLOWLISTED_CONFIGS])
|
||||
print("""
|
||||
Your ninjalog will be uploaded to build stats server. The uploaded log will be
|
||||
used to analyze user side build performance.
|
||||
|
||||
@@ -85,51 +85,51 @@ https://chromium.googlesource.com/chromium/tools/depot_tools/+/main/ninjalog.REA
|
||||
|
||||
|
||||
def main():
|
||||
config = LoadConfig()
|
||||
config = LoadConfig()
|
||||
|
||||
if len(sys.argv) == 2 and sys.argv[1] == 'opt-in':
|
||||
config['opt-in'] = True
|
||||
config['countdown'] = 0
|
||||
SaveConfig(config)
|
||||
print('ninjalog upload is opted in.')
|
||||
return 0
|
||||
if len(sys.argv) == 2 and sys.argv[1] == 'opt-in':
|
||||
config['opt-in'] = True
|
||||
config['countdown'] = 0
|
||||
SaveConfig(config)
|
||||
print('ninjalog upload is opted in.')
|
||||
return 0
|
||||
|
||||
if len(sys.argv) == 2 and sys.argv[1] == 'opt-out':
|
||||
config['opt-in'] = False
|
||||
SaveConfig(config)
|
||||
print('ninjalog upload is opted out.')
|
||||
return 0
|
||||
if len(sys.argv) == 2 and sys.argv[1] == 'opt-out':
|
||||
config['opt-in'] = False
|
||||
SaveConfig(config)
|
||||
print('ninjalog upload is opted out.')
|
||||
return 0
|
||||
|
||||
if 'opt-in' in config and not config['opt-in']:
|
||||
# Upload is opted out.
|
||||
return 0
|
||||
if 'opt-in' in config and not config['opt-in']:
|
||||
# Upload is opted out.
|
||||
return 0
|
||||
|
||||
if not config.get("is-googler", False):
|
||||
# Not googler.
|
||||
return 0
|
||||
if not config.get("is-googler", False):
|
||||
# Not googler.
|
||||
return 0
|
||||
|
||||
if config.get("countdown", 0) > 0:
|
||||
# Need to show message.
|
||||
ShowMessage(config["countdown"])
|
||||
# Only save config if something has meaningfully changed.
|
||||
SaveConfig(config)
|
||||
return 0
|
||||
if config.get("countdown", 0) > 0:
|
||||
# Need to show message.
|
||||
ShowMessage(config["countdown"])
|
||||
# Only save config if something has meaningfully changed.
|
||||
SaveConfig(config)
|
||||
return 0
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
# dry-run for debugging.
|
||||
print("upload ninjalog dry-run")
|
||||
return 0
|
||||
if len(sys.argv) == 1:
|
||||
# dry-run for debugging.
|
||||
print("upload ninjalog dry-run")
|
||||
return 0
|
||||
|
||||
# Run upload script without wait.
|
||||
devnull = open(os.devnull, "w")
|
||||
creationnflags = 0
|
||||
if platform.system() == 'Windows':
|
||||
creationnflags = subprocess.CREATE_NEW_PROCESS_GROUP
|
||||
subprocess2.Popen([sys.executable, UPLOADER] + sys.argv[1:],
|
||||
stdout=devnull,
|
||||
stderr=devnull,
|
||||
creationflags=creationnflags)
|
||||
# Run upload script without wait.
|
||||
devnull = open(os.devnull, "w")
|
||||
creationnflags = 0
|
||||
if platform.system() == 'Windows':
|
||||
creationnflags = subprocess.CREATE_NEW_PROCESS_GROUP
|
||||
subprocess2.Popen([sys.executable, UPLOADER] + sys.argv[1:],
|
||||
stdout=devnull,
|
||||
stderr=devnull,
|
||||
creationflags=creationnflags)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user