[Scons-users] SWIG emitter patch

E.Z. Evgenii dreamlands at hotmail.com
Sun Jan 21 02:46:44 EST 2018


I can file a bug report, with this code piece, if that's what you mean.

I am new here and don't know what pull request is.

I also haven't tried the test set up. I suppose I could write a test for this, but it would take time to learn, and I don't have much spare time.

I should write a unit test for my patch anyway...

Evgenii


________________________________
Date: Fri, 19 Jan 2018 15:56:18 -0500
From: Bill Deegan <bill at baddogconsulting.com>
To: SCons users mailing list <scons-users at scons.org>
Subject: Re: [Scons-users] SWIG emitter patch
Message-ID:
        <CAEyG4CE7_4kEPNWGRmvHMp3rD0xskMg8bD13Kh2VT0C31hm_=g at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Evgenii,

Any chance you could make a pull request with a test to cover this new
functionality?

-Bill

On Fri, Jan 19, 2018 at 1:56 PM, E.Z. Evgenii <dreamlands at hotmail.com>
wrote:

> Hello.
>
> 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.
>
> Evgenii
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180119/3932150a/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
Scons-users Info Page - pairlist4.pair.net<https://pairlist4.pair.net/mailman/listinfo/scons-users>
pairlist4.pair.net
A general discussion list for the SCons project's end users. Questions, discussion and suggestions are all appropriate here. If you're in doubt as to whether a post ...





------------------------------

End of Scons-users Digest, Vol 74, Issue 8
******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180121/ca3b5993/attachment.html>


More information about the Scons-users mailing list