From 7fdaf0ac35d38995ac78f330a1d0ab8a9ebb4771 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 15 Mar 2025 20:22:31 -0400 Subject: [PATCH] Initial package (close RHBZ#2327093) --- .gitignore | 2 + get_source | 51 ++++++++++++++++++ python-uharfbuzz.spec | 119 ++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 173 insertions(+) create mode 100644 .gitignore create mode 100755 get_source create mode 100644 python-uharfbuzz.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e435feb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/uharfbuzz-0.45.0-filtered.tar.gz +/uharfbuzz-0.46.0-filtered.tar.gz diff --git a/get_source b/get_source new file mode 100755 index 0000000..cd5864f --- /dev/null +++ b/get_source @@ -0,0 +1,51 @@ +#!/bin/sh +set -o errexit +set -o nounset + +if [ "$#" != '1' ] +then + cat 1>&2 < Downloading: ${URL}" 1>&2 +curl -L -O "${URL}" + +ARCHIVE="$(find . -mindepth 1 -maxdepth 1 -type f -name '*.tar.gz' -print -quit)" +echo "--> Extracting: $(basename "${ARCHIVE}")" 1>&2 +tar -xzf "${ARCHIVE}" +echo '--> Removing certain test fonts due to uncertain licensing' 1>&2 +TARDIR="$(basename "${ARCHIVE}" '.tar.gz')" +MTIME="$(stat -c '%Y' "${TARDIR}")" +rm -v "${TARDIR}/tests/data/SparseFont.ttf" +rm -v "${TARDIR}/tests/data/noto_handwriting-cff2_colr_1.otf" +rm -v "${TARDIR}/tests/data/test_glyphs-glyf_colr_1.ttf" +# Restore the original mtime even though we modified the base directory by +# removing the tests. +touch -d @"${MTIME}" "${TARDIR}" +FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.gz" +echo "--> Re-archiving: ${FILTERED}" 1>&2 +# https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html +TZ=UTC LC_ALL=C tar \ + --create --verbose \ + --sort=name \ + --format=posix \ + --numeric-owner --owner=0 --group=0 \ + --mode=go+u,go-w \ + --pax-option='delete=atime,delete=ctime' \ + "${TARDIR}/" | + gzip -9 > "${FILTERED}" +mv -v "${FILTERED}" "${OUTDIR}" +echo 'Done.' 1>&2 diff --git a/python-uharfbuzz.spec b/python-uharfbuzz.spec new file mode 100644 index 0000000..946109e --- /dev/null +++ b/python-uharfbuzz.spec @@ -0,0 +1,119 @@ +Name: python-uharfbuzz +Version: 0.46.0 +Release: %autorelease +Summary: Streamlined Cython bindings for the harfbuzz shaping engine + +License: Apache-2.0 +# The entire source is Apache-2.0, except for test fonts that are not bundled +# in the binary RPMs and do not contribute to their licenses. +# +# Apache-2.0, tests/data/LICENSE_OpenSans.txt: +# - tests/data/OpenSans.subset.ttf +# MIT, tests/data/LICENSE_MutatorSans.txt: +# - tests/data/MutatorSans-VF.subset.ttf +# MIT, tests/data/LICENSE_ChromaCheck_colr.txt (added by patch) +# - tests/data/chromacheck-colr.ttf +# OFL-1.1, tests/data/LICENSE_AdobeBlank.txt: +# - tests/data/AdobeBlank.fea +# - tests/data/AdobeBlank.subset.ttf +# OFL-1.1, tests/data/LICENSE_StixTwoMath.txt (added by patch) +# - tests/data/STIXTwoMath-Regular.ttf +# +# Some test fonts have been filtered out of the source because we could not +# determine what their licenses were. +SourceLicense: %{license} AND MIT AND OFL-1.1 +URL: https://github.com/harfbuzz/uharfbuzz +# Since harfbuzz is bundled via a git submodule, packaging from the GitHub +# archive rather than the PyPI sdist is advantageous: the source does not +# contain the bundled harfbuzz at all. +# +# We still must use a filtered source tarball, obtained by (see Source1): +# +# ./get_source %%{version} +# +# This is required because there are a few test fonts for which we cannot +# determine the applicable licenses: +# +# UNKNOWN, introduced in https://github.com/harfbuzz/uharfbuzz/pull/84: +# - tests/data/SparseFont.ttf +# UNKNOWN, introduced in +# https://github.com/harfbuzz/uharfbuzz/commit/5a80c3eaeea58d36b15a76dba45639294e0200ce, +# taken from Harfbuzz where they were introduced in +# https://github.com/harfbuzz/harfbuzz/commit/30a6fd04d00624129b13b20fb755d6c1c4982637, +# but their ultimate provenance is unclear: +# - tests/data/noto_handwriting-cff2_colr_1.otf +# - tests/data/test_glyphs-glyf_colr_1.ttf +# +# Font licenses for test font files +# https://github.com/harfbuzz/uharfbuzz/issues/234 +# +# Source0: %%{url}/archive/v%%{version}/uharfbuzz-%%{version}.tar.gz +Source0: uharfbuzz-%{version}-filtered.tar.gz +Source1: get_source + +BuildRequires: python3-devel +BuildRequires: gcc-c++ +BuildRequires: pkgconfig(harfbuzz-subset) + +%global common_description %{expand: +%{summary}.} + +%description %{common_description} + + +%package -n python3-uharfbuzz +Summary: %{summary} + +%description -n python3-uharfbuzz %{common_description} + + +%prep +%autosetup -n uharfbuzz-%{version} + +# Remove Cythonized C++ sources (if any remain): +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_using_cython +find . -type f -exec grep -FrinIl 'Generated by Cython' '{}' '+' | + xargs -r -t rm -v + + +%generate_buildrequires +export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}' +export USE_SYSTEM_LIBS=1 +%pyproject_buildrequires -t + + +%build +export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}' +export USE_SYSTEM_LIBS=1 +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files -l uharfbuzz + + +%check +# Requires SparseFont.ttf, omitted from the source archive, via the sparsefont +# fixture: +k="${k-}${k+ and }not test_sparsefont_coretext" +# Requires noto_handwriting-cff2_colr_1.otf and test_glyphs-glyf_colr_1.ttf, +# omitted from the source archive: +k="${k-}${k+ and }not test_paint" +# Require test_glyphs-glyf_colr_1.ttf, omitted from the source archive, via the +# colorv1font fixture: +k="${k-}${k+ and }not test_color_palettes" +k="${k-}${k+ and }not test_color_palette_color_get_name_id" +k="${k-}${k+ and }not test_has_color_paint" +k="${k-}${k+ and }not test_glyph_has_color_paint" +k="${k-}${k+ and }not TestOTColor" + +%tox -- -- -k "${k-}" -v + + +%files -n python3-uharfbuzz -f %{pyproject_files} +%doc README.md + + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..ba02835 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (uharfbuzz-0.46.0-filtered.tar.gz) = 995afc0f40734213c2a76e41965db8c794070c762efdd6df804b0005e866a725b4c3da658560d3a337879fb5fc837e7587f2e26679ae524b089b375da269e79d