Boost logo

Boost :

From: Ullrich Koethe (u.koethe_at_[hidden])
Date: 2001-07-18 12:08:03


David Turner wrote:
>
> Hello all,
>
> David Abrahams a écrit :
> >
> > Ulli,
> >
> > the problem with this approach is that the Jam architecture does not allow
> > the running of shell commands at any point where this information can be
> > used. The info would have to be located in an environment variable at the
> > time Jam is invoked in order to be interpreted by any of the Jam code.
> >
> > I have often wished for some way to call into the system during the rule
> > evaluation phase, so I could find out things like "which version of Python
> > is installed", etc., but this would be a fairly significant change to the
> > Jam architecture and would certainly invite abuse. Maybe the best thing
> > would be to invoke Jam from a script that does a few of these jobs and
> > passes the results in variables on the Jam command-line. On the other hand,
> > there's something to be said for being able to do the whole job with a
> > single tool. I wonder what David Turner thinks of this?
> >
> The solution would be to implement a new built-in (let's name it "EXEC" or "SHELL")
> that would return the output of a shell command like in:
>
> uname = [ EXEC "uname -a" ] ;
>
> the built-in SUBST could also be used to filter the fields then :o)
>

This looks good. It would be even better if the command's return/exit
code could also be retrieved within Jam :-)

> The problem is that we need to redirect the standard output to a Jam
> string (if it's small enough). GNU Make already provides something similar
> with its "shell" function, but the Win32 implementation is definitely
> _not_ pretty.
>

I've had a look at the Python implementation of this functionality, and
it's also not exactly a straightforward solution. But at least it's
clean and comprehensible code.

Perhaps, for the particular task of finding out the OS name and version,
I direct library call would be easier?

Regards
Ulli

-- 
 ________________________________________________________________
|                                                                |
| Ullrich Koethe  Universität Hamburg / University of Hamburg    |
|                 FB Informatik / Dept. of Computer Science      |
|                 AB Kognitive Systeme / Cognitive Systems Group |
|                                                                |
| Phone: +49 (0)40 42883-2573                Vogt-Koelln-Str. 30 |
| Fax:   +49 (0)40 42883-2572                D - 22527 Hamburg   |
| Email: u.koethe_at_[hidden]               Germany             |
|        koethe_at_[hidden]                        |
| WWW:   http://kogs-www.informatik.uni-hamburg.de/~koethe/      |
|________________________________________________________________|

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk