Skip to content

Commit

Permalink
py3-cairo: Add python multiversion support (#34388)
Browse files Browse the repository at this point in the history
Related: chainguard-dev/internal-dev#5334

---------

Signed-off-by: dann frazier <[email protected]>
  • Loading branch information
dannf authored Nov 17, 2024
1 parent f9b4857 commit 23f057c
Showing 1 changed file with 83 additions and 9 deletions.
92 changes: 83 additions & 9 deletions py3-cairo.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
package:
name: py3-cairo
version: 1.27.0
epoch: 0
epoch: 1
description: Python3 bindings for the cairo graphics library
copyright:
- license: LGPL-2.0-or-later
dependencies:
runtime:
- python3
provider-priority: 0

vars:
pypi-package: cairo
import: cairo

data:
- name: py-versions
items:
3.10: "310"
3.11: "311"
3.12: "312"
3.13: "300"

environment:
contents:
Expand All @@ -21,9 +32,10 @@ environment:
- fontconfig-dev
- freetype-dev
- libpng-dev
- meson
- openssf-compiler-options
- python3-dev
- py3-supported-meson-python
- py3-supported-pip
- py3-supported-python-dev
- zlib-dev

pipeline:
Expand All @@ -42,18 +54,80 @@ pipeline:

- uses: meson/install

- runs: python3 -m compileall "${{targets.destdir}}"/usr/lib
- runs: |
# python-version-specific files will be provided by subpackages
rm -rf ${{targets.destdir}}/usr/lib/python*
- uses: strip

subpackages:
- name: py3-cairo-dev
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}
description: python${{range.key}} version of ${{vars.pypi-package}}
dependencies:
provides:
- py3-${{vars.pypi-package}}
provider-priority: ${{range.value}}
pipeline:
- uses: split/dev
- uses: py/pip-build-install
with:
python: python${{range.key}}
- uses: strip
test:
pipeline:
- uses: python/import
with:
python: python${{range.key}}
import: ${{vars.import}}
- runs: |
include="$(python${{range.key}} -c 'import ${{vars.import}}; print(${{vars.import}}.get_include())')"
test -f "$include/py3cairo.h"
environment:
contents:
packages:
- py3-supported-${{vars.pypi-package}}

- name: py3-supported-${{vars.pypi-package}}
description: meta package providing ${{vars.pypi-package}} for supported python versions.
dependencies:
runtime:
- py3-cairo
- py3.10-${{vars.pypi-package}}
- py3.11-${{vars.pypi-package}}
- py3.12-${{vars.pypi-package}}
- py3.13-${{vars.pypi-package}}
test:
pipeline:
- uses: python/import
with:
python: python3.10
import: ${{vars.import}}
- uses: python/import
with:
python: python3.11
import: ${{vars.import}}
- uses: python/import
with:
python: python3.12
import: ${{vars.import}}
- uses: python/import
with:
python: python3.13
import: ${{vars.import}}

- name: py3-cairo-dev
description: py3-cairo dev
dependencies:
runtime:
- py3-cairo
pipeline:
- uses: split/dev
test:
pipeline:
- uses: py/one-python
with:
content: |
include="$(python3 -c 'import ${{vars.import}}; print(${{vars.import}}.get_include())')"
test -f "$include/py3cairo.h"
update:
enabled: true
Expand Down

0 comments on commit 23f057c

Please sign in to comment.