|
Boost-Build : |
Subject: Re: [Boost-build] string manipulation
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2016-10-13 17:38:44
On 13.10.2016 17:02, aaron_at_[hidden] wrote:
> Making Python perform the redirect seems to work:
>
> command = "python -c \"import sys; sys.stderr = sys.stdout; import
> non_existent; print 'asdf'\"" ;
> output = [ SHELL $(command) : strip-eol ] ;
> echo ------------------------ ;
> echo $(output) ;
> echo ------------------------ ;
> exit : 0 ;
>
> Which will output the following:
>
> ------------------------
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> ImportError: No module named non_existent
> ------------------------
>
> That's about the best I could come up with at the moment.
>
OK, that should work indeed. Thanks !
> It would probably be cleaner, though, to just create a script and do
> all of your setup/checking in there and just call out to that script
> to perform the configuration.
>
Well, to be honest, I'm really surprised that BB doesn't support this
use-case. Performing some config checks and handling failures gracefully
is a really basic task in any build infrastructure.
...
I'm actually trying this code:
local result = [ SHELL $(full-cmd) : strip-eol exit-status ] ;
if $(result[2]) = 0
{
ECHO "check passed" ;
}
else
{
ECHO "check failed" ;
}
It turns out this works well if I omit the "strip-eol" flag above. As
soon as I add it, result[2] will always be non-zero, making the above fail.
Can someone please confirm that this is a bug in bjam / b2, and if not,
tell me what I'm doing wrong ?
Thanks,
Stefan
-- ...ich hab' noch einen Koffer in Berlin...
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk