forked from bokeh/bokeh
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build_and_upload.sh
executable file
·155 lines (123 loc) · 4.72 KB
/
build_and_upload.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
#CLI user interface
if [ "$1" == "-h" ]; then
usage="$(basename "$0") [-h] -- program to build and upload bokeh pkgs to binstar
where:
-h show this help text
-u RackSpace username
-k RackSpace APIkey
-c whether to clean the built packages, defaults to true
"
echo "$usage"
exit 0
fi
#defauls
clean=true
#handling of arguments
while getopts u:k:c: option;
do
case "${option}" in
u) username=${OPTARG};;
k) key=${OPTARG};;
c) clean=${OPTARG};;
esac
done
#get user and key from env variables if they are not provided with args
if [ "$username" == "" ]; then
username=$BOKEH_DEVEL_USERNAME
echo "$username"
fi
if [ "$key" == "" ]; then
key=$BOKEH_DEVEL_APIKEY
echo "$key"
fi
# build for each python version
for py in 27 33 34;
do
echo "Building py$py pkg"
CONDA_PY=$py conda build conda.recipe --quiet
done
# get conda info about root_prefix and platform
function conda_info {
conda info --json | python -c "import json, sys; print(json.load(sys.stdin)['$1'])"
}
CONDA_ENV=$(conda_info root_prefix)
PLATFORM=$(conda_info platform)
BUILD_PATH=$CONDA_ENV/conda-bld/$PLATFORM
# get travis_build_id
travis_build_id=$(cat __travis_build_id__.txt)
# convert to platform-specific builds
conda convert -p all -f $BUILD_PATH/bokeh*$travis_build_id*.tar.bz2; # --quiet option will be available soon
#upload conda pkgs to binstar
array=(osx-64 linux-64 win-64 linux-32 win-32)
for i in "${array[@]}"
do
echo Uploading: $i;
binstar upload -u bokeh $i/bokeh*$travis_build_id*.tar.bz2 -c dev --force --no-progress;
done
# get complete version
complete_version=$(cat __conda_version__.txt)
#create and upload pypi pkgs to binstar
#zip is currently not working
python setup.py sdist --formats=gztar
binstar upload -u bokeh dist/bokeh*$travis_build_id* --package-type pypi -c dev --force --no-progress;
echo "I'm done uploading to binstar"
########################
# General clean up #
########################
#clean up platform folders
if [ $clean == true ]; then
for i in "${array[@]}"
do
rm -rf $i
done
rm -rf dist/
else
echo "Not cleaning the packages."
fi
#and the additional building stuff
rm -rf build/
rm -rf bokeh.egg-info/
rm -rf record.txt
rm -rf versioneer.pyc
rm -rf __conda_version__.txt
rm -rf bokeh/__conda_version__.py
rm -rf bokeh/__conda_version__.pyc
rm -rf bokeh/__pycache__/__conda_version__.pyc
#upload js and css to the cdn
#get token
token=`curl -s -XPOST https://identity.api.rackspacecloud.com/v2.0/tokens \
-d'{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'$username'","apiKey":"'$key'"}}}' \
-H"Content-type:application/json" | python -c 'import sys,json;data=json.loads(sys.stdin.read());print(data["access"]["token"]["id"])'`
#get unique url id
id=`curl -s -XPOST https://identity.api.rackspacecloud.com/v2.0/tokens \
-d'{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'$username'","apiKey":"'$key'"}}}' \
-H"Content-type:application/json" | python -c 'import sys,json;data=json.loads(sys.stdin.read());print(data["access"]["serviceCatalog"][-1]["endpoints"][0]["tenantId"])'`
#push the js and css files
curl -XPUT -T bokehjs/build/js/bokeh.js -v -H "X-Auth-Token:$token" -H "Content-Type: application/javascript" -H "Origin: https://mycloud.rackspace.com" \
"https://storage101.dfw1.clouddrive.com/v1/$id/bokeh/bokeh/dev/bokeh-$complete_version.js";
curl -XPUT -T bokehjs/build/js/bokeh.min.js -v -H "X-Auth-Token:$token" -H "Content-Type: application/javascript" -H "Origin: https://mycloud.rackspace.com" \
"https://storage101.dfw1.clouddrive.com/v1/$id/bokeh/bokeh/dev/bokeh-$complete_version.min.js";
curl -XPUT -T bokehjs/build/css/bokeh.css -v -H "X-Auth-Token:$token" -H "Content-Type: text/css" -H "Origin: https://mycloud.rackspace.com" \
"https://storage101.dfw1.clouddrive.com/v1/$id/bokeh/bokeh/dev/bokeh-$complete_version.css";
curl -XPUT -T bokehjs/build/css/bokeh.min.css -v -H "X-Auth-Token:$token" -H "Content-Type: text/css" -H "Origin: https://mycloud.rackspace.com" \
"https://storage101.dfw1.clouddrive.com/v1/$id/bokeh/bokeh/dev/bokeh-$complete_version.min.css";
echo "I'm done uploading to Rackspace"
# upload devel docs
pushd sphinx
make clean all
fab update:dev
popd
echo "I'm done uploading the devel docs"
########################
#Removing from binstar #
########################
# remove entire release
# binstar remove user/package/release
# binstar --verbose remove bokeh/bokeh/0.4.5.dev.20140602
# remove file
# binstar remove user[/package[/release/os/[[file]]]]
# binstar remove bokeh/bokeh/0.4.5.dev.20140602/linux-64/bokeh-0.4.5.dev.20140602-np18py27_1.tar.bz2
# show files
# binstar show user[/package[/release/[file]]]
# binstar show bokeh/bokeh/0.4.5.dev.20140604