forked from iterative/dvc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_macos.sh
executable file
·63 lines (49 loc) · 1.08 KB
/
build_macos.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
#!/bin/sh
set -e
BUILD_DIR=build
INSTALL_DIR=usr/local
BIN_DIR=$BUILD_DIR/$INSTALL_DIR/bin
print_error()
{
echo -e "\e[31m$1\e[0m"
}
trap 'print_error "FAIL"; exit 1' ERR
print_info()
{
echo -e "\e[32m$1\e[0m"
}
command_exists()
{
command -v $1 > /dev/null 2>&1
}
fpm_build()
{
print_info "Building $1..."
VERSION=$(python -c "import dvc; from dvc import VERSION; print(str(VERSION))")
fpm -s dir -f -t $1 --osxpkg-identifier-prefix com.dataversioncontrol -n dvc -v $VERSION -C $BUILD_DIR $INSTALL_DIR
}
cleanup()
{
print_info "Cleaning up..."
rm -rf build
}
install_dependencies()
{
print_info "Installing requirements..."
pip install -r requirements.txt
print_info "Installing fpm..."
gem install --no-ri --no-rdoc fpm
print_info "Installing pyinstaller..."
pip install pyinstaller
}
build_dvc()
{
print_info "Building dvc binary..."
pyinstaller --onefile --additional-hooks-dir $(pwd)/hooks dvc/__main__.py --name dvc --distpath $BIN_DIR --specpath $BUILD_DIR
}
cleanup
install_dependencies
build_dvc
fpm_build osxpkg
cleanup
print_info "Successfully built dvc osx package"