Skip to content

Commit

Permalink
Move several py3- packages to pip-build-install, add tests.
Browse files Browse the repository at this point in the history
I set out to get rid of SETUPTOOLS_SCM_PRETEND_VERSION,
and found some issues along the way.

 * 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 - melange sca
   does the right thing.

 * py3-cppy - add setuptools dep, found when adding a test.

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

 * py3-maturin - Fix the provides in py3-maturin-bin packages to provide
   py3-maturin-bin rather than just py3-maturin.
   That 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.

 * py3-pendulum - fix dependency it should be tzdata not pytzdata

 * py3-pytzdata - Drop this, it is not used anywhere.

Note the 'python3' shell snippet in py3-rich and others is painful.
See #26818 for more context.
  • Loading branch information
smoser committed Aug 22, 2024
1 parent 4bfb7ed commit e92110a
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 144 deletions.
25 changes: 10 additions & 15 deletions py3-cppy.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package:
name: py3-cppy
version: 1.2.1
epoch: 1
epoch: 2
copyright:
- 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
27 changes: 17 additions & 10 deletions py3-gcloud-aio-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package:
name: py3-gcloud-aio-auth
version: 5.3.2
epoch: 0
epoch: 1
description: Python Client for Google Cloud Auth
copyright:
- license: MIT
Expand All @@ -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
27 changes: 17 additions & 10 deletions py3-gcloud-aio-storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package:
name: py3-gcloud-aio-storage
version: 9.3.0
epoch: 0
epoch: 1
description: Python Client for Google Cloud Storage
copyright:
- license: MIT
Expand All @@ -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
16 changes: 10 additions & 6 deletions py3-maturin.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: py3-maturin
version: 1.7.1
epoch: 0
epoch: 1
description: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages
copyright:
- license: MIT OR Apache-2.0
Expand Down 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
35 changes: 23 additions & 12 deletions py3-pendulum.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package:
name: py3-pendulum
version: 3.0.0
epoch: 0
epoch: 1
description: Python datetimes made easy
copyright:
- license: MIT
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
22 changes: 9 additions & 13 deletions py3-psycopg.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: py3-psycopg
version: 3.2.1
epoch: 0
epoch: 1
description: PostgreSQL database adapter for Python
copyright:
- license: LGPL-3.0-only
Expand All @@ -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 e92110a

Please sign in to comment.