Syntax check script for Windows

I use this as a pre-commit hook on Windows
This commit is contained in:
mailchuck 2016-04-20 15:34:23 +02:00 committed by Peter Surda
parent 3dbb4d5ce9
commit be29a24a80
1 changed files with 20 additions and 0 deletions

20 Normal file
View File

@ -0,0 +1,20 @@
import ctypes
import fnmatch
import os
import sys
import traceback
matches = []
for root, dirnames, filenames in os.walk('src'):
for filename in fnmatch.filter(filenames, '*.py'):
matches.append(os.path.join(root, filename))
for filename in matches:
source = open(filename, 'r').read() + '\n'
compile(source, filename, 'exec')
except Exception as e:
ctypes.windll.user32.MessageBoxA(0, traceback.format_exc(), "Exception in " + filename, 1)