Skip to content

Commit

Permalink
drop python req from pip-build-install, move to pip-build-install, ad…
Browse files Browse the repository at this point in the history
…d tests

There are lots of changes here, centered around removing all occurences
of SETUPTOOLS_SCM_PRETEND_VERSION.  That seems to be not necessary now,
at least with the current pip-build-install workflow.

 * do not require 'python' setting in pip-build-install.  Default to
   using the target of the 'python3' link. If not present, user
   has to supply it.

   Also use contextdir rather than subpkgdir so it can be used from "main"
   packages also.

 * replace any packages that had SETUPTOOLS_SCM_PRETEND_VERSION with
   py/pip-build-install.

 * Add tests to touched packages

 * Drop 'python3' runtime dep from touched packages.

 * Fix uninstallable py3-gcloud-aio-storage which conflicted with
   its dependency py3-gcloud-aio-auth as they both provided
   usr/lib/python3.12/site-packages/gcloud/py.typed

 * Fix the provides in py3-maturin-bin packages to provide py3-maturin-bin
   rather than just py3-maturin.  That also fixes py3-pendulum which
   was failing to build because it actually needs 'maturin' executable
   but that was not being provided by the 'py3-maturin' dep.

 * Fix pendulum's dependency that had py3-pytzdata, it's deps list 'tzdata'

 * Drop the now-unused py3-pytzdata

Note the 'python3' shell snippet in py3-rich and others is painful.
See wolfi-dev#26818 for more context.
  • Loading branch information
smoser committed Aug 21, 2024
1 parent 4c4bd8b commit 5122148
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 148 deletions.
12 changes: 10 additions & 2 deletions pipelines/py/pip-build-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@ name: Build and install python package with pip
inputs:
python:
description: which python to use
required: true
default: DEFAULT
dest:
description: the destination
default: ${{targets.subpkgdir}}
default: ${{targets.contextdir}}

pipeline:
- name: "pip build ${{inputs.python}}"
runs: |
export SOURCE_DATE_EPOCH=315532800
py=${{inputs.python}}
if [ "$py" = "DEFAULT" ]; then
py=python3
p=$(command -v $py) || { echo "No $py command found"; exit 1; }
if [ -L "$p" ]; then
py=$(readlink -f "$p") ||
{ echo "failed 'readlink -f $p'"; exit 1; }
fi
fi
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#/}
Expand Down
12 changes: 2 additions & 10 deletions py3-antlr4-python3-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,8 @@ pipeline:
repository: https://github.com/antlr/antlr4
tag: ${{package.version}}

- runs: |
cd runtime/Python3
export SETUPTOOLS_SCM_PRETEND_VERSION=${{package.version}}
python3=$(readlink -f `which python3`)
$python3 -m pip install -U poetry
$python3 -m gpep517 build-wheel \
--wheel-dir dist \
--output-fd 3 3>&1 >&2
$python3 -m installer -d "${{targets.destdir}}" \
dist/*.whl
- uses: py/pip-build-install
working-directory: runtime/Python3

- uses: strip

Expand Down
23 changes: 9 additions & 14 deletions py3-cppy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package:
- license: BSD-3-Clause
dependencies:
runtime:
- python3
- py3-setuptools

environment:
contents:
Expand All @@ -30,22 +30,17 @@ pipeline:
expected-commit: 13a67972ca9063951440c911270f204aa7fe631a
tag: ${{package.version}}

- runs: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Python Build
runs: |
export SETUPTOOLS_SCM_PRETEND_VERSION=${{package.version}}
python3 -m gpep517 build-wheel \
--wheel-dir .dist \
--output-fd 3 3>&1 >&2
- name: Python Install
runs: python3 -m installer -d "${{targets.destdir}}" .dist/cppy*.whl
- uses: py/pip-build-install

- uses: strip

test:
pipeline:
- uses: python/import
with:
imports: |
import cppy
update:
enabled: true
github:
Expand Down
25 changes: 16 additions & 9 deletions py3-gcloud-aio-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package:
- py3-chardet
- py3-cryptography
- py3-pyjwt
- python3

environment:
contents:
Expand All @@ -23,6 +22,7 @@ environment:
- ca-certificates-bundle
- poetry
- py3-gpep517
- py3-pip
- py3-setuptools
- py3-wheel
- python3
Expand All @@ -35,19 +35,26 @@ pipeline:
repository: https://github.com/talkiq/gcloud-aio
tag: auth-${{package.version}}

- name: Python Build
- name: remove py.typed to avoid conflict with py3-gcloud-aio-*
runs: |
cd auth
export SETUPTOOLS_SCM_PRETEND_VERSION=${{package.version}}
python3 -m gpep517 build-wheel \
--wheel-dir dist \
--output-fd 3 3>&1 >&2
rm auth/gcloud/py.typed auth/gcloud/aio/py.typed
python3 -m installer -d "${{targets.destdir}}" \
dist/*.whl
- uses: py/pip-build-install
working-directory: auth

- uses: strip

test:
environment:
contents:
packages:
- openssl-provider-legacy # needed for 'from gcloud.aio import auth'
pipeline:
- uses: python/import
with:
imports: |
from gcloud.aio import auth
update:
enabled: true
github:
Expand Down
25 changes: 16 additions & 9 deletions py3-gcloud-aio-storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package:
- py3-gcloud-aio-auth
- py3-asn1-modules
- py3-rsa
- python3

environment:
contents:
Expand All @@ -22,6 +21,7 @@ environment:
- ca-certificates-bundle
- poetry
- py3-gpep517
- py3-pip
- py3-setuptools
- py3-wheel
- python3
Expand All @@ -34,19 +34,26 @@ pipeline:
repository: https://github.com/talkiq/gcloud-aio
tag: storage-${{package.version}}

- name: Python Build
- name: remove py.typed to avoid conflict with py3-gcloud-aio-*
runs: |
cd storage
export SETUPTOOLS_SCM_PRETEND_VERSION=${{package.version}}
python3 -m gpep517 build-wheel \
--wheel-dir dist \
--output-fd 3 3>&1 >&2
rm storage/gcloud/py.typed storage/gcloud/aio/py.typed
python3 -m installer -d "${{targets.destdir}}" \
dist/*.whl
- uses: py/pip-build-install
working-directory: storage

- uses: strip

test:
environment:
contents:
packages:
- openssl-provider-legacy # needed for gcloud.aio.auth imports to work.
pipeline:
- uses: python/import
with:
imports: |
from gcloud.aio import storage
update:
enabled: true
github:
Expand Down
14 changes: 9 additions & 5 deletions py3-maturin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ subpackages:
with:
python: python${{range.key}}
- uses: strip
test:
pipeline:
- uses: python/import
with:
python: python${{range.key}}
import: ${{vars.pypi-package}}

- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}-bin
Expand All @@ -63,18 +69,16 @@ subpackages:
runtime:
- py${{range.key}}-${{vars.pypi-package}}
provides:
- py3-${{vars.pypi-package}}
- py3-${{vars.pypi-package}}-bin
provider-priority: ${{range.value}}
pipeline:
- runs: |
mkdir -p ${{targets.contextdir}}/usr
mv ${{targets.contextdir}}/../py${{range.key}}-${{vars.pypi-package}}/usr/bin ${{targets.contextdir}}/usr
test:
pipeline:
- uses: python/import
with:
python: python${{range.key}}
import: ${{vars.pypi-package}}
- runs: |
maturin --help
- name: py3-supported-${{vars.pypi-package}}
description: meta package providing ${{vars.pypi-package}} for supported python versions.
Expand Down
33 changes: 22 additions & 11 deletions py3-pendulum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ package:
dependencies:
runtime:
- py3-dateutil
- py3-pytzdata
- py3-typing
- python3
- py3-tzdata

environment:
contents:
Expand All @@ -22,7 +21,7 @@ environment:
- poetry
- py3-gpep517
- py3-installer
- py3-maturin
- py3-maturin-bin
- py3-pip
- py3-setuptools
- py3-wheel
Expand All @@ -38,17 +37,29 @@ pipeline:
tag: ${{package.version}}
expected-commit: 0fcd10217af0469b3edda072f2b152d5273f3d58

- runs: |
export SETUPTOOLS_SCM_PRETEND_VERSION=${{package.version}}
python3 -m gpep517 build-wheel \
--wheel-dir dist \
--output-fd 3 3>&1 >&2
python3 -m installer -d "${{targets.destdir}}" \
dist/*.whl
- uses: py/pip-build-install

- uses: strip

test:
pipeline:
- uses: python/import
with:
imports: |
import pendulum
- runs: |
python=$(set +x; m=/usr/bin/python3.*; set -- $m
[ $# -eq 1 -a -x "$1" ] && echo "$1" && exit 0
echo "found $# matches to $m"; exit 1;)
# test verifies that timezone data is present.
$python -c '
from pendulum import datetime
tor = datetime(2012, 1, 1, tz="America/Toronto")
van = datetime(2012, 1, 1, tz="America/Vancouver")
assert 3 == van.diff(tor).in_hours()
print("PASS: time zones check out")
'
update:
enabled: true
github:
Expand Down
20 changes: 8 additions & 12 deletions py3-psycopg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package:
- libpq-16
- py3-typing-extensions
- py3-tzdata
- python3

environment:
contents:
Expand All @@ -20,6 +19,7 @@ environment:
- ca-certificates-bundle
- poetry
- py3-gpep517
- py3-pip
- py3-setuptools
- py3-wheel
- python3
Expand All @@ -32,16 +32,8 @@ pipeline:
tag: ${{package.version}}
expected-commit: bb47d3944d1c65d9baf83808696aba1b2dfed9af

- name: Python Build
runs: |
cd psycopg
export SETUPTOOLS_SCM_PRETEND_VERSION=${{package.version}}
python3 -m gpep517 build-wheel \
--wheel-dir dist \
--output-fd 3 3>&1 >&2
python3 -m installer -d "${{targets.destdir}}" \
dist/*.whl
- uses: py/pip-build-install
working-directory: psycopg

- uses: strip

Expand Down Expand Up @@ -113,4 +105,8 @@ test:
if __name__ == "__main__":
main()
EOF
python3 /tmp/test.py
python=$(m=/usr/bin/python3.*; set +x; set -- $m
[ $# -eq 1 -a -x "$1" ] && echo "$1" && exit 0
echo "found $# matches to $m"; exit 1;)
$python /tmp/test.py
55 changes: 0 additions & 55 deletions py3-pytzdata.yaml

This file was deleted.

Loading

0 comments on commit 5122148

Please sign in to comment.