[Scons-users] Scons understanding existing project

Dirk Bächle tshortik at gmx.de
Thu Aug 4 14:08:33 EDT 2016


Hi Pietro,

On 04.08.2016 18:25, Pietro Paolini wrote:
> Hi all,
>
> I am wrestling to print out the sources files resulting in a certain target being built, I have inserted a print statement into the
> Sconscript file as following :
>
>      src += [task_c]
>      for p_file in src:
>          print(p_file)
>      env.Program('executable-name', source = src)
>
> But all I get is :
>
> * [<SCons.Node.FS.File object at 0x7f08505a4390>]                          *
> * [<SCons.Node.FS.File object at 0x7f08505b0050>, <SCons.Node.FS.File object at 0x7f08505b0690>, <SCons.Node.FS.File object at
> 0x7f08505b0550>, <SCons.Node.FS.File object at 0x7f08505b0a90>, <SCons.Node.FS.Fil
> e object at 0x7f08505b0950>, <SCons.Node.FS.File object at 0x7f08505a4ed0>, <SCons.Node.FS.File object at 0x7f08505b0310>] *
>
>
> Is there any way to print the actual file name ?
>

instead of fiddling with Node objects yourself, you could also simly call:

   scons --tree=all executable_name

which would print you the list of sources and dependencies for the single target "executable_name". Is this perhaps what you're 
actually after?
Note how wrapping a File/Dir object in the "str()" method as in

   f = env.File('local.file')
   print str(f)

will yield the relative path of the Node object...

Best regards,

Dirk



More information about the Scons-users mailing list