[DEV] remove unneeded file in shared folder
This commit is contained in:
parent
1ac0ecd5c5
commit
7d48e91b9b
@ -192,6 +192,20 @@ def copy_list(in_list):
|
|||||||
# note we force the copy to disable the check of needed of copy (already done)
|
# note we force the copy to disable the check of needed of copy (already done)
|
||||||
copy_file(in_list[dst]["src"], dst, cmd_file=in_list[dst]["cmd_file"], force=True)
|
copy_file(in_list[dst]["src"], dst, cmd_file=in_list[dst]["cmd_file"], force=True)
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Clean a path from all un-needed element in a directory
|
||||||
|
## @param[in] path Path to clean
|
||||||
|
## @param[in] normal_list List of all files/path in the path
|
||||||
|
##
|
||||||
|
def clean_directory(path, normal_list):
|
||||||
|
# get a list of all element in the path:
|
||||||
|
for root, dirnames, filenames in os.walk(path):
|
||||||
|
for file in filenames:
|
||||||
|
file_name = os.path.join(root, file)
|
||||||
|
if file_name not in normal_list:
|
||||||
|
debug.print_element("remove file ", os.path.relpath(file_name), "==>", "---")
|
||||||
|
os.remove(file_name)
|
||||||
|
|
||||||
def filter_extention(list_files, extentions, invert=False):
|
def filter_extention(list_files, extentions, invert=False):
|
||||||
out = []
|
out = []
|
||||||
for file in list_files:
|
for file in list_files:
|
||||||
|
@ -112,10 +112,11 @@ class Target(target.Target):
|
|||||||
tools.create_directory_of_file(target_outpath)
|
tools.create_directory_of_file(target_outpath)
|
||||||
|
|
||||||
## Create share datas:
|
## Create share datas:
|
||||||
|
target_shared_path = os.path.join(target_outpath, self.pkg_path_data)
|
||||||
if static == True:
|
if static == True:
|
||||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
target_outpath_data = os.path.join(target_shared_path, pkg_name)
|
||||||
else:
|
else:
|
||||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
|
target_outpath_data = target_shared_path
|
||||||
tools.create_directory_of_file(target_outpath_data)
|
tools.create_directory_of_file(target_outpath_data)
|
||||||
# prepare list of copy files
|
# prepare list of copy files
|
||||||
copy_list={}
|
copy_list={}
|
||||||
@ -143,7 +144,8 @@ class Target(target.Target):
|
|||||||
in_list=copy_list)
|
in_list=copy_list)
|
||||||
#real copy files
|
#real copy files
|
||||||
tools.copy_list(copy_list)
|
tools.copy_list(copy_list)
|
||||||
|
# remove unneded files (NOT folder ...)
|
||||||
|
tools.clean_directory(target_shared_path, copy_list)
|
||||||
|
|
||||||
## copy binary files:
|
## copy binary files:
|
||||||
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
|
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user