diff options
author | William Escande <wescande@google.com> | 2021-12-01 17:55:38 +0100 |
---|---|---|
committer | William Escande <wescande@google.com> | 2022-01-19 15:44:48 +0000 |
commit | 7c401ddfc8bd80dd58db27d569e04f10b52f594e (patch) | |
tree | 20dee4df520e60a79159a8f06d61657f346720f0 /system/tools/scripts/yapf_checker.py | |
parent | f7dcd35776bc2ff358c9f508a0bf132e9dca58c7 (diff) |
Change pre-upload hook check order for non python upload
It's currently not possible to run the pre-upload hook without having
to source the build/envsetup.sh.
With this change it will be allowed as long as there is no python files
modified.
Test: Upload this change (it's a python file)
Change-Id: I0a27c777b0a0aa58d48e42650063f62cba0a4027
Diffstat (limited to 'system/tools/scripts/yapf_checker.py')
-rwxr-xr-x | system/tools/scripts/yapf_checker.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/tools/scripts/yapf_checker.py b/system/tools/scripts/yapf_checker.py index 62a753e7d7..34ab7f1e1c 100755 --- a/system/tools/scripts/yapf_checker.py +++ b/system/tools/scripts/yapf_checker.py @@ -38,10 +38,6 @@ def main(): logging.error('Missing PREUPLOAD_COMMIT in environment.') exit(1) - if ANDROID_BUILD_TOP_KEY not in os.environ: - logging.error('Missing ANDROID_BUILD_TOP in environment.') - exit(1) - # Gather changed Python files commit_id = os.environ[COMMIT_ID_ENV_KEY] full_git_command = GIT_COMMAND + ['-r', commit_id] @@ -50,6 +46,10 @@ def main(): if not full_files: return + if ANDROID_BUILD_TOP_KEY not in os.environ: + logging.error('Missing ANDROID_BUILD_TOP in environment.') + exit(1) + # Find yapf in Android code tree yapf_dir = os.path.join(os.environ[ANDROID_BUILD_TOP_KEY], DEFAULT_YAPF_DIR) yapf_binary = os.path.join(yapf_dir, 'yapf') |