Add python scons rules
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664860 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/TSCons.py b/lib/py/src/TSCons.py
new file mode 100644
index 0000000..430b43f
--- /dev/null
+++ b/lib/py/src/TSCons.py
@@ -0,0 +1,11 @@
+from SCons.Builder import Builder
+
+def scons_env(env):
+ cppbuild = Builder(action = 'thrift --cpp $SOURCE')
+ env.Append(BUILDERS = {'ThriftCpp' : cppbuild})
+
+def gen_cpp(env, dir, file):
+ scons_env(env)
+ suffixes = ['_types.h', '_types.cpp']
+ targets = map(lambda s: 'gen-cpp/' + file + s, suffixes)
+ return env.ThriftCpp(targets, dir+file+'.thrift')