Skip to content

Commit 48348ee

Browse files
committed
c2pa-python: Carry patches over to version 0.38.1
Both 0.38.0 patches still apply unchanged to v0.38.1.
1 parent f5319ed commit 48348ee

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

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)