-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall-minipy
executable file
·150 lines (129 loc) · 3.4 KB
/
install-minipy
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
#!/bin/bash
#
# Generate debug output ?
DEBUG=0
### Configuration
# Select Python version (major.minor)
PYTHON_VERSION=2.7
# Select PyRun version (major.minor.patch)
PYRUN_VERSION=1.1.0
# Platform string on the PyRun binary distribution (usually
# auto-detected, see below)
PLATFORM=
# PyRun distribution file. This may contain path information and is
# set from the above configuration parameters, if not given explicitly
# via --pyrun-distribution=
PYRUN_DISTRIBUTION="miniPyPack.tgz"
# Local PyRun distribution directory to search in
LOCAL_PYRUN_DISTRIBUTION_DIR=/downloads/egenix
### Parse options
INSTALL_DISTRIBUTE=1
INSTALL_PIP=0
LOG_INSTALLATION=0
RUN_SILENT=0
VERBOSITY=0
INSTALLATION_DIR=$1
# Installation directory
if [ -z "$INSTALLATION_DIR" ]; then
echo "$HELP"
exit 1
fi
### Helpers
# Current work dir
CWD=`pwd`
# Tools
TAR=tar
MKDIR=mkdir
RM=rm
ECHO=echo
# Log file
if (( $LOG_INSTALLATION )); then
LOG_FILE=$CWD/$INSTALLATION_DIR/pyrun-installation.log
else
LOG_FILE=/dev/null
fi
if (( $RUN_SILENT )); then
LOG_FILE=/dev/null
ECHO=true
fi
# Detect platform, if not given
PLATFORM_UNAME=`uname -s -p`
if [[ -z "$PLATFORM" ]]; then
case "$PLATFORM_UNAME" in
Linux\ x86_64 )
PLATFORM=linux-x86_64
;;
Linux\ i?86 )
PLATFORM=linux-i686
;;
FreeBSD\ amd64 )
PLATFORM=freebsd-8.3-RELEASE-p3-amd64
;;
FreeBSD\ i386 )
PLATFORM=freebsd-8.3-RELEASE-p3-i386
;;
Darwin\ powerpc )
PLATFORM=macosx-10.4-fat
;;
Darwin\ i386 )
OS_VERSION=`uname -r`
if (( ${OS_VERSION%%.*} < 10 )); then
# Leopard and earlier default to 32-bit applications
PLATFORM=macosx-10.4-fat
else
# Snow Leopard and later can run 64-bit applications
PLATFORM=macosx-10.5-x86_64
fi
;;
Darwin\ x86_64 )
PLATFORM=macosx-10.5-x86_64
;;
* )
echo "Unknown platform. Please set manually using --platform=..."
exit 1
;;
esac
fi
if (( DEBUG )); then
$ECHO "Using the following PyRun installation settings:"
$ECHO " PYRUN_DISTRIBUTION=${PYRUN_DISTRIBUTION}"
$ECHO " LOCAL_PYRUN_DISTRIBUTION=${LOCAL_PYRUN_DISTRIBUTION}"
$ECHO " REMOTE_PYRUN_DISTRIBUTION=${REMOTE_PYRUN_DISTRIBUTION}"
$ECHO " INSTALLATION_DIR=${INSTALLATION_DIR}"
fi
### Installation
# Install PyRun
$MKDIR -p $INSTALLATION_DIR
$ECHO "Installing PyRun ..." 2>&1 | tee -a $LOG_FILE
$TAR -x -v -z -f $PYRUN_DISTRIBUTION -C $INSTALLATION_DIR >> $LOG_FILE 2>&1
rc=$?
if (( $rc )); then
echo "Failed to extract $PYRUN_DISTRIBUTION"
exit $rc
fi
$ECHO "" >> $LOG_FILE 2>&1
# Install distribute
if (( $INSTALL_DISTRIBUTE )); then
$ECHO "Installing distribute ..." 2>&1 | tee -a $LOG_FILE
cd $INSTALLATION_DIR && bin/python distribute_setup.py >> $LOG_FILE 2>&1
rc=$?
if (( $rc )); then
echo "Failed to install distribute"
exit $rc
fi
$RM -rf distribute* >> $LOG_FILE 2>&1
$ECHO "" >> $LOG_FILE 2>&1
fi
# Install pip
if (( $INSTALL_PIP )); then
$ECHO "Installing pip ..." 2>&1 | tee -a $LOG_FILE
bin/easy_install pip >> $LOG_FILE 2>&1
rc=$?
if (( $rc )); then
echo "Failed to install pip"
exit $rc
fi
$ECHO "" >> $LOG_FILE 2>&1
fi
# Finished
$ECHO "Finished"