Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
added build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
vggonzal authored and vggonzal committed Sep 27, 2023
1 parent ff8f46b commit 17cbd57
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -eo pipefail

BUNDLE_PLUGIN_INSTALLED=$(poetry self show plugins | (grep 'poetry-plugin-bundle' || true) | wc -l)
if [ "$BUNDLE_PLUGIN_INSTALLED" -ne 1 ]; then
echo "Poetry bundle plugin missing! - https://github.com/python-poetry/poetry-plugin-bundle"
echo "Install the poetry bundle plugin with: poetry self add poetry-plugin-bundle"
exit 1
fi

PACKAGE_NAME=$(awk -F' = ' '{gsub(/"/,"");if($1=="name")print $2}' pyproject.toml)
VERSION=$(poetry version -s)

ROOT_PATH="$PWD"
ZIP_PATH="$ROOT_PATH/dist/$PACKAGE_NAME-$VERSION-test.zip"

poetry bundle venv build --clear --without=dev

cd build/lib/python3.*/site-packages
touch hydrocronapi/__init__.py
rm -rf *.dist-info _virtualenv.*
find . -type d -name __pycache__ -exec rm -rf {} \+

mkdir -p "$ROOT_PATH/dist/"
rm -f "$ZIP_PATH"
zip -vr9 "$ZIP_PATH" .

0 comments on commit 17cbd57

Please sign in to comment.