forked from mtbannister/astroquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.pip.wheel
99 lines (87 loc) · 2.56 KB
/
.travis.pip.wheel
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
#!/usr/bin/env bash
#This bash script trys to install a python package *first* by using a wheel,
#and if here isn't one there or it fails, it falls
#back on using pip to build from source.
USAGE=".travis.pip.wheel PYVERSION PACKAGENAME [PACKAGEVERSION] [-q] [-p]"
#"-q" means use "pip install -q ..." if a source install is needed
#"-p" means it's a pure-python package (necessary for looking up wheels correctly)
#these are variables that help locate the wheels
BASEWHEELURL="http://www.mpia.de/~robitaille/python/wheels"
PLATFORM="linux_x86_64"
#array mapping python versions to their wheel code
#this is based on wheels made for Ubuntu 12.04 64-bit, April 2013
#this is for non pure-python code - it requires extra information about the C compilation flags
declare -A pyvtowheelcodecp=(
[2.6]="cp26-none"
[2.7]="cp27-none"
[3.2]="cp32-32mu"
[3.3]="cp33-33dm"
)
#this is for pure-python
declare -A pyvtowheelcodepy=(
[2.6]="py26-none"
[2.7]="py27-none"
[3.2]="py32-32mu"
[3.3]="py33-33dm"
)
#process command line arguments
PYVERSION=""
PKGNAME=""
PKGVERS=""
PIPFLAGS=""
PUREPYTHON=false
while [ "$1" != "" ]; do
if [ "$1" == '-q' ]; then
PIPFLAGS="-q"
elif [ "$1" == '-p' ]; then
PUREPYTHON=true
elif [[ $1 == -* ]]; then
echo "Invalid option $1. Usage: $USAGE"
exit 1
elif [ "$PYVERSION" == "" ]; then
PYVERSION="$1"
elif [ "$PKGNAME" == "" ]; then
PKGNAME="$1"
elif [ "$PKGVERS" == "" ]; then
PKGVERS="$1"
else
echo "Too many arguments $1. Usage: $USAGE"
exit 1
fi
shift
done
if [ "$PYVERSION" == "" -o "$PKGNAME" == "" ]; then
echo "Not enough arguments. Usage: $USAGE"
exit 1
fi
#done w/command line arguments
#figure out the version code
if $PUREPYTHON
then
PYVERSION=${pyvtowheelcodepy[$PYVERSION]}
#the pure python code, the platform is "any"
PLATFORM="any"
else
PYVERSION=${pyvtowheelcodecp[$PYVERSION]}
fi
# now figure out the name sphinx wants to see in case we need to fall back
if [ "$PKGVERS" == "" ]
then
PACKAGENAMEANDVERSDASH="$PKGNAME"
PACKAGENAMEANDVERSEQ="$PKGNAME"
else
PACKAGENAMEANDVERSDASH="$PKGNAME-$PKGVERS"
PACKAGENAMEANDVERSEQ="$PKGNAME==$PKGVERS"
fi
#now construct the url
WHEELURL="$BASEWHEELURL/$PACKAGENAMEANDVERSDASH-$PYVERSION-$PLATFORM.whl"
echo "Trying to install with wheel:"
echo "pip install $WHEELURL"
pip install $WHEELURL
if [ $? -ne 0 ]
then
echo "Wheel install failed, trying to build from source:"
echo "pip install $PACKAGENAMEANDVERSEQ --use-mirrors $PIPFLAGS"
pip install $PACKAGENAMEANDVERSEQ --use-mirrors $PIPFLAGS
fi
exit $?