Search code examples
sconssdl-2

scons not using PATH for ParseConfig


I have a simple SConstruct file that contains the following:

env = Environment()
env.ParseConfig('sdl2-config --cflags')

When I run it, I get the following error:

$scons
scons: Reading SConscript files ...
/bin/sh: sdl2-config: command not found

However, I can run sdl2-config from the same shell:

$ sdl2-config --cflags
-I/opt/local/include/SDL2 -D_THREAD_SAFE
$ which sdl2-config
/opt/local/bin/sdl2-config

Is there something special I need to do to make scons use my PATH? I'm on MacOS 10.9.5, using scons 2.3.4 installed by MacPorts.


Solution

  • Yes. SCons does not use the user's path by default. You need to pass the PATH explicitly to the Environment:

    import os
    env = Environment(ENV = {'PATH' : os.environ['PATH']})
    

    See the SCons FAQ.