Merge pull request #4655 from bdbaddog/fix_new_ninja_package
[scons.git] / test / Install / rec-sub-dir.py
blob0a11928c373e38faab46c3a267ac3afa2fa73c84
1 #!/usr/bin/env python
3 # MIT Licenxe
5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 """
27 Test using Install() on directory that contains existing subdirectories
28 causing copytree recursion where the directory already exists.
29 """
31 import os.path
33 import TestSCons
35 test = TestSCons.TestSCons()
37 test.write('SConstruct', """\
38 DefaultEnvironment(tools=[])
39 Execute(Mkdir('a/b/c'))
40 Execute(Mkdir('b/c/d'))
41 Install('z', 'a')
42 Install('z/a', 'b')
43 """)
45 expect="""\
46 Mkdir("a/b/c")
47 Mkdir("b/c/d")
48 Install directory: "a" as "z%sa"
49 Install directory: "b" as "z%sa%sb"
50 """ % (os.sep, os.sep, os.sep)
51 test.run(arguments=["-Q"], stdout=expect)
53 test.must_exist(test.workpath('a', 'b', 'c'))
54 test.must_exist(test.workpath('b', 'c', 'd'))
55 test.must_exist(test.workpath('z', 'a', 'b', 'c', 'd'))
57 # this run used to fail on Windows with an OS error before the copytree fix
58 test.run(arguments=["-Q"])
60 test.pass_test()
62 # Local Variables:
63 # tab-width:4
64 # indent-tabs-mode:nil
65 # End:
66 # vim: set expandtab tabstop=4 shiftwidth=4: