Rev | Line | |
---|
[1124] | 1 | import os
|
---|
| 2 | import fnmatch
|
---|
| 3 | from SCons.Script import *
|
---|
| 4 |
|
---|
| 5 | def InstallTree(env, dest_dir, src_dir, includes, excludes):
|
---|
| 6 | destnode = env.Dir(dest_dir)
|
---|
| 7 | dirs = []
|
---|
| 8 | dirs.append(src_dir)
|
---|
| 9 | while len(dirs) > 0:
|
---|
| 10 | currdir = dirs.pop(0)
|
---|
| 11 | currdestdir = dest_dir + currdir[len(src_dir):]
|
---|
| 12 | flist = os.listdir(currdir)
|
---|
| 13 | for currfile in flist:
|
---|
| 14 | currpath = os.path.join(currdir, currfile)
|
---|
| 15 | match = 0
|
---|
| 16 | for pattern in includes:
|
---|
| 17 | if fnmatch.fnmatchcase(currfile, pattern):
|
---|
| 18 | match = 1
|
---|
| 19 | if (match == 1):
|
---|
| 20 | for pattern in excludes:
|
---|
| 21 | if fnmatch.fnmatchcase(currfile, pattern):
|
---|
| 22 | match = 0
|
---|
| 23 | if (match == 1):
|
---|
| 24 | if (os.path.isdir(currpath)):
|
---|
| 25 | #print "d=" + currpath
|
---|
| 26 | dirs.append(currpath)
|
---|
| 27 | else:
|
---|
| 28 | #print "f=" + currpath
|
---|
| 29 | env.Install(currdestdir, currpath)
|
---|
| 30 | return destnode
|
---|
Note:
See
TracBrowser
for help on using the repository browser.