17
0

Accepting request 1158283 from devel:languages:python:numeric

- Clean up the SPEC file
- Fix tests on Python 3.12 with tests-int-division.patch

OBS-URL: https://build.opensuse.org/request/show/1158283
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-louvain?expand=0&rev=8
This commit is contained in:
2024-03-15 19:32:23 +00:00
committed by Git OBS Bridge
3 changed files with 38 additions and 8 deletions

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Fri Mar 15 14:56:29 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Clean up the SPEC file
-------------------------------------------------------------------
Thu Mar 14 14:20:48 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Fix tests on Python 3.12 with tests-int-division.patch
-------------------------------------------------------------------
Fri Oct 14 09:09:53 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-python-louvain
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,9 +16,9 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%define skip_python36 1
%{?sle15_python_module_pythons}
Name: python-python-louvain
Version: 0.16
Release: 0
@@ -27,16 +27,21 @@ License: BSD-3-Clause
URL: https://github.com/taynaud/python-louvain
Source0: https://files.pythonhosted.org/packages/source/p/python-louvain/python-louvain-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-test-karate.patch gh#taynaud/python-louvain#95
Patch: fix-test-karate.patch
Patch0: fix-test-karate.patch
# PATCH-FIX-UPSTREAM tests-int-division.patch gh#taynaud/python-louvain#104
Patch1: tests-int-division.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-networkx
Requires: python-numpy
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
Provides: python-community = %{version}
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module networkx}
@@ -53,18 +58,19 @@ Statistical Mechanics: Theory and Experiment 2008(10), P10008 (12pp)
%prep
%autosetup -p1 -n python-louvain-%{version}
sed -i -e '/^#!\//, 1d' community/__init__.py
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/community
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_exec test_community.py
%pyunittest -v test_*.py
%post
%python_install_alternative community
@@ -76,6 +82,7 @@ sed -i -e '/^#!\//, 1d' community/__init__.py
%doc README.rst
%license LICENSE
%python_alternative %{_bindir}/community
%{python_sitelib}/*
%{python_sitelib}/community
%{python_sitelib}/python_louvain-%{version}*-info
%changelog

13
tests-int-division.patch Normal file
View File

@@ -0,0 +1,13 @@
Index: python-louvain-0.16/test_community.py
===================================================================
--- python-louvain-0.16.orig/test_community.py
+++ python-louvain-0.16/test_community.py
@@ -61,7 +61,7 @@ class ModularityTest(unittest.TestCase):
graph = nx.erdos_renyi_graph(50, 0.1)
part = dict([])
for node in graph:
- part[node] = random.randint(0, self.number_of_tests / 10)
+ part[node] = random.randint(0, self.number_of_tests // 10)
mod = co.modularity(part, graph)
self.assertGreaterEqual(mod, -1)
self.assertLessEqual(mod, 1)