Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#
# vim: ft=python
import os
import re
import glob
ALLOW_NAMESPACE = re.compile("Proj", re.M)
USE_REGEX = re.compile(r"^\s*use\s+(\S+);", re.M)
def perl_scan(node, env, path):
contents = node.get_contents()
result = USE_REGEX.findall(contents)
baselibdir = env.GetLaunchDir() + "/lib/";
result = [ baselibdir + '/'.join(i.split('::')) + ".pm" for i in filter(lambda x: ALLOW_NAMESPACE.findall(x), result) ]
return result
def test_actions(source, target, env, for_signature):
return "prove ./%s > %s || ( cat %s && rm %s )" % (source[0], target[0], target[0], target[0])
bld = Builder(generator = test_actions,
suffix = '.tso')
environ = os.environ
env = Environment(ENV=environ, BUILDERS={'Test': bld})
scanner = Scanner(function = perl_scan ,skeys = ['.pm', '.t', '.pl'])
env.Append(SCANNERS = scanner)
for target in glob.glob('**/*.t'):
env.Test(target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment