From e2bd58da293bfefc5082d7e227b7b4244c73b497 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Tue, 31 Oct 2006 05:09:24 +0000 Subject: [PATCH] Add python scons rules git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664860 13f79535-47bb-0310-9956-ffa450edef68 --- bootstrap.sh | 1 - lib/py/src/TSCons.py | 11 +++++++++++ lib/py/src/__init__.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lib/py/src/TSCons.py diff --git a/bootstrap.sh b/bootstrap.sh index 9d8ac58b..e994cc17 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -29,7 +29,6 @@ install-sh \ .libs \ libtool \ ltmain.sh \ -Makefile.in \ missing echo "SUBDIRS = ${subdirs}" > Makefile.am diff --git a/lib/py/src/TSCons.py b/lib/py/src/TSCons.py new file mode 100644 index 00000000..430b43fd --- /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') diff --git a/lib/py/src/__init__.py b/lib/py/src/__init__.py index 9ddc3ce1..11aeca94 100644 --- a/lib/py/src/__init__.py +++ b/lib/py/src/__init__.py @@ -1 +1 @@ -__all__ = ["Thrift"] +__all__ = ["Thrift", "TSCons"] -- 2.17.1