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
63 changes: 34 additions & 29 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,42 +25,58 @@ permissions:
packages: read
actions: read

env:
GITHUB_TOKEN: ${{ secrets.github-token }}

jobs:
build:
runs-on: ${{ inputs.runs-on }}
env:
GITHUB_TOKEN: ${{ secrets.github-token }}
steps:
- uses: actions/checkout@v4

- name: Build Linux wheels
if: runner.os == 'Linux'
run: |
docker run --rm -v $PWD:/io quay.io/pypa/manylinux_2_28_x86_64 bash -c "
# Create necessary directories
mkdir -p artifacts
mkdir -p src/c2pa/libs
rm -rf dist build

# Set Docker image and platform tag based on architecture
if [ "${{ inputs.architecture }}" = "aarch64" ]; then
DOCKER_IMAGE="quay.io/pypa/manylinux_2_28_aarch64"
PLATFORM_TAG="manylinux_2_28_aarch64"
else
DOCKER_IMAGE="quay.io/pypa/manylinux_2_28_x86_64"
PLATFORM_TAG="manylinux_2_28_x86_64"
fi

# Build wheel in Docker container
docker run --rm -v $PWD:/io $DOCKER_IMAGE bash -c "
yum install -y gcc gcc-c++ make &&
mkdir -p /io/artifacts /io/src/c2pa/libs &&
rm -rf /io/dist /io/build &&
cd /io &&
/opt/python/cp310-cp310/bin/pip install -r requirements.txt -r requirements-dev.txt &&
/opt/python/cp310-cp310/bin/python scripts/download_artifacts.py c2pa-v0.55.0 &&
/opt/python/cp310-cp310/bin/pip install toml &&
C2PA_LIBS_PLATFORM=\"${{ inputs.architecture == 'aarch64' && 'aarch64-unknown-linux-gnu' || 'x86_64-unknown-linux-gnu' }}\" /opt/python/cp310-cp310/bin/python scripts/download_artifacts.py c2pa-v0.55.0 &&
for PYBIN in /opt/python/cp3{10,11}-*/bin; do
\${PYBIN}/pip install --upgrade pip wheel &&
CFLAGS=\"-I/opt/python/cp310-cp310/include/python3.10\" LDFLAGS=\"-L/opt/python/cp310-cp310/lib\" \${PYBIN}/python setup.py bdist_wheel --plat-name manylinux_2_28_x86_64
\${PYBIN}/pip install toml &&
CFLAGS=\"-I/opt/python/cp310-cp310/include/python3.10\" LDFLAGS=\"-L/opt/python/cp310-cp310/lib\" \${PYBIN}/python setup.py bdist_wheel --plat-name $PLATFORM_TAG
done &&
rm -f /io/dist/*-linux_*.whl
"

- name: Verify Linux wheels
if: runner.os == 'Linux'
run: |
# Verify the wheel was built
echo "Contents of dist directory:"
ls -la dist/
echo "Number of wheels found:"
find dist -name "*.whl" | wc -l
echo "Wheel filenames:"
find dist -name "*.whl" -exec basename {} \;

- name: Build Windows wheel
- name: Build Windows wheel (x64)
if: runner.os == 'Windows'
shell: pwsh
run: |
Expand All @@ -81,25 +97,6 @@ jobs:
# Build wheel
python setup.py bdist_wheel --plat-name win_amd64

- name: Build macOS wheel (Intel)
if: runner.os == 'macOS' && runner.arch == 'x64'
run: |
# Create necessary directories
mkdir -p artifacts
mkdir -p src/c2pa/libs
rm -rf dist build

# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install wheel

# Download native artifacts
python scripts/download_artifacts.py c2pa-v0.55.0

# Build wheel
python setup.py bdist_wheel --plat-name macosx_10_9_x86_64

- name: Build macOS wheel (Apple Silicon)
if: runner.os == 'macOS' && runner.arch == 'arm64'
run: |
Expand All @@ -119,6 +116,13 @@ jobs:
# Build wheel
python setup.py bdist_wheel --plat-name macosx_11_0_arm64

# Rename wheel to ensure unique filename
cd dist
for wheel in *.whl; do
mv "$wheel" "${wheel/macosx_11_0_arm64/macosx_11_0_arm64}"
done
cd ..

- name: Log wheel filename
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
Expand All @@ -130,4 +134,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: dist
path: dist
if-no-files-found: error
52 changes: 15 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@ jobs:
needs: tests-unix
with:
python-version: "3.10"
architecture: ${{ matrix.target }}
artifact-name: wheels-linux-${{ matrix.target }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.runs-on }}
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
target: [x86_64, aarch64]
include:
- target: x86_64
runs-on: ubuntu-24.04
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
Expand All @@ -171,10 +174,12 @@ jobs:
test-built-linux-wheel:
name: Test Linux built wheel
needs: build-linux-wheel
runs-on: ubuntu-latest
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
target: [x86_64, aarch64]
include:
- target: x86_64
runs-on: ubuntu-24.04
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
Expand Down Expand Up @@ -236,7 +241,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
target: [x64, x86]
target: [x64]
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
Expand All @@ -250,7 +255,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
target: [x64]
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
Expand Down Expand Up @@ -313,7 +318,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
target: [x86_64, aarch64]
target: [aarch64]
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
Expand All @@ -327,7 +332,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
target: [aarch64]
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
Expand Down Expand Up @@ -394,6 +399,8 @@ jobs:
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install dev dependencies for build
run: pip install -r requirements-dev.txt
- name: Build sdist
run: python setup.py sdist
- name: Upload sdist
Expand All @@ -415,41 +422,12 @@ jobs:
- uses: actions/checkout@v4
- name: Create dist directory
run: mkdir -p dist
- name: Debug - List dist before download
run: |
echo "=== Dist directory before download ==="
ls -la dist/ || echo "dist is empty"
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Debug - List downloaded artifacts
run: |
echo "=== Downloaded artifacts structure ==="
find dist -type f -ls
echo "=== Downloaded artifacts contents ==="
ls -R dist/
echo "=== Artifact details ==="
for file in dist/*; do
echo "File: $file"
echo "Size: $(stat -f %z "$file")"
echo "Last modified: $(stat -f %Sm "$file")"
echo "---"
done
echo "=== Platform-specific artifacts ==="
echo "Linux x86_64: $(ls -l dist/wheels-linux-x86_64/* 2>/dev/null || echo 'Not found')"
echo "Linux aarch64: $(ls -l dist/wheels-linux-aarch64/* 2>/dev/null || echo 'Not found')"
echo "macOS x86_64: $(ls -l dist/wheels-macos-x86_64/* 2>/dev/null || echo 'Not found')"
echo "macOS aarch64: $(ls -l dist/wheels-macos-aarch64/* 2>/dev/null || echo 'Not found')"
echo "Windows x64: $(ls -l dist/wheels-windows-x64/* 2>/dev/null || echo 'Not found')"
echo "Windows x86: $(ls -l dist/wheels-windows-x86/* 2>/dev/null || echo 'Not found')"
echo "SDist: $(ls -l dist/wheels-sdist/* 2>/dev/null || echo 'Not found')"
- name: Debug - List final dist directory
run: |
echo "=== Final dist directory contents ==="
ls -la dist/ || echo "dist is empty"
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools>=68.0.0", "wheel"]
requires = ["setuptools>=68.0.0", "wheel", "toml>=0.10.2"]
build-backend = "setuptools.build_meta"

[project]
name = "c2pa-python"
version = "0.10.9"
version = "0.10.12"
requires-python = ">=3.10"
description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
readme = { file = "README.md", content-type = "text/markdown" }
Expand Down Expand Up @@ -37,5 +37,6 @@ test = [
[project.scripts]
download-artifacts = "c2pa.build:download_artifacts"

# Workaround to prevent setuptools from automatically including invalid metadata
[tool.setuptools]
license-files = []
16 changes: 0 additions & 16 deletions setup.cfg

This file was deleted.

15 changes: 11 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from setuptools import setup, find_namespace_packages
import sys
import os
import platform
import shutil
from pathlib import Path
import toml

# Read version from pyproject.toml
def get_version():
pyproject = toml.load("pyproject.toml")
return pyproject["project"]["version"]

VERSION = get_version()

# Define platform to library extension mapping (for reference only)
PLATFORM_EXTENSIONS = {
Expand Down Expand Up @@ -158,7 +165,7 @@ def find_available_platforms():
print("No platform-specific libraries found. Building wheel without platform-specific libraries.")
setup(
name="c2pa-python",
version="0.10.9",
version=VERSION,
package_dir={"": "src"},
packages=find_namespace_packages(where="src"),
include_package_data=True,
Expand Down Expand Up @@ -190,7 +197,7 @@ def find_available_platforms():
# Build the wheel
setup(
name="c2pa-python",
version="0.10.9",
version=VERSION,
package_dir={"": "src"},
packages=find_namespace_packages(where="src"),
include_package_data=True,
Expand All @@ -215,7 +222,7 @@ def find_available_platforms():
# For sdist and development installation
setup(
name="c2pa-python",
version="0.10.9",
version=VERSION,
package_dir={"": "src"},
packages=find_namespace_packages(where="src"),
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion src/c2pa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.10.9"
__version__ = "0.10.12"

from .c2pa import (
Builder,
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def getitem(d, key):

class TestC2paSdk(unittest.TestCase):
def test_version(self):
assert version() == "0.10.9"
assert version() == "0.10.12"

def test_sdk_version(self):
assert "c2pa-rs/" in sdk_version()
Expand Down