From 4cb779d743d484c0ffc4c53a4421969984e02dd7 Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Sat, 6 Oct 2012 03:01:02 +0000 Subject: [PATCH] Update GlobSubDir() function. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2321 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- tools/building.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/building.py b/tools/building.py index ad449b9884..bef7761a2a 100644 --- a/tools/building.py +++ b/tools/building.py @@ -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