diff options
author | Graham Percival <graham@percival-music.ca> | 2011-10-23 01:46:11 +0100 |
---|---|---|
committer | Graham Percival <graham@percival-music.ca> | 2011-10-23 01:46:11 +0100 |
commit | 4dfb5067f3646cd99b11dd919e8a29897eea00de (patch) | |
tree | 6e313cb42b7460a1f4a203e4f0d851cedb08fda1 /scripts/auxiliar | |
parent | f38075180844255b6e0c01fcb8027e98d002e938 (diff) |
fixcc.py now rejects astyle != 2.02
Diffstat (limited to 'scripts/auxiliar')
-rwxr-xr-x | scripts/auxiliar/fixcc.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/auxiliar/fixcc.py b/scripts/auxiliar/fixcc.py index 4449a45b47..3fb76d4458 100755 --- a/scripts/auxiliar/fixcc.py +++ b/scripts/auxiliar/fixcc.py @@ -31,6 +31,7 @@ import re import string import sys import time +import subprocess COMMENT = 'COMMENT' STRING = 'STRING' @@ -38,6 +39,8 @@ GLOBAL_CXX = 'GC++' CXX = 'C++' verbose_p = 0 indent_p = 1 +REQUIRED_ASTYLE_VERSION = "Artistic Style Version 2.02" + rules = { GLOBAL_CXX: @@ -392,6 +395,14 @@ def do_options (): sys.exit (2) return files +def check_astyle_version(): + cmd = "astyle --version" + process = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + stdout, stderr = process.communicate() + if REQUIRED_ASTYLE_VERSION in stderr: + return True + return False + outdir = 0 format = CXX @@ -399,6 +410,10 @@ socketdir = '/tmp/fixcc' socketname = 'fixcc%d' % os.getpid () def main (): + if not check_astyle_version(): + print "Error: we require %s" % REQUIRED_ASTYLE_VERSION + print "Sorry, no higher (or lower) versions allowed" + sys.exit(1) files = do_options () if outdir and not os.path.isdir (outdir): os.makedirs (outdir) |