summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-06-14 13:30:52 +0800
committerGitHub <[email protected]>2018-06-14 13:30:52 +0800
commitc397c91c1d54abd7a6803f7db3556c4e3327c3e3 (patch)
tree6328ab230c4270179feb3240fb103fe66f80a9b8 /tools
parentb6e436bb59ad2cb2cd32f2e1bef960eeb191f7ee (diff)
parent82a50f29e9286af6adeb183ffe80f7898a7da0e0 (diff)
Merge pull request #1538 from geniusgogo/fixSrcRemove
fixed SrcRemove
Diffstat (limited to 'tools')
-rw-r--r--tools/building.py58
1 files changed, 40 insertions, 18 deletions
diff --git a/tools/building.py b/tools/building.py
index 6c4587b37e..61743bf4a1 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -21,7 +21,7 @@
# Date Author Notes
# 2015-01-20 Bernard Add copyright information
# 2015-07-25 Bernard Add LOCAL_CCFLAGS/LOCAL_CPPPATH/LOCAL_CPPDEFINES for
-# group definition.
+# group definition.
#
import os
@@ -69,7 +69,7 @@ def stop_handling_includes(self, t=None):
d['include'] = self.do_nothing
d['include_next'] = self.do_nothing
d['define'] = self.do_nothing
-
+
PatchedPreProcessor = SCons.cpp.PreProcessor
PatchedPreProcessor.start_handling_includes = start_handling_includes
PatchedPreProcessor.stop_handling_includes = stop_handling_includes
@@ -278,7 +278,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
'ua':('gcc', 'gcc'),
'cdk':('gcc', 'gcc')}
tgt_name = GetOption('target')
-
+
if tgt_name:
# --target will change the toolchain settings which clang-analyzer is
# depend on
@@ -297,10 +297,10 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
and rtconfig.PLATFORM == 'gcc':
AddDepend('RT_USING_MINILIBC')
- AddOption('--genconfig',
+ AddOption('--genconfig',
dest = 'genconfig',
action = 'store_true',
- default = False,
+ default = False,
help = 'Generate .config from rtconfig.h')
if GetOption('genconfig'):
from genconf import genconfig
@@ -308,7 +308,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
exit(0)
if env['PLATFORM'] != 'win32':
- AddOption('--menuconfig',
+ AddOption('--menuconfig',
dest = 'menuconfig',
action = 'store_true',
default = False,
@@ -772,7 +772,7 @@ def EndBuilding(target, program = None):
if GetOption('target') == 'vsc':
from vsc import GenerateVSCode
GenerateVSCode(Env)
-
+
if GetOption('target') == 'cdk':
from cdk import CDKProject
CDKProject('project.cdkproj', Projects)
@@ -803,21 +803,43 @@ def SrcRemove(src, remove):
if not src:
return
- for item in src:
- if type(item) == type('str'):
- item_str = item
- else:
- item_str = item.rstr()
+ src_bak = src[:]
+
+ if type(remove) == type('str'):
+ if os.path.isabs(remove):
+ remove = os.path.relpath(remove, GetCurrentDir())
+ remove = os.path.normpath(remove)
+
+ for item in src_bak:
+ if type(item) == type('str'):
+ item_str = item
+ else:
+ item_str = item.rstr()
- if os.path.isabs(item_str):
- item_str = os.path.relpath(item_str, GetCurrentDir())
+ if os.path.isabs(item_str):
+ item_str = os.path.relpath(item_str, GetCurrentDir())
+ item_str = os.path.normpath(item_str)
- if type(remove) == type('str'):
if item_str == remove:
src.remove(item)
- else:
- for remove_item in remove:
- if item_str == str(remove_item):
+ else:
+ for remove_item in remove:
+ remove_str = str(remove_item)
+ if os.path.isabs(remove_str):
+ remove_str = os.path.relpath(remove_str, GetCurrentDir())
+ remove_str = os.path.normpath(remove_str)
+
+ for item in src_bak:
+ if type(item) == type('str'):
+ item_str = item
+ else:
+ item_str = item.rstr()
+
+ if os.path.isabs(item_str):
+ item_str = os.path.relpath(item_str, GetCurrentDir())
+ item_str = os.path.normpath(item_str)
+
+ if item_str == remove_str:
src.remove(item)
def GetVersion():