-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·65 lines (55 loc) · 1.78 KB
/
build.sh
File metadata and controls
executable file
·65 lines (55 loc) · 1.78 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
#!/bin/bash
# Usage: build.sh path_to_venv (E.g. ~/Python-environments/EasyAuth/)
# Requires: Pyinstaller (pip install pyinstaller in the projects virtual environment)
# Results: Packages this project into a binary file named 'main' in the dist folder
# Check if VENV_PATH is provided via command line argument
# e.g.: build.sh /home/user/Py-venvs/EasyAuth/
if [ -z "$1" ]; then
echo "Error: VENV_PATH is required, E.g., ~/Python-environments/EasyAuth"
exit 1
else
export VENV_PATH="$1"
fi
# Set the PYINSTALLER_PATH if it's not already set
if [ -z "$PYINSTALLER_PATH" ]; then
export PYINSTALLER_PATH=$VENV_PATH"bin"
fi
# Check if the version info file exists
if [ ! -f "assets/version_info.txt" ]; then
echo "Error: assets/version_info.txt does not exist"
exit 1
fi
# Display current content
echo "Version info $(cat assets/version_info.txt)"
echo "Update? "
read new_version
# Update only if input is not empty
if [ -n "$new_version" ]; then
echo "$new_version" > assets/version_info.txt
echo -n "New version accepted: "
cat assets/version_info.txt
else
echo Using $(cat assets/version_info.txt)
fi
# Check if PYINSTALLER_PATH is set
if [ -z "$PYINSTALLER_PATH" ]; then
echo "Error: PYINSTALLER_PATH environment variable is not set"
exit 1
fi
# Check if the directory exists
if [ ! -d "$PYINSTALLER_PATH" ]; then
echo "Error: Directory $PYINSTALLER_PATH does not exist"
exit 1
fi
# Create tmp file for current date
echo " "$(date) > /tmp/build_date.txt
"$PYINSTALLER_PATH/pyinstaller" -y \
--clean \
--hidden-import "_cffi_backend" \
--hidden-import 'html.parser' \
--add-data "assets:assets" \
--add-data "docs/Quick Start Guide.md:assets" \
--add-data "/tmp/build_date.txt:assets" \
--noconsole \
--onefile \
src/main.py