diff options
author | Ben Webb <benmwebb@gmail.com> | 2009-03-31 01:53:59 (GMT) |
---|---|---|
committer | Ben Webb <benmwebb@gmail.com> | 2009-03-31 01:53:59 (GMT) |
commit | 8ef9fa96bce4b29b755c8ec2fa4b51cc5c51d5d5 (patch) | |
tree | 20114146c109f288e1e96436a67d33a788fb069c /src/engine/SCons | |
parent | 3469e3b99156774d1f6cbd2efc12a477a2799faf (diff) | |
download | SCons-8ef9fa96bce4b29b755c8ec2fa4b51cc5c51d5d5.zip SCons-8ef9fa96bce4b29b755c8ec2fa4b51cc5c51d5d5.tar.gz SCons-8ef9fa96bce4b29b755c8ec2fa4b51cc5c51d5d5.tar.bz2 |
Be sure to honor the setting of SWIGOUTDIR when the SWIG tool generates
Python wrappers.
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Tool/swig.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index b62d593..fef1ff2 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -90,8 +90,18 @@ def _swigEmitter(target, source, env): mnames, directors = _find_modules(src) if directors: _add_director_header_targets(target, env) - target.extend(map(lambda m, d=target[0].dir: - d.File(m + ".py"), mnames)) + python_files = map(lambda m: m + ".py", mnames) + outdir = env.subst('$SWIGOUTDIR', target=target, source=source) + # .py files should be generated in SWIGOUTDIR if specified, + # otherwise in the same directory as the target + if outdir: + python_files = map(lambda j, o=outdir: + env.fs.File(os.path.join(o, j)), + python_files) + else: + python_files = map(lambda m, d=target[0].dir: + d.File(m), python_files) + target.extend(python_files) if "-java" in flags: if mnames is None: mnames, directors = _find_modules(src) |