summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorMartin Bligh <mbligh@mongodb.com>2015-06-26 08:24:54 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-08-03 15:43:00 -0400
commit8ceae098a0c093698dd95267d79f6e0a8421848e (patch)
treef97187533157715d5e9f7e1c8d9b871a29a0ed90 /buildscripts
parentc091f0ef2351d7ec85a68a8c627ae6a1055fb697 (diff)
downloadmongo-8ceae098a0c093698dd95267d79f6e0a8421848e.tar.gz
SERVER-19070: Fix various clang-format issues
(cherry picked from commit 0a9a207be302c2deb23311659cad158f84f3a9bf)
Diffstat (limited to 'buildscripts')
-rwxr-xr-xbuildscripts/clang_format.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/buildscripts/clang_format.py b/buildscripts/clang_format.py
index 07371f09f15..3e4b16707b7 100755
--- a/buildscripts/clang_format.py
+++ b/buildscripts/clang_format.py
@@ -29,7 +29,7 @@ from multiprocessing import cpu_count
# Get relative imports to work when the package is not installed on the PYTHONPATH.
if __name__ == "__main__" and __package__ is None:
- sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(os.path.realpath(__file__)))))
from buildscripts.resmokelib.utils import globstar
from buildscripts import moduleconfig
@@ -189,7 +189,10 @@ class ClangFormat(object):
and linting/formating an individual file
"""
def __init__(self, path, cache_dir):
- clang_format_progname = CLANG_FORMAT_PROGNAME
+ if os.path.exists('/usr/bin/clang-format-3.6'):
+ clang_format_progname = 'clang-format-3.6'
+ else:
+ clang_format_progname = CLANG_FORMAT_PROGNAME
# Initialize clang-format configuration information
if sys.platform.startswith("linux"):
@@ -315,7 +318,7 @@ def parallel_process(items, func):
except NotImplementedError:
cpus = 1
- print("Running across %d cpus" % (cpus))
+ # print("Running across %d cpus" % (cpus))
task_queue = Queue.Queue()
@@ -379,9 +382,11 @@ def get_base_dir():
This script assumes that it is running in buildscripts/, and uses
that to find the base directory.
"""
- script_path = os.path.dirname(os.path.realpath(__file__))
-
- return os.path.dirname(script_path)
+ try:
+ return subprocess.check_output(['git', 'rev-parse', '--show-toplevel']).rstrip()
+ except:
+ # We are not in a valid git directory. Use the script path instead.
+ return os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def get_repos():
"""Get a list of Repos to check clang-format for