From 17cbd57a40460229424b9029f2f5685478156577 Mon Sep 17 00:00:00 2001 From: vggonzal <9Tcostoamm> Date: Wed, 27 Sep 2023 13:47:32 -0700 Subject: [PATCH] added build.sh --- build.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..8c1b007 --- /dev/null +++ b/build.sh @@ -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" . \ No newline at end of file