Skip to content

Commit

Permalink
ci: add flask to binaries, fix python 3.9+ ver
Browse files Browse the repository at this point in the history
  • Loading branch information
silv3rr committed Jul 8, 2023
1 parent 0e9ae69 commit 8e5e3c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python3 -m venv venv && . venv/bin/activate
pip3 install --upgrade pip wheel setuptools
pip3 install -r requirements.txt
pip3 install pyinstaller sysv-ipc geoip2
pip3 install pyinstaller sysv-ipc geoip2 flask
./build.sh && mkdir ./build-ubuntu && mv -f *.tar.gz *.sha512sum ./build-ubuntu
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -68,11 +68,8 @@ jobs:
python3 -m venv venv && . venv/bin/activate
pip3 install --upgrade pip wheel setuptools
pip3 install -r requirements.txt
pip3 install pyinstaller sysv-ipc geoip2
pip3 install pyinstaller sysv-ipc geoip2 flask
./build.sh && mkdir ./build-debian && mv -f *.tar.gz *.sha512sum ./build-debian
# git config --global user.name "${{ env.GIT_USER_NAME }}"
# git config --global user.email "${{ env.GIT_USER_EMAIL }}"
# git pull && git add bin && git commit -m "update debian binaries" && git push
- uses: actions/upload-artifact@v3
with:
name: build-debian-artifacts
Expand All @@ -98,7 +95,7 @@ jobs:
python3 -m venv venv && . venv/bin/activate
pip3 install --upgrade pip wheel setuptools
pip3 install -r requirements.txt
pip3 install pyinstaller sysv-ipc geoip2
pip3 install pyinstaller sysv-ipc geoip2 flask
./build.sh && mkdir ./build-centos && mv -f *.tar.gz *.sha512sum ./build-centos
- uses: actions/upload-artifact@v2
with:
Expand Down
11 changes: 6 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ command -V python3 || {
}
#command -V bc || { echo "ERROR: bc not found"; exit 1; }

PYVER="$(python3 --version | sed 's/.* \([0-9]\.[0-9]\).*/\1/' | grep -E '^[0-9.]+$' || echo 0)"
PYVER="$(python3 --version | sed 's/.* \([0-9]\.[0-9]\{1,2\}\).*/\1/' | grep -E '^[0-9.]+$' || echo 0)"
PYVER_OK=0
if command -V bc >/dev/null 2>&1; then
if [ "$(echo "$PYVER >= $PYREQVER" | bc)" -eq 1 ]; then
PYVER_OK=1
fi
else
PYVER_MAY="$(echo "$PYVER" | sed 's/\([0-9]\)\.[0-9]/\1/')"
PYVER_MIN="$(echo "$PYVER" | sed 's/[0-9]\.\([0-9]\)/\1/')"
PYVER_MIN="$(echo "$PYVER" | sed 's/[0-9]\.\([0-9]\+\)/\1/')"
PYREQVER_MAY="$(echo $PYREQVER | sed 's/\([0-9]\)\.[0-9]/\1/')"
PYREQVER_MIN="$(echo $PYREQVER | sed 's/[0-9]\.\([0-9]\)/\1/')"
PYREQVER_MIN="$(echo $PYREQVER | sed 's/[0-9]\.\([0-9]\+\)/\1/')"
if [ "$PYVER_MAY" -gt "$PYREQVER_MAY" ]; then
PYVER_OK=1
elif [ "$PYVER_MAY" -eq "$PYREQVER_MAY" ] && [ "$PYVER_MIN" -ge "$PYREQVER_MIN" ]; then
Expand All @@ -93,8 +93,9 @@ fi

ECNT=0
for i in $REQS; do
PKG="$( echo $i | tr '_' '-' )"
printf "%b\n" 'try:\n import '"${i}"'\nexcept:\n exit(1)' | python3 || {
echo "Module '${i}' not found, try 'apt install python3-${i}' or 'pip install ${i}'"
echo "Module '${i}' not found, try 'apt install python3-${PKG}' or 'pip install ${PKG}'"
ECNT=$((ECNT + 1))
}
done
Expand All @@ -105,7 +106,7 @@ fi

if [ "$PYINSTALLER" -eq 1 ]; then
command -v pyinstaller >/dev/null 2>&1 || {
echo "ERROR: pyinstaller not found, try 'pip install pyinstaller'"
echo "ERROR: pyinstaller not found, try 'apt install python3-pyinstaller' or 'pip install pyinstaller'"
exit 1
}
pyinstaller spy.py $ARGS --clean --noconfirm --onefile &&
Expand Down

0 comments on commit 8e5e3c8

Please sign in to comment.