Merge pull request #1538 from geniusgogo/fixSrcRemove

fixed SrcRemove
This commit is contained in:
Bernard Xiong 2018-06-14 13:30:52 +08:00 committed by GitHub
commit c397c91c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 18 deletions

View File

@ -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 os.path.isabs(item_str):
item_str = os.path.relpath(item_str, GetCurrentDir())
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())
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():