source: trunk/scons/installtree.py@ 1129

Last change on this file since 1129 was 1129, checked in by mar637, 18 years ago

changed to use scons environments

File size: 1.2 KB
RevLine 
[1124]1import os
2import fnmatch
[1129]3#from SCons.Script import *
[1124]4
[1129]5def 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):]
13 flist = os.listdir(currdir)
14 for currfile in flist:
15 currpath = os.path.join(currdir, currfile)
16 match = 0
17 for pattern in includes:
[1124]18 if fnmatch.fnmatchcase(currfile, pattern):
[1129]19 match = 1
[1124]20 if (match == 1):
[1129]21 for pattern in excludes:
22 if fnmatch.fnmatchcase(currfile, pattern):
23 match = 0
24 if (match == 1):
25 if (os.path.isdir(currpath)):
26 #print "d=" + currpath
27 dirs.append(currpath)
28 else:
29 #print "f=" + currpath
30 env.Install(currdestdir, currpath)
31 return destnode
32
33 env.InstallTree = InstallTree
34def exists(env):
35 return true
Note: See TracBrowser for help on using the repository browser.