Files
jumpserver/requirements/clean_site_packages.sh
wangruidong d48eb40472 perf: Upgrade python version and dependency libraries
fix: Update aliyun-python-sdk-core-v3 to version 2.13.36 and remove telnetlib3 dependency

perf: Implement AsyncLocal for asynchronous context storage and update signal handler

fix: api docs access error

fix: ticket flow api docs access error

perf: stash ansible update version

perf: update pynacl to version 1.6.2

perf: update telnet version

perf: update docker-base

perf: update ci
2026-04-23 09:56:06 +08:00

42 lines
1.2 KiB
Bash

#!/bin/bash
python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
lib_path="/opt/py3/lib/python${python_version}/site-packages"
if [ ! -d "$lib_path" ]; then
echo "lib_path $lib_path not exist"
exit 0
fi
# 清理不需要的模块
need_clean="jedi"
for i in $need_clean; do
rm -rf "${lib_path}/${i}"
done
# 清理 ansible connection 中 不需要的模块
ansible_connection="${lib_path}/ansible_collections"
need_clean="fortinet dellemc f5networks netapp theforeman google azure cyberark ibm
netbox purestorage inspur netapp_eseries sensu check_point vyos arista"
for i in $need_clean; do
echo "rm -rf ${ansible_connection:-tmp}/${i}"
rm -rf "${ansible_connection:-tmp}/${i}"
done
# 清理缓存文件
cd ${lib_path} || exit 1
find . -name "*.pyc" -exec rm -f {} \;
# 清理不需要的国际化文件
find . -name 'locale' -o -name 'locales' -type d | while read -r dir; do
find "$dir" -mindepth 1 -maxdepth 1 -type d \
! -name 'zh_Hans' \
! -name 'zh_Hant' \
! -name 'zh_CN' \
! -name 'en' \
! -name 'en_US' \
! -name 'ja' \
! -name 'fr' \
-exec rm -rf {} \;
done