Debian Codegraph @

test/Actions/pre-post-fixture/work2/SConstruct

raw
1 # SPDX-License-Identifier: MIT
2 #
3 # Copyright The SCons Foundation
4
5 def b(target, source, env):
6 with open(target[0], 'wb') as f:
7 f.write((env['X'] + '\n').encode())
8
9 DefaultEnvironment(tools=[])
10 env1 = Environment(X='111', tools=[])
11 env2 = Environment(X='222', tools=[])
12 B = Builder(action=b, env=env1, multi=1)
13 print("B =", B)
14 print("B.env =", B.env)
15 env1.Append(BUILDERS={'B': B})
16 env2.Append(BUILDERS={'B': B})
17 env3 = env1.Clone(X='333')
18 print("env1 =", env1)
19 print("env2 =", env2)
20 print("env3 =", env3)
21 f1 = env1.B(File('file1.out'), [])
22 f2 = env2.B('file2.out', [])
23 f3 = env3.B('file3.out', [])
24
25 def do_nothing(env, target, source):
26 pass
27
28 AddPreAction(f2[0], do_nothing)
29 AddPostAction(f3[0], do_nothing)
30 print("f1[0].builder =", f1[0].builder)
31 print("f2[0].builder =", f2[0].builder)
32 print("f3[0].builder =", f3[0].builder)
33 print("f1[0].env =", f1[0].env)
34 print("f2[0].env =", f2[0].env)
35 print("f3[0].env =", f3[0].env)