-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·51 lines (44 loc) · 1.64 KB
/
build.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
#!/bin/bash
# This Bash script (1) builds Python dependencies needed to run and deploy
# the Trendy Lights application and (2) installs the Google App Engine
# developer tools if they aren't found on the system.
# Builds the specified dependency if it hasn't been built. Takes 3 parameters:
# 1. The URL of the git repo.
# 2. The tag name or commit SHA at which to checkout the repo.
# 3. The path within the repo to the library folder.
BuildDep () {
DST_FOLDER=`basename "$3"`
echo "Building $DST_FOLDER..."
if [ ! -d "$DST_FOLDER" ]; then
# See: http://unix.stackexchange.com/a/84980
TEMP_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
cd $TEMP_DIR
git clone "$1" .
git checkout "$2" .
cd -
mv "$TEMP_DIR/$3" ./
rm -rf $TEMP_DIR
fi
}
# Build oauth2client.
BuildDep https://github.com/google/oauth2client.git tags/v1.3.2 oauth2client
# Build the Earth Engine Python client library.
SHA_v0153="92b1b5f" # v0.1.53
BuildDep https://github.com/google/earthengine-api.git $SHA_v0153 python/ee
# Build httplib2.
BuildDep https://github.com/jcgregorio/httplib2.git tags/v0.9.1 python2/httplib2
# Build PyCrypto.
BuildDep https://github.com/dlitz/pycrypto.git tags/v2.6.1 lib/Crypto
# Install the Google App Engine command line tools.
if ! hash dev_appserver.py 2>/dev/null; then
# Install the `gcloud` command line tool.
curl https://sdk.cloud.google.com/ | bash
# Ensure the `gcloud` command is in our path.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
# Install the Google App Engine command line tools.
gcloud components update gae-python
fi