Last change
on this file since 1148 was 1137, checked in by mar637, 18 years ago |
added hack to prevent scons from failing when ditr doesn't exists
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1124] | 1 | import os
|
---|
| 2 | import fnmatch
|
---|
[1129] | 3 | #from SCons.Script import *
|
---|
[1124] | 4 |
|
---|
[1129] | 5 | def generate(env):
|
---|
| 6 | def InstallTree(dest_dir, src_dir, includes, excludes):
|
---|
| 7 | destnode = env.Dir(dest_dir)
|
---|
| 8 | dirs = []
|
---|
| 9 | dirs.append(src_dir)
|
---|
| 10 | while len(dirs) > 0:
|
---|
| 11 | currdir = dirs.pop(0)
|
---|
| 12 | currdestdir = dest_dir + currdir[len(src_dir):]
|
---|
[1137] | 13 | if not os.path.exists(currdir): return
|
---|
[1129] | 14 | flist = os.listdir(currdir)
|
---|
| 15 | for currfile in flist:
|
---|
| 16 | currpath = os.path.join(currdir, currfile)
|
---|
| 17 | match = 0
|
---|
| 18 | for pattern in includes:
|
---|
[1124] | 19 | if fnmatch.fnmatchcase(currfile, pattern):
|
---|
[1129] | 20 | match = 1
|
---|
[1124] | 21 | if (match == 1):
|
---|
[1129] | 22 | for pattern in excludes:
|
---|
| 23 | if fnmatch.fnmatchcase(currfile, pattern):
|
---|
| 24 | match = 0
|
---|
| 25 | if (match == 1):
|
---|
| 26 | if (os.path.isdir(currpath)):
|
---|
| 27 | #print "d=" + currpath
|
---|
| 28 | dirs.append(currpath)
|
---|
| 29 | else:
|
---|
| 30 | #print "f=" + currpath
|
---|
| 31 | env.Install(currdestdir, currpath)
|
---|
| 32 | return destnode
|
---|
| 33 |
|
---|
| 34 | env.InstallTree = InstallTree
|
---|
| 35 | def exists(env):
|
---|
| 36 | return true
|
---|
Note:
See
TracBrowser
for help on using the repository browser.