[Scons-users] Scons-users Digest, Vol 70, Issue 2
James Rinkevich
rinkevichjm at gmail.com
Sun Oct 1 14:55:07 EDT 2017
No you did not quite get that Bill
The elif clearly limits the type of s at this point to a duck type of
sequence
then l is initialized to an empty sequence type
then in the for loop for each element of s the function recursively is
called on the element returning a string which is appended to l
l is then discarded on the return of the join of s with a blank between
each. This assumes all the elements of s can be converted to a string type
for the join.
Thus l is unneeded and so is the for loop over s, which merely appends
everything to l.
On Sun, Oct 1, 2017 at 10:45 AM, <scons-users-request at scons.org> wrote:
> Send Scons-users mailing list submissions to
> scons-users at scons.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> or, via email, send a message with subject or body 'help' to
> scons-users-request at scons.org
>
> You can reach the person managing the list at
> scons-users-owner at scons.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Scons-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Surprising behavior with pipes (Andrew C. Morrow)
> 2. Module Scons.Util (James Rinkevich)
> 3. Re: Module Scons.Util (Bill Deegan)
> 4. Re: Surprising behavior with pipes (Tom Tanner)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 1 Oct 2017 11:46:15 -0400
> From: "Andrew C. Morrow" <andrew.c.morrow at gmail.com>
> To: Gary Granger <granger at ucar.edu>
> Cc: SCons users mailing list <scons-users at scons.org>
> Subject: Re: [Scons-users] Surprising behavior with pipes
> Message-ID:
> <CA+Acj4e_LpfZv+E8jDcX5mokdBFmCsJzCMFJjC+
> o6jvb0rA9wg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> That does assume that SHELL is set to bash though, right? I'd be OK
> limiting it to POSIX, but going so far as to mandate one particular shell
> implementation feels pretty fragile.
>
> I guess the right solution is to not use pipes, but instead redirect the
> output to an intermediate target and then consume that, making a two step
> process.
>
> Somewhat unfortunate in my case as I really don't need the intermediate
> state and would prefer to avoid the IO cost. Perhaps the intermediate could
> be a tempfile of some sort. Basically, re-implement the pipe by hand.
>
>
> On Wed, Sep 20, 2017 at 12:51 PM, Gary Granger <granger at ucar.edu> wrote:
>
> > When I have had to use pipelines in actions, I have had to set pipefail
> > explicitly, eg:
> >
> > "set -o pipefail; %s 2>&1 | ${ASAN_FILTER}" % (command)
> >
> >
> > On 09/20/2017 08:39 AM, Andrew C. Morrow wrote:
> > >
> > > I noticed to my surprise recently that an Action that uses a pipeline
> > > doesn't fail if one of the subcommands fails:
> > >
> > > https://github.com/mongodb/mongo/blob/master/site_scons/
> > site_tools/abilink.py#L66
> > >
> > > I had a buggy version of abidw installed, and when it crashed with an
> > > assertion, the SCons build did not terminate with an error. Instead
> > > the partial output up to the crash was consumed by md5 and used as the
> > > result.
> > >
> > > Is there a way to ask SCons to enforce pipefail?
> > >
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://pairlist4.pair.net/pipermail/scons-users/
> attachments/20171001/585fd4c5/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 1 Oct 2017 10:16:27 -0700
> From: James Rinkevich <rinkevichjm at gmail.com>
> To: scons-users at scons.org
> Subject: [Scons-users] Module Scons.Util
> Message-ID:
> <CANw3BEcKrcY+9gA8sBh+efHPm=BVS1rvN5Vj++GKBJrzrHJk0Q at mail.
> gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> in this function
> def to_String_for_subst(s,
> isinstance=isinstance, str=str,
> to_String=to_String,
> BaseStringTypes=BaseStringTypes,
> SequenceTypes=SequenceTypes,
> UserString=UserString):
>
> # Note that the test cases are sorted by order of probability.
> if isinstance(s, BaseStringTypes):
> return s
> elif isinstance(s, SequenceTypes):
> l = []
> for e in s:
> l.append(to_String_for_subst(e))
> return ' '.join( s )
> elif isinstance(s, UserString):
> # s.data can only be either a unicode or a regular
> # string. Please see the UserString initializer.
> return s.data
> else:
> return str(s)
>
> the lines
> l = []
> for e in s:
> l.append(to_String_for_subst(e))
> have no effect and just waste time, perhaps someone intended the return
> line to be
> return ' '.join( l )
> instead of
> return ' '.join( s )
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://pairlist4.pair.net/pipermail/scons-users/
> attachments/20171001/c074fcdd/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Sun, 1 Oct 2017 10:27:55 -0700
> From: Bill Deegan <bill at baddogconsulting.com>
> To: SCons users mailing list <scons-users at scons.org>
> Subject: Re: [Scons-users] Module Scons.Util
> Message-ID:
> <CAEyG4CF_aJp9y84BQEjUU96yWgXkz0Fn8qwN=P
> LT3LOdPz++ZA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I think you're mistaken.
> If s is a UserString or not a Sequence or BaseStringTypes then it's
> actually doing something.
>
> It could probably be rewritten as:
>
> return ''.join([to_String_for_subst(e) for e in s])
>
>
>
> On Sun, Oct 1, 2017 at 10:16 AM, James Rinkevich <rinkevichjm at gmail.com>
> wrote:
>
> > in this function
> > def to_String_for_subst(s,
> > isinstance=isinstance, str=str,
> > to_String=to_String,
> > BaseStringTypes=BaseStringTypes,
> > SequenceTypes=SequenceTypes,
> > UserString=UserString):
> >
> > # Note that the test cases are sorted by order of probability.
> > if isinstance(s, BaseStringTypes):
> > return s
> > elif isinstance(s, SequenceTypes):
> > l = []
> > for e in s:
> > l.append(to_String_for_subst(e))
> > return ' '.join( s )
> > elif isinstance(s, UserString):
> > # s.data can only be either a unicode or a regular
> > # string. Please see the UserString initializer.
> > return s.data
> > else:
> > return str(s)
> >
> > the lines
> > l = []
> > for e in s:
> > l.append(to_String_for_subst(e))
> > have no effect and just waste time, perhaps someone intended the return
> > line to be
> > return ' '.join( l )
> > instead of
> > return ' '.join( s )
> >
> >
> >
> > _______________________________________________
> > 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/20171001/5bd1fbea/attachment-0001.html>
>
> ------------------------------
>
> Message: 4
> Date: Sun, 1 Oct 2017 18:44:57 +0100
> From: Tom Tanner <trtanner at btinternet.com>
> To: scons-users at scons.org
> Subject: Re: [Scons-users] Surprising behavior with pipes
> Message-ID: <9745dc43-b64e-c4bb-9c5d-ffb52671ccfd at btinternet.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> On 20/09/2017 15:39, Andrew C. Morrow wrote:
> >
> > I noticed to my surprise recently that an Action that uses a pipeline
> > doesn't fail if one of the subcommands fails:
> >
> > https://github.com/mongodb/mongo/blob/master/site_scons/
> site_tools/abilink.py#L66
> >
> > I had a buggy version of abidw installed, and when it crashed with an
> > assertion, the SCons build did not terminate with an error. Instead
> > the partial output up to the crash was consumed by md5 and used as the
> > result.
> >
> > Is there a way to ask SCons to enforce pipefail?
> >
> > Or should I be approaching this in a different way and not attempting
> > to use pipelines in Actions?
> >
> > Thanks,
> > Andrew
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-users at scons.org
> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>
> That rule does two of the worst things you could possibly do
>
>
> 1 - it uses a pipe
>
> 2 - it uses output redirection to a file.
>
>
> It's sort of a pity scons fires things off to a shell to execute, as
> both of the above can lead to unexpected failures and totally stuff your
> build / cache
>
>
> Firstly, if something in a pipeline fails, there's a good chance the
> failure will just be eaten
>
> Secondly, if your output redirection goes astray - well, no runtime
> system I've come across checks the error return when closing STDOUT. And
> yes, I have had had to recover the mess when disk space ran out, and the
> build was considered successful.
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://pairlist4.pair.net/pipermail/scons-users/
> attachments/20171001/e6424805/attachment.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
> ------------------------------
>
> End of Scons-users Digest, Vol 70, Issue 2
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20171001/16fde6f9/attachment.html>
More information about the Scons-users
mailing list