mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix discovery of the .clang-format file (issue #2171)
This commit is contained in:
@ -3,16 +3,26 @@
|
||||
# can be found in the LICENSE file
|
||||
|
||||
from exec_util import exec_cmd
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Script directory.
|
||||
script_dir = os.path.dirname(__file__)
|
||||
root_dir = os.path.join(script_dir, os.pardir)
|
||||
|
||||
if sys.platform == 'win32':
|
||||
# Force use of the clang-format version bundled with depot_tools.
|
||||
clang_format_exe = 'clang-format.bat'
|
||||
else:
|
||||
clang_format_exe = 'clang-format'
|
||||
|
||||
def clang_format(file_contents):
|
||||
result = exec_cmd(clang_format_exe, ".", file_contents)
|
||||
def clang_format(file_name, file_contents):
|
||||
# -assume-filename is necessary to find the .clang-format file and determine
|
||||
# the language when specifying contents via stdin.
|
||||
result = exec_cmd("%s -assume-filename=%s" % (clang_format_exe, file_name), \
|
||||
root_dir, file_contents)
|
||||
if result['err'] != '':
|
||||
print "clang-format error: %s" % result['err']
|
||||
if result['out'] != '':
|
||||
output = result['out']
|
||||
if sys.platform == 'win32':
|
||||
|
Reference in New Issue
Block a user