views:

25

answers:

1

I'm using SCons for building a project and need to add a symbolic link to a file it is installing via env.Install. What command(s) will make a link that's the equivalent of running ln -s on the command line?

+1  A: 

SCons doesn't have a dedicated symbolic link command, but you can use os.symlink(src, dst) from Python's os module:

import os
env = Environment()
def SymLink(target, source, env):
    os.symlink(str(source[0]), str(target[0]))
env.Command("file.out", "file.in", SymLink)

This may not work correctly on Windows, I've only tried it on Linux.

rq