from __future__ import with_statement, print_function

EnsurePythonVersion(2, 6)  # For 'with' statement


def test_data(target, source, env):
    if len(target) != 1:
        raise ValueError("only one target")
    elif len(source) != 1:
        raise ValueError("only one source")

    with open(str(source[0]), 'r') as input_file:
        with open(str(target[0]), 'w') as output_file:
            print("testdata =", input_file.read(), ";", sep="",
                    file=output_file)


env = Environment()
env.Command('testdata.js', '#/testdata.json', test_data)
