summaryrefslogtreecommitdiff
path: root/tools/mkdist.py
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2023-09-14 18:40:45 -0400
committerMeco Man <[email protected]>2023-09-15 08:52:48 -0400
commitc19c907b62e241b0649673e8cfd02bb46f48d18c (patch)
treeea4abd27354ae0759e3ff756e0fbb856312a5003 /tools/mkdist.py
parente7c3ca61fd2a13fe8d1623e7cdd215f17eedf13c (diff)
[env] remove --dist-strip command
Diffstat (limited to 'tools/mkdist.py')
-rw-r--r--tools/mkdist.py127
1 files changed, 0 insertions, 127 deletions
diff --git a/tools/mkdist.py b/tools/mkdist.py
index b7ca7ffc56..64458961e4 100644
--- a/tools/mkdist.py
+++ b/tools/mkdist.py
@@ -182,133 +182,6 @@ def zip_dist(dist_dir, dist_name):
zip.close()
-def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
- global source_list
-
- print('make distribution and strip useless files....')
-
- dist_name = os.path.basename(BSP_ROOT)
- dist_dir = os.path.join(BSP_ROOT, 'dist-strip', dist_name)
- rtt_dir_path = os.path.join(dist_dir, 'rt-thread')
-
- print('=> %s' % os.path.basename(BSP_ROOT))
- bsp_copy_files(BSP_ROOT, dist_dir)
-
- # copy stm32 bsp libiary files
- if os.path.basename(os.path.dirname(BSP_ROOT)) == 'stm32':
- print("=> copy stm32 bsp library")
- library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
- library_dir = os.path.join(dist_dir, 'libraries')
- bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(library_dir, 'HAL_Drivers'))
- bsp_copy_files(os.path.join(library_path, Env['bsp_lib_type']), os.path.join(library_dir, Env['bsp_lib_type']))
- shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
-
- # do bsp special dist handle
- if 'dist_handle' in Env:
- print("=> start dist handle")
- dist_handle = Env['dist_handle']
- dist_handle(BSP_ROOT, dist_dir)
-
- # get all source files from program
- for item in program:
- walk_children(item)
- source_list.sort()
-
- # copy the source files without libcpu and components/libc in RT-Thread
- target_list = []
- libcpu_dir = os.path.join(RTT_ROOT, 'libcpu').lower()
- libc_dir = os.path.join(RTT_ROOT, 'components', 'libc', 'compilers').lower()
- sal_dir = os.path.join(RTT_ROOT, 'components', 'net', 'sal_socket').lower()
- sources_include_sal = False
- for src in source_list:
- if src.lower().startswith(BSP_ROOT.lower()):
- continue
-
- # skip libc and libcpu dir
- if src.lower().startswith(libcpu_dir):
- continue
- if src.lower().startswith(libc_dir):
- continue
- if src.lower().startswith(sal_dir):
- sources_include_sal = True
- continue
-
- if src.lower().startswith(RTT_ROOT.lower()):
- target_list.append(src)
- source_list = target_list
-
- # get source directory
- src_dir = []
- for src in source_list:
- src = src.replace(RTT_ROOT, '')
- if src[0] == os.sep or src[0] == '/':
- src = src[1:]
-
- path = os.path.dirname(src)
- sub_path = path.split(os.sep)
- full_path = RTT_ROOT
- for item in sub_path:
- full_path = os.path.join(full_path, item)
- if full_path not in src_dir:
- src_dir.append(full_path)
-
- # add all of SConscript files
- for item in src_dir:
- source_list.append(os.path.join(item, 'SConscript'))
-
- # add all of Kconfig files
- walk_kconfig(RTT_ROOT, source_list)
-
- # copy all files to target directory
- source_list.sort()
- for src in source_list:
- dst = src.replace(RTT_ROOT, '')
- if dst[0] == os.sep or dst[0] == '/':
- dst = dst[1:]
-
- print('=> %s' % dst)
- dst = os.path.join(rtt_dir_path, dst)
- do_copy_file(src, dst)
-
- # copy tools directory
- print('=> tools')
- do_copy_folder(os.path.join(RTT_ROOT, 'tools'), os.path.join(rtt_dir_path, 'tools'), ignore_patterns('*.pyc'))
- do_copy_file(os.path.join(RTT_ROOT, 'Kconfig'), os.path.join(rtt_dir_path, 'Kconfig'))
- do_copy_file(os.path.join(RTT_ROOT, 'AUTHORS'), os.path.join(rtt_dir_path, 'AUTHORS'))
- do_copy_file(os.path.join(RTT_ROOT, 'COPYING'), os.path.join(rtt_dir_path, 'COPYING'))
- do_copy_file(os.path.join(RTT_ROOT, 'README.md'), os.path.join(rtt_dir_path, 'README.md'))
- do_copy_file(os.path.join(RTT_ROOT, 'README_zh.md'), os.path.join(rtt_dir_path, 'README_zh.md'))
-
- print('=> %s' % os.path.join('components', 'libc', 'compilers'))
- do_copy_folder(os.path.join(RTT_ROOT, 'components', 'libc', 'compilers'), os.path.join(rtt_dir_path, 'components', 'libc', 'compilers'))
-
- if sources_include_sal:
- print('=> %s' % os.path.join('components', 'net', 'sal_socket'))
- do_copy_folder(os.path.join(RTT_ROOT, 'components', 'net', 'sal_socket'), os.path.join(rtt_dir_path, 'components', 'net', 'sal_socket'))
-
- # copy all libcpu/ARCH directory
- import rtconfig
- print('=> %s' % (os.path.join('libcpu', rtconfig.ARCH, rtconfig.CPU)))
- do_copy_folder(os.path.join(RTT_ROOT, 'libcpu', rtconfig.ARCH, rtconfig.CPU), os.path.join(rtt_dir_path, 'libcpu', rtconfig.ARCH, rtconfig.CPU))
- if os.path.exists(os.path.join(RTT_ROOT, 'libcpu', rtconfig.ARCH, 'common')):
- print('=> %s' % (os.path.join('libcpu', rtconfig.ARCH, 'common')))
- do_copy_folder(os.path.join(RTT_ROOT, 'libcpu', rtconfig.ARCH, 'common'), os.path.join(rtt_dir_path, 'libcpu', rtconfig.ARCH, 'common'))
- do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'Kconfig'), os.path.join(rtt_dir_path, 'libcpu', 'Kconfig'))
- do_copy_file(os.path.join(RTT_ROOT, 'libcpu', 'SConscript'), os.path.join(rtt_dir_path, 'libcpu', 'SConscript'))
-
- print('Update configuration files...')
- # change RTT_ROOT in SConstruct
- bsp_update_sconstruct(dist_dir)
- # change RTT_ROOT in Kconfig
- bsp_update_kconfig(dist_dir)
- bsp_update_kconfig_library(dist_dir)
- # delete testcases in Kconfig
- bsp_update_kconfig_testcases(dist_dir)
- # make zip package
- zip_dist(dist_dir, dist_name)
-
- print('done!')
-
def MkDist(program, BSP_ROOT, RTT_ROOT, Env, project_name, project_path):
print('make distribution....')