From 98fff47346a2e1fcdb29297635578374e9307255 Mon Sep 17 00:00:00 2001
From: Jon Nordby <jononor@gmail.com>
Date: Sat, 5 Jan 2013 22:18:57 +0100
Subject: [PATCH] build: Use a scons Command to build Python module
 _mypaintlib.so

---
 lib/SConscript | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/SConscript b/lib/SConscript
index 4627621..ff30db3 100644
--- a/lib/SConscript
+++ b/lib/SConscript
@@ -17,9 +17,11 @@ env = mypaintlib_env
 # 
 # I have given up. Scons just can't get the dependencies right with those
 # code generators. Let's give scons a "normal" c++ project to dependency-scan.
+
 swig_opts = '-DHAVE_GEGL' if env['enable_gegl'] else ''
-if env.Execute('swig -Wall -o mypaintlib_wrap.cpp -noproxydel -python -c++ %s mypaintlib.i' % swig_opts):
-    Exit(1)
+def run_swig(env, target, source):
+    env.Execute('swig -Wall -o %s -noproxydel -python -c++ %s %s' % (str(target[0]), swig_opts, str(source[0])))
+env.Command('mypaintlib_wrap.cpp', 'mypaintlib.i', run_swig)
 env.Clean('.', 'mypaintlib_wrap.cpp')
 env.Clean('.', 'mypaintlib.py')
 env.Clean('.', Glob('*.o'))
@@ -103,6 +105,7 @@ if env.get('CPPDEFINES'):
 
 # python extension module
 src = 'mypaintlib_wrap.cpp'
+env.Depends(src, '../brushlib/mypaint-brush-settings-gen.h') #FIXME: this should not be neccesary??
 module = build_py_module(env, '../_mypaintlib', Split(src), SHLIBPREFIX="")
 
 Return('module')
-- 
1.8.1

