forked from Lawrence-Public-Schools/appleloops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.sh
executable file
·32 lines (25 loc) · 912 Bytes
/
custom.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
#!/bin/sh
LOCAL_PYTHON=$(/usr/bin/which python3)
BUILD_DIR=dist/custom/zipapp/usr/local/bin
BUILD_OUT=${BUILD_DIR}/appleloops
if [ ${LOCAL_PYTHON} == '' ]; then
/bin/echo 'Python 3 is required. Exiting.'
exit 1
fi
# To provide your own python path, just add '--python=/path/to/python' after './build'
# For example: ./build.sh --python="/usr/bin/env python3.7"
# or ./build.sh --python="/usr/local/munki/python"
if [[ ! -z ${1} ]]; then
DIST_CMD=$(echo /usr/local/bin/python3 -m zipapp src --compress --output ${BUILD_OUT} ${1})
else
DIST_CMD=$(echo /usr/local/bin/python3 -m zipapp src --compress --output ${BUILD_OUT} --python=\"/usr/bin/env python\")
fi
# Clean up
/bin/rm ${BUILD_OUT} &> /dev/null
# Build
eval ${DIST_CMD}
# If the file exists, we can build the pkg
if [ -f ${BUILD_OUT} ]; then
/bin/chmod +x ${BUILD_OUT}
/usr/bin/make --file=dist/custom/Makefile
fi