From 868e7065426c77af6a1daa5b1cc044a11428a130 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Tue, 13 May 2025 04:10:40 -0700 Subject: [PATCH] add: fast-colorthief (#4788) (#4807) * add: fast-colorthief * chore: Python prefix I guess? * A little better? (cherry picked from commit b8ce03cc803837c8f5e1a2da273f728c5a84f02b) Co-authored-by: Gilver --- anda/langs/python/fast-colorthief/anda.hcl | 5 + .../python-fast-colorthief.spec | 94 +++++++++++++++++++ anda/langs/python/fast-colorthief/update.rhai | 1 + 3 files changed, 100 insertions(+) create mode 100644 anda/langs/python/fast-colorthief/anda.hcl create mode 100644 anda/langs/python/fast-colorthief/python-fast-colorthief.spec create mode 100644 anda/langs/python/fast-colorthief/update.rhai diff --git a/anda/langs/python/fast-colorthief/anda.hcl b/anda/langs/python/fast-colorthief/anda.hcl new file mode 100644 index 0000000000..bb6b85eca0 --- /dev/null +++ b/anda/langs/python/fast-colorthief/anda.hcl @@ -0,0 +1,5 @@ +project "pkg" { + rpm { + spec = "python-fast-colorthief.spec" + } +} diff --git a/anda/langs/python/fast-colorthief/python-fast-colorthief.spec b/anda/langs/python/fast-colorthief/python-fast-colorthief.spec new file mode 100644 index 0000000000..599e5af6b3 --- /dev/null +++ b/anda/langs/python/fast-colorthief/python-fast-colorthief.spec @@ -0,0 +1,94 @@ +%global pypi_name fast-colorthief +%global debug_package %{nil} +%bcond docs 1 + +Name: python-%{pypi_name} +Version: 0.0.5 +Release: 1%{?dist} +Summary: Faster version of Colorthief +License: MIT +URL: https://github.com/bedapisl/fast-colorthief +Source0: %{pypi_source} +BuildRequires: cmake +BuildRequires: doxygen +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: pybind11-devel +BuildRequires: python3-devel +BuildRequires: python3-sphinxcontrib-rsvgconverter +BuildRequires: python3dist(breathe) +BuildRequires: python3dist(furo) +BuildRequires: python3dist(numpy) +BuildRequires: python3dist(pillow) +BuildRequires: python3dist(pip) +BuildRequires: python3dist(pybind11) +BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(sphinx) +BuildRequires: python3dist(sphinxcontrib-moderncmakedomain) +BuildRequires: python3dist(sphinx-copybutton) +Packager: Gilver E. + +%description +A Python module for selecting most dominant colors in the image. + +%package -n python3-%{pypi_name} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pypi_name}} + +Requires: python3dist(numpy) +Requires: python3dist(pillow) + +%description -n python3-%{pypi_name} +A Python module for selecting most dominant colors in the image. + +A faster version of the original Colorthief. + +%if %{with docs} +%package -n python3-%{pypi_name}-doc +Summary: Docs for %{pypi_name} +BuildArch: noarch + +%description -n python3-%{pypi_name}-doc +Documentation files for %{pypi_name} +%endif + +%prep +%autosetup -n %{pypi_name}-%{version} +# Remove bundled egg-info +rm -rf %{pypi_name}.egg-info + +%build +### This is not a fully Python project and is mostly C++ +## Disable PIC +# https://docs.fedoraproject.org/en-US/packaging-guidelines/#_pie +sed -i 's/CMAKE_POSITION_INDEPENDENT_CODE ON/CMAKE_POSITION_INDEPENDENT_CODE OFF/' CMakeLists.txt +%pyproject_wheel + +%if %{with docs} +# generate docs +PYTHONPATH=${PWD} sphinx-build pybind11/docs html +# remove the sphinx-build leftovers +rm -rf html/.{doctrees,buildinfo} +%endif + +%install +%pyproject_install + +%files -n python3-%{pypi_name} +%license pybind11/LICENSE +%doc PKG-INFO +%doc README.md +%{python3_sitearch}/__pycache__/* +%{python3_sitearch}/fast_colorthief.py +%{python3_sitearch}/version.py +%{python3_sitearch}/fast_colorthief_backend.cpython-*-%{_arch}-linux-gnu.so +%{python3_sitearch}/fast_colorthief-%{version}.dist-info + +%if %{with docs} +%files -n python3-%{pypi_name}-doc +%doc html/* +%endif + +%changelog +* Sun May 11 2025 Gilver E. - 0.0.5-1 +- Initial package. diff --git a/anda/langs/python/fast-colorthief/update.rhai b/anda/langs/python/fast-colorthief/update.rhai new file mode 100644 index 0000000000..406e9de7fb --- /dev/null +++ b/anda/langs/python/fast-colorthief/update.rhai @@ -0,0 +1 @@ +rpm.version(pypi("fast-colorthief"));