4
Traverses a directory and output the code that would create the same directory
5
structure during testing. Assumes that the instance of Tester is called 't'.
14
print "usage: load_dir.py directory"
17
def remove_first_component(path):
20
s = os.path.split(result[0])
24
return apply(os.path.join, result[1:])
27
def create_file(arg, dirname, fnames):
29
path = os.path.join(dirname, n)
30
if not os.path.isdir(path):
31
print "t.write(\"%s\", \"\"\"" % (remove_first_component(path),),
38
header = """#!/usr/bin/python
40
# Copyright (C) FILL SOMETHING HERE 2005.
41
# Distributed under the Boost Software License, Version 1.0. (See
42
# accompanying file LICENSE_1_0.txt or copy at
43
# http://www.boost.org/LICENSE_1_0.txt)
47
t = BoostBuild.Tester()
54
t.expect_addition("bin/$toolset/debug/FILL_SOME_HERE.exe")
61
if len(sys.argv) != 2:
66
if not os.access(path, os.F_OK):
67
print "Path '%s' does not exist" % (path,)
70
if not os.path.isdir(path):
71
print "Path '%s' is not a directory" % (path,)
75
os.path.walk(path, create_file, None)
80
if __name__ == '__main__':