Max Howell 2024-01-07 05:10:53 -05:00 committed by GitHub
parent 29fd4229a7
commit 07dc2e728e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 21 deletions

View file

@ -0,0 +1,5 @@
# fit & finish
* we provide all `pip3.x` (that we could build) that automatically invoke
pip via that python
* if a pkgx python is already in the environment, that python is used

View file

@ -12,34 +12,52 @@ dependencies:
build: build:
dependencies: dependencies:
python.org: ~3.11
crates.io/semverator: ^0.4.3 crates.io/semverator: ^0.4.3
script: script:
- pkgx curl -O https://bootstrap.pypa.io/get-pip.py - pkgx curl -O https://bootstrap.pypa.io/get-pip.py
# build a pip for every python - rm -rf bootstrap && mkdir bootstrap
# FIXME hardcoding 3.12 sucks - python get-pip.py --target=bootstrap
# FIXME 3.7 *should* work but doesn't
- PYTHONPATH=$PWD/bootstrap
python -m pip install .
--target={{prefix}}/libexec
- run: - run:
# FIXME 3.7 *should* work but doesn't
- v=3.7 - v=3.7
- while semverator lt $v 3.12; do
# Python 3.12 had various breaking changes (semver is meaningless
# apparently) and thus pip less than 23.1.2 will not work with it
# FIXME hardcoding 3.12 sucks
- |
if semverator lt {{version}} 23.1.2; then
vMax=3.11
else
vMax=3.12
fi
- while semverator lt $v $vMax; do
- v=$(semverator bump $v minor | cut -d. -f1,2) - v=$(semverator bump $v minor | cut -d. -f1,2)
- rm -rf bootstrap && mkdir bootstrap
- pkgx python@$v get-pip.py --target=bootstrap
- PYTHONPATH=$PWD/bootstrap
pkgx python@$v -m pip install .
--target={{prefix}}/py$v
- | - |
install -D $PROP {{prefix}}/bin/pip$v install -D $PROP {{prefix}}/bin/pip$v
sed -i s/{{v}}/$v/ {{prefix}}/bin/pip$v
echo "exec pkgx python@$v \"\$d/bin/pip\" \"\$@\"" >> {{prefix}}/bin/pip$v echo "exec pkgx python@$v \"\$d/bin/pip\" \"\$@\"" >> {{prefix}}/bin/pip$v
- vMax=$v
- done - done
# FIXME hardcoded `3`
- |
install -D $PROP {{prefix}}/bin/pip3
echo "exec pkgx python@3 \"\$d/bin/pip\" \"\$@\"" >> {{prefix}}/bin/pip3
- |
install -D $PROP {{prefix}}/bin/pip
echo "exec pkgx python \"\$d/bin/pip\" \"\$@\"" >> {{prefix}}/bin/pip
prop: | prop: |
#!/bin/sh #!/bin/sh
d="$(cd "$(dirname "$0")"/.. && pwd)/py{{v}}" d="$(cd "$(dirname "$0")"/.. && pwd)/libexec"
export PIP_DISABLE_PIP_VERSION_CHECK=1 export PIP_DISABLE_PIP_VERSION_CHECK=1
if [ -n "$PYTHONPATH" ]; then if [ -n "$PYTHONPATH" ]; then
export PYTHONPATH="$d:$PYTHONPATH" export PYTHONPATH="$d:$PYTHONPATH"
@ -47,14 +65,10 @@ build:
export PYTHONPATH="$d" export PYTHONPATH="$d"
fi fi
# FIXME hardcoded `3` # cleanup unused files
- run: | - rm {{prefix}}/libexec/bin/pip?*
ln -s pip$vMax pip3
ln -s pip$vMax pip
working-directory:
${{prefix}}/bin
- fix-shebangs.ts {{prefix}}/py*/bin/* - fix-shebangs.ts {{prefix}}/libexec/bin/*
test: test:
- run: pkgx +python.org~3.9 pip install findtui --target . - run: pkgx +python.org~3.9 pip install findtui --target .
@ -69,6 +83,16 @@ test:
- pip --version | grep {{prefix}} - pip --version | grep {{prefix}}
- pip --version | grep {{version}} - pip --version | grep {{version}}
- |
for v in 3.8 3.9 3.10 3.11; do
test $(pip$v inspect | pkgx jq --raw-output .environment.python_version) = $v
done
provides: provides:
- bin/pip - bin/pip
- bin/pip3.8
- bin/pip3.9
- bin/pip3.10
- bin/pip3.11
- bin/pip3.12
#FIXME - bin/pip{{deps.python.org.version.major}} #FIXME - bin/pip{{deps.python.org.version.major}}