Skip to content

Commit

Permalink
Merge pull request #11 from replit/th-bundle-script
Browse files Browse the repository at this point in the history
Added build-bundle.sh script
  • Loading branch information
airportyh authored Jul 27, 2023
2 parents 5fe9525 + 827a293 commit c3c003c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ pip-wheel-metadata

poetry/core/*

.pythonlibs
.pythonlibs

poetry-*-bundle.tgz
22 changes: 22 additions & 0 deletions build-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generate a bundle containing poetry + dependencies
# for use by Nix using pip's download command to allow offline installs as
# described here: https://stackoverflow.com/a/36730026

# The generated file is to be uploaded to the poetry-bundles bucket on gcs, available at
# https://storage.googleapis.com/poetry-bundles/poetry-x.y.z-bundle.tgz

# You may use `nix develop` to gain access the tools used by this script.

set -x

BUILD_DIR=poetry-bundle

rm -fr $BUILD_DIR
mkdir -p $BUILD_DIR
VERSION=$(toml2json pyproject.toml | jq '.tool.poetry.version' --raw-output)
POETRY_TAR_FILE="poetry-${VERSION}.tgz"
tar cz --sort=name --mtime='@1' --exclude="$BUILD_DIR" --exclude="$POETRY_TAR_FILE" --owner=0 --group=0 --numeric-owner -P -f "$POETRY_TAR_FILE" .
pip download "$POETRY_TAR_FILE" -d $BUILD_DIR
tar czf poetry-${VERSION}-bundle.tgz $BUILD_DIR
rm "$POETRY_TAR_FILE"
rm -fr "$BUILD_DIR"
6 changes: 6 additions & 0 deletions replit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ pkgs }: {
deps = [
pkgs.toml2json
pkgs.jq.bin
];
}

0 comments on commit c3c003c

Please sign in to comment.