Skip to content

Commit 068e8f6

Browse files
committed
pyjpegls: Add version 1.5.1
cibuildwheel build narrowed to Linux riscv64, mirroring upstream's own release-wheels.yml. The extension vendors CharLS (BSD-3-Clause) via a git submodule compiled straight into _CharLS; a patch adds LICENSE and LICENSE.charls so the built wheel carries both licence texts, which upstream's own wheels omit entirely.
1 parent 721892d commit 068e8f6

3 files changed

Lines changed: 234 additions & 0 deletions

File tree

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on upstream's own cibuildwheel-driven
5+
# https://github.com/pydicom/pyjpegls/blob/v1.5.1/.github/workflows/release-wheels.yml,
6+
# narrowed to Linux riscv64, with the tests of its pr-tests.yml.
7+
name: Build pyjpegls wheels (riscv64)
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Version glob to (re)build; empty builds every version of docs/packages/pyjpegls.yaml not released yet'
14+
required: false
15+
default: ''
16+
pull_request:
17+
branches: [main]
18+
paths:
19+
- '.github/workflows/build-pyjpegls.yml'
20+
- 'docs/packages/pyjpegls.yaml'
21+
push:
22+
branches: [main]
23+
paths:
24+
- '.github/workflows/build-pyjpegls.yml'
25+
- 'docs/packages/pyjpegls.yaml'
26+
27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
29+
cancel-in-progress: true
30+
31+
permissions:
32+
contents: read # to fetch code (actions/checkout)
33+
34+
env:
35+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
36+
37+
jobs:
38+
setup:
39+
uses: $/.github/workflows/_setup.yml
40+
with:
41+
package: pyjpegls
42+
version: ${{ inputs.version }}
43+
44+
build_wheels:
45+
needs: [setup]
46+
if: needs.setup.outputs.versions != '[]'
47+
name: Build pyjpegls ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
48+
runs-on: ubuntu-24.04-riscv
49+
timeout-minutes: 60
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
54+
# Mirrors upstream's own pr-tests.yml/release-wheels.yml matrix
55+
# (3.9-3.13). Upstream ships no cp314 or cp314t wheel, has no
56+
# free-threaded CI env, and the Cython extension declares no
57+
# Py_mod_gil slot, so both are left out rather than shipped
58+
# untested (gotcha 33/127).
59+
python: ["cp39", "cp310", "cp311", "cp312", "cp313"]
60+
61+
env:
62+
PYJPEGLS_VERSION: ${{ matrix.version }}
63+
64+
steps:
65+
- name: Checkout pyjpegls v${{ env.PYJPEGLS_VERSION }}
66+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
67+
with:
68+
repository: pydicom/pyjpegls
69+
ref: v${{ env.PYJPEGLS_VERSION }}
70+
submodules: true
71+
persist-credentials: false
72+
73+
- name: Checkout python-wheels
74+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
75+
with:
76+
path: python-wheels
77+
persist-credentials: false
78+
79+
# The extension compiles in the vendored CharLS (BSD-3-Clause) but the
80+
# wheel ships no licence at all, for either project.
81+
- name: Patch pyjpegls source
82+
run: |
83+
git apply python-wheels/patches/pyjpegls/${{ env.PYJPEGLS_VERSION }}/00*.patch
84+
85+
- name: Build wheels
86+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
87+
with:
88+
output-dir: wheelhouse/
89+
only: ${{ matrix.python }}-manylinux_riscv64
90+
env:
91+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
92+
CIBW_ENVIRONMENT: >-
93+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
94+
PIP_ONLY_BINARY=numpy
95+
CIBW_TEST_REQUIRES: pytest
96+
CIBW_TEST_COMMAND: pytest --pyargs jpeg_ls.tests
97+
98+
- name: Check the wheel contents
99+
run: |
100+
python3 - wheelhouse/*.whl <<'EOF'
101+
import sys, zipfile
102+
for whl in sys.argv[1:]:
103+
names = zipfile.ZipFile(whl).namelist()
104+
assert any(n.startswith("_CharLS") and n.endswith(".so") for n in names), whl
105+
for lic in ("LICENSE", "LICENSE.charls"):
106+
assert any(n.endswith(".dist-info/licenses/" + lic) for n in names), (whl, lic)
107+
print(whl, "ok")
108+
EOF
109+
110+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
111+
with:
112+
name: pyjpegls-${{ env.PYJPEGLS_VERSION }}-${{ matrix.python }}-manylinux_riscv64
113+
path: wheelhouse/*.whl
114+
if-no-files-found: error
115+
116+
publish:
117+
name: Publish pyjpegls ${{ matrix.version }}
118+
needs: [setup, build_wheels]
119+
if: needs.setup.outputs.versions != '[]'
120+
strategy:
121+
fail-fast: false
122+
matrix:
123+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
124+
permissions:
125+
contents: write
126+
pull-requests: write
127+
uses: $/.github/workflows/_publish-wheel.yml
128+
secrets:
129+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
130+
with:
131+
artifact-pattern: pyjpegls-${{ matrix.version }}-*-manylinux_riscv64

‎docs/packages/pyjpegls.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: pyjpegls
2+
source-code: https://github.com/pydicom/pyjpegls
3+
license: MIT
4+
versions:
5+
- version: 1.5.1
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Tue, 13 Oct 2026 12:00:00 +0200
4+
Subject: [PATCH] package the CharLS and pyjpegls licences in the built wheel
5+
6+
Upstream-Status: To upstream [not yet submitted; every pyjpegls wheel on PyPI has the same gap, so it needs a maintainer discussion rather than a drive-by PR]
7+
8+
setup.py compiles lib/charls/src/*.cpp (CharLS, vendored by the
9+
team-charls/charls submodule pinned at v2.4.2) straight into the
10+
_CharLS extension, so every wheel redistributes CharLS in binary form.
11+
Its BSD-3-Clause licence requires the copyright notice to travel with
12+
the binary, but the repository's only licence text is license.txt
13+
(lowercase), which carries pyjpegls's own MIT text and nothing for
14+
CharLS.
15+
16+
Worse, setuptools' default license-files auto-discovery glob
17+
(LICENSE*/LICENCE*/COPYING*/NOTICE*/AUTHORS*) is case-sensitive on
18+
Linux and never matches license.txt, so the built wheel ships no
19+
licence at all, for either project.
20+
21+
Add LICENSE as an uppercase copy of the existing license.txt (MIT,
22+
verbatim) and LICENSE.charls with the vendored copy's licence text
23+
(BSD-3-Clause, verbatim from team-charls/charls's LICENSE.md) at the
24+
project root: setuptools' default glob then picks up both and copies
25+
them into the wheel's dist-info/licenses/, so no pyproject.toml change
26+
is needed.
27+
---
28+
LICENSE | 23 +++++++++++++++++++++++
29+
LICENSE.charls | 28 ++++++++++++++++++++++++++++
30+
2 files changed, 51 insertions(+)
31+
create mode 100644 LICENSE
32+
create mode 100644 LICENSE.charls
33+
34+
diff --git a/LICENSE b/LICENSE
35+
new file mode 100644
36+
index 0000000..03de66a
37+
--- /dev/null
38+
+++ b/LICENSE
39+
@@ -0,0 +1,23 @@
40+
+
41+
+pyjpegls - JPEG-LS for Python via CharLS C++ Library
42+
+
43+
+The MIT License (MIT)
44+
+
45+
+Copyright (c) 2013 Pierre V. Villeneuve, pierre.villeneuve@gmail.com
46+
+
47+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
48+
+this software and associated documentation files (the "Software"), to deal in
49+
+the Software without restriction, including without limitation the rights to
50+
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
51+
+the Software, and to permit persons to whom the Software is furnished to do so,
52+
+subject to the following conditions:
53+
+
54+
+The above copyright notice and this permission notice shall be included in all
55+
+copies or substantial portions of the Software.
56+
+
57+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58+
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
59+
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
60+
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
61+
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
62+
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63+
diff --git a/LICENSE.charls b/LICENSE.charls
64+
new file mode 100644
65+
index 0000000..bbd8e6c
66+
--- /dev/null
67+
+++ b/LICENSE.charls
68+
@@ -0,0 +1,28 @@
69+
+CharLS
70+
+Copyright (c) 2007, Jan de Vaan and Victor Derks
71+
+All rights reserved.
72+
+
73+
+Redistribution and use in source and binary forms, with or without
74+
+modification, are permitted provided that the following conditions are met:
75+
+
76+
+1. Redistributions of source code must retain the above copyright notice, this
77+
+ list of conditions and the following disclaimer.
78+
+
79+
+2. Redistributions in binary form must reproduce the above copyright notice,
80+
+ this list of conditions and the following disclaimer in the documentation
81+
+ and/or other materials provided with the distribution.
82+
+
83+
+3. Neither the name of the copyright holder nor the names of its
84+
+ contributors may be used to endorse or promote products derived from
85+
+ this software without specific prior written permission.
86+
+
87+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
88+
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
89+
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
90+
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
91+
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
92+
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
93+
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
94+
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
95+
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
96+
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
97+
--
98+
2.43.0

0 commit comments

Comments
 (0)