-
Notifications
You must be signed in to change notification settings - Fork 19
/
checkout-deps.sh
executable file
·83 lines (70 loc) · 1.93 KB
/
checkout-deps.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
#!/usr/bin/env bash
# This should be run inside a folder that contains sourcemod, otherwise, it will checkout things into "sm-dependencies".
trap "exit" INT
ismac=0
iswin=0
if [ `uname` = "Darwin" ]; then
ismac=1
elif [ `uname` != "Linux" ] && [ -n "${COMSPEC:+1}" ]; then
iswin=1
fi
checkout ()
{
if [ ! -d "$name" ]; then
git clone $repo -b $branch $name
if [ -n "$origin" ]; then
cd $name
git remote rm origin
git remote add origin $origin
cd ..
fi
else
cd $name
git checkout $branch
git pull origin $branch
cd ..
fi
}
python_cmd=`command -v python`
if [ -z "$python_cmd" ]; then
python_cmd=`command -v python3`
if [ -z "$python_cmd" ]; then
echo "No suitable installation of Python detected"
exit 1
fi
fi
`$python_cmd -c "import ambuild2"` 2>&1 1>/dev/null
if [ $? -eq 1 ]; then
echo "AMBuild is required to build AMTL"
`$python_cmd -m pip --version` 2>&1 1>/dev/null
if [ $? -eq 1 ]; then
echo "The detected Python installation does not have PIP"
echo "Installing the latest version of PIP available (VIA \"get-pip.py\")"
get_pip="./get-pip.py"
get_pip_url="https://bootstrap.pypa.io/get-pip.py"
if [ `command -v wget` ]; then
wget $get_pip_url -O $get_pip --no-check-certificate
elif [ `command -v curl` ]; then
curl -o $get_pip $get_pip_url --insecure
else
echo "Failed to locate wget or curl. Install one of these programs to download 'get-pip.py'."
exit 1
fi
$python_cmd $get_pip
if [ $? -eq 1 ]; then
echo "Installation of PIP has failed"
exit 1
fi
fi
repo="https://github.com/alliedmodders/ambuild"
origin=
branch=master
name=ambuild
checkout
if [ $iswin -eq 1 ] || [ $ismac -eq 1 ]; then
$python_cmd -m pip install ./ambuild
else
echo "Installing AMBuild at the user level. Location can be: ~/.local/bin"
$python_cmd -m pip install --user ./ambuild
fi
fi