[Scons-users] Creation of an archive of source files with Node.all_children()

Paul Grégoire pg.ensiie at gmail.com
Thu Jan 15 05:09:51 EST 2015


Hi,

Sorry to add some noise here, but I am still interested in a solution
for this problem. I did some other tests without success.

Thanks for any help you could give to me.

Paul

2014-12-22 15:25 GMT+01:00 Paul Grégoire <pg.ensiie at gmail.com>:
> Hello,
>
> I try to create an archive of all the sources and dependancies of my
> project. I have tested the FindSourceFiles() method, but this method
> only reports the cpp files and not the associated headers files, so I
> tried to implement it myself.
>
> I use this code :
>
> def get_dep(node):
>     s = set()
>     if node.has_builder():
>         for i in node.all_children():
>             s |= get_dep(i)
>     else:
>         s.add(node)
>     return s
>
> foo = Program(....
>
> s = list(get_dep(foo[0]))
> s.sort()
>
> env.Tar('foo_sources', list(s))
>
> This works well for a simple project, but not for my real project that
> uses subdirectories and the Command method for building targets.
>
> I have created a minimal project that I attach to this mail. It
> contains a subdirectory named sub, a source file named main.cpp, an
> header file named define.h which is created with a call to
> Command('define.h', 'define.inc', 'cp $SOURCE $TARGET')
>
> When I execute the scons command, I obtain the following message :
>
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> tar -c -f sub/all_sources.tar sub/define.inc sub/main.cpp /usr/bin/g++ /bin/cp
> tar: Removing leading `/' from member names
> cp sub/define.inc sub/define.h
> g++ -o sub/main.o -c sub/main.cpp
> g++ -o sub/foo sub/main.o
> scons: done building targets.
> OSError: [Errno 2] No such file or directory: '.sconsign.dblite':
>   File "/usr/local/lib/scons-2.3.4/SCons/Script/Main.py", line 1372:
>     _exec_main(parser, values)
>   File "/usr/local/lib/scons-2.3.4/SCons/Script/Main.py", line 1335:
>     _main(parser)
>   File "/usr/local/lib/scons-2.3.4/SCons/Script/Main.py", line 1099:
>     nodes = _build_targets(fs, options, targets, target_top)
>   File "/usr/local/lib/scons-2.3.4/SCons/Script/Main.py", line 1297:
>     jobs.run(postfunc = jobs_postfunc)
>   File "/usr/local/lib/scons-2.3.4/SCons/Job.py", line 113:
>     postfunc()
>   File "/usr/local/lib/scons-2.3.4/SCons/Script/Main.py", line 1294:
>     SCons.SConsign.write()
>   File "/usr/local/lib/scons-2.3.4/SCons/SConsign.py", line 109:
>     syncmethod()
>   File "/usr/local/lib/scons-2.3.4/SCons/dblite.py", line 127:
>     self._os_unlink(self._file_name)
> Exception OSError: OSError(2, 'No such file or directory') in <bound
> method dblite.__del__ of <SCons.dblite.dblite object at 0x9439e6c>>
> ignored
>
>
> This only happens when I use a subdirectory AND the Command method to
> create a target.
>
> Does someone have an idea to solve my problem, or to explain me why I
> obtain this message ?
>
> Thank you very much,
>
> Paul


More information about the Scons-users mailing list