forked from datature/portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-python.sh
executable file
·41 lines (36 loc) · 1.18 KB
/
build-python.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
#! /bin/bash
# exit when any command fails
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "Exiting shell: \"${last_command}\" command failed with exit code $?."' EXIT
echo "Running build-python bash job!"
cd ./portal_build
echo "$OSTYPE"
if [[ "$OSTYPE" == "msys" ]]; then
echo "Activating .venv/Scripts/activate"
. .venv/Scripts/activate
else
echo "Activating .venv/bin/activate"
. .venv/bin/activate
fi
echo "Installing Pyinstaller..."
pip install --upgrade pyinstaller
echo "Creating flask executable..."
if [[ "$OSTYPE" == "msys" ]]; then
pyinstaller -F run.py --hidden-import datature-hub --hidden-import engineio.async_drivers.threading --distpath ./dist
chmod u+x ./dist/run.exe
else
DYLD_LIBRARY_PATH=".venv/bin" pyinstaller -F run.py --hidden-import datature-hub --hidden-import engineio.async_drivers.threading --distpath ./dist
chmod u+x ./dist/run
if [ -f ./dist/run ]; then
echo "Renaming file"
mv ./dist/run ./dist/run.exe
fi
fi
echo "Removing extra files - run.spec and build"
rm -r run.spec build
cd ..
echo "Ending build-python bash job in 10 secs..."
sleep 10