-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20318 from wolfi-dev/python-dev
python dev
- Loading branch information
Showing
28 changed files
with
771 additions
and
568 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
name: Collect wheels built by a python pipeline | ||
|
||
needs: | ||
packages: | ||
- util-linux | ||
|
||
inputs: | ||
dest: | ||
description: the destination | ||
default: ${{targets.subpkgdir}}/usr/share/wheels | ||
|
||
pipeline: | ||
- name: "pip build ${{inputs.python}}" | ||
runs: | | ||
found="" | ||
set -- | ||
for wheel in ./.wheels/*/*.whl; do | ||
[ -f "$wheel" ] || continue | ||
set -- "$@" "$wheel" | ||
done | ||
if [ $# -eq 0 ]; then | ||
echo "No wheels found in $PWD/.wheels/*/*.whl" | ||
exit 1 | ||
fi | ||
mkdir -p ${{inputs.dest}} | ||
echo "Found wheels:" "$@" | ||
sha256sum "$@" | ||
cp -v "$@" "${{inputs.dest}}" |
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,18 @@ | ||
name: Setup, install and compile python | ||
|
||
inputs: | ||
python: | ||
description: which python to use | ||
required: true | ||
dest: | ||
description: the destination | ||
default: ${{targets.subpkgdir}} | ||
|
||
pipeline: | ||
- name: "setup ${{inputs.python}}" | ||
runs: | | ||
${{inputs.python}} setup.py install --no-compile --root="${{targets.subpkgdir}}" --prefix=/usr | ||
rm -Rf build/ | ||
- name: "compileall ${{inputs.python}}" | ||
runs: | | ||
${{inputs.python}} -m compileall --invalidation-mode=unchecked-hash -r100 ${{targets.subpkgdir}}/usr/lib/ |
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,58 @@ | ||
name: Use pip from a zipapp for bootstrap. Only for use with bootstrapping. | ||
|
||
needs: | ||
packages: | ||
- pip-zipapp | ||
|
||
inputs: | ||
python: | ||
description: which python to use | ||
required: true | ||
wheel: | ||
description: build a wheel? | ||
required: false | ||
default: true | ||
dest: | ||
description: the destination | ||
default: ${{targets.subpkgdir}} | ||
|
||
pipeline: | ||
- name: "pip-bootstrap build" | ||
runs: | | ||
export SOURCE_DATE_EPOCH=315532800 | ||
py=${{inputs.python}} | ||
pipzip=/usr/share/pip-zipapp/pip-zipapp.pyz | ||
[ -e "$pipzip" ] || { echo "missing pip-zip - $pipzip does not exist"; exit 1; } | ||
[ -f "$pipzip" ] || { echo "missing pip-zip - $pipzip is not a file"; exit 1; } | ||
pyver=$("$py" -c 'import sys; print("%s.%s" % (sys.version_info.major, sys.version_info.minor))') | ||
sitepkgd=$("$py" -c 'import site; print(site.getsitepackages()[0])') | ||
sitepkgd=${sitepkgd#/} | ||
root=${{inputs.dest}} | ||
wd="./.wheels/$pyver" | ||
info() { echo "$@" 1>&2; } | ||
vr() { info "execute:" "$@"; "$@"; } | ||
tmpd=$(mktemp -d) | ||
trap "rm -Rf '$tmpd'" EXIT | ||
# --find-links to an empty dir and --no-index makes pip fully "offline" | ||
distwheelsd="/usr/share/pip-zipapp/wheels" | ||
mkdir -p "$distwheelsd" | ||
info "$py is $pyver with site_packages dir '$sitepkgd'" | ||
if [ "${{inputs.wheel}}" = "false" ]; then | ||
info "skipping bdist-wheel" | ||
vr "$py" "$pipzip" --python=/usr/bin/$py install --verbose --no-deps \ | ||
"--find-links=$distwheelsd" --no-index \ | ||
--force-reinstall --no-compile --prefix=/usr "--root=$root" . | ||
else | ||
vr "$py" "$pipzip" --python=/usr/bin/$py wheel --verbose "--wheel-dir=$wd" \ | ||
"--find-links=$distwheelsd" --no-index --no-deps . | ||
set -- "$wd"/*.whl | ||
[ -f "$1" ] || { info "did not produce a wheel in $wd"; exit 1; } | ||
info "produced $# wheels: $*" | ||
vr "$py" "$pipzip" --python=/usr/bin/$py install --verbose \ | ||
"--find-links=$distwheelsd" --no-index --no-build-isolation --no-deps \ | ||
--force-reinstall --no-compile --prefix=/usr "--root=$root" "$@" | ||
fi | ||
vr $py -m compileall --invalidation-mode=unchecked-hash -r100 "$root/$sitepkgd" |
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,35 @@ | ||
name: Build and install python package with pip | ||
|
||
inputs: | ||
python: | ||
description: which python to use | ||
required: true | ||
dest: | ||
description: the destination | ||
default: ${{targets.subpkgdir}} | ||
|
||
pipeline: | ||
- name: "pip build ${{inputs.python}}" | ||
runs: | | ||
export SOURCE_DATE_EPOCH=315532800 | ||
py=${{inputs.python}} | ||
pyver=$("$py" -c 'import sys; print("%s.%s" % (sys.version_info.major, sys.version_info.minor))') | ||
sitepkgd=$("$py" -c 'import site; print(site.getsitepackages()[0])') | ||
sitepkgd=${sitepkgd#/} | ||
root=${{inputs.dest}} | ||
wd="./.wheels/$pyver" | ||
vr() { echo "execute:" "$@"; "$@"; } | ||
tmpd=$(mktemp -d) | ||
trap "rm -Rf '$tmpd'" EXIT | ||
# --find-links to an empty dir and --no-index makes pip fully "offline" | ||
distwheelsd="$tmpd/dist-wheels" | ||
mkdir -p "$distwheelsd" | ||
echo "$py is $pyver with site_packages dir '$sitepkgd'" | ||
vr $py -m pip wheel --verbose "--wheel-dir=$wd" \ | ||
"--find-links=$distwheelsd" --no-index --no-build-isolation --no-deps . | ||
vr $py -m pip install --verbose \ | ||
"--find-links=$distwheelsd" --no-index --no-build-isolation --no-deps \ | ||
--force-reinstall --no-compile --prefix=/usr "--root=$root" "$wd"/*.whl | ||
vr $py -m compileall --invalidation-mode=unchecked-hash -r100 "$root/$sitepkgd" |
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,57 @@ | ||
package: | ||
name: py3-cython | ||
version: 3.0.10 | ||
epoch: 1 | ||
description: Cython is an optimising static compiler for both the Python & the extended Cython programming languages. | ||
copyright: | ||
- license: Apache-2.0 | ||
dependencies: | ||
provider-priority: 0 | ||
|
||
vars: | ||
pypi-package: cython | ||
|
||
data: | ||
- name: py-versions | ||
items: | ||
3.10: "310" | ||
3.11: "311" | ||
3.12: "312" | ||
|
||
environment: | ||
contents: | ||
packages: | ||
- build-base | ||
- busybox | ||
- py3-supported-pip | ||
- py3-supported-python-dev | ||
- py3-supported-wheel | ||
|
||
pipeline: | ||
- uses: fetch | ||
with: | ||
expected-sha256: 00f97476cef9fcd9a89f9d2a49be3b518e1a74b91f377fe08c97fcb44bc0f7d7 | ||
uri: https://github.com/cython/cython/archive/${{package.version}}.tar.gz | ||
|
||
subpackages: | ||
- range: py-versions | ||
name: py${{range.key}}-${{vars.pypi-package}} | ||
dependencies: | ||
provider-priority: ${{range.value}} | ||
provides: | ||
- ${{package.name}} | ||
- cython | ||
pipeline: | ||
- uses: py/pip-build-install | ||
with: | ||
python: python${{range.key}} | ||
- uses: strip | ||
|
||
- name: py3-wheels-${{vars.pypi-package}} | ||
pipeline: | ||
- uses: py/collect-wheels | ||
|
||
update: | ||
enabled: true | ||
github: | ||
identifier: cython/cython |
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
Oops, something went wrong.