新增Linux Shell脚本,用于导出当前项目环境中第三方库信息

This commit is contained in:
azhengzz 2021-02-19 17:58:32 +08:00
parent b3cfeb0ac5
commit fd78cdce24
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#!/bin/bash
echo "**********************************************************************"
echo "***********************【导出Python环境包信息】***********************"
pip=`pwd`/venv/bin/pip
pipdeptree=`pwd`/venv/bin/pipdeptree
if [ -e $pip ]
then
echo "***********************【检测到项目目录下Python解释器】***************"
echo "# 项目目录下Python第三方package信息" > `pwd`/package_info.txt
$pip freeze >> `pwd`/package_info.txt
echo "# 项目目录下Python第三方package依赖树信息" > `pwd`/package_deptree_info.txt
$pipdeptree -a >> `pwd`/package_deptree_info.txt
else
echo "***********************【未检测到项目目录下Python解释器使用系统环境变量目录下Python解释器】************"
echo "# 系统环境变量中Python第三方package信息" > `pwd`/package_info.txt
pip freeze >> `pwd`/package_info.txt
echo "# 系统环境变量中Python第三方package依赖树信息" > `pwd`/package_deptree_info.txt
pipdeptree -a >> `pwd`/package_deptree_info.txt
fi
echo "***********************【导出Python包信息完成】***********************"