From e8dac36de32bbd5f788868fa10079f00159d9297 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Tue, 5 Dec 2023 08:51:09 +0100 Subject: [PATCH] Add `make bundle` for creating a pyz bundle --- .gitignore | 10 ++++++---- Makefile | 14 +++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 82e262f..957a67b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,12 +6,14 @@ /.env /.envrc /.pytest_cache/ +/book /build/ +/bundle/ /dist/ /htmlcov/ -/tmp/ -/toot-*.tar.gz -debug.log /pyrightconfig.json +/tmp/ +/toot-*.pyz +/toot-*.tar.gz /venv/ -/book +debug.log diff --git a/Makefile b/Makefile index e560506..b6b26ad 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ coverage: clean : find . -name "*pyc" | xargs rm -rf $1 - rm -rf build dist MANIFEST htmlcov toot*.tar.gz + rm -rf build dist MANIFEST htmlcov bundle toot*.tar.gz toot*.pyz changelog: ./scripts/generate_changelog > CHANGELOG.md @@ -34,3 +34,15 @@ docs-serve: docs-deploy: docs rsync --archive --compress --delete --stats book/ bezdomni:web/toot + +bundle: + mkdir bundle + cp toot/__main__.py bundle + pip install . --target=bundle + rm -rf bundle/*.dist-info + find bundle/ -type d -name "__pycache__" -exec rm -rf {} + + python -m zipapp \ + --python "/usr/bin/env python3" \ + --output toot-`git describe`.pyz bundle \ + --compress + echo "Bundle created: toot-`git describe`.pyz"