views:

134

answers:

1

I have an SConscript which is being copied to a build directory (variant_dir = ...) for construction. As a workaround for not being able to express dependencies, I'm trying to copy some additional files into the build directory.

How do I determine what the current build directory is, within an SConscript?

For instance, in the following layout, the inner SConscript file should set my_build_directory as, "build/something."

project/
    SConstruct      # "SConscript('something/SConscript', variant_dir = 'build/something')
    something/
        SConscript  # "my_build_directory = ..."
+1  A: 

My answer seems too simple, so maybe I misunderstood the question, but ...

For me, in subdir/SConscript:

my_build_directory = '.'

echo_cmd = Command('always.echo', [],  "echo %s" % (Dir('.').abspath))
Alias('echo', echo_cmd)

produces:

# => cd test-scons
# => ls 
#    build/  SConstruct  subdir/
# => scons echo 
#    scons: Building targets ...
#    echo HOME/test-scons/build/subdir
#    HOME/test-scons/build/subdir
#    scons: done building targets.
Dave Bacher
Actually, that looks like exactly what I want. Let's see...
Andres Jaan Tack