5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
32 test = TestSCons.TestSCons()
34 subdir_SConscript = os.path.join('subdir', 'SConscript')
35 sub1_xxx_exe = test.workpath('sub1', 'xxx.exe')
36 sub2_xxx_exe = test.workpath('sub2', 'xxx.exe')
37 sub3_xxx_exe = test.workpath('sub3', 'xxx.exe')
38 sub4_xxx_exe = test.workpath('sub4', 'xxx.exe')
40 test.subdir('subdir', 'sub1', 'sub2', 'sub3', 'sub4')
42 if sys.platform != 'win32':
43 test.write(sub1_xxx_exe, "\n")
45 os.mkdir(sub2_xxx_exe)
47 test.write(sub3_xxx_exe, "\n")
48 os.chmod(sub3_xxx_exe, 0777)
50 test.write(sub4_xxx_exe, "\n")
51 os.chmod(sub4_xxx_exe, 0777)
53 env_path = os.environ['PATH']
55 pathdirs_1234 = [ test.workpath('sub1'),
56 test.workpath('sub2'),
57 test.workpath('sub3'),
58 test.workpath('sub4'),
59 ] + env_path.split(os.pathsep)
61 pathdirs_1243 = [ test.workpath('sub1'),
62 test.workpath('sub2'),
63 test.workpath('sub4'),
64 test.workpath('sub3'),
65 ] + env_path.split(os.pathsep)
67 test.write('SConstruct', """
70 print WhereIs('xxx.exe')
71 print WhereIs('xxx.exe', %s)
72 print env.WhereIs('xxx.exe', %s)
73 print WhereIs('xxx.exe', %s)
74 print WhereIs('xxx.exe', %s)
75 print WhereIs('xxx.exe', %s, reject=%s)
76 env.Replace( XXXNAME='xxx.exe' )
77 print env.WhereIs( '$XXXNAME', %s )
78 """ % (subdir_SConscript,
79 repr(os.pathsep.join(pathdirs_1234)),
80 repr(os.pathsep.join(pathdirs_1243)),
85 repr(os.pathsep.join(pathdirs_1243)),
88 test.write(subdir_SConscript, """
90 print WhereIs('xxx.exe')
91 print WhereIs('xxx.exe', %s)
92 print env.WhereIs('xxx.exe', %s)
93 print WhereIs('xxx.exe', %s)
94 print WhereIs('xxx.exe', %s)
95 """ % (repr(os.pathsep.join(pathdirs_1234)),
96 repr(os.pathsep.join(pathdirs_1243)),
101 os.environ['PATH'] = os.pathsep.join(pathdirs_1234)
103 expect = [ test.workpath(sub3_xxx_exe),
104 test.workpath(sub3_xxx_exe),
105 test.workpath(sub4_xxx_exe),
106 test.workpath(sub3_xxx_exe),
107 test.workpath(sub4_xxx_exe),
108 test.workpath(sub3_xxx_exe),
109 test.workpath(sub3_xxx_exe),
110 test.workpath(sub4_xxx_exe),
111 test.workpath(sub3_xxx_exe),
112 test.workpath(sub4_xxx_exe),
113 test.workpath(sub3_xxx_exe),
114 test.workpath(sub4_xxx_exe)
117 test.run(arguments = ".",
118 stdout = test.wrap_stdout(read_str = "\n".join(expect) + "\n",
119 build_str = "scons: `.' is up to date.\n"))
121 os.environ['PATH'] = os.pathsep.join(pathdirs_1243)
123 expect = [ test.workpath(sub4_xxx_exe),
124 test.workpath(sub3_xxx_exe),
125 test.workpath(sub4_xxx_exe),
126 test.workpath(sub3_xxx_exe),
127 test.workpath(sub4_xxx_exe),
128 test.workpath(sub4_xxx_exe),
129 test.workpath(sub3_xxx_exe),
130 test.workpath(sub4_xxx_exe),
131 test.workpath(sub3_xxx_exe),
132 test.workpath(sub4_xxx_exe),
133 test.workpath(sub3_xxx_exe),
134 test.workpath(sub4_xxx_exe)
137 test.run(arguments = ".",
138 stdout = test.wrap_stdout(read_str = "\n".join(expect) + "\n",
139 build_str = "scons: `.' is up to date.\n"))
146 # indent-tabs-mode:nil
148 # vim: set expandtab tabstop=4 shiftwidth=4: