-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redo python venv machinery. Allow poetry
Refs #211
- Loading branch information
Showing
28 changed files
with
160 additions
and
89 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env -S pkgx +git +install bash | ||
|
||
set -eo pipefail | ||
|
||
cd "$SRCROOT" | ||
|
||
d="$(cd "$(dirname "$0")"/.. && pwd)" | ||
|
||
CMD=$1 | ||
shift | ||
|
||
if [ $1 = '--engine=poetry' ]; then | ||
ENGINE=poetry | ||
shift | ||
fi | ||
|
||
PREFIX=$1 | ||
shift | ||
|
||
set -x | ||
|
||
case $CMD in | ||
stage) | ||
VERSION=$1 | ||
|
||
if [ ! -d "$SRCROOT/.git" ]; then | ||
GIT_DIR="$SRCROOT/.git" | ||
git init | ||
git config user.name 'pkgx[bot]' | ||
git config user.email 'bot@pkgx.dev' | ||
git commit -mnil --allow-empty | ||
git tag -a "$VERSION" -m "Version $VERSION" --force | ||
unset GIT_DIR | ||
fi | ||
|
||
if [ "$ENGINE" = poetry ]; then | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
else | ||
python -m venv "$PREFIX"/venv | ||
fi | ||
;; | ||
seal) | ||
PYTHON=$(python --version | sed -n 's/Python \([0-9]\+\.[0-9]\+\).*/\1/p') | ||
|
||
if [ "$ENGINE" = poetry ]; then | ||
# FIXME is there a more efficient way to do this? | ||
# FIXME the glob is unfortunate | ||
poetry build -f sdist | ||
tar xzf \ | ||
dist/*.tar.gz \ | ||
--directory "$SRCROOT"/.venv/lib/python$PYTHON/site-packages \ | ||
--strip-components=1 | ||
mkdir -p "$PREFIX" | ||
mv "$SRCROOT"/.venv "$PREFIX/venv" | ||
fi | ||
|
||
for cmd in $@; do | ||
install -D "$d/share/brewkit/python-venv-stub.py" $PREFIX/bin/$cmd | ||
sed -i "1s|.*|#!/usr/bin/env -S pkgx python@$PYTHON|" $PREFIX/bin/$cmd | ||
done | ||
;; | ||
esac |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
0
share/brewkit/python-venv.py → libexec/python-venv.py
100755 → 100644
File renamed without changes.
0
share/brewkit/python-venv.sh → libexec/python-venv.sh
100755 → 100644
File renamed without changes.
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
distributable: | ||
# test can fetch a git repo | ||
url: git+https://github.com/pkgxdev/brewkit | ||
ref: v{{version}} | ||
|
||
versions: | ||
- 1.0.0 | ||
|
||
dependencies: | ||
pkgx.sh: ^1 | ||
|
||
build: | ||
dependencies: | ||
python.org: ^3.11 | ||
script: | ||
- mv props/* . | ||
|
||
- bkpyvenv stage {{prefix}} {{version}} | ||
- ${{prefix}}/venv/bin/pip install {{srcroot}} | ||
- bkpyvenv seal {{prefix}} myapp | ||
|
||
provides: | ||
- bin/myapp | ||
|
||
test: | ||
- myapp |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
versions: | ||
- 1.0.0 | ||
|
||
dependencies: | ||
pkgx.sh: ^1 | ||
|
||
build: | ||
dependencies: | ||
python.org: ~3.11 | ||
python-poetry.org: ^1.7 | ||
script: | ||
- mv props/* . | ||
|
||
- bkpyvenv stage --engine=poetry {{prefix}} {{version}} | ||
- poetry install | ||
- bkpyvenv seal --engine=poetry {{prefix}} myapp | ||
|
||
provides: | ||
- bin/myapp | ||
|
||
test: | ||
- myapp | ||
|
||
# test fixtures can have extnames | ||
- run: | | ||
test $(basename $FIXTURE .rb).rb = $(basename $FIXTURE) | ||
test $(cat $FIXTURE) = foo | ||
fixture: | ||
content: foo | ||
extname: .rb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[tool.poetry] | ||
name = "myapp" | ||
version = "1.0.0" | ||
authors = ['foo'] | ||
description = 'bar' | ||
|
||
[tool.poetry.scripts] | ||
myapp = 'myapp.main:main' | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.8.1,<3.12" # updated for llama-index dependency | ||
requests = '*' |
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