1 Star 0 Fork 18

kunchanglee/PrimiHub

forked from PrimiHub/PrimiHub 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pre_build.sh 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
david_sdu 提交于 2023-04-13 17:22 . Support centos (#378)
#!/bin/bash
set -x
set -e
PYTHON_BIN=python3
if ! command -v python3 >/dev/null 2>&1; then
if ! command -v python >/dev/null 2>&1; then
echo "please install python3"
exit
else
PYTHON_BIN=python
fi
fi
U_V1=`$PYTHON_BIN -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
U_V2=`$PYTHON_BIN -V 2>&1|awk '{print $2}'|awk -F '.' '{print $2}'`
U_V3=`$PYTHON_BIN -V 2>&1|awk '{print $2}'|awk -F '.' '{print $3}'`
echo your python version is : "$U_V1.$U_V2.$U_V3"
if ! [ "${U_V1}" = 3 ] && [ "${U_V2}" > 6 ]; then
echo "python version must > 3.6"
exit
fi
PYTHON_CONFIG_CMD="python$U_V1.$U_V2-config"
if ! command -v ${PYTHON_CONFIG_CMD} >/dev/null 2>&1; then
echo "please install python$U_V1.$U_V2-dev"
exit
fi
#get python include path
PYTHON_INC_CONFIG=`${PYTHON_CONFIG_CMD} --includes | awk '{print $1}' |awk -F'-I' '{print $2}'`
if [ ! -d "${PYTHON_INC_CONFIG}" ]; then
echo "${PYTHON_CONFIG_CMD} get python include path failed"
exit -1
fi
# link python include path into workspace
pushd third_party
rm -f python_headers
ln -s ${PYTHON_INC_CONFIG} python_headers
popd
#get python link option
CONFIG=`${PYTHON_CONFIG_CMD} --ldflags` && NEWLINE="[\"${CONFIG}\"] + [\"-lpython$U_V1.$U_V2\"]"
# Compatible with MacOS
sed -e "s|PLACEHOLDER-PYTHON3.X-CONFIG|${NEWLINE}|g" BUILD.bazel > BUILD.bazel.tmp && mv BUILD.bazel.tmp BUILD.bazel
echo "done"
if [ ! -d "localdb" ]; then
mkdir localdb
fi
if [ ! -d "log" ]; then
mkdir log
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/kunchanglee/primihub.git
git@gitee.com:kunchanglee/primihub.git
kunchanglee
primihub
PrimiHub
develop

搜索帮助