Skip to content

Commit 732f1f5

Browse files
authored
Merge branch 'main' into dependabot/pip/cryptography-44.0.1
2 parents f160432 + 6d7cd9f commit 732f1f5

File tree

8 files changed

+129
-16
lines changed

8 files changed

+129
-16
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,28 @@ jobs:
359359

360360
release:
361361
name: Release
362-
363362
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true'
364-
365363
runs-on: ubuntu-latest
366-
environment: Publish
364+
environment: pypipublish
367365
needs: [linux, windows, macos_x86, macos_aarch64, sdist]
366+
permissions:
367+
id-token: write
368+
contents: read
368369
steps:
370+
- uses: actions/checkout@v4
369371
- uses: actions/download-artifact@v4
370372
with:
371373
pattern: wheels-*
372-
name: wheels
374+
path: dist
375+
merge-multiple: true
376+
- name: List contents of dist directory
377+
run: ls -la dist/
373378
- name: Publish to PyPI
374-
uses: PyO3/maturin-action@v1
375-
env:
376-
MATURIN_PYPI_TOKEN: ${{ secrets.caipypi }}
379+
uses: pypa/gh-action-pypi-publish@release/v1
377380
with:
378-
command: upload
379-
args: --non-interactive --skip-existing *
381+
packages-dir: dist
382+
# verbose: true
383+
# print-hash: true
384+
# Uncomment below for test runs, otherwise fails on existing packages being reuploaded
385+
skip-existing: true
386+

.github/workflows/upload-test.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Upload Test for Pypi.
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
linux:
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
target: [aarch64]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.10"
18+
cache: "pip"
19+
- run: pip install -r requirements.txt
20+
- name: Setup QEMU
21+
uses: docker/setup-qemu-action@v1
22+
if: ${{ matrix.target == 'aarch64' }}
23+
- name: Build wheels
24+
uses: PyO3/maturin-action@v1
25+
with:
26+
target: ${{ matrix.target }}
27+
maturin-version: "1.2.0"
28+
args: --release --out dist --find-interpreter
29+
sccache: "true"
30+
manylinux: ${{ matrix.target == 'aarch64' && 'manylinux_2_28' || 'auto' }}
31+
before-script-linux: |
32+
pip install uniffi-bindgen==0.24.1
33+
34+
# ISSUE: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145
35+
# If we're running on rhel centos, install needed packages.
36+
if command -v yum &> /dev/null; then
37+
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
38+
39+
# If we're running on i686 we need to symlink libatomic
40+
# in order to build openssl with -latomic flag.
41+
if [[ ! -d "/usr/lib64" ]]; then
42+
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
43+
fi
44+
else
45+
# If we're running on debian-based system.
46+
apt update -y && apt-get install -y libssl-dev openssl pkg-config
47+
fi
48+
- name: Upload wheels
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: wheels-${{ matrix.target }}
52+
path: dist
53+
54+
sdist:
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Build sdist
60+
uses: PyO3/maturin-action@v1
61+
with:
62+
command: sdist
63+
args: --out dist
64+
- name: Upload sdist
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: wheels
68+
path: dist
69+
70+
pypi-publish:
71+
name: upload release to PyPI
72+
runs-on: ubuntu-latest
73+
needs: [linux, sdist]
74+
75+
# Specifying a GitHub environment is optional, but strongly encouraged
76+
environment: testpublish
77+
permissions:
78+
# IMPORTANT: this permission is mandatory for Trusted Publishing
79+
id-token: write
80+
steps:
81+
# retrieve your distributions here
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
85+
- name: Download aarch64 wheels artifact
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: wheels-aarch64
89+
90+
- name: Download sdist artifact
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: sdist
94+
95+
- name: Publish package distributions to PyPI
96+
uses: pypa/gh-action-pypi-publish@release/v1
97+
with:
98+
repository-url: https://test.pypi.org/legacy/

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "c2pa-python"
3-
version = "0.8.1"
3+
version = "0.9.0"
44
edition = "2021"
55
authors = ["Gavin Peacock <[email protected]"]
66

@@ -12,7 +12,7 @@ crate-type = ["lib", "cdylib"]
1212
normal = ["openssl-src"]
1313

1414
[dependencies]
15-
c2pa = { version = "0.49.2", features = ["file_io", "pdf", "fetch_remote_manifests"]}
15+
c2pa = { version = "0.51.0", features = ["file_io", "pdf", "fetch_remote_manifests"]}
1616
thiserror = "1.0.49"
1717
uniffi = "0.28.2"
1818
openssl-src = "=300.3.1" # Required for openssl-sys

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ build-python:
1515

1616
test:
1717
python3 ./tests/test_unit_tests.py
18-
python3 ./tests/test_api.py
18+
python3 ./tests/test_api.py
19+
20+
publish: release
21+
python3 -m pip install twine
22+
python3 -m twine upload dist/*

deny.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ allow = [
3939
"Unicode-DFS-2016",
4040
"Unicode-3.0",
4141
"Zlib",
42+
"CDLA-Permissive-2.0",
4243
]
4344
confidence-threshold = 0.9
4445

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["maturin>=1.7.4,<2.0","uniffi_bindgen>=0.28,<0.30"]
33
build-backend = "maturin"
44

55
[project]
6-
name = "c2pa"
6+
name = "c2pa-python"
77
dependencies = ["cffi"]
88
requires-python = ">=3.7"
99
description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
@@ -27,4 +27,7 @@ urls = {homepage = "https://contentauthenticity.org", repository = "https://gith
2727
[project.optional-dependencies]
2828
test = [
2929
"pytest < 5.0.0"
30-
]
30+
]
31+
32+
[tool.maturin]
33+
module-name = "c2pa"

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def getitem(d, key):
6363

6464
class TestC2paSdk(unittest.TestCase):
6565
def test_version(self):
66-
assert version() == "0.8.0"
66+
assert version() == "0.9.0"
6767

6868
def test_sdk_version(self):
6969
assert "c2pa-rs/" in sdk_version()

tests/test_unit_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
class TestC2paSdk(unittest.TestCase):
2727
def test_version(self):
28-
self.assertIn("0.8.0", sdk_version())
28+
self.assertIn("0.9.0", sdk_version())
2929

3030

3131
class TestReader(unittest.TestCase):

0 commit comments

Comments
 (0)