summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-08-22 06:19:04 +0000
committer[email protected] <[email protected]>2012-08-22 06:19:04 +0000
commit8e95bc94b6b18acf2a6c868d12fb36d2d174b1bf (patch)
tree0e5a7afe4442fc4ad38afc0108db46a04647748c /tools
parent3ea99e46f3d5abed30d5f8b81be74a9eb557ffa4 (diff)
add --copy-header option to copy header of RT-Thread to local.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2257 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'tools')
-rw-r--r--tools/building.py57
1 files changed, 56 insertions, 1 deletions
diff --git a/tools/building.py b/tools/building.py
index 8373d3ccd9..f59d856bd4 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -71,7 +71,12 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
action='store_true',
default=False,
help='copy rt-thread directory to local.')
-
+ AddOption('--copy-header',
+ dest='copy-header',
+ action='store_true',
+ default=False,
+ help='copy header of rt-thread directory to local.')
+
# add target option
AddOption('--target',
dest='target',
@@ -252,6 +257,8 @@ def EndBuilding(target, program = None):
if GetOption('copy') and program != None:
MakeCopy(program)
+ if GetOption('copy-header') and program != None:
+ MakeCopyHeader(program)
def SrcRemove(src, remove):
if type(src[0]) == type('str'):
@@ -392,3 +399,51 @@ def MakeCopy(program):
do_copy_folder(os.path.join(RTT_ROOT, "tools"), os.path.join(target_path, "tools"))
do_copy_file(os.path.join(RTT_ROOT, 'AUTHORS'), os.path.join(target_path, 'AUTHORS'))
do_copy_file(os.path.join(RTT_ROOT, 'COPYING'), os.path.join(target_path, 'COPYING'))
+
+def MakeCopyHeader(program):
+ global source_ext
+ source_ext = []
+ source_ext = ["h", "xpm"]
+ global source_list
+ global Rtt_Root
+ global Env
+
+ target_path = os.path.join(Dir('#').abspath, 'rt-thread')
+
+ if Env['PLATFORM'] == 'win32':
+ RTT_ROOT = Rtt_Root.lower()
+ else:
+ RTT_ROOT = Rtt_Root
+
+ if target_path.startswith(RTT_ROOT):
+ return
+
+ for item in program:
+ walk_children(item)
+
+ source_list.sort()
+
+ # filte source file in RT-Thread
+ target_list = []
+ for src in source_list:
+ if Env['PLATFORM'] == 'win32':
+ src = src.lower()
+
+ if src.startswith(RTT_ROOT):
+ target_list.append(src)
+
+ source_list = target_list
+
+ for src in source_list:
+ dst = src.replace(RTT_ROOT, '')
+ if dst[0] == os.sep or dst[0] == '/':
+ dst = dst[1:]
+ print '=> ', dst
+ dst = os.path.join(target_path, dst)
+ do_copy_file(src, dst)
+
+ # copy tools directory
+ print "=> tools"
+ do_copy_folder(os.path.join(RTT_ROOT, "tools"), os.path.join(target_path, "tools"))
+ do_copy_file(os.path.join(RTT_ROOT, 'AUTHORS'), os.path.join(target_path, 'AUTHORS'))
+ do_copy_file(os.path.join(RTT_ROOT, 'COPYING'), os.path.join(target_path, 'COPYING'))