diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/rocksdb/tools/check_all_python.py | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/rocksdb/tools/check_all_python.py')
-rw-r--r-- | src/rocksdb/tools/check_all_python.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rocksdb/tools/check_all_python.py b/src/rocksdb/tools/check_all_python.py new file mode 100644 index 000000000..17fe95eab --- /dev/null +++ b/src/rocksdb/tools/check_all_python.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python2 +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +import glob + +# Checks that all python files in the repository are at least free of syntax +# errors. This provides a minimal pre-/post-commit check for python file +# modifications. + +filenames = [] +# Avoid scanning all of ./ because there might be other external repos +# linked in. +for base in ["buckifier", "build_tools", "coverage", "tools"]: + # Clean this up when we finally upgrade to Python 3 + for suff in ["*", "*/*", "*/*/*"]: + filenames += glob.glob(base + "/" + suff + ".py") + +for filename in filenames: + source = open(filename, 'r').read() + '\n' + # Parses and syntax checks the file, throwing on error. (No pyc written.) + _ = compile(source, filename, 'exec') + +print("No syntax errors in {0} .py files".format(len(filenames))) |