[Scons-users] SWIG emitter patch
bill at baddogconsulting.com
Fri Jan 19 15:56:18 EST 2018
Any chance you could make a pull request with a test to cover this new
On Fri, Jan 19, 2018 at 1:56 PM, E.Z. Evgenii <dreamlands at hotmail.com>
> I ended up monkey-patching SWIG emitter to work when module name is not
> inside *.i* file, but provided with *-module* option instead. The latter
> is preferred for us, because we often need to base some names off this
> module name, and we don't want to have it in two places.
> The original code in *SCons/Tool/swig.py* completely ignores this option
> and results in not emitting anything.
> Here's a chunk of code I patched:
> def _swigEmitter(target, source, env):
> swigflags = env.subst("$SWIGFLAGS", target=target, source=source)
> flags = SCons.Util.CLVar(swigflags)
> for src in source:
> src = str(src.rfile())
> *##### Replace this line:* mnames = None
> * ##### Begin patch*
> * try:*
> * mod_index = flags.index('-module')*
> * mod_name = flags[mod_index+1]*
> * mnames = [mod_name] if mod_name else None*
> * except ValueError, IndexError:*
> * mnames = None*
> * directors = 0*
> * ##### end patch*
> if "-python" in flags and "-noproxy" not in flags:
> # etc. etc.
> I now get the .py file emitted (should work for other languages, as this
> is a language-independent section)
> It would be nice to have that inside SCons, by default.
> I am using 2.5.0, by the way.
> Scons-users mailing list
> Scons-users at scons.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scons-users