forked from PyAV-Org/PyAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate.sh
More file actions
executable file
·76 lines (59 loc) · 2.06 KB
/
Copy pathactivate.sh
File metadata and controls
executable file
·76 lines (59 loc) · 2.06 KB
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
#!/bin/bash
# Make sure this is sourced.
if [[ "$0" == "${BASH_SOURCE[0]}" ]]; then
echo This must be sourced.
exit 1
fi
export PYAV_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)"
PYAV_LIBRARY_NAME="${PYAV_LIBRARY_NAME}"
PYAV_LIBRARY_VERSION="${PYAV_LIBRARY_VERSION}"
if [[ ! "$PYAV_LIBRARY_NAME" ]]; then
# We allow $FFMPEG and $LIBAV on Travis to make the build matrix pretty.
if [[ "$TRAVIS" && "$FFMPEG" ]]; then
PYAV_LIBRARY_NAME=ffmpeg
PYAV_LIBRARY_VERSION="$FFMPEG"
elif [[ "$TRAVIS" && "$LIBAV" ]]; then
PYAV_LIBRARY_NAME=libav
PYAV_LIBRARY_VERSION="$LIBAV"
# Pull from command line argument.
elif [[ "$1" ]]; then
PYAV_LIBRARY_NAME="$1"
else
PYAV_LIBRARY_NAME=ffmpeg
echo "No \$PYAV_LIBRARY_NAME set; defaulting to $PYAV_LIBRARY_NAME"
fi
fi
if [[ ! "$PYAV_LIBRARY_VERSION" ]]; then
# Pull from command line argument.
if [[ "$2" ]]; then
PYAV_LIBRARY_VERSION="$2"
# Defaults.
else
case "$PYAV_LIBRARY_NAME" in
ffmpeg)
PYAV_LIBRARY_VERSION=2.7
;;
libav)
PYAV_LIBRARY_VERSION=11.4
;;
*)
echo "Unknown \$PYAV_LIBRARY_NAME \"$PYAV_LIBRARY_NAME\"; exiting"
exit 1
esac
echo "No \$PYAV_LIBRARY_VERSION set; defaulting to $PYAV_LIBRARY_VERSION"
fi
fi
export PYAV_LIBRARY_NAME
export PYAV_LIBRARY_VERSION
export PYAV_LIBRARY_SLUG=$PYAV_LIBRARY_NAME-$PYAV_LIBRARY_VERSION
export PYAV_VENV_NAME="$(uname -s).$(uname -r).cpython$(python -c 'import sys; print "%d.%d" % sys.version_info[:2]')"
export PYAV_VENV="$PYAV_ROOT/venvs/$PYAV_VENV_NAME"
if [[ ! -e "$PYAV_VENV/bin/python" ]]; then
mkdir -p "$PYAV_VENV"
virtualenv "$PYAV_VENV"
"$PYAV_VENV/bin/pip" install --upgrade pip setuptools
fi
source "$PYAV_VENV/bin/activate"
# Just a flag so that we know this was supposedly run.
export _PYAV_ACTIVATED=1
export PKG_CONFIG_PATH="$PYAV_VENV/vendor/$PYAV_LIBRARY_SLUG/lib/pkgconfig:$PKG_CONFIG_PATH"