Update GlobSubDir() function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2321 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2012-10-06 03:01:02 +00:00
parent 7cc241301a
commit 4cb779d743
1 changed files with 14 additions and 7 deletions

View File

@ -332,14 +332,21 @@ def GlobSubDir(sub_dir, ext_name):
import os
import glob
list = os.listdir(sub_dir)
src = glob.glob(os.path.join(sub_dir, ext_name))
def glob_source(sub_dir, ext_name):
list = os.listdir(sub_dir)
src = glob.glob(os.path.join(sub_dir, ext_name))
for item in list:
full_subdir = os.path.join(sub_dir, item)
if os.path.isdir(full_subdir):
src += GlobSubDir(full_subdir, ext_name)
return src
for item in list:
full_subdir = os.path.join(sub_dir, item)
if os.path.isdir(full_subdir):
src += glob_source(full_subdir, ext_name)
return src
dst = []
src = glob_source(sub_dir, ext_name)
for item in src:
dst.append(os.path.relpath(item, sub_dir))
return dst
def do_copy_file(src, dst):
import shutil