Ignore:
Timestamp:
08/11/06 12:27:39 (18 years ago)
Author:
mar637
Message:

changed to use scons environments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scons/installtree.py

    r1124 r1129  
    11import os
    22import fnmatch
    3 from SCons.Script import *
     3#from SCons.Script import *
    44
    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:
     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:
    2118                    if fnmatch.fnmatchcase(currfile, pattern):
    22                         match = 0
     19                        match = 1
    2320                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
     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 TracChangeset for help on using the changeset viewer.