[Scons-users] strange File() behaviour

voxspox voxspox at gmx.net
Wed Oct 5 10:08:27 EDT 2016


Hi,

for preparing a report after some build stages I read in files. I use 
the File() method of the File class to access a file in the same folder 
as the origin file.

I experience very strange results for the new node. Here some code. The 
variable "node" is the return value of a builder.


print 'Report:'
print '0', node, type(node)
print '1', node.File('file1')
print '2', node.Dir('dir1')
print '3', node.Dir('dir2').File('file2')
print '4', node.Entry('entry1')

env = node.get_build_env()
filepath = os.path.join(os.path.dirname(str(node)), 'file3')
print '5', filepath
print '6', env.File(filepath)


output the following:

Report:
0 build/FFT/GCC/main.result <class 'SCons.Node.FS.File'>
1 FFT/file1
2 build/FFT/GCC/dir1
3 FFT/dir2/file2
4 FFT/entry1
5 build/FFT/GCC/file3
6 FFT/file3


I expect 1 to be "build/FFT/GCC/file1".

Especially the difference between 5 and 6 is very strange. Is there 
happening some magic?

regards Knut,


SCons 2.4.1 / Python 2.7.12


More information about the Scons-users mailing list