Last active
February 11, 2024 00:40
-
-
Save RhetTbull/879532b3a8f24508cbac3e6a754fa960 to your computer and use it in GitHub Desktop.
Run PyApp to build a python app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# PyApp Runner | |
# This script is used to build and copy the PyApp executable | |
# See https://ofek.dev/pyapp/latest/how-to/ for more information on PyApp. | |
# Change this to the path where pyapp is installed | |
PYAPP="/path/to/pyapp-latest" | |
# Check that both arguments are provided | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 PROJECT_NAME PROJECT_VERSION" | |
exit 1 | |
fi | |
PROJECT_NAME=$1 | |
PROJECT_VERSION=$2 | |
CWD=$(pwd) | |
cd $PYAPP | |
# clean the build directory | |
rm -f target/release/pyapp | |
# build the project | |
PYAPP_PROJECT_NAME=${PROJECT_NAME} PYAPP_PROJECT_VERSION=${PROJECT_VERSION} cargo build --release | |
if [ $? -ne 0 ]; then | |
echo "Build failed" | |
exit 1 | |
fi | |
# Copy the binary | |
PYAPP_ARCH=$(uname -m) | |
TARGET=${PROJECT_NAME}-${PROJECT_VERSION}-${PYAPP_ARCH} | |
echo "Copying ${PYAPP}/target/release/pyapp to ${CWD}/${TARGET}" | |
cp "${PYAPP}/target/release/pyapp" ${CWD}/${TARGET} | |
echo "Done: ${TARGET}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment