-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
format-code.py
executable file
·50 lines (49 loc) · 1.5 KB
/
format-code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# The build machines for Ubuntu don't have clang-format installed yet
# so return 0 immediately until that is fixed
import sys
sys.exit(0)
#import argparse
#import glob
#import os
#import subprocess
#import sys
#
#class A(object):
# pass
#
#a = A()
#parser = argparse.ArgumentParser(description='Formats native code with clang-format')
#parser.add_argument('checkonly', nargs='?', help='Do not overwrite the files with format changes, only check what would happen')
#parser.parse_args(namespace=a)
#
#try:
# subprocess.call(['clang-format', '--version'])
# cf='clang-format '
#except:
# try:
# subprocess.call(['clang-format-3.6', ' --version'])
# cf='clang-format-3.6 '
# except:
# print 'Clang Format v3.6+ is required'
# sys.exit(-1)
#
#if a.checkonly is None:
# args = '-style=file -i '
#else:
# args = '-style=file -output-replacements-xml '
#
#print 'Running clang-format style cop on native code...'
#
#os.chdir(os.path.dirname(os.path.realpath(__file__)))
#
#extensions=['cpp', 'c', 'h', 'hpp', 'hxx', 'in']
#for extension in extensions:
# for nativefile in glob.glob('**/*.' + extension):
# cmd = cf + args + os.path.realpath(nativefile)
# print 'Formatting native file with command: ' + cmd
# if a.checkonly is None:
# subprocess.call(cmd, shell=True)
# else:
# if len(subprocess.check_output(cmd, shell=True)) != 74:
# print 'File not style compliant, exiting: ' + nativefile
# sys.exit(-1)