Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/packages/c2pa-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ versions:
- filename: c2pa_python-0.37.12-py3-none-manylinux_2_39_riscv64.whl
sha256: 25a6fa6da964fd03be32eb6e77d42bfafa0c2f2fa79757d41eed49212e20ee39
requires-python: '>=3.10'
- version: 0.38.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 12 Sep 2026 11:16:12 +0200
Subject: [PATCH 1/2] add riscv64 to the platform-identifier tables

Upstream-Status: To upstream [not yet submitted; python-wheels does not open issues/PRs on third-party repos]

get_platform_identifier() (setup.py, used by bdist_wheel to pick the
artifacts/ subfolder to copy into the wheel) and its runtime counterpart
in src/c2pa/lib.py both fall through to the x86_64-unknown-linux-gnu
branch on a native riscv64 host, since neither platform.machine() check
recognises 'riscv64'. Add a riscv64gc-unknown-linux-gnu branch to each,
plus the corresponding PLATFORM_EXTENSIONS/PLATFORM_FOLDERS entries and
get_current_platform()'s linux_riscv64 case, matching the existing
aarch64 handling.

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
setup.py | 6 ++++++
src/c2pa/lib.py | 3 +++
2 files changed, 9 insertions(+)

diff --git a/setup.py b/setup.py
index ddf6e98..8c66a90 100644
--- a/setup.py
+++ b/setup.py
@@ -33,6 +33,7 @@ PLATFORM_EXTENSIONS = {
'apple-darwin': 'dylib', # universal
'linux_x86_64': 'so',
'linux_aarch64': 'so',
+ 'linux_riscv64': 'so',
}

# Based on what c2pa-rs repo publishes
@@ -44,6 +45,7 @@ PLATFORM_FOLDERS = {
'aarch64-pc-windows-msvc': 'dll',
'x86_64-unknown-linux-gnu': 'so',
'aarch64-unknown-linux-gnu': 'so',
+ 'riscv64gc-unknown-linux-gnu': 'so',
}

# Directory structure
@@ -86,6 +88,8 @@ def get_platform_identifier(target_arch=None) -> str:
elif system == "linux":
if target_arch == "aarch64" or platform.machine() == "aarch64":
return "aarch64-unknown-linux-gnu"
+ elif target_arch == "riscv64" or platform.machine() == "riscv64":
+ return "riscv64gc-unknown-linux-gnu"
else:
return "x86_64-unknown-linux-gnu"
else:
@@ -115,6 +119,8 @@ def get_current_platform():
else: # Linux
if platform.machine() == "aarch64":
return "linux_aarch64"
+ elif platform.machine() == "riscv64":
+ return "linux_riscv64"
return "linux_x86_64"

def copy_platform_libraries(platform_name, clean_first=False):
diff --git a/src/c2pa/lib.py b/src/c2pa/lib.py
index be6353f..17ecbff 100644
--- a/src/c2pa/lib.py
+++ b/src/c2pa/lib.py
@@ -27,6 +27,7 @@ class CPUArchitecture(Enum):
AARCH64 = "aarch64"
X86_64 = "x86_64"
ARM64 = "arm64"
+ RISCV64 = "riscv64"


def get_platform_identifier() -> str:
@@ -61,6 +62,8 @@ def get_platform_identifier() -> str:
elif system == "linux":
if _get_architecture() in [CPUArchitecture.ARM64.value, CPUArchitecture.AARCH64.value]:
return "aarch64-unknown-linux-gnu"
+ elif _get_architecture() == CPUArchitecture.RISCV64.value:
+ return "riscv64gc-unknown-linux-gnu"
return "x86_64-unknown-linux-gnu"
else:
raise ValueError(f"Unsupported operating system: {system}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 12 Sep 2026 11:16:20 +0200
Subject: [PATCH 2/2] ship the project's own LICENSE-MIT and LICENSE-APACHE in
the wheel

Upstream-Status: To upstream [not yet submitted; python-wheels does not open issues/PRs on third-party repos]

[tool.setuptools] overrides license-files to an empty list, so every
published wheel (all platforms, not just riscv64) carries no licence
text at all despite the project being dual MIT/Apache-2.0 licensed.
Point the list at the two licence files already at the project root
instead of disabling it outright.

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 7620ff9..00602da 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,4 +32,4 @@ download-artifacts = "c2pa.build:download_artifacts"

# Workaround to prevent setuptools from automatically including invalid metadata
[tool.setuptools]
-license-files = []
+license-files = ["LICENSE-MIT", "LICENSE-APACHE"]
Loading