ran
ran

Reputation: 33

scons Command function not working

I am trying to use the Command function form my SConscript in SCons but with no success. When I create a new SConstruct out of my project and put the same lines in the SConstuct it works.

env = Environment()
testing1= env.Command(None,None,'ls -l')
AlwaysBuild(testing1)

I do not understand why the simple Command is not working from my project SConscript and outside it does.

The output from my project is:

scons: done reading SConscript files.
scons: Building targets ...
scons: Nothing to be done for `/myproject/SConscript'.
scons: done building targets.

Thanks in advance for your help.

Upvotes: 2

Views: 3160

Answers (1)

dirkbaechle
dirkbaechle

Reputation: 4052

SCons is a "build" system, so it expects you to have something like a "target" file/folder that you want to create (=build). If in your SConscript you would call the Command builder as:

env.Command("mydummy", None, 'ls -l')

(without the AlwaysBuild call), SCons would try to build "mydummy" by calling the command "ls -l". It would do this over and over again, because "ls -l" never creates the requested target file...unless you change the Action to "ls -l > mydummy", or the file exists already.

Upvotes: 4

Related Questions