Skip to content

Commit e7484b9

Browse files
c2pa-python: Add version 0.37.12 (#2279)
* c2pa-python: Add version 0.37.12 Signed-off-by: riseproject-dev[bot] <330740410+riseproject-dev[bot]@users.noreply.github.com> * c2pa-python: carry forward 0.37.10 patches to 0.37.12 The nightly-upgrade bot bumped docs/packages/c2pa-python.yaml to 0.37.12 but did not copy patches/c2pa-python/0.37.10/ forward, so build-c2pa-python.yml's git apply failed with "No such file or directory" before the build could start. setup.py, src/c2pa/lib.py and pyproject.toml are unchanged between v0.37.10 and v0.37.12 (the only upstream diff in that range is the c2pa-rs pin bump in c2pa-native-version.txt), and both patches still apply cleanly against the v0.37.12 tag (verified with git apply --check), so copy them unchanged to patches/c2pa-python/0.37.12/. * c2pa-python: drop --locked from the c2pa-rs cargo build (upstream stopped tracking Cargo.lock) * c2pa-python: fix apostrophe breaking the docker bash -c single-quoted script The "Makefile's own" comment's raw apostrophe closed the single-quoted `bash -c '...'` string early, right there in the shell's eyes. Everything after it in that line, plus the intended cargo build command on the next line, was left as unquoted text/arguments to the outer `run:` script - which meant `cd /tmp/c2pa-rs` never affected anything past that point, and the `cargo build -p c2pa-c-ffi ...` line actually executed on the raw runner host (outside the container, in the checkout directory) instead of inside the container against the cloned c2pa-rs tree. That's exactly why every attempt failed identically with "could not find Cargo.toml" at the runner's own workspace path rather than /tmp/c2pa-rs. Reworded the comment to drop the apostrophe instead of trying to escape a literal ' inside a single-quoted bash string (the '\''-style escape works but is easy to get wrong and harder to read here). --------- Signed-off-by: riseproject-dev[bot] <330740410+riseproject-dev[bot]@users.noreply.github.com> Co-authored-by: riseproject-dev[bot] <330740410+riseproject-dev[bot]@users.noreply.github.com> Co-authored-by: Ludovic Henry <git@ludovic.dev>
1 parent 73f289b commit e7484b9

4 files changed

Lines changed: 115 additions & 1 deletion

File tree

‎.github/workflows/build-c2pa-python.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ jobs:
9393
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
9494
git clone --depth 1 --branch "$C2PA_NATIVE_TAG" https://github.com/contentauth/c2pa-rs /tmp/c2pa-rs
9595
cd /tmp/c2pa-rs
96-
"$HOME/.cargo/bin/cargo" build --release --locked -p c2pa-c-ffi --no-default-features --features "rust_native_crypto,add_thumbnails,http,file_io"
96+
# c2pa-rs stopped tracking Cargo.lock as of the c2pa-v0.91.0 tag (upstream
97+
# commit 40d0218b); --locked has nothing to lock against and just errors.
98+
# Matches the CARGO_BUILD_FLAGS in c2pa_c_ffi/Makefile, which never had it.
99+
"$HOME/.cargo/bin/cargo" build --release -p c2pa-c-ffi --no-default-features --features "rust_native_crypto,add_thumbnails,http,file_io"
97100
cp target/release/libc2pa_c.so /io/artifacts/riscv64gc-unknown-linux-gnu/
98101
cd /io
99102
/opt/python/cp312-cp312/bin/pip install -q toml==0.10.2 setuptools==68.0.0 wheel==0.46.2

‎docs/packages/c2pa-python.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ versions:
99
- filename: c2pa_python-0.37.10-py3-none-manylinux_2_39_riscv64.whl
1010
sha256: 862ee7d92f163865741657b0bb53fbc998a3ca3339d580e6be713959d735c8cd
1111
requires-python: '>=3.10'
12+
- version: 0.37.12
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Sat, 12 Sep 2026 11:16:12 +0200
4+
Subject: [PATCH 1/2] add riscv64 to the platform-identifier tables
5+
6+
Upstream-Status: To upstream [not yet submitted; python-wheels does not open issues/PRs on third-party repos]
7+
8+
get_platform_identifier() (setup.py, used by bdist_wheel to pick the
9+
artifacts/ subfolder to copy into the wheel) and its runtime counterpart
10+
in src/c2pa/lib.py both fall through to the x86_64-unknown-linux-gnu
11+
branch on a native riscv64 host, since neither platform.machine() check
12+
recognises 'riscv64'. Add a riscv64gc-unknown-linux-gnu branch to each,
13+
plus the corresponding PLATFORM_EXTENSIONS/PLATFORM_FOLDERS entries and
14+
get_current_platform()'s linux_riscv64 case, matching the existing
15+
aarch64 handling.
16+
17+
Signed-off-by: Ludovic Henry <git@ludovic.dev>
18+
---
19+
setup.py | 6 ++++++
20+
src/c2pa/lib.py | 3 +++
21+
2 files changed, 9 insertions(+)
22+
23+
diff --git a/setup.py b/setup.py
24+
index ddf6e98..8c66a90 100644
25+
--- a/setup.py
26+
+++ b/setup.py
27+
@@ -33,6 +33,7 @@ PLATFORM_EXTENSIONS = {
28+
'apple-darwin': 'dylib', # universal
29+
'linux_x86_64': 'so',
30+
'linux_aarch64': 'so',
31+
+ 'linux_riscv64': 'so',
32+
}
33+
34+
# Based on what c2pa-rs repo publishes
35+
@@ -44,6 +45,7 @@ PLATFORM_FOLDERS = {
36+
'aarch64-pc-windows-msvc': 'dll',
37+
'x86_64-unknown-linux-gnu': 'so',
38+
'aarch64-unknown-linux-gnu': 'so',
39+
+ 'riscv64gc-unknown-linux-gnu': 'so',
40+
}
41+
42+
# Directory structure
43+
@@ -86,6 +88,8 @@ def get_platform_identifier(target_arch=None) -> str:
44+
elif system == "linux":
45+
if target_arch == "aarch64" or platform.machine() == "aarch64":
46+
return "aarch64-unknown-linux-gnu"
47+
+ elif target_arch == "riscv64" or platform.machine() == "riscv64":
48+
+ return "riscv64gc-unknown-linux-gnu"
49+
else:
50+
return "x86_64-unknown-linux-gnu"
51+
else:
52+
@@ -115,6 +119,8 @@ def get_current_platform():
53+
else: # Linux
54+
if platform.machine() == "aarch64":
55+
return "linux_aarch64"
56+
+ elif platform.machine() == "riscv64":
57+
+ return "linux_riscv64"
58+
return "linux_x86_64"
59+
60+
def copy_platform_libraries(platform_name, clean_first=False):
61+
diff --git a/src/c2pa/lib.py b/src/c2pa/lib.py
62+
index be6353f..17ecbff 100644
63+
--- a/src/c2pa/lib.py
64+
+++ b/src/c2pa/lib.py
65+
@@ -27,6 +27,7 @@ class CPUArchitecture(Enum):
66+
AARCH64 = "aarch64"
67+
X86_64 = "x86_64"
68+
ARM64 = "arm64"
69+
+ RISCV64 = "riscv64"
70+
71+
72+
def get_platform_identifier() -> str:
73+
@@ -61,6 +62,8 @@ def get_platform_identifier() -> str:
74+
elif system == "linux":
75+
if _get_architecture() in [CPUArchitecture.ARM64.value, CPUArchitecture.AARCH64.value]:
76+
return "aarch64-unknown-linux-gnu"
77+
+ elif _get_architecture() == CPUArchitecture.RISCV64.value:
78+
+ return "riscv64gc-unknown-linux-gnu"
79+
return "x86_64-unknown-linux-gnu"
80+
else:
81+
raise ValueError(f"Unsupported operating system: {system}")
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Sat, 12 Sep 2026 11:16:20 +0200
4+
Subject: [PATCH 2/2] ship the project's own LICENSE-MIT and LICENSE-APACHE in
5+
the wheel
6+
7+
Upstream-Status: To upstream [not yet submitted; python-wheels does not open issues/PRs on third-party repos]
8+
9+
[tool.setuptools] overrides license-files to an empty list, so every
10+
published wheel (all platforms, not just riscv64) carries no licence
11+
text at all despite the project being dual MIT/Apache-2.0 licensed.
12+
Point the list at the two licence files already at the project root
13+
instead of disabling it outright.
14+
15+
Signed-off-by: Ludovic Henry <git@ludovic.dev>
16+
---
17+
pyproject.toml | 2 +-
18+
1 file changed, 1 insertion(+), 1 deletion(-)
19+
20+
diff --git a/pyproject.toml b/pyproject.toml
21+
index 7620ff9..00602da 100644
22+
--- a/pyproject.toml
23+
+++ b/pyproject.toml
24+
@@ -32,4 +32,4 @@ download-artifacts = "c2pa.build:download_artifacts"
25+
26+
# Workaround to prevent setuptools from automatically including invalid metadata
27+
[tool.setuptools]
28+
-license-files = []
29+
+license-files = ["LICENSE-MIT", "LICENSE-APACHE"]

0 commit comments

Comments
 (0)