Commit 97f1e13c authored by Evan Simpson's avatar Evan Simpson

Skip 'test' and 'tests' directories when compiling.

parent 30791b3b
...@@ -22,6 +22,23 @@ class NoteErr: ...@@ -22,6 +22,23 @@ class NoteErr:
self.wrote = 1 self.wrote = 1
apply(stderr.write, args) apply(stderr.write, args)
def compile_non_test(dir):
"""Byte-compile all modules except those in test directories."""
success = compileall.compile_dir(dir, maxlevels=0)
try:
names = os.listdir(dir)
except os.error:
print "Can't list", dir
names = []
names.sort()
for name in names:
fullname = os.path.join(dir, name)
if (name != os.curdir and name != os.pardir and
os.path.isdir(fullname) and not os.path.islink(fullname) and
name != 'test' and name != 'tests'):
success = success and compile_non_test(fullname)
return success
print print
print '-'*78 print '-'*78
print 'Compiling python modules' print 'Compiling python modules'
...@@ -32,7 +49,7 @@ try: ...@@ -32,7 +49,7 @@ try:
success = 0 success = 0
sys.stdout = Shutup() sys.stdout = Shutup()
sys.stderr = NoteErr() sys.stderr = NoteErr()
success = compileall.compile_dir(os.getcwd()) success = compile_non_test(os.getcwd())
finally: finally:
success = success and not sys.stderr.wrote success = success and not sys.stderr.wrote
sys.stdout = stdout sys.stdout = stdout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment