Update PRESUBMIT.py
Updates PRESUBMIT.py for pdfium_test for Python 3, and presubmit 2.0.
Also enables pan-project checks, and fix the existing violation.
Bug: pdfium:1962
Change-Id: I9e97e8d26a3a9f72e771f616989fc61ee422b127
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium_tests/+/102870
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 8308f14..3b9c3d1 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1,13 +1,16 @@
# Copyright 2017 The PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Presubmit script for PDFium testing corpus.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""
+PRESUBMIT_VERSION = '2.0.0'
+
+USE_PYTHON3 = True
+
def _CheckNoIn(input_api, output_api):
"""Checks that corpus tests don't contain .in files. Corpus tests should be
.pdf files, having both can cause race conditions on the bots, which run the
@@ -17,7 +20,8 @@
for f in input_api.AffectedFiles(include_deletes=False):
if f.LocalPath().endswith('.in'):
results.append(output_api.PresubmitError(
- 'Remove %s since corpus tests should not use .in files' % f.LocalPath()))
+ f'Remove {f.LocalPath()} since corpus tests should not use .in files'
+ ))
return results
def _CheckPngNames(input_api, output_api):
@@ -43,6 +47,15 @@
warnings))
return results
+def ChecksCommon(input_api, output_api):
+ results = []
+
+ results.extend(
+ input_api.canned_checks.PanProjectChecks(
+ input_api, output_api, project_name='PDFium'))
+
+ return results
+
def CheckChangeOnUpload(input_api, output_api):
results = []
results += _CheckPngNames(input_api, output_api)