[Scons-users] compiler detection
Gary Oberbrunner
garyo at oberbrunner.com
Mon Oct 29 16:42:54 EDT 2012
On Mon, Oct 29, 2012 at 3:40 PM, Evan Driscoll <driscoll at cs.wisc.edu> wrote:
> On 10/29/2012 02:40 PM, Kraus Philipp wrote:
> >
> > Am 29.10.2012 um 18:21 schrieb Evan Driscoll:
> >> Native Python/SCons knows nothing of MinGW paths; the /usr/bin/sh and
> >> /c/blah paths are translated to Windows paths by the MinGW libraries.
> >>
> >> You need to set env["SHELL'] to whatever the physical location of sh.exe
> >> is, e.g. env["SHELL"] = "c:/programs/mingw/bin/sh.exe" to make
> something up.
> >
> > The scons script is run from the MinGW shell (it is /bin/sh).
>
> ...as I said before, that doesn't matter.
>
>
> > I have tried to setup the Windows
> > path to the sh.exe and also the unix-styled path, in all cases the
> env.command stops with
> > the error that the shell is not found.
>
> Open CMD.exe and enter the Windows path to sh.exe. Does it run?
>
> When you put in the Windows path, are you perhaps using
> unescaped-backslashes (which are then escaping other things)? Is there
> any chance you're overwriting env["SHELL"] with something else later?
>
> What's the (Windows) path to sh.exe? What's the exact line you're using
> to set env["SHELL"]?
>
> And Philipp, don't forget what Evan said in the other thread; to use mingw
shell as the shell for Commands in a native-python SCons, you will have to
set the spawn function:
from SCons.Platform.win32 import exec_spawn
import os
env = Environment(ENV = {'PATH' : os.environ["PATH"]})
env["SHELL"]=env.WhereIs("bash")
env["SPAWN"] = (lambda sh, esc, cmd, args, env_param:
exec_spawn([sh, '-c', ' '.join(args)], env_param))
(actually I'm not 100% sure that is sufficient, because cmd.exe and sh/bash
have different quoting rules, and I'm not sure this handles
quoting/escaping... but it's a start anyway.)
Of course there's another way: in the Command itself, just do:
env.Command('tgt', 'src', '''c:/programs/mingw/bin/sh.exe -c cat "$SOURCE"
> "$TARGET"''')
but even there you will have to probably do some pathname manipulation (at
least sometimes), because $SOURCE will expand to the Windows path, not
mingw.
--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20121029/01b4c3d0/attachment.htm>
More information about the Scons-users
mailing list