157 lines
4.7 KiB
Python
157 lines
4.7 KiB
Python
|
|
||
|
import os
|
||
|
import sys
|
||
|
import shutil
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# 把这个脚本放到电鸿根目录
|
||
|
# 然后运行 python3 remove_path.py
|
||
|
# 以删除多余的目录
|
||
|
|
||
|
|
||
|
_dir_list=[
|
||
|
"./applications",
|
||
|
|
||
|
"./arkcompiler",
|
||
|
|
||
|
"./base/global",
|
||
|
"./base/web",
|
||
|
"./base/update/packaging_tools",
|
||
|
"./base/update/sys_installer",
|
||
|
"./base/update/update_app",
|
||
|
"./base/update/updater",
|
||
|
"./base/update/updateservice",
|
||
|
|
||
|
"./device/board/goodix",
|
||
|
"./device/board/hihope",
|
||
|
"./device/board/hisilicon",
|
||
|
"./device/board/openvalley",
|
||
|
"./device/board/lango",
|
||
|
|
||
|
"./device/soc/artery",
|
||
|
"./device/soc/asrmicro",
|
||
|
"./device/soc/esp",
|
||
|
"./device/soc/goodix",
|
||
|
"./device/soc/hdsc",
|
||
|
"./device/soc/hisilicon",
|
||
|
|
||
|
"./docs",
|
||
|
|
||
|
"./foundation/arkui",
|
||
|
"./foundation/graphic",
|
||
|
"./foundation/multimedia",
|
||
|
"./foundation/multimodalinput",
|
||
|
"./foundation/window",
|
||
|
"./foundation/communication",
|
||
|
"./foundation/distributeddatamgr",
|
||
|
|
||
|
"./ide",
|
||
|
|
||
|
"./interface",
|
||
|
|
||
|
"./kernel/linux",
|
||
|
"./kernel/liteos_a",
|
||
|
|
||
|
"./napi_generator",
|
||
|
|
||
|
"./prebuilts/ark_tools",
|
||
|
"./prebuilts/clang",
|
||
|
"./prebuilts/develop_tools",
|
||
|
"./prebuilts/gcc",
|
||
|
"./prebuilts/mingw-w64",
|
||
|
"./prebuilts/rustc",
|
||
|
|
||
|
"./test/ostest",
|
||
|
|
||
|
"./vendor/asrmicro",
|
||
|
"./vendor/goodix",
|
||
|
"./vendor/openvalley",
|
||
|
"./vendor/goodix",
|
||
|
]
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# 工具
|
||
|
_developtools_path_lsit='''
|
||
|
ace_ets2bundle ace_js2bundle global_resource_tool smartperf_host syscap_codec
|
||
|
'''.split()
|
||
|
for item in _developtools_path_lsit:
|
||
|
path=os.path.join("./developtools",item)
|
||
|
_dir_list.append(path)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# 测试项
|
||
|
_test_path_list='''
|
||
|
ability arkXtest demo global_lite msdp open_posix_testsuite sensors time xts
|
||
|
account barrierfree developtools graphic multimedia powermgr startup usb
|
||
|
ai bundlemanager distributeddatamgr hiviewdfx multimedia_lite request storage useriam
|
||
|
applications commonlibrary figures inputmethod multimodalinput resourceschedule telephony validator
|
||
|
arkui communication global location notification security theme wukong
|
||
|
'''.split()
|
||
|
|
||
|
for item in _test_path_list:
|
||
|
path=os.path.join("./test/xts/acts",item)
|
||
|
_dir_list.append(path)
|
||
|
|
||
|
|
||
|
|
||
|
# 第三方包
|
||
|
_thrid_party_path_list='''
|
||
|
abseil-cpp expat gstreamer libjpeg-turbo mksh pcre2 typescript_eslint
|
||
|
alsa-lib f2fs-tools harfbuzz libnl mtdev pixman tzdata
|
||
|
alsa-utils ffmpeg icu libphonenumber newfs_msdos popt vk-gl-cts
|
||
|
benchmark flatbuffers iniparser libpng nghttp2 protobuf vulkan-headers
|
||
|
boost flutter iowow libpsl ninja pulseaudio wayland-ivi-extension
|
||
|
bzip2 FreeBSD iptables libsnd node python wayland-protocols_standard
|
||
|
cef freetype jerryscript libsoup ntfs-3g PyYAML wayland_standard
|
||
|
chromium fsck_msdos jsframework libunwind NuttX qrcodegen weex-loader
|
||
|
css-what gettext json libusb opencl-headers quickjs weston
|
||
|
curl giflib jsoncpp libuv openGLES re2 wpa_supplicant
|
||
|
e2fsprogs glib libcoap libwebsockets openh264 skia zlib
|
||
|
EGL glslang libdrm libxml2 openmax spirv-headers
|
||
|
ejdb gn libevdev ltp openSLES spirv-tools
|
||
|
elfio googletest libexif lz4 openssl sqlite
|
||
|
eudev gptfdisk libffi mesa3d optimized-routines toybox
|
||
|
exfatprogs grpc libinput mindspore parse5 typescript
|
||
|
libabigail rust cups cups-filters dataBuffer elfutils
|
||
|
fsverity-utils libbpf libfuse vulkan-loader
|
||
|
'''.split()
|
||
|
|
||
|
for item in _thrid_party_path_list:
|
||
|
path=os.path.join("./third_party",item)
|
||
|
_dir_list.append(path)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# 删除任意目录下指定名称的目录
|
||
|
def del_dirs(path:str,del_list:list):
|
||
|
dlist=os.listdir(path)
|
||
|
for i in dlist:
|
||
|
ps=os.path.join(path, i)
|
||
|
# print(f"find path: {ps}")
|
||
|
if os.path.isdir(ps) and not os.path.islink(ps):
|
||
|
if(i in del_list):
|
||
|
print(f"delete path: {ps}")
|
||
|
shutil.rmtree(ps)
|
||
|
else:
|
||
|
del_dirs(ps,del_list)
|
||
|
|
||
|
|
||
|
|
||
|
for item in _dir_list:
|
||
|
if os.path.exists(item):
|
||
|
print(f"delete path: {item}")
|
||
|
# 取消这一行注释以删除目录
|
||
|
shutil.rmtree(item)
|
||
|
# shutil.move(ps,'../back/third_party')
|
||
|
# else:
|
||
|
# print(f"path: {item} not exist.")
|
||
|
|
||
|
del_dirs('.',['.git','.gitee','.github','doc'])
|