Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#505 from reyoung/release/v0.9.0
Browse files Browse the repository at this point in the history
Add Paddle Usage Stats Scripts.
  • Loading branch information
qingqing01 authored Nov 17, 2016
2 parents 3b5336a + 7b1d3c7 commit 6146a2e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions paddle/scripts/submit_local.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,34 @@ function version(){
echo " with_predict_sdk: @WITH_PREDICT_SDK@"
}

function ver2num() {
# convert version to number.
if [ -z "$1" ]; then # empty argument
printf "%03d%03d%03d%03d%03d" 0
else
local VERN=$(echo $1 | sed 's#v##g' | sed 's#\.# #g' \
| sed 's#a# 0 #g' | sed 's#b# 1 #g' | sed 's#rc# 2 #g')
if [ `echo $VERN | wc -w` -eq 3 ] ; then
printf "%03d%03d%03d%03d%03d" $VERN 999 999
else
printf "%03d%03d%03d%03d%03d" $VERN
fi
fi
}

PADDLE_CONF_HOME="$HOME/.config/paddle"
mkdir -p ${PADDLE_CONF_HOME}

if [ -z "${PADDLE_NO_STAT+x}" ]; then
SERVER_VER=`curl -m 5 -X POST --data content="{ \"version\": \"@PADDLE_VERSION@\" }"\
-b ${PADDLE_CONF_HOME}/paddle.cookie \
-c ${PADDLE_CONF_HOME}/paddle.cookie \
http://api.paddlepaddle.org/version 2>/dev/null`
if [ $? -eq 0 ] && [ "$(ver2num @PADDLE_VERSION@)" -lt $(ver2num $SERVER_VER) ]; then
echo "Paddle release a new version ${SERVER_VER}, you can get the install package in http://www.paddlepaddle.org"
fi
fi


MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand Down

0 comments on commit 6146a2e

Please sign in to comment.