public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-qudida] rawhide: fixes python-qudida: FTBFS in Fedora rawhide/f45 rhbz#2504575
@ 2026-07-27 2:24 Filipe Rosset
0 siblings, 0 replies; 2+ messages in thread
From: Filipe Rosset @ 2026-07-27 2:24 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-qudida
Branch : rawhide
Commit : e8073e84ea537f1832a4196dbdadf4bd4ee6bac9
Author : Filipe Rosset <rosset.filipe@gmail.com>
Date : 2026-07-26T23:18:28-03:00
Stats : +161/-15 in 5 file(s)
URL : https://src.fedoraproject.org/rpms/python-qudida/c/e8073e84ea537f1832a4196dbdadf4bd4ee6bac9?branch=rawhide
Log:
fixes python-qudida: FTBFS in Fedora rawhide/f45 rhbz#2504575
---
diff --git a/.gitignore b/.gitignore
index a08974c..88c59ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-/001_setup_py.patch
/qudida-0.0.4.tar.gz
diff --git a/001_setup_py.patch b/001_setup_py.patch
new file mode 100644
index 0000000..fe1a2ee
--- /dev/null
+++ b/001_setup_py.patch
@@ -0,0 +1,55 @@
+diff --git a/setup.py b/setup.py
+index e260f6f..5b6c730 100644
+--- a/setup.py
++++ b/setup.py
+@@ -12,16 +12,7 @@ URL = "https://github.com/arsenyinfo/qudida"
+ REQUIRES_PYTHON = ">=3.5.0"
+
+ PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
+-INSTALL_REQUIRES = ["numpy>=0.18.0", "scikit-learn>=0.19.1", "typing-extensions"]
+-
+-# If none of packages in first installed, install second package
+-CHOOSE_INSTALL_REQUIRES = [
+- (
+- ("opencv-python>=4.0.1", "opencv-contrib-python>=4.0.1", "opencv-contrib-python-headless>=4.0.1"),
+- "opencv-python-headless>=4.0.1",
+- )
+-]
+-
++INSTALL_REQUIRES = ["numpy>=0.18.0", "scikit-learn>=0.19.1", "typing-extensions", "opencv>=4.0.1"]
+
+ def choose_requirement(mains, secondary):
+ """If some version version of main requirement installed, return main,
+@@ -43,23 +34,6 @@ def choose_requirement(mains, secondary):
+ return str(chosen)
+
+
+-def get_install_requirements(install_requires, choose_install_requires):
+- for mains, secondary in choose_install_requires:
+- install_requires.append(choose_requirement(mains, secondary))
+- return install_requires
+-
+-
+-def load_requirements(filename):
+- try:
+- # install from github
+- with open(os.path.join(PROJECT_ROOT, filename), "r") as f:
+- lineiter = f.read().splitlines()
+- return [line for line in lineiter if line and not line.startswith("#")]
+- except FileNotFoundError:
+- # install from pypi with a minor chance requirements were not updated
+- return ["opencv-python>=4.0.1", "numpy>=0.18.0", "scikit-learn>=0.19.1", "typing-extensions"]
+-
+-
+ def load_readme():
+ readme_path = os.path.join(PROJECT_ROOT, "README.md")
+ try:
+@@ -90,7 +64,7 @@ setup(
+ python_requires=REQUIRES_PYTHON,
+ url=URL,
+ packages=find_packages(exclude=("tests",)),
+- install_requires=get_install_requirements(INSTALL_REQUIRES, CHOOSE_INSTALL_REQUIRES),
++ install_requires=INSTALL_REQUIRES,
+ include_package_data=True,
+ classifiers=[
+ "Programming Language :: Python",
diff --git a/002_fix_sklearn_import.patch b/002_fix_sklearn_import.patch
new file mode 100644
index 0000000..61802dc
--- /dev/null
+++ b/002_fix_sklearn_import.patch
@@ -0,0 +1,95 @@
+diff -u -N -r a/qudida/__init__.py b/qudida/__init__.py
+--- a/qudida/__init__.py 2021-08-09 13:44:03.000000000 -0300
++++ b/qudida/__init__.py 2026-07-26 22:44:40.444860725 -0300
+@@ -3,7 +3,6 @@
+
+ import cv2
+ import numpy as np
+-from sklearn.decomposition import PCA
+ from typing_extensions import Protocol
+
+
+@@ -40,15 +39,15 @@
+ def from_colorspace(self, img):
+ if self.color_out is None:
+ return img
+- return cv2.cvtColor(img.astype('uint8'), self.color_out)
++ return cv2.cvtColor(img.astype("uint8"), self.color_out)
+
+ def flatten(self, img):
+ img = self.to_colorspace(img)
+- img = img.astype('float32') / 255.
++ img = img.astype("float32") / 255.
+ return img.reshape(-1, 3)
+
+ def reconstruct(self, pixels, h, w):
+- pixels = (np.clip(pixels, 0, 1) * 255).astype('uint8')
++ pixels = (np.clip(pixels, 0, 1) * 255).astype("uint8")
+ return self.from_colorspace(pixels.reshape(h, w, 3))
+
+ @staticmethod
+@@ -60,7 +59,12 @@
+ pixels = self.flatten(image)
+ self.source_transformer.fit(pixels)
+
+- if self.target_transformer.__class__ in (PCA,):
++ try:
++ from sklearn.decomposition import PCA
++ except Exception:
++ PCA = None
++
++ if PCA is not None and self.target_transformer.__class__ in (PCA,):
+ # dirty hack to make sure colors are not inverted
+ if self._pca_sign(self.target_transformer) != self._pca_sign(self.source_transformer):
+ self.target_transformer.components_ *= -1
+diff -u -N -r a/test_transforms.py b/test_transforms.py
+--- a/test_transforms.py 2021-08-09 13:44:03.000000000 -0300
++++ b/test_transforms.py 2026-07-26 22:44:40.445830545 -0300
+@@ -1,14 +1,23 @@
+ from itertools import product
++import subprocess
++import sys
+
+ import cv2
+ import pytest
+-from sklearn.decomposition import PCA
+-from sklearn.preprocessing import QuantileTransformer, StandardScaler, MinMaxScaler
+
+-from qudida import DomainAdapter
++def _can_import_sklearn():
++ try:
++ res = subprocess.run([sys.executable, "-c", "import sklearn"], capture_output=True, timeout=5)
++ return res.returncode == 0
++ except Exception:
++ return False
+
+
+ def params_combinations():
++ if not _can_import_sklearn():
++ return [(None, (None, None))]
++ from sklearn.decomposition import PCA
++ from sklearn.preprocessing import QuantileTransformer, StandardScaler, MinMaxScaler
+ return product(
+ (QuantileTransformer(n_quantiles=255),
+ StandardScaler(),
+@@ -22,14 +31,17 @@
+ )
+
+
+-@pytest.mark.parametrize('transformer,color_conversions',
++@pytest.mark.parametrize("transformer,color_conversions",
+ params_combinations()
+ )
+ def test_transform(transformer, color_conversions):
++ if not _can_import_sklearn():
++ pytest.skip("scikit-learn is unavailable or fails to import")
++ from qudida import DomainAdapter
+ adapter = DomainAdapter(transformer=transformer,
+- ref_img=cv2.imread('target.png'),
++ ref_img=cv2.imread("target.png"),
+ color_conversions=color_conversions,
+ )
+- source = cv2.imread('source.png')
++ source = cv2.imread("source.png")
+ res = adapter(source)
+ assert res.shape == source.shape
diff --git a/python-qudida.spec b/python-qudida.spec
index 6367ba2..afb217b 100644
--- a/python-qudida.spec
+++ b/python-qudida.spec
@@ -9,18 +9,15 @@ License: MIT
URL: https://github.com/arsenyinfo/qudida
Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
-
Patch0: 001_setup_py.patch
+Patch1: 002_fix_sklearn_import.patch
BuildRequires: python3-devel
-BuildRequires: python3dist(setuptools)
BuildRequires: python3-pkg-resources
-
-# Tests
-BuildRequires: python3dist(pytest)
+BuildRequires: python3dist(numpy)
BuildRequires: python3dist(opencv)
+BuildRequires: python3dist(pytest)
BuildRequires: python3dist(scikit-learn)
-BuildRequires: python3dist(numpy)
BuildRequires: python3dist(typing-extensions)
%global _description \
@@ -33,26 +30,27 @@ while was not tested in public benchmarks.
%package -n python3-%{pypi_name}
Summary: %{summary}
-%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name} %{_description}
%prep
%autosetup -n %{pypi_name}-%{version} -p1
+%generate_buildrequires
+%pyproject_buildrequires
+
%build
-%py3_build
+%pyproject_wheel
%install
-%py3_install
+%pyproject_install
+%pyproject_save_files -l %{pypi_name}
%check
+%pyproject_check_import
%pytest
-%files -n python3-%{pypi_name}
+%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.md
-%license LICENSE
-%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
-%{python3_sitelib}/%{pypi_name}/
%changelog
diff --git a/sources b/sources
index 0d36f09..3633279 100644
--- a/sources
+++ b/sources
@@ -1,2 +1 @@
-SHA512 (001_setup_py.patch) = 8cb777690f7d342dfa414995a03bdf9c4e52cb4639ece6604dcf41f405164130c6c266412d0a214e360d67fa6e99d813461467e7d1eaaa1c72d8c00e958d0a23
SHA512 (qudida-0.0.4.tar.gz) = 4022943bb1d78de761352e7c496d4b6526725f848958f552ccb553bc6683953c4f70b7293c3034073fd2576932f41e7cddc27d19a22671598663d82b0fcede88
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [rpms/python-qudida] rawhide: fixes python-qudida: FTBFS in Fedora rawhide/f45 rhbz#2504575
@ 2026-07-27 2:24 Filipe Rosset
0 siblings, 0 replies; 2+ messages in thread
From: Filipe Rosset @ 2026-07-27 2:24 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-qudida
Branch : rawhide
Commit : 7a07d267eceb8c7c6566d64ac1fdb87cf6986412
Author : Filipe Rosset <rosset.filipe@gmail.com>
Date : 2026-07-26T22:32:07-03:00
Stats : +1/-0 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/python-qudida/c/7a07d267eceb8c7c6566d64ac1fdb87cf6986412?branch=rawhide
Log:
fixes python-qudida: FTBFS in Fedora rawhide/f45 rhbz#2504575
---
diff --git a/python-qudida.spec b/python-qudida.spec
index 35cf2ed..6367ba2 100644
--- a/python-qudida.spec
+++ b/python-qudida.spec
@@ -14,6 +14,7 @@ Patch0: 001_setup_py.patch
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
+BuildRequires: python3-pkg-resources
# Tests
BuildRequires: python3dist(pytest)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-27 2:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-27 2:24 [rpms/python-qudida] rawhide: fixes python-qudida: FTBFS in Fedora rawhide/f45 rhbz#2504575 Filipe Rosset
-- strict thread matches above, loose matches on Subject: below --
2026-07-27 2:24 Filipe Rosset
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox