refurbish pip/meson/pipenv with state of the art techniques (#4756)

This commit is contained in:
Max Howell 2024-01-05 16:38:07 +00:00 committed by GitHub
parent 6b6205f0c1
commit eadb61b340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 54 deletions

View file

@ -6,10 +6,15 @@ versions:
github: mesonbuild/meson/tags
dependencies:
python.org: '>=3<3.12'
pkgx.sh: ^1
build:
python-venv.sh "{{prefix}}/bin/meson"
dependencies:
python.org: ~3.11
script:
- bkpyvenv stage {{prefix}} {{version}}
- ${{prefix}}/venv/bin/pip install .
- bkpyvenv seal {{prefix}} meson
test:
dependencies:

View file

@ -8,45 +8,56 @@ versions:
ignore: ['<18']
dependencies:
python.org: '*' #FIXME actually: ^3.7
# FIXME deps vary by version for the above and we dont support that yet
runtime:
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
PYTHONPATH: ${{prefix}}:$PYTHONPATH
pkgx.sh: ^1
build:
dependencies:
curl.se: '*'
script: |
curl -O https://bootstrap.pypa.io/get-pip.py
test -d bootstrap || mkdir bootstrap
python get-pip.py --target="$(pwd)/bootstrap"
PYTHONPATH=$(pwd)/bootstrap python -m pip install . --target={{prefix}}
cd {{prefix}}
for binfile in $shebangs; do
sed -i.bak -e 's|#!{{ deps.python.org.prefix }}/bin/|#!/usr/bin/env |g' $binfile
rm $binfile.bak
done
rm -f bin/pip{{deps.python.org.version.major}}.{{deps.python.org.version.minor}}
env:
shebangs:
- bin/pip
- bin/pip{{deps.python.org.version.major}}
test:
dependencies:
tea.xyz: '*'
python.org: ^3.7
crates.io/semverator: ^0.4.3
script:
- run: tea +python.org~3.9 pip install findtui --target .
- pkgx curl -O https://bootstrap.pypa.io/get-pip.py
- test -d bootstrap || mkdir bootstrap
- python get-pip.py --target="$(pwd)/bootstrap"
- PYTHONPATH=$(pwd)/bootstrap python -m pip install . --target={{prefix}}/lib
# provide pip3.7 — pip3.12 (or whatever is latest)
# they will automatically use the correct python versions
- run: |
v=3.6
while semverator lt $v {{deps.python.org.version.marketing}}; do
v=$(semverator bump $v minor | cut -d. -f1,2)
cp $PROP pip$v
echo "exec pkgx python@$v \$d/lib/bin/pip \"\$@\"" >> pip$v
done
cp $PROP pip{{ deps.python.org.version.major }}
echo 'exec pkgx python@{{ deps.python.org.version.major }} $d/lib/bin/pip "$@"' >> pip{{ deps.python.org.version.major }}
cp $PROP pip
echo 'exec pkgx python $d/lib/bin/pip "$@"' >> pip
rm {{prefix}}/lib/bin/pip?*
working-directory:
${{prefix}}/bin
prop: |
#!/bin/sh
d="$(cd "$(dirname "$0")"/.. && pwd)"
export PIP_DISABLE_PIP_VERSION_CHECK=1
export PYTHONPATH="$d:$PYTHONPATH"
- fix-shebangs.ts {{prefix}}/lib/bin/*
test:
- run: pkgx +python.org~3.9 pip install findtui --target .
if: ~18
- run: pip install findtui --target .
- run:
- pip install findtui --target foo
- pip3.10 install findtui --target .
if: '>=19'
- test -f findtui/main.py
provides:

View file

@ -6,19 +6,20 @@ versions:
github: pypa/pipenv/releases/tags
strip: /^v/
dependencies:
tea.xyz: ^0
companions:
python.org: '>=3.7<3.12'
pip.pypa.io: '*'
dependencies:
pkgx.sh: ^1
build:
dependencies:
python.org: '>=3.7<3.12'
python.org: '*' # we want the latest python and should restock when it bumps
crates.io/semverator: '*'
script:
- python-venv.sh {{prefix}}/bin/pipenv
- bkpyvenv stage {{prefix}} {{version}}
- ${{prefix}}/venv/bin/pip install .
- bkpyvenv seal {{prefix}} pipenv
# create exec scripts for pipenv so it can auto install and use the pythons it wants
- working-directory:
@ -28,19 +29,10 @@ build:
while semverator lt $v {{deps.python.org.version.marketing}}; do
v=$(semverator bump $v minor | cut -d. -f1,2)
echo '#!/bin/sh' > python$v
echo "exec tea python~$v \"\$@\"" >> python$v
echo "exec pkgx python~$v \"\$@\"" >> python$v
chmod +x python$v
done
# so the venv for ourselves works without adding a specific python to
# our runtime dependencies
- working-directory:
${{prefix}}/bin
run: |
echo '#!/bin/sh' > python
echo "exec tea python~{{ deps.python.org.version.marketing }} \"\$@\"" >> python
chmod +x python
runtime:
env:
PIPENV_IGNORE_VIRTUALENVS: 1