mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-27 20:43:57 +00:00
0c56fc4d66
Summary: RocksDB Makefile was assuming existence of 'python' command, which is not present in CentOS 8. We avoid using 'python' if 'python3' is available. Also added fancy logic to format-diff.sh to make clang-format-diff.py for Python2 work even with Python3 only (as some CentOS 8 FB machines come equipped) Also, now use just 'python3' for PYTHON if not found so that an informative "command not found" error will result rather than something weird. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6883 Test Plan: manually tried some variants, 'make check' on a fresh CentOS 8 machine without 'python' executable or Python2 but with clang-format-diff.py for Python2. Reviewed By: gg814 Differential Revision: D21767029 Pulled By: pdillinger fbshipit-source-id: 54761b376b140a3922407bdc462f3572f461d0e9
23 lines
853 B
Python
Executable file
23 lines
853 B
Python
Executable file
#!/usr/bin/env python3
|
|
# 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)))
|